diff --git a/README.md b/README.md index 2c074f4..cab9258 100644 --- a/README.md +++ b/README.md @@ -62,5 +62,5 @@ $gateway->execute($captureRequest); ### Missing features -* `OrderRequest` params `cardOnFile`, `recurring`, `mcpData`, `threeDsAuthentication`, `credit` +* `OrderRequest` params `recurring`, `mcpData`, `threeDsAuthentication`, `credit` * ... diff --git a/src/Action/CaptureAction.php b/src/Action/CaptureAction.php index b1f3133..8bab9b8 100644 --- a/src/Action/CaptureAction.php +++ b/src/Action/CaptureAction.php @@ -152,7 +152,8 @@ private function prepareOrderRequest(Capture $request, TokenInterface $token, Mo $payMethod, $model->additionalDescription(), $model->visibleDescription(), - $model->statementDescription() + $model->statementDescription(), + $model->cardOnFile() ); } diff --git a/src/Enum/CardOnFileEnum.php b/src/Enum/CardOnFileEnum.php new file mode 100644 index 0000000..9c1c269 --- /dev/null +++ b/src/Enum/CardOnFileEnum.php @@ -0,0 +1,11 @@ +value; + } + public function setPayUResponse(Response\OrderCreatedResponse $orderCreatedResponse): void { $this[ModelFields::PAYU_RESPONSE] = $orderCreatedResponse->toArray(); diff --git a/src/ValueObject/Request/OrderRequest.php b/src/ValueObject/Request/OrderRequest.php index 6e18016..b9c9c07 100644 --- a/src/ValueObject/Request/OrderRequest.php +++ b/src/ValueObject/Request/OrderRequest.php @@ -5,6 +5,7 @@ namespace Answear\Payum\PayU\ValueObject\Request; use Answear\Payum\PayU\Enum\AuthType; +use Answear\Payum\PayU\Enum\CardOnFileEnum; use Answear\Payum\PayU\Enum\RecurringEnum; use Answear\Payum\PayU\ValueObject\Buyer; use Answear\Payum\PayU\ValueObject\Product; @@ -35,7 +36,7 @@ public function __construct( public readonly ?string $additionalDescription = null, public readonly ?string $visibleDescription = null, public readonly ?string $statementDescription = null, - public ?string $cardOnFile = null, + public ?CardOnFileEnum $cardOnFile = null, public ?string $recurring = null, ) { Assert::notEmpty($this->products); @@ -63,7 +64,7 @@ public function toArray(string $merchantPosId): array 'buyer' => $this->buyer?->toArray(), 'products' => array_map(static fn(Product $product) => $product->toArray(), $this->products), 'payMethods' => null === $this->payMethod ? null : ['payMethod' => $this->payMethod->toArray()], - 'cardOnFile' => $this->cardOnFile, + 'cardOnFile' => $this->cardOnFile?->value, 'recurring' => $this->recurring, ]; }