From 472daf325049b705b9b765c710cba59bc0f03141 Mon Sep 17 00:00:00 2001 From: SSAnish76 Date: Tue, 3 Aug 2021 15:42:59 +0530 Subject: [PATCH 1/4] Default Payment Method feature added --- src/Message/UpdateCustomerRequest.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Message/UpdateCustomerRequest.php b/src/Message/UpdateCustomerRequest.php index d05cf8c9..07bc6852 100644 --- a/src/Message/UpdateCustomerRequest.php +++ b/src/Message/UpdateCustomerRequest.php @@ -66,7 +66,7 @@ public function getSource() { return $this->getParameter('source'); } - + /** * Sets the customer's source. * @@ -78,12 +78,35 @@ public function setSource($value) $this->setParameter('source', $value); } + /** + * Get the customer's def source. + * + * @return string + */ + public function getDefaultSource() + { + return $this->getParameter('default_source'); + } + + /** + * Sets the customer's def source. + * + * @param string $value + * @return CreateCustomerRequest provides a fluent interface. + */ + public function setDefaultSource($value) + { + $this->setParameter('default_source', $value); + } + public function getData() { $this->validate('customerReference'); $data = array(); $data['description'] = $this->getDescription(); + $data['default_source'] = $this->getDefaultSource(); + if ($this->getToken()) { $data['card'] = $this->getToken(); } elseif ($this->getCard()) { @@ -102,6 +125,7 @@ public function getData() $data['source'] = $this->getSource(); } + return $data; } From f03709ed30bf141155006bb3a89d218f2b67ac7a Mon Sep 17 00:00:00 2001 From: Vigikaran Vijayaratnam Date: Thu, 16 Sep 2021 17:25:12 +0100 Subject: [PATCH 2/4] Customer, Client REferance added --- src/Message/Checkout/PurchaseRequest.php | 27 ++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Message/Checkout/PurchaseRequest.php b/src/Message/Checkout/PurchaseRequest.php index d3d2386d..72de0770 100644 --- a/src/Message/Checkout/PurchaseRequest.php +++ b/src/Message/Checkout/PurchaseRequest.php @@ -25,7 +25,6 @@ public function setSuccessUrl($value) { return $this->setParameter('success_url', $value); } - /** * Get the success url * @@ -35,6 +34,28 @@ public function getSuccessUrl() { return $this->getParameter('success_url'); } + + /** + * Get the Customer + * + * @return string + */ + public function getCustomer() + { + return $this->getParameter('customer'); + } + /** + * Set the Customer + * + * @param string $value + * + * @return \Omnipay\Common\Message\AbstractRequest|PurchaseRequest + */ + public function setCustomer($value) + { + return $this->setParameter('customer', $value); + } + /** * Set the cancel url * @@ -153,7 +174,9 @@ public function getData() 'cancel_url' => $this->getCancelUrl(), 'payment_method_types' => $this->getPaymentMethodTypes(), 'mode' => $this->getMode(), - 'line_items' => $this->getLineItems() + 'line_items' => $this->getLineItems(), + 'customer' => $this->getCustomer(), + 'client_reference_id'=>$this->getClientReferenceId() ); return $data; From 41af3f530eb35fe26146ed09126b6349f686a70e Mon Sep 17 00:00:00 2001 From: SSAnish76 Date: Fri, 17 Sep 2021 12:55:42 +0530 Subject: [PATCH 3/4] Add PaymentMethodType in PaymentIntent --- .../PaymentIntents/AuthorizeRequest.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Message/PaymentIntents/AuthorizeRequest.php b/src/Message/PaymentIntents/AuthorizeRequest.php index 4a0ec8ad..c6e65487 100644 --- a/src/Message/PaymentIntents/AuthorizeRequest.php +++ b/src/Message/PaymentIntents/AuthorizeRequest.php @@ -329,6 +329,28 @@ public function getOffSession() return $this->getParameter('off_session'); } + /** + * Set the setup_future_usage parameter. + * + * @param $value + * @return AbstractRequest provides a fluent interface. + */ + public function setPaymentMethodTypes($value) + { + return $this->setParameter('payment_method_types', $value); + } + + /** + * Get the success url + * + * @return string + */ + public function getPaymentMethodTypes() + { + return $this->getParameter('payment_method_types'); + } + + /** * @inheritdoc */ @@ -403,6 +425,7 @@ public function getData() } $data['off_session'] = $this->getOffSession() ? 'true' : 'false'; + $data['payment_method_types'] = $this->getPaymentMethodTypes(); return $data; } From da41aa934f85b6aa44e375a41887c259ccd96ba9 Mon Sep 17 00:00:00 2001 From: SSAnish76 Date: Mon, 20 Sep 2021 18:13:34 +0530 Subject: [PATCH 4/4] Add metadata for checkout session --- src/Message/Checkout/PurchaseRequest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Message/Checkout/PurchaseRequest.php b/src/Message/Checkout/PurchaseRequest.php index 72de0770..1fb1749d 100644 --- a/src/Message/Checkout/PurchaseRequest.php +++ b/src/Message/Checkout/PurchaseRequest.php @@ -167,6 +167,16 @@ public function getClientReferenceId() } + public function getMetadata() + { + return $this->getParameter('metadata'); + } + + public function setMetadata($value) + { + return $this->setParameter('metadata', $value); + } + public function getData() { $data = array( @@ -179,6 +189,10 @@ public function getData() 'client_reference_id'=>$this->getClientReferenceId() ); + if ($this->getMetadata()) { + $data['metadata'] = $this->getMetadata(); + } + return $data; }