From 01f941078f84cf4139735a4b4e013ae32b04232d Mon Sep 17 00:00:00 2001 From: Kamil Pajdzik <99290280+kamil-stripe@users.noreply.github.com> Date: Fri, 8 Apr 2022 09:43:16 -0700 Subject: [PATCH] Codegen for openapi fc5a2b9 (#1261) --- lib/Checkout/Session.php | 2 +- lib/Event.php | 1 + lib/PaymentIntent.php | 17 +++++++++++++++++ lib/Service/PaymentIntentService.php | 20 ++++++++++++++++++++ lib/Service/Terminal/ReaderService.php | 2 +- 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/Checkout/Session.php b/lib/Checkout/Session.php index c3fbaae37..aa8b34011 100644 --- a/lib/Checkout/Session.php +++ b/lib/Checkout/Session.php @@ -64,7 +64,7 @@ * @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful. * @property \Stripe\StripeObject $tax_id_collection * @property null|\Stripe\StripeObject $total_details Tax and discount details for the computed total amount. - * @property null|string $url The URL to the Checkout Session. + * @property null|string $url The URL to the Checkout Session. Redirect customers to this URL to take them to Checkout. If you’re using Custom Domains, the URL will use your subdomain. Otherwise, it’ll use checkout.stripe.com. */ class Session extends \Stripe\ApiResource { diff --git a/lib/Event.php b/lib/Event.php index 469b75222..96674da4c 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -75,6 +75,7 @@ class Event extends ApiResource const BILLING_PORTAL_CONFIGURATION_CREATED = 'billing_portal.configuration.created'; const BILLING_PORTAL_CONFIGURATION_UPDATED = 'billing_portal.configuration.updated'; const CAPABILITY_UPDATED = 'capability.updated'; + const CASH_BALANCE_FUNDS_AVAILABLE = 'cash_balance.funds_available'; const CHARGE_CAPTURED = 'charge.captured'; const CHARGE_EXPIRED = 'charge.expired'; const CHARGE_FAILED = 'charge.failed'; diff --git a/lib/PaymentIntent.php b/lib/PaymentIntent.php index bf46ad33a..c184d2a05 100644 --- a/lib/PaymentIntent.php +++ b/lib/PaymentIntent.php @@ -75,6 +75,23 @@ class PaymentIntent extends ApiResource const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method'; const STATUS_SUCCEEDED = 'succeeded'; + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PaymentIntent the applied payment intent + */ + public function applyCustomerBalance($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/apply_customer_balance'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + /** * @param null|array $params * @param null|array|string $opts diff --git a/lib/Service/PaymentIntentService.php b/lib/Service/PaymentIntentService.php index f69eaab0a..801654657 100644 --- a/lib/Service/PaymentIntentService.php +++ b/lib/Service/PaymentIntentService.php @@ -21,6 +21,26 @@ public function all($params = null, $opts = null) return $this->requestCollection('get', '/v1/payment_intents', $params, $opts); } + /** + * Manually reconcile the remaining amount for a customer_balance PaymentIntent. + * + * This can be used when the cash balance for a + * customer in manual reconciliation mode received funds. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PaymentIntent + */ + public function applyCustomerBalance($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_intents/%s/apply_customer_balance', $id), $params, $opts); + } + /** * A PaymentIntent object can be canceled when it is in one of these statuses: * requires_payment_method, requires_capture, diff --git a/lib/Service/Terminal/ReaderService.php b/lib/Service/Terminal/ReaderService.php index 2a97fa36a..ae8555950 100644 --- a/lib/Service/Terminal/ReaderService.php +++ b/lib/Service/Terminal/ReaderService.php @@ -117,7 +117,7 @@ public function retrieve($id, $params = null, $opts = null) } /** - * Sets reader display. + * Sets reader display to show cart details. * * @param string $id * @param null|array $params