com.commercetools.payment.nopsp.methods.FreeCreatePaymentTransactionMethodProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nopsp-adapter Show documentation
Show all versions of nopsp-adapter Show documentation
The commercetools java payment project intend is to make payment integration easy
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());
}
}