From 80efac0afce5c4f11b34d03386474e9629d5ddf8 Mon Sep 17 00:00:00 2001 From: Andreas Radloff Date: Fri, 26 Aug 2022 11:16:34 +0200 Subject: [PATCH 1/4] send client_reference_id with PurchaseRequest --- src/Message/Checkout/PurchaseRequest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Message/Checkout/PurchaseRequest.php b/src/Message/Checkout/PurchaseRequest.php index d3d2386d..39708c31 100644 --- a/src/Message/Checkout/PurchaseRequest.php +++ b/src/Message/Checkout/PurchaseRequest.php @@ -149,6 +149,7 @@ public function getClientReferenceId() public function getData() { $data = array( + 'client_reference_id' => $this->getClientReferenceId(), 'success_url' => $this->getSuccessUrl(), 'cancel_url' => $this->getCancelUrl(), 'payment_method_types' => $this->getPaymentMethodTypes(), From a9074d1facd7e66a73a2ca8eae445e9488fd889b Mon Sep 17 00:00:00 2001 From: Andreas Radloff Date: Fri, 26 Aug 2022 11:57:41 +0200 Subject: [PATCH 2/4] tests for send client_reference_id with PurchaseRequest --- .../Message/Checkout/PurchaseRequestTest.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/Message/Checkout/PurchaseRequestTest.php diff --git a/tests/Message/Checkout/PurchaseRequestTest.php b/tests/Message/Checkout/PurchaseRequestTest.php new file mode 100644 index 00000000..801d701b --- /dev/null +++ b/tests/Message/Checkout/PurchaseRequestTest.php @@ -0,0 +1,31 @@ +request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest()); + $this->request->initialize( + array( + 'client_reference_id' => 'cart_id_123' + ) + ); + } + + public function testGetData() + { + $data = $this->request->getData(); + + $this->assertSame('cart_id_123', $data['client_reference_id']); + } + +} From 598d633546da7140951e5fca57459bc7d5ccb1c5 Mon Sep 17 00:00:00 2001 From: Andreas Radloff Date: Mon, 29 Aug 2022 11:38:42 +0200 Subject: [PATCH 3/4] Squashed commit of the following: commit 4f93e2271855185d8eab25dad5d47c700f254529 Author: Andreas Radloff Date: Mon Aug 29 11:37:00 2022 +0200 add some params required for saving card for future use commit e76e7ffcdcd7b4225ddc2a3903dc640ef7ad0f54 Author: Andreas Radloff Date: Mon Aug 29 11:21:14 2022 +0200 add some params required for saving card for future use --- src/Message/Checkout/PurchaseRequest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Message/Checkout/PurchaseRequest.php b/src/Message/Checkout/PurchaseRequest.php index 39708c31..9f5b39a8 100644 --- a/src/Message/Checkout/PurchaseRequest.php +++ b/src/Message/Checkout/PurchaseRequest.php @@ -145,6 +145,27 @@ public function getClientReferenceId() return $this->getParameter('client_reference_id'); } + /** + * Set the customer_creation parameter + * + * @param string $value + * + * @return \Omnipay\Common\Message\AbstractRequest|PurchaseRequest + */ + public function setCustomerCreation($value) + { + return $this->setParameter('customer_creation', $value); + } + + /** + * Get the customer_creation parameter + * + * @return string + */ + public function getCustomerCreation() + { + return $this->getParameter('customer_creation'); + } public function getData() { @@ -154,6 +175,7 @@ public function getData() 'cancel_url' => $this->getCancelUrl(), 'payment_method_types' => $this->getPaymentMethodTypes(), 'mode' => $this->getMode(), + 'customer_creation' => $this->getCustomerCreation(), 'line_items' => $this->getLineItems() ); From 8e50cde8f3f88b73db810cf416bdf99add2c1cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enes=20Sacid=20B=C3=BCker?= <73346401+EnesSacid-Buker@users.noreply.github.com> Date: Mon, 20 Mar 2023 18:46:13 +0300 Subject: [PATCH 4/4] Some parameters made optional (#218) * Some parameters made optional * Update composer.json * Update CreatePaymentMethodRequest.php * Revert "Update composer.json" This reverts commit 705a85edc633fd4c03f4d27b9318e41f1dabc2a3. --- .../PaymentIntents/AuthorizeRequest.php | 45 ++++++++++++++++++- .../CreatePaymentMethodRequest.php | 2 +- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/Message/PaymentIntents/AuthorizeRequest.php b/src/Message/PaymentIntents/AuthorizeRequest.php index 4a0ec8ad..5154042f 100644 --- a/src/Message/PaymentIntents/AuthorizeRequest.php +++ b/src/Message/PaymentIntents/AuthorizeRequest.php @@ -329,6 +329,42 @@ public function getOffSession() return $this->getParameter('off_session'); } + /** + * @return mixed + */ + public function getConfirmationMethod() + { + return $this->getParameter('confirmation_method'); + } + + /** + * @param string $value + * + * @return AbstractRequest provides a fluent interface. + */ + public function setConfirmationMethod($value) + { + return $this->setParameter('confirmation_method', $value); + } + + /** + * @return mixed + */ + public function getCaptureMethod() + { + return $this->getParameter('capture_method'); + } + + /** + * @param string $value + * + * @return AbstractRequest provides a fluent interface. + */ + public function setCaptureMethod($value) + { + return $this->setParameter('capture_method', $value); + } + /** * @inheritdoc */ @@ -392,8 +428,13 @@ public function getData() $data['off_session'] = $this->getOffSession() ? 'true' : 'false'; - $data['confirmation_method'] = 'manual'; - $data['capture_method'] = 'manual'; + if ($this->getConfirmationMethod()) { + $data['confirmation_method'] = $this->getConfirmationMethod(); + } + + if ($this->getCaptureMethod()) { + $data['capture_method'] = $this->getCaptureMethod(); + } $data['confirm'] = $this->getConfirm() ? 'true' : 'false'; diff --git a/src/Message/PaymentIntents/CreatePaymentMethodRequest.php b/src/Message/PaymentIntents/CreatePaymentMethodRequest.php index 61ee03d0..32c3642a 100644 --- a/src/Message/PaymentIntents/CreatePaymentMethodRequest.php +++ b/src/Message/PaymentIntents/CreatePaymentMethodRequest.php @@ -117,7 +117,7 @@ public function getBillingDetails() 'country' => $data['address_country'], 'line1' => $data['address_line1'], 'line2' => $data['address_line2'], - 'postal_code' => $data['address_zip'], + 'postal_code' => $data['address_zip'] ?? null, 'state' => $data['address_state'], ]), ]);