diff --git a/lib/Checkout/Payments/Request/PartialAuthorization.php b/lib/Checkout/Payments/Request/PartialAuthorization.php new file mode 100644 index 0000000..1081e6b --- /dev/null +++ b/lib/Checkout/Payments/Request/PartialAuthorization.php @@ -0,0 +1,11 @@ +reference = uniqid(); $authorizationRequest->metadata = array("param1" => "value1", "param2" => "value2"); - $authorizationResponse = $this->checkoutApi->getPaymentsClient()->incrementPaymentAuthorization($paymentResponse["id"], $authorizationRequest); + $authorizationResponse = $this->checkoutApi->getPaymentsClient()->incrementPaymentAuthorization( + $paymentResponse["id"], + $authorizationRequest + ); $this->assertResponse( $authorizationResponse, @@ -60,8 +64,16 @@ public function shouldIncrementPaymentAuthorizationIdempotent() $idempotencyKey = $this->idempotencyKey(); - $authorizationResponse = $this->checkoutApi->getPaymentsClient()->incrementPaymentAuthorization($paymentResponse["id"], $authorizationRequest, $idempotencyKey); - $authorizationResponse2 = $this->checkoutApi->getPaymentsClient()->incrementPaymentAuthorization($paymentResponse["id"], $authorizationRequest, $idempotencyKey); + $authorizationResponse = $this->checkoutApi->getPaymentsClient()->incrementPaymentAuthorization( + $paymentResponse["id"], + $authorizationRequest, + $idempotencyKey + ); + $authorizationResponse2 = $this->checkoutApi->getPaymentsClient()->incrementPaymentAuthorization( + $paymentResponse["id"], + $authorizationRequest, + $idempotencyKey + ); $this->assertEquals($authorizationResponse["action_id"], $authorizationResponse2["action_id"]); } @@ -91,12 +103,16 @@ private function makeEstimatedAuthorizedPayment() $paymentIndividualSender->last_name = "Test"; $paymentIndividualSender->address = $address; + $partialAuthorization = new PartialAuthorization(); + $partialAuthorization->enabled = true; + $paymentRequest = new PaymentRequest(); $paymentRequest->source = $requestCardSource; $paymentRequest->capture = false; $paymentRequest->reference = uniqid(); $paymentRequest->amount = 10; $paymentRequest->authorization_type = AuthorizationType::$estimated; + $paymentRequest->partial_authorization = $partialAuthorization; $paymentRequest->currency = Currency::$EUR; $paymentRequest->customer = $customerRequest; $paymentRequest->sender = $paymentIndividualSender;