diff --git a/COPYRIGHT b/COPYRIGHT index ea0c6453486..f58095e1558 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -32,7 +32,7 @@ PSR/simple-cache ? Library for cache (used by PHPSp Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) Sabre 3.2.2 BSD Yes DAV support Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP -Stripe 6.35 MIT licence Yes Library for Stripe module +Stripe 6.41 MIT licence Yes Library for Stripe module TCPDF 6.2.25 LGPL-3+ Yes PDF generation TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement diff --git a/htdocs/includes/stripe/CHANGELOG.md b/htdocs/includes/stripe/CHANGELOG.md index 26b449ff039..bed9cff5722 100644 --- a/htdocs/includes/stripe/CHANGELOG.md +++ b/htdocs/includes/stripe/CHANGELOG.md @@ -1,5 +1,45 @@ # Changelog +## 6.41.0 - 2019-07-31 +* [#683](https://github.com/stripe/stripe-php/pull/683) Move the List Balance History API to `/v1/balance_transactions` + +## 6.40.0 - 2019-06-27 +* [#675](https://github.com/stripe/stripe-php/pull/675) Add support for `SetupIntent` resource and APIs + +## 6.39.2 - 2019-06-26 +* [#676](https://github.com/stripe/stripe-php/pull/676) Fix exception message in `CustomerBalanceTransaction::update()` + +## 6.39.1 - 2019-06-25 +* [#674](https://github.com/stripe/stripe-php/pull/674) Add new constants for `collection_method` on `Invoice` + +## 6.39.0 - 2019-06-24 +* [#673](https://github.com/stripe/stripe-php/pull/673) Enable request latency telemetry by default + +## 6.38.0 - 2019-06-17 +* [#649](https://github.com/stripe/stripe-php/pull/649) Add support for `CustomerBalanceTransaction` resource and APIs + +## 6.37.2 - 2019-06-17 +* [#671](https://github.com/stripe/stripe-php/pull/671) Add new PHPDoc +* [#672](https://github.com/stripe/stripe-php/pull/672) Add constants for `submit_type` on Checkout `Session` + +## 6.37.1 - 2019-06-14 +* [#670](https://github.com/stripe/stripe-php/pull/670) Add new PHPDoc + +## 6.37.0 - 2019-05-23 +* [#663](https://github.com/stripe/stripe-php/pull/663) Add support for `radar.early_fraud_warning` resource + +## 6.36.0 - 2019-05-22 +* [#661](https://github.com/stripe/stripe-php/pull/661) Add constants for new TaxId types +* [#662](https://github.com/stripe/stripe-php/pull/662) Add constants for BalanceTransaction types + +## 6.35.2 - 2019-05-20 +* [#655](https://github.com/stripe/stripe-php/pull/655) Add constants for payment intent statuses +* [#659](https://github.com/stripe/stripe-php/pull/659) Fix PHPDoc for various nested Account actions +* [#660](https://github.com/stripe/stripe-php/pull/660) Fix various PHPDoc + +## 6.35.1 - 2019-05-20 +* [#658](https://github.com/stripe/stripe-php/pull/658) Use absolute value when checking timestamp tolerance + ## 6.35.0 - 2019-05-14 * [#651](https://github.com/stripe/stripe-php/pull/651) Add support for the Capability resource and APIs diff --git a/htdocs/includes/stripe/README.md b/htdocs/includes/stripe/README.md index 8dca764d7d1..7d1b681c087 100644 --- a/htdocs/includes/stripe/README.md +++ b/htdocs/includes/stripe/README.md @@ -6,7 +6,11 @@ [![License](https://poser.pugx.org/stripe/stripe-php/license.svg)](https://packagist.org/packages/stripe/stripe-php) [![Code Coverage](https://coveralls.io/repos/stripe/stripe-php/badge.svg?branch=master)](https://coveralls.io/r/stripe/stripe-php?branch=master) -You can sign up for a Stripe account at https://stripe.com. +The Stripe PHP library provides convenient access to the Stripe API from +applications written in the PHP language. It includes a pre-defined set of +classes for API resources that initialize themselves dynamically from API +responses which makes it compatible with a wide range of versions of the Stripe +API. ## Requirements @@ -56,7 +60,7 @@ echo $charge; ## Documentation -Please see https://stripe.com/docs/api for up-to-date documentation. +See the [PHP API docs](https://stripe.com/docs/api/php#intro). ## Legacy Version Support @@ -179,6 +183,17 @@ an intermittent network problem: [Idempotency keys][idempotency-keys] are added to requests to guarantee that retries are safe. +### Request latency telemetry + +By default, the library sends request latency telemetry to Stripe. These +numbers help Stripe improve the overall latency of its API for all users. + +You can disable this behavior if you prefer: + +```php +\Stripe\Stripe::setEnableTelemetry(false); +``` + ## Development Get [Composer][composer]. For example, on Mac OS: diff --git a/htdocs/includes/stripe/VERSION b/htdocs/includes/stripe/VERSION index b22907d080c..08c99ad1b68 100644 --- a/htdocs/includes/stripe/VERSION +++ b/htdocs/includes/stripe/VERSION @@ -1 +1 @@ -6.35.0 +6.41.0 diff --git a/htdocs/includes/stripe/init.php b/htdocs/includes/stripe/init.php index 2f6ccfbf67b..e893cfcda90 100644 --- a/htdocs/includes/stripe/init.php +++ b/htdocs/includes/stripe/init.php @@ -76,6 +76,7 @@ require(dirname(__FILE__) . '/lib/CountrySpec.php'); require(dirname(__FILE__) . '/lib/Coupon.php'); require(dirname(__FILE__) . '/lib/CreditNote.php'); require(dirname(__FILE__) . '/lib/Customer.php'); +require(dirname(__FILE__) . '/lib/CustomerBalanceTransaction.php'); require(dirname(__FILE__) . '/lib/Discount.php'); require(dirname(__FILE__) . '/lib/Dispute.php'); require(dirname(__FILE__) . '/lib/EphemeralKey.php'); @@ -104,6 +105,7 @@ require(dirname(__FILE__) . '/lib/Payout.php'); require(dirname(__FILE__) . '/lib/Person.php'); require(dirname(__FILE__) . '/lib/Plan.php'); require(dirname(__FILE__) . '/lib/Product.php'); +require(dirname(__FILE__) . '/lib/Radar/EarlyFraudWarning.php'); require(dirname(__FILE__) . '/lib/Radar/ValueList.php'); require(dirname(__FILE__) . '/lib/Radar/ValueListItem.php'); require(dirname(__FILE__) . '/lib/Recipient.php'); @@ -112,6 +114,7 @@ require(dirname(__FILE__) . '/lib/Refund.php'); require(dirname(__FILE__) . '/lib/Reporting/ReportRun.php'); require(dirname(__FILE__) . '/lib/Reporting/ReportType.php'); require(dirname(__FILE__) . '/lib/Review.php'); +require(dirname(__FILE__) . '/lib/SetupIntent.php'); require(dirname(__FILE__) . '/lib/SKU.php'); require(dirname(__FILE__) . '/lib/Sigma/ScheduledQueryRun.php'); require(dirname(__FILE__) . '/lib/Source.php'); diff --git a/htdocs/includes/stripe/lib/Account.php b/htdocs/includes/stripe/lib/Account.php index 0e84951dcd0..1adc6b79d53 100644 --- a/htdocs/includes/stripe/lib/Account.php +++ b/htdocs/includes/stripe/lib/Account.php @@ -152,8 +152,8 @@ class Account extends ApiResource /** - * @param string|null $id The ID of the account to which the capability belongs. - * @param string|null $capabilityId The ID of the capability to retrieve. + * @param string $id The ID of the account to which the capability belongs. + * @param string $capabilityId The ID of the capability to retrieve. * @param array|null $params * @param array|string|null $opts * @@ -165,8 +165,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the capability belongs. - * @param string|null $capabilityId The ID of the capability to update. + * @param string $id The ID of the account to which the capability belongs. + * @param string $capabilityId The ID of the capability to update. * @param array|null $params * @param array|string|null $opts * @@ -178,7 +178,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to retrieve the capabilities. + * @param string $id The ID of the account on which to retrieve the capabilities. * @param array|null $params * @param array|string|null $opts * @@ -190,7 +190,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to create the external account. + * @param string $id The ID of the account on which to create the external account. * @param array|null $params * @param array|string|null $opts * @@ -202,8 +202,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the external account belongs. - * @param array|null $externalAccountId The ID of the external account to retrieve. + * @param string $id The ID of the account to which the external account belongs. + * @param string $externalAccountId The ID of the external account to retrieve. * @param array|null $params * @param array|string|null $opts * @@ -215,8 +215,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the external account belongs. - * @param array|null $externalAccountId The ID of the external account to update. + * @param string $id The ID of the account to which the external account belongs. + * @param string $externalAccountId The ID of the external account to update. * @param array|null $params * @param array|string|null $opts * @@ -228,8 +228,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the external account belongs. - * @param array|null $externalAccountId The ID of the external account to delete. + * @param string $id The ID of the account to which the external account belongs. + * @param string $externalAccountId The ID of the external account to delete. * @param array|null $params * @param array|string|null $opts * @@ -241,7 +241,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to retrieve the external accounts. + * @param string $id The ID of the account on which to retrieve the external accounts. * @param array|null $params * @param array|string|null $opts * @@ -253,7 +253,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to create the login link. + * @param string $id The ID of the account on which to create the login link. * @param array|null $params * @param array|string|null $opts * @@ -280,7 +280,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to create the person. + * @param string $id The ID of the account on which to create the person. * @param array|null $params * @param array|string|null $opts * @@ -292,8 +292,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the person belongs. - * @param string|null $personId The ID of the person to retrieve. + * @param string $id The ID of the account to which the person belongs. + * @param string $personId The ID of the person to retrieve. * @param array|null $params * @param array|string|null $opts * @@ -305,8 +305,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the person belongs. - * @param string|null $personId The ID of the person to update. + * @param string $id The ID of the account to which the person belongs. + * @param string $personId The ID of the person to update. * @param array|null $params * @param array|string|null $opts * @@ -318,8 +318,8 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account to which the person belongs. - * @param string|null $personId The ID of the person to delete. + * @param string $id The ID of the account to which the person belongs. + * @param string $personId The ID of the person to delete. * @param array|null $params * @param array|string|null $opts * @@ -331,7 +331,7 @@ class Account extends ApiResource } /** - * @param string|null $id The ID of the account on which to retrieve the persons. + * @param string $id The ID of the account on which to retrieve the persons. * @param array|null $params * @param array|string|null $opts * diff --git a/htdocs/includes/stripe/lib/BalanceTransaction.php b/htdocs/includes/stripe/lib/BalanceTransaction.php index cd9b79ae675..403c4aa173e 100644 --- a/htdocs/includes/stripe/lib/BalanceTransaction.php +++ b/htdocs/includes/stripe/lib/BalanceTransaction.php @@ -31,11 +31,36 @@ class BalanceTransaction extends ApiResource use ApiOperations\Retrieve; /** - * @return string The class URL for this resource. It needs to be special - * cased because it doesn't fit into the standard resource pattern. + * Possible string representations of the type of balance transaction. + * @link https://stripe.com/docs/api/balance/balance_transaction#balance_transaction_object-type */ - public static function classUrl() - { - return "/v1/balance/history"; - } + const TYPE_ADJUSTMENT = 'adjustment'; + const TYPE_ADVANCE = 'advance'; + const TYPE_ADVANCE_FUNDING = 'advance_funding'; + const TYPE_APPLICATION_FEE = 'application_fee'; + const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund'; + const TYPE_CHARGE = 'charge'; + const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer'; + const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold'; + const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release'; + const TYPE_ISSUING_TRANSACTION = 'issuing_transaction'; + const TYPE_PAYMENT = 'payment'; + const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund'; + const TYPE_PAYMENT_REFUND = 'payment_refund'; + const TYPE_PAYOUT = 'payout'; + const TYPE_PAYOUT_CANCEL = 'payout_cancel'; + const TYPE_PAYOUT_FAILURE = 'payout_failure'; + const TYPE_REFUND = 'refund'; + const TYPE_REFUND_FAILURE = 'refund_failure'; + const TYPE_RESERVE_TRANSACTION = 'reserve_transaction'; + const TYPE_RESERVED_FUNDS = 'reserved_funds'; + const TYPE_STRIPE_FEE = 'stripe_fee'; + const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee'; + const TYPE_TAX_FEE = 'tax_fee'; + const TYPE_TOPUP = 'topup'; + const TYPE_TOPUP_REVERSAL = 'topup_reversal'; + const TYPE_TRANSFER = 'transfer'; + const TYPE_TRANSFER_CANCEL = 'transfer_cancel'; + const TYPE_TRANSFER_FAILURE = 'transfer_failure'; + const TYPE_TRANSFER_REFUND = 'transfer_refund'; } diff --git a/htdocs/includes/stripe/lib/BankAccount.php b/htdocs/includes/stripe/lib/BankAccount.php index 019a4d87cbd..3fdc9188c64 100644 --- a/htdocs/includes/stripe/lib/BankAccount.php +++ b/htdocs/includes/stripe/lib/BankAccount.php @@ -31,6 +31,16 @@ class BankAccount extends ApiResource use ApiOperations\Delete; use ApiOperations\Update; + /** + * Possible string representations of the bank verification status. + * @link https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status + */ + const STATUS_NEW = 'new'; + const STATUS_VALIDATED = 'validated'; + const STATUS_VERIFIED = 'verified'; + const STATUS_VERIFICATION_FAILED = 'verification_failed'; + const STATUS_ERRORED = 'errored'; + /** * @return string The instance URL for this resource. It needs to be special * cased because it doesn't fit into the standard resource pattern. diff --git a/htdocs/includes/stripe/lib/Charge.php b/htdocs/includes/stripe/lib/Charge.php index 832a07c7c04..43274c5559c 100644 --- a/htdocs/includes/stripe/lib/Charge.php +++ b/htdocs/includes/stripe/lib/Charge.php @@ -11,7 +11,9 @@ namespace Stripe; * @property int $amount_refunded * @property string $application * @property string $application_fee + * @property int $application_fee_amount * @property string $balance_transaction + * @property mixed $billing_details * @property bool $captured * @property int $created * @property string $currency @@ -30,6 +32,8 @@ namespace Stripe; * @property mixed $outcome * @property bool $paid * @property string $payment_intent + * @property string $payment_method + * @property mixed $payment_method_details * @property string $receipt_email * @property string $receipt_number * @property string $receipt_url @@ -86,6 +90,7 @@ class Charge extends ApiResource const DECLINED_INVALID_PIN = 'invalid_pin'; const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available'; const DECLINED_LOST_CARD = 'lost_card'; + const DECLINED_MERCHANT_BLACKLIST = 'merchant_blacklist'; const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available'; const DECLINED_NO_ACTION_TAKEN = 'no_action_taken'; const DECLINED_NOT_PERMITTED = 'not_permitted'; diff --git a/htdocs/includes/stripe/lib/Checkout/Session.php b/htdocs/includes/stripe/lib/Checkout/Session.php index 968d58cf632..33fc6a08ab2 100644 --- a/htdocs/includes/stripe/lib/Checkout/Session.php +++ b/htdocs/includes/stripe/lib/Checkout/Session.php @@ -15,6 +15,7 @@ namespace Stripe\Checkout; * @property bool $livemode * @property string $payment_intent * @property string[] $payment_method_types + * @property string $submit_type * @property string $subscription * @property string $success_url * @@ -27,4 +28,13 @@ class Session extends \Stripe\ApiResource use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Retrieve; + + /** + * Possible string representations of submit type. + * @link https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-submit_type + */ + const SUBMIT_TYPE_AUTO = 'auto'; + const SUBMIT_TYPE_BOOK = 'book'; + const SUBMIT_TYPE_DONATE = 'donate'; + const SUBMIT_TYPE_PAY = 'pay'; } diff --git a/htdocs/includes/stripe/lib/CreditNote.php b/htdocs/includes/stripe/lib/CreditNote.php index 169ed0815c3..66351ffb828 100644 --- a/htdocs/includes/stripe/lib/CreditNote.php +++ b/htdocs/includes/stripe/lib/CreditNote.php @@ -8,6 +8,7 @@ namespace Stripe; * @property string $id * @property string $object * @property int $amount + * @property string $customer_balance_transaction * @property int $created * @property string $currency * @property string $customer diff --git a/htdocs/includes/stripe/lib/Customer.php b/htdocs/includes/stripe/lib/Customer.php index 44f5e6e2f09..6e78f981ee4 100644 --- a/htdocs/includes/stripe/lib/Customer.php +++ b/htdocs/includes/stripe/lib/Customer.php @@ -7,8 +7,8 @@ namespace Stripe; * * @property string $id * @property string $object - * @property int $account_balance * @property mixed $address + * @property int $balance * @property string $created * @property string $currency * @property string $default_source @@ -26,6 +26,7 @@ namespace Stripe; * @property mixed $shipping * @property Collection $sources * @property Collection $subscriptions + * @property string $tax_exempt * @property Collection $tax_ids * * @package Stripe @@ -61,6 +62,7 @@ class Customer extends ApiResource return $savedNestedResources; } + const PATH_BALANCE_TRANSACTIONS = '/balance_transactions'; const PATH_SOURCES = '/sources'; const PATH_TAX_IDS = '/tax_ids'; @@ -264,4 +266,55 @@ class Customer extends ApiResource { return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts); } + + /** + * @param string|null $id The ID of the customer on which to create the balance transaction. + * @param array|null $params + * @param array|string|null $opts + * + * @return ApiResource + */ + public static function createBalanceTransaction($id, $params = null, $opts = null) + { + return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer to which the balance transaction belongs. + * @param string|null $balanceTransactionId The ID of the balance transaction to retrieve. + * @param array|null $params + * @param array|string|null $opts + * + * @return ApiResource + */ + public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) + { + return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer on which to update the balance transaction. + * @param string|null $balanceTransactionId The ID of the balance transaction to update. + * @param array|null $params + * @param array|string|null $opts + * + * + * @return ApiResource + */ + public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) + { + return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer on which to retrieve the customer balance transactions. + * @param array|null $params + * @param array|string|null $opts + * + * @return Collection The list of customer balance transactions. + */ + public static function allBalanceTransactions($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); + } } diff --git a/htdocs/includes/stripe/lib/CustomerBalanceTransaction.php b/htdocs/includes/stripe/lib/CustomerBalanceTransaction.php new file mode 100644 index 00000000000..06cafcd45c6 --- /dev/null +++ b/htdocs/includes/stripe/lib/CustomerBalanceTransaction.php @@ -0,0 +1,88 @@ +instanceUrl() . '/cancel'; + list($response, $opts) = $this->_request('post', $url, $params, $options); + $this->refreshFrom($response, $opts); + return $this; + } + + /** + * @param array|null $params + * @param array|string|null $options + * + * @return SetupIntent The confirmed setup intent. + */ + public function confirm($params = null, $options = null) + { + $url = $this->instanceUrl() . '/confirm'; + list($response, $opts) = $this->_request('post', $url, $params, $options); + $this->refreshFrom($response, $opts); + return $this; + } +} diff --git a/htdocs/includes/stripe/lib/Source.php b/htdocs/includes/stripe/lib/Source.php index 31b7cf77bba..1e2c8c73565 100644 --- a/htdocs/includes/stripe/lib/Source.php +++ b/htdocs/includes/stripe/lib/Source.php @@ -18,6 +18,7 @@ namespace Stripe; * @property mixed $code_verification * @property int $created * @property string $currency + * @property string $customer * @property mixed $eps * @property string $flow * @property mixed $giropay diff --git a/htdocs/includes/stripe/lib/Stripe.php b/htdocs/includes/stripe/lib/Stripe.php index 027f22fd83c..2397ef9c418 100644 --- a/htdocs/includes/stripe/lib/Stripe.php +++ b/htdocs/includes/stripe/lib/Stripe.php @@ -47,7 +47,7 @@ class Stripe public static $maxNetworkRetries = 0; // @var boolean Whether client telemetry is enabled. Defaults to false. - public static $enableTelemetry = false; + public static $enableTelemetry = true; // @var float Maximum delay between retries, in seconds private static $maxNetworkRetryDelay = 2.0; @@ -55,7 +55,7 @@ class Stripe // @var float Initial delay between retries, in seconds private static $initialNetworkRetryDelay = 0.5; - const VERSION = '6.35.0'; + const VERSION = '6.41.0'; /** * @return string The API key used for requests. diff --git a/htdocs/includes/stripe/lib/Subscription.php b/htdocs/includes/stripe/lib/Subscription.php index 8b57d46b625..f5a46171d81 100644 --- a/htdocs/includes/stripe/lib/Subscription.php +++ b/htdocs/includes/stripe/lib/Subscription.php @@ -13,6 +13,7 @@ namespace Stripe; * @property mixed $billing_thresholds * @property bool $cancel_at_period_end * @property int $canceled_at + * @property string $collection_method * @property int $created * @property int $current_period_end * @property int $current_period_start @@ -31,6 +32,7 @@ namespace Stripe; * @property int $quantity * @property SubscriptionSchedule $schedule * @property int $start + * @property int $start_date * @property string $status * @property float $tax_percent * @property int $trial_end diff --git a/htdocs/includes/stripe/lib/TaxId.php b/htdocs/includes/stripe/lib/TaxId.php index 2993e2d1375..0f72a2ac95f 100644 --- a/htdocs/includes/stripe/lib/TaxId.php +++ b/htdocs/includes/stripe/lib/TaxId.php @@ -12,7 +12,6 @@ namespace Stripe; * @property string $country * @property int $created * @property string $customer - * @property bool $deleted * @property bool $livemode * @property string $type * @property string $value @@ -27,10 +26,12 @@ class TaxId extends ApiResource /** * Possible string representations of a tax id's type. - * @link https://stripe.com/docs/api/customers/tax_id_object#tax_id_object-type + * @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-type */ const TYPE_AU_ABN = 'au_abn'; const TYPE_EU_VAT = 'eu_vat'; + const TYPE_IN_GST = 'in_gst'; + const TYPE_NO_VAT = 'no_vat'; const TYPE_NZ_GST = 'nz_gst'; const TYPE_UNKNOWN = 'unknown'; diff --git a/htdocs/includes/stripe/lib/Util/Util.php b/htdocs/includes/stripe/lib/Util/Util.php index e21d45dac16..f9f15440023 100644 --- a/htdocs/includes/stripe/lib/Util/Util.php +++ b/htdocs/includes/stripe/lib/Util/Util.php @@ -88,6 +88,7 @@ abstract class Util \Stripe\Coupon::OBJECT_NAME => 'Stripe\\Coupon', \Stripe\CreditNote::OBJECT_NAME => 'Stripe\\CreditNote', \Stripe\Customer::OBJECT_NAME => 'Stripe\\Customer', + \Stripe\CustomerBalanceTransaction::OBJECT_NAME => 'Stripe\\CustomerBalanceTransaction', \Stripe\Discount::OBJECT_NAME => 'Stripe\\Discount', \Stripe\Dispute::OBJECT_NAME => 'Stripe\\Dispute', \Stripe\EphemeralKey::OBJECT_NAME => 'Stripe\\EphemeralKey', @@ -117,6 +118,7 @@ abstract class Util \Stripe\Person::OBJECT_NAME => 'Stripe\\Person', \Stripe\Plan::OBJECT_NAME => 'Stripe\\Plan', \Stripe\Product::OBJECT_NAME => 'Stripe\\Product', + \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => 'Stripe\\Radar\\EarlyFraudWarning', \Stripe\Radar\ValueList::OBJECT_NAME => 'Stripe\\Radar\\ValueList', \Stripe\Radar\ValueListItem::OBJECT_NAME => 'Stripe\\Radar\\ValueListItem', \Stripe\Recipient::OBJECT_NAME => 'Stripe\\Recipient', @@ -125,6 +127,7 @@ abstract class Util \Stripe\Reporting\ReportRun::OBJECT_NAME => 'Stripe\\Reporting\\ReportRun', \Stripe\Reporting\ReportType::OBJECT_NAME => 'Stripe\\Reporting\\ReportType', \Stripe\Review::OBJECT_NAME => 'Stripe\\Review', + \Stripe\SetupIntent::OBJECT_NAME => 'Stripe\\SetupIntent', \Stripe\SKU::OBJECT_NAME => 'Stripe\\SKU', \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => 'Stripe\\Sigma\\ScheduledQueryRun', \Stripe\Source::OBJECT_NAME => 'Stripe\\Source', diff --git a/htdocs/includes/stripe/lib/Webhook.php b/htdocs/includes/stripe/lib/Webhook.php index e0ab3021a89..45c7dc0f30a 100644 --- a/htdocs/includes/stripe/lib/Webhook.php +++ b/htdocs/includes/stripe/lib/Webhook.php @@ -24,6 +24,8 @@ abstract class Webhook */ public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE) { + WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance); + $data = json_decode($payload, true); $jsonError = json_last_error(); if ($data === null && $jsonError !== JSON_ERROR_NONE) { @@ -33,8 +35,6 @@ abstract class Webhook } $event = Event::constructFrom($data); - WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance); - return $event; } } diff --git a/htdocs/includes/stripe/lib/WebhookSignature.php b/htdocs/includes/stripe/lib/WebhookSignature.php index 73e70dbd7de..9f8be8777b3 100644 --- a/htdocs/includes/stripe/lib/WebhookSignature.php +++ b/htdocs/includes/stripe/lib/WebhookSignature.php @@ -60,7 +60,7 @@ abstract class WebhookSignature } // Check if timestamp is within tolerance - if (($tolerance > 0) && ((time() - $timestamp) > $tolerance)) { + if (($tolerance > 0) && (abs(time() - $timestamp) > $tolerance)) { throw new Error\SignatureVerification( "Timestamp outside the tolerance zone", $header,