From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- .../lib/Service/PaymentIntentService.php | 464 +++++++++++++-------- 1 file changed, 283 insertions(+), 181 deletions(-) (limited to 'vendor/stripe/stripe-php/lib/Service/PaymentIntentService.php') diff --git a/vendor/stripe/stripe-php/lib/Service/PaymentIntentService.php b/vendor/stripe/stripe-php/lib/Service/PaymentIntentService.php index 43aba46..d197ab6 100644 --- a/vendor/stripe/stripe-php/lib/Service/PaymentIntentService.php +++ b/vendor/stripe/stripe-php/lib/Service/PaymentIntentService.php @@ -1,181 +1,283 @@ -requestCollection('get', '/v1/payment_intents', $params, $opts); - } - - /** - * A PaymentIntent object can be canceled when it is in one of these statuses: - * requires_payment_method, requires_capture, - * requires_confirmation, or requires_action. - * - * Once canceled, no additional charges will be made by the PaymentIntent and any - * operations on the PaymentIntent will fail with an error. For PaymentIntents with - * status=’requires_capture’, the remaining - * amount_capturable will automatically be refunded. - * - * @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 cancel($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/payment_intents/%s/cancel', $id), $params, $opts); - } - - /** - * Capture the funds of an existing uncaptured PaymentIntent when its status is - * requires_capture. - * - * Uncaptured PaymentIntents will be canceled exactly seven days after they are - * created. - * - * Learn more about separate authorization - * and capture. - * - * @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 capture($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/payment_intents/%s/capture', $id), $params, $opts); - } - - /** - * Confirm that your customer intends to pay with current or provided payment - * method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. - * - * If the selected payment method requires additional authentication steps, the - * PaymentIntent will transition to the requires_action status and - * suggest additional actions via next_action. If payment fails, the - * PaymentIntent will transition to the requires_payment_method - * status. If payment succeeds, the PaymentIntent will transition to the - * succeeded status (or requires_capture, if - * capture_method is set to manual). - * - * If the confirmation_method is automatic, payment may - * be attempted using our client SDKs and - * the PaymentIntent’s client_secret. After - * next_actions are handled by the client, no additional confirmation - * is required to complete the payment. - * - * If the confirmation_method is manual, all payment - * attempts must be initiated using a secret key. If any actions are required for - * the payment, the PaymentIntent will return to the - * requires_confirmation state after those actions are completed. Your - * server needs to then explicitly re-confirm the PaymentIntent to initiate the - * next payment attempt. Read the expanded documentation to - * learn more about manual confirmation. - * - * @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 confirm($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/payment_intents/%s/confirm', $id), $params, $opts); - } - - /** - * Creates a PaymentIntent object. - * - * After the PaymentIntent is created, attach a payment method and confirm to continue the payment. - * You can read more about the different payment flows available via the Payment - * Intents API here. - * - * When confirm=true is used during creation, it is equivalent to - * creating and confirming the PaymentIntent in the same call. You may use any - * parameters available in the confirm - * API when confirm=true is supplied. - * - * @param null|array $params - * @param null|array|\Stripe\Util\RequestOptions $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - * - * @return \Stripe\PaymentIntent - */ - public function create($params = null, $opts = null) - { - return $this->request('post', '/v1/payment_intents', $params, $opts); - } - - /** - * Retrieves the details of a PaymentIntent that has previously been created. - * - * Client-side retrieval using a publishable key is allowed when the - * client_secret is provided in the query string. - * - * When retrieved with a publishable key, only a subset of properties will be - * returned. Please refer to the payment - * intent object reference for more details. - * - * @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 retrieve($id, $params = null, $opts = null) - { - return $this->request('get', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); - } - - /** - * Updates properties on a PaymentIntent object without confirming. - * - * Depending on which properties you update, you may need to confirm the - * PaymentIntent again. For example, updating the payment_method will - * always require you to confirm the PaymentIntent again. If you prefer to update - * and confirm at the same time, we recommend updating properties via the confirm API instead. - * - * @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 update($id, $params = null, $opts = null) - { - return $this->request('post', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); - } -} + + */ + 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, + * requires_confirmation, requires_action, or + * processing. + * + * Once canceled, no additional charges will be made by the PaymentIntent and any + * operations on the PaymentIntent will fail with an error. For PaymentIntents with + * status=’requires_capture’, the remaining + * amount_capturable will automatically be refunded. + * + * You cannot cancel the PaymentIntent for a Checkout Session. Expire the Checkout Session + * instead + * + * @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 cancel($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_intents/%s/cancel', $id), $params, $opts); + } + + /** + * Capture the funds of an existing uncaptured PaymentIntent when its status is + * requires_capture. + * + * Uncaptured PaymentIntents will be canceled a set number of days after they are + * created (7 by default). + * + * Learn more about separate authorization + * and capture. + * + * @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 capture($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_intents/%s/capture', $id), $params, $opts); + } + + /** + * Confirm that your customer intends to pay with current or provided payment + * method. Upon confirmation, the PaymentIntent will attempt to initiate a payment. + * + * If the selected payment method requires additional authentication steps, the + * PaymentIntent will transition to the requires_action status and + * suggest additional actions via next_action. If payment fails, the + * PaymentIntent will transition to the requires_payment_method + * status. If payment succeeds, the PaymentIntent will transition to the + * succeeded status (or requires_capture, if + * capture_method is set to manual). + * + * If the confirmation_method is automatic, payment may + * be attempted using our client SDKs and + * the PaymentIntent’s client_secret. After + * next_actions are handled by the client, no additional confirmation + * is required to complete the payment. + * + * If the confirmation_method is manual, all payment + * attempts must be initiated using a secret key. If any actions are required for + * the payment, the PaymentIntent will return to the + * requires_confirmation state after those actions are completed. Your + * server needs to then explicitly re-confirm the PaymentIntent to initiate the + * next payment attempt. Read the expanded documentation to + * learn more about manual confirmation. + * + * @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 confirm($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_intents/%s/confirm', $id), $params, $opts); + } + + /** + * Creates a PaymentIntent object. + * + * After the PaymentIntent is created, attach a payment method and confirm to continue the payment. + * You can read more about the different payment flows available via the Payment + * Intents API here. + * + * When confirm=true is used during creation, it is equivalent to + * creating and confirming the PaymentIntent in the same call. You may use any + * parameters available in the confirm + * API when confirm=true is supplied. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PaymentIntent + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/payment_intents', $params, $opts); + } + + /** + * Perform an incremental authorization on an eligible PaymentIntent. To be eligible, the + * PaymentIntent’s status must be requires_capture and incremental_authorization_supported + * must be true. + * + * Incremental authorizations attempt to increase the authorized amount on your + * customer’s card to the new, higher amount provided. As with the + * initial authorization, incremental authorizations may be declined. A single + * PaymentIntent can call this endpoint multiple times to further increase the + * authorized amount. + * + * If the incremental authorization succeeds, the PaymentIntent object is returned + * with the updated amount. + * If the incremental authorization fails, a card_declined error is returned, and + * no fields on the PaymentIntent or Charge are updated. The PaymentIntent object + * remains capturable for the previously authorized amount. + * + * Each PaymentIntent can have a maximum of 10 incremental authorization attempts, + * including declines. Once captured, a PaymentIntent can no longer be incremented. + * + * Learn more about incremental + * authorizations. + * + * @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 incrementAuthorization($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_intents/%s/increment_authorization', $id), $params, $opts); + } + + /** + * Retrieves the details of a PaymentIntent that has previously been created. + * + * Client-side retrieval using a publishable key is allowed when the + * client_secret is provided in the query string. + * + * When retrieved with a publishable key, only a subset of properties will be + * returned. Please refer to the payment + * intent object reference for more details. + * + * @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 retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); + } + + /** + * Search for PaymentIntents you’ve previously created using Stripe’s Search Query Language. Don’t use + * search in read-after-write flows where strict consistency is necessary. Under + * normal operating conditions, data is searchable in less than a minute. + * Occasionally, propagation of new or updated data can be up to an hour behind + * during outages. Search functionality is not available to merchants in India. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SearchResult<\Stripe\PaymentIntent> + */ + public function search($params = null, $opts = null) + { + return $this->requestSearchResult('get', '/v1/payment_intents/search', $params, $opts); + } + + /** + * Updates properties on a PaymentIntent object without confirming. + * + * Depending on which properties you update, you may need to confirm the + * PaymentIntent again. For example, updating the payment_method will + * always require you to confirm the PaymentIntent again. If you prefer to update + * and confirm at the same time, we recommend updating properties via the confirm API instead. + * + * @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 update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_intents/%s', $id), $params, $opts); + } + + /** + * Verifies microdeposits on a PaymentIntent object. + * + * @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 verifyMicrodeposits($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_intents/%s/verify_microdeposits', $id), $params, $opts); + } +} -- cgit v1.2.3