From b88d0167eec00bb0ccb484a7bd95fb1b6ba2161a Mon Sep 17 00:00:00 2001 From: James Doyley Date: Wed, 28 Apr 2021 11:41:07 +0100 Subject: [PATCH 1/2] Update CreateSetupIntentRequest --- src/Message/SetupIntents/CreateSetupIntentRequest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Message/SetupIntents/CreateSetupIntentRequest.php b/src/Message/SetupIntents/CreateSetupIntentRequest.php index 53eb08b0..b5505872 100644 --- a/src/Message/SetupIntents/CreateSetupIntentRequest.php +++ b/src/Message/SetupIntents/CreateSetupIntentRequest.php @@ -37,10 +37,10 @@ public function getData() } if ($this->getMetadata()) { - $this['metadata'] = $this->getMetadata(); + $data['metadata'] = $this->getMetadata(); } if ($this->getPaymentMethod()) { - $this['payment_method'] = $this->getPaymentMethod(); + $data['payment_method'] = $this->getPaymentMethod(); } $data['usage'] = 'off_session'; From 94582e0965f5ca2295793dba38cf3631fc6cf352 Mon Sep 17 00:00:00 2001 From: James Doyley Date: Wed, 28 Apr 2021 13:05:26 +0100 Subject: [PATCH 2/2] Allow confirm and usage parameters to be set --- .../SetupIntents/CreateSetupIntentRequest.php | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/Message/SetupIntents/CreateSetupIntentRequest.php b/src/Message/SetupIntents/CreateSetupIntentRequest.php index b5505872..1913d2ce 100644 --- a/src/Message/SetupIntents/CreateSetupIntentRequest.php +++ b/src/Message/SetupIntents/CreateSetupIntentRequest.php @@ -22,6 +22,48 @@ */ class CreateSetupIntentRequest extends AbstractRequest { + /** + * @param bool $value + * + * @return AbstractRequest provides a fluent interface. + */ + public function setConfirm($value) + { + return $this->setParameter('confirm', $value); + } + + /** + * @return mixed + */ + public function getConfirm() + { + if (is_null($this->getParameter('confirm'))) { + return 'false'; + } + return $this->getParameter('confirm'); + } + + /** + * @param bool $value + * + * @return AbstractRequest provides a fluent interface. + */ + public function setUsage($value) + { + return $this->setParameter('usage', $value); + } + + /** + * @return mixed + */ + public function getUsage() + { + if (is_null($this->getParameter('usage'))) { + return 'off_session'; + } + return $this->getParameter('usage'); + } + /** * @inheritdoc */ @@ -43,7 +85,9 @@ public function getData() $data['payment_method'] = $this->getPaymentMethod(); } - $data['usage'] = 'off_session'; + $data['confirm'] = $this->getConfirm(); + + $data['usage'] = $this->getUsage(); $data['payment_method_types'][] = 'card'; return $data;