All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.commercetools.payment.nopsp.methods.FreeCreatePaymentTransactionMethodProvider Maven / Gradle / Ivy

Go to download

The commercetools java payment project intend is to make payment integration easy

There is a newer version: 1.6.0
Show newest version
package com.commercetools.payment.nopsp.methods;

import com.commercetools.payment.actions.HandlingTask;
import com.commercetools.payment.actions.OperationResult;
import com.commercetools.payment.actions.ShopAction;
import com.commercetools.payment.domain.PaymentTransactionCreationResultBuilder;
import com.commercetools.payment.methods.CreatePaymentTransactionMethod;
import com.commercetools.payment.model.CreatePaymentTransactionData;
import com.commercetools.payment.model.PaymentTransactionCreationResult;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.function.Function;

/**
 * @author [email protected]
 */
public class FreeCreatePaymentTransactionMethodProvider implements CreatePaymentTransactionMethod {
    private FreeCreatePaymentTransactionMethodProvider() {
    }

    public static FreeCreatePaymentTransactionMethodProvider of() {
        return new FreeCreatePaymentTransactionMethodProvider();
    }

    /**
     * We dont create an actual Transaction on CTP
     * @return the empty PaymentTransactionCreationResult
     */
    @Override
    public Function> create() {
        return cptd -> CompletableFuture.completedFuture(
                PaymentTransactionCreationResultBuilder.of(OperationResult.SUCCESS)
                        .handlingTask(HandlingTask.of(ShopAction.CONTINUE))
                        .build());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy