From 37e4d51e7173ca26a5cf81ae1d56ee42a70aa430 Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Mon, 29 Apr 2019 15:20:51 +0200 Subject: [PATCH] Small fixes - Fix Payment::getStatusOfSource - Removed unused Variable in Merx::completePayment - Update Stripe PHP Library --- composer.lock | 76 +++++++++--------- src/merx.php | 2 +- src/payment.php | 2 +- vendor/composer/autoload_classmap.php | 3 + vendor/composer/autoload_static.php | 3 + vendor/stripe/stripe-php/init.php | 3 + vendor/stripe/stripe-php/lib/Account.php | 37 ++++++++- vendor/stripe/stripe-php/lib/Coupon.php | 2 +- vendor/stripe/stripe-php/lib/CreditNote.php | 73 +++++++++++++++++ vendor/stripe/stripe-php/lib/Customer.php | 66 ++++++++++++++- vendor/stripe/stripe-php/lib/Event.php | 8 ++ vendor/stripe/stripe-php/lib/File.php | 9 ++- .../stripe-php/lib/HttpClient/CurlClient.php | 55 ++++++++++++- vendor/stripe/stripe-php/lib/Invoice.php | 17 +++- vendor/stripe/stripe-php/lib/InvoiceItem.php | 1 + .../stripe/stripe-php/lib/InvoiceLineItem.php | 2 + vendor/stripe/stripe-php/lib/Person.php | 15 ++++ vendor/stripe/stripe-php/lib/Stripe.php | 2 +- vendor/stripe/stripe-php/lib/Subscription.php | 2 + .../stripe-php/lib/SubscriptionItem.php | 1 + vendor/stripe/stripe-php/lib/TaxId.php | 80 +++++++++++++++++++ vendor/stripe/stripe-php/lib/TaxRate.php | 31 +++++++ vendor/stripe/stripe-php/lib/Util/Util.php | 3 + 23 files changed, 441 insertions(+), 52 deletions(-) create mode 100644 vendor/stripe/stripe-php/lib/CreditNote.php create mode 100644 vendor/stripe/stripe-php/lib/TaxId.php create mode 100644 vendor/stripe/stripe-php/lib/TaxRate.php diff --git a/composer.lock b/composer.lock index 6935529..d8e365c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3398a02387cd26c8c83312a54bd80eec", + "content-hash": "386d9a7df0a6ab68abe0c1f06f117458", "packages": [ { "name": "braintree/braintreehttp", @@ -96,16 +96,16 @@ }, { "name": "stripe/stripe-php", - "version": "v6.31.2", + "version": "v6.34.2", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "19456bcbdde319a4e936e042f65769f0993eb90b" + "reference": "60335d5dad000fb4b08aa7176b832a59d13d0420" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/19456bcbdde319a4e936e042f65769f0993eb90b", - "reference": "19456bcbdde319a4e936e042f65769f0993eb90b", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/60335d5dad000fb4b08aa7176b832a59d13d0420", + "reference": "60335d5dad000fb4b08aa7176b832a59d13d0420", "shasum": "" }, "require": { @@ -148,7 +148,7 @@ "payment processing", "stripe" ], - "time": "2019-03-25T20:28:43+00:00" + "time": "2019-04-26T18:30:55+00:00" } ], "packages-dev": [ @@ -310,16 +310,16 @@ }, { "name": "getkirby/cms", - "version": "3.1.1", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/getkirby/kirby.git", - "reference": "52e21a48f32b8edf7bc0a2bd630b41b8dab5561c" + "reference": "c9dcfb5a79af7951a6be6dcecd202d9c8a01b28e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getkirby/kirby/zipball/52e21a48f32b8edf7bc0a2bd630b41b8dab5561c", - "reference": "52e21a48f32b8edf7bc0a2bd630b41b8dab5561c", + "url": "https://api.github.com/repos/getkirby/kirby/zipball/c9dcfb5a79af7951a6be6dcecd202d9c8a01b28e", + "reference": "c9dcfb5a79af7951a6be6dcecd202d9c8a01b28e", "shasum": "" }, "require": { @@ -331,7 +331,7 @@ "michelf/php-smartypants": "1.8.1", "mustangostang/spyc": "0.6.2", "php": ">=7.1.0", - "phpmailer/phpmailer": "6.0.6", + "phpmailer/phpmailer": "6.0.7", "true/punycode": "2.1.1", "zendframework/zend-escaper": "2.6.0" }, @@ -367,7 +367,7 @@ "core", "kirby" ], - "time": "2019-03-26T09:52:09+00:00" + "time": "2019-04-23T14:04:29+00:00" }, { "name": "getkirby/composer-installer", @@ -563,16 +563,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.8.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", - "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", "shasum": "" }, "require": { @@ -607,7 +607,7 @@ "object", "object graph" ], - "time": "2018-06-11T23:09:50+00:00" + "time": "2019-04-07T13:18:21+00:00" }, { "name": "phar-io/manifest", @@ -865,16 +865,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.0.6", + "version": "v6.0.7", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "8190d73eb5def11a43cfb020b7f36db65330698c" + "reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/8190d73eb5def11a43cfb020b7f36db65330698c", - "reference": "8190d73eb5def11a43cfb020b7f36db65330698c", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/0c41a36d4508d470e376498c1c0c527aa36a2d59", + "reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59", "shasum": "" }, "require": { @@ -927,7 +927,7 @@ } ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "time": "2018-11-16T00:41:32+00:00" + "time": "2019-02-01T15:04:28+00:00" }, { "name": "phpspec/prophecy", @@ -1246,16 +1246,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.8", + "version": "7.5.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a" + "reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c29c0525cf4572c11efe1db49a8b8aee9dfac58a", - "reference": "c29c0525cf4572c11efe1db49a8b8aee9dfac58a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/134669cf0eeac3f79bc7f0c793efbc158bffc160", + "reference": "134669cf0eeac3f79bc7f0c793efbc158bffc160", "shasum": "" }, "require": { @@ -1326,7 +1326,7 @@ "testing", "xunit" ], - "time": "2019-03-26T13:23:54+00:00" + "time": "2019-04-19T15:50:46+00:00" }, { "name": "psr/log", @@ -1542,16 +1542,16 @@ }, { "name": "sebastian/environment", - "version": "4.1.0", + "version": "4.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656" + "reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656", - "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/3095910f0f0fb155ac4021fc51a4a7a39ac04e8a", + "reference": "3095910f0f0fb155ac4021fc51a4a7a39ac04e8a", "shasum": "" }, "require": { @@ -1566,7 +1566,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -1591,7 +1591,7 @@ "environment", "hhvm" ], - "time": "2019-02-01T05:27:49+00:00" + "time": "2019-04-25T07:55:20+00:00" }, { "name": "sebastian/exporter", @@ -2060,16 +2060,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.1.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/1c42705be2b6c1de5904f8afacef5895cab44bf8", + "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8", "shasum": "" }, "require": { @@ -2096,7 +2096,7 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "time": "2019-04-04T09:56:43+00:00" }, { "name": "true/punycode", diff --git a/src/merx.php b/src/merx.php index f736853..df90910 100644 --- a/src/merx.php +++ b/src/merx.php @@ -232,7 +232,7 @@ public function completePayment(array $data = []): OrderPage kirby()->trigger('ww.merx.completePayment:before', $virtualOrderPage, $gateway, $data); if (is_callable($gateway['completePayment'])) { - $redirect = $gateway['completePayment']($virtualOrderPage, $data); + $gateway['completePayment']($virtualOrderPage, $data); } $virtualOrderPage->content()->update([ diff --git a/src/payment.php b/src/payment.php index 200d3f6..b708511 100644 --- a/src/payment.php +++ b/src/payment.php @@ -97,7 +97,7 @@ public static function getStatusOfSource(string $sourceString): string { self::setStripeApiKey(); - $source = \Stripe\Source::retrieve($_GET['source']); + $source = \Stripe\Source::retrieve($sourceString); return $source->status; } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 6ea840a..5ea152a 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -82,6 +82,7 @@ 'Stripe\\Collection' => $vendorDir . '/stripe/stripe-php/lib/Collection.php', 'Stripe\\CountrySpec' => $vendorDir . '/stripe/stripe-php/lib/CountrySpec.php', 'Stripe\\Coupon' => $vendorDir . '/stripe/stripe-php/lib/Coupon.php', + 'Stripe\\CreditNote' => $vendorDir . '/stripe/stripe-php/lib/CreditNote.php', 'Stripe\\Customer' => $vendorDir . '/stripe/stripe-php/lib/Customer.php', 'Stripe\\Discount' => $vendorDir . '/stripe/stripe-php/lib/Discount.php', 'Stripe\\Dispute' => $vendorDir . '/stripe/stripe-php/lib/Dispute.php', @@ -150,6 +151,8 @@ 'Stripe\\SubscriptionItem' => $vendorDir . '/stripe/stripe-php/lib/SubscriptionItem.php', 'Stripe\\SubscriptionSchedule' => $vendorDir . '/stripe/stripe-php/lib/SubscriptionSchedule.php', 'Stripe\\SubscriptionScheduleRevision' => $vendorDir . '/stripe/stripe-php/lib/SubscriptionScheduleRevision.php', + 'Stripe\\TaxId' => $vendorDir . '/stripe/stripe-php/lib/TaxId.php', + 'Stripe\\TaxRate' => $vendorDir . '/stripe/stripe-php/lib/TaxRate.php', 'Stripe\\Terminal\\ConnectionToken' => $vendorDir . '/stripe/stripe-php/lib/Terminal/ConnectionToken.php', 'Stripe\\Terminal\\Location' => $vendorDir . '/stripe/stripe-php/lib/Terminal/Location.php', 'Stripe\\Terminal\\Reader' => $vendorDir . '/stripe/stripe-php/lib/Terminal/Reader.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 5fab2d8..06e5217 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -126,6 +126,7 @@ class ComposerStaticInit1a6b0deb482e2dc1bcccd797ab955784 'Stripe\\Collection' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Collection.php', 'Stripe\\CountrySpec' => __DIR__ . '/..' . '/stripe/stripe-php/lib/CountrySpec.php', 'Stripe\\Coupon' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Coupon.php', + 'Stripe\\CreditNote' => __DIR__ . '/..' . '/stripe/stripe-php/lib/CreditNote.php', 'Stripe\\Customer' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Customer.php', 'Stripe\\Discount' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Discount.php', 'Stripe\\Dispute' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Dispute.php', @@ -194,6 +195,8 @@ class ComposerStaticInit1a6b0deb482e2dc1bcccd797ab955784 'Stripe\\SubscriptionItem' => __DIR__ . '/..' . '/stripe/stripe-php/lib/SubscriptionItem.php', 'Stripe\\SubscriptionSchedule' => __DIR__ . '/..' . '/stripe/stripe-php/lib/SubscriptionSchedule.php', 'Stripe\\SubscriptionScheduleRevision' => __DIR__ . '/..' . '/stripe/stripe-php/lib/SubscriptionScheduleRevision.php', + 'Stripe\\TaxId' => __DIR__ . '/..' . '/stripe/stripe-php/lib/TaxId.php', + 'Stripe\\TaxRate' => __DIR__ . '/..' . '/stripe/stripe-php/lib/TaxRate.php', 'Stripe\\Terminal\\ConnectionToken' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Terminal/ConnectionToken.php', 'Stripe\\Terminal\\Location' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Terminal/Location.php', 'Stripe\\Terminal\\Reader' => __DIR__ . '/..' . '/stripe/stripe-php/lib/Terminal/Reader.php', diff --git a/vendor/stripe/stripe-php/init.php b/vendor/stripe/stripe-php/init.php index 0ed7ab4..5ccf332 100644 --- a/vendor/stripe/stripe-php/init.php +++ b/vendor/stripe/stripe-php/init.php @@ -73,6 +73,7 @@ require(dirname(__FILE__) . '/lib/Collection.php'); 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/Discount.php'); require(dirname(__FILE__) . '/lib/Dispute.php'); @@ -118,6 +119,8 @@ require(dirname(__FILE__) . '/lib/SubscriptionItem.php'); require(dirname(__FILE__) . '/lib/SubscriptionSchedule.php'); require(dirname(__FILE__) . '/lib/SubscriptionScheduleRevision.php'); +require(dirname(__FILE__) . '/lib/TaxId.php'); +require(dirname(__FILE__) . '/lib/TaxRate.php'); require(dirname(__FILE__) . '/lib/Terminal/ConnectionToken.php'); require(dirname(__FILE__) . '/lib/Terminal/Location.php'); require(dirname(__FILE__) . '/lib/Terminal/Reader.php'); diff --git a/vendor/stripe/stripe-php/lib/Account.php b/vendor/stripe/stripe-php/lib/Account.php index c643d81..1c10fa2 100644 --- a/vendor/stripe/stripe-php/lib/Account.php +++ b/vendor/stripe/stripe-php/lib/Account.php @@ -42,6 +42,37 @@ class Account extends ApiResource } use ApiOperations\Update; + /** + * Possible string representations of an account's business type. + * @link https://stripe.com/docs/api/accounts/object#account_object-business_type + */ + const BUSINESS_TYPE_COMPANY = 'company'; + const BUSINESS_TYPE_INDIVIDUAL = 'individual'; + + /** + * Possible string representations of an account's capabilities. + * @link https://stripe.com/docs/api/accounts/object#account_object-capabilities + */ + const CAPABILITY_CARD_PAYMENTS = 'card_payments'; + const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments'; + const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments'; + + /** + * Possible string representations of an account's capability status. + * @link https://stripe.com/docs/api/accounts/object#account_object-capabilities + */ + const CAPABILITY_STATUS_ACTIVE = 'active'; + const CAPABILITY_STATUS_INACTIVE = 'inactive'; + const CAPABILITY_STATUS_PENDING = 'pending'; + + /** + * Possible string representations of an account's type. + * @link https://stripe.com/docs/api/accounts/object#account_object-type + */ + const TYPE_CUSTOM = 'custom'; + const TYPE_EXPRESS = 'express'; + const TYPE_STANDARD = 'standard'; + public static function getSavedNestedResources() { static $savedNestedResources = null; @@ -216,7 +247,7 @@ public static function createPerson($id, $params = null, $opts = null) /** * @param string|null $id The ID of the account to which the person belongs. - * @param array|null $personId The ID of the person to retrieve. + * @param string|null $personId The ID of the person to retrieve. * @param array|null $params * @param array|string|null $opts * @@ -229,7 +260,7 @@ public static function retrievePerson($id, $personId, $params = null, $opts = nu /** * @param string|null $id The ID of the account to which the person belongs. - * @param array|null $personId The ID of the person to update. + * @param string|null $personId The ID of the person to update. * @param array|null $params * @param array|string|null $opts * @@ -242,7 +273,7 @@ public static function updatePerson($id, $personId, $params = null, $opts = null /** * @param string|null $id The ID of the account to which the person belongs. - * @param array|null $personId The ID of the person to delete. + * @param string|null $personId The ID of the person to delete. * @param array|null $params * @param array|string|null $opts * diff --git a/vendor/stripe/stripe-php/lib/Coupon.php b/vendor/stripe/stripe-php/lib/Coupon.php index 9d97e3a..51d4fd8 100644 --- a/vendor/stripe/stripe-php/lib/Coupon.php +++ b/vendor/stripe/stripe-php/lib/Coupon.php @@ -16,7 +16,7 @@ * @property int $max_redemptions * @property StripeObject $metadata * @property string $name - * @property int $percent_off + * @property float $percent_off * @property int $redeem_by * @property int $times_redeemed * @property bool $valid diff --git a/vendor/stripe/stripe-php/lib/CreditNote.php b/vendor/stripe/stripe-php/lib/CreditNote.php new file mode 100644 index 0000000..169ed08 --- /dev/null +++ b/vendor/stripe/stripe-php/lib/CreditNote.php @@ -0,0 +1,73 @@ +instanceUrl() . '/void'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + return $this; + } +} diff --git a/vendor/stripe/stripe-php/lib/Customer.php b/vendor/stripe/stripe-php/lib/Customer.php index 83683fe..44f5e6e 100644 --- a/vendor/stripe/stripe-php/lib/Customer.php +++ b/vendor/stripe/stripe-php/lib/Customer.php @@ -8,6 +8,7 @@ * @property string $id * @property string $object * @property int $account_balance + * @property mixed $address * @property string $created * @property string $currency * @property string $default_source @@ -19,11 +20,13 @@ * @property mixed $invoice_settings * @property bool $livemode * @property StripeObject $metadata + * @property string $name + * @property string $phone + * @property string[] preferred_locales * @property mixed $shipping * @property Collection $sources * @property Collection $subscriptions - * @property mixed $tax_info - * @property mixed $tax_info_verification + * @property Collection $tax_ids * * @package Stripe */ @@ -39,6 +42,14 @@ class Customer extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; + /** + * Possible string representations of the customer's type of tax exemption. + * @link https://stripe.com/docs/api/customers/object#customer_object-tax_exempt + */ + const TAX_EXEMPT_NONE = 'none'; + const TAX_EXEMPT_EXEMPT = 'exempt'; + const TAX_EXEMPT_REVERSE = 'reverse'; + public static function getSavedNestedResources() { static $savedNestedResources = null; @@ -51,6 +62,7 @@ public static function getSavedNestedResources() } const PATH_SOURCES = '/sources'; + const PATH_TAX_IDS = '/tax_ids'; /** * @param array|null $params @@ -202,4 +214,54 @@ public static function allSources($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts); } + + /** + * @param string|null $id The ID of the customer on which to create the tax id. + * @param array|null $params + * @param array|string|null $opts + * + * @return ApiResource + */ + public static function createTaxId($id, $params = null, $opts = null) + { + return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer to which the tax id belongs. + * @param string|null $taxIdId The ID of the tax id to retrieve. + * @param array|null $params + * @param array|string|null $opts + * + * @return ApiResource + */ + public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null) + { + return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer to which the tax id belongs. + * @param string|null $taxIdId The ID of the tax id to delete. + * @param array|null $params + * @param array|string|null $opts + * + * @return ApiResource + */ + public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null) + { + return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); + } + + /** + * @param string|null $id The ID of the customer on which to retrieve the tax ids. + * @param array|null $params + * @param array|string|null $opts + * + * @return Collection The list of tax ids. + */ + public static function allTaxIds($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts); + } } diff --git a/vendor/stripe/stripe-php/lib/Event.php b/vendor/stripe/stripe-php/lib/Event.php index 319cc9d..5e199c0 100644 --- a/vendor/stripe/stripe-php/lib/Event.php +++ b/vendor/stripe/stripe-php/lib/Event.php @@ -53,6 +53,9 @@ class Event extends ApiResource const COUPON_CREATED = 'coupon.created'; const COUPON_DELETED = 'coupon.deleted'; const COUPON_UPDATED = 'coupon.updated'; + const CREDIT_NOTE_CREATED = 'credit_note.created'; + const CREDIT_NOTE_UPDATED = 'credit_note.updated'; + const CREDIT_NOTE_VOIDED = 'credit_note.voided'; const CUSTOMER_CREATED = 'customer.created'; const CUSTOMER_DELETED = 'customer.deleted'; const CUSTOMER_UPDATED = 'customer.updated'; @@ -104,6 +107,9 @@ class Event extends ApiResource const PAYOUT_FAILED = 'payout.failed'; const PAYOUT_PAID = 'payout.paid'; const PAYOUT_UPDATED = 'payout.updated'; + const PERSON_CREATED = 'person.created'; + const PERSON_DELETED = 'person.deleted'; + const PERSON_UPDATED = 'person.updated'; const PING = 'ping'; const PLAN_CREATED = 'plan.created'; const PLAN_DELETED = 'plan.deleted'; @@ -137,6 +143,8 @@ class Event extends ApiResource const SUBSCRIPTION_SCHEDULE_EXPIRING = 'subscription_schedule.expiring'; const SUBSCRIPTION_SCHEDULE_RELEASED = 'subscription_schedule.released'; const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated'; + const TAX_RATE_CREATED = 'tax_rate.created'; + const TAX_RATE_UPDATED = 'tax_rate.updated'; const TOPUP_CANCELED = 'topup.canceled'; const TOPUP_CREATED = 'topup.created'; const TOPUP_FAILED = 'topup.failed'; diff --git a/vendor/stripe/stripe-php/lib/File.php b/vendor/stripe/stripe-php/lib/File.php index ae4253d..76109ad 100644 --- a/vendor/stripe/stripe-php/lib/File.php +++ b/vendor/stripe/stripe-php/lib/File.php @@ -50,6 +50,13 @@ public static function create($params = null, $options = null) if (is_null($opts->apiBase)) { $opts->apiBase = Stripe::$apiUploadBase; } - return static::_create($params, $opts); + // Manually flatten params, otherwise curl's multipart encoder will + // choke on nested arrays. + // TODO: use array_column() once we drop support for PHP 5.4 + $flatParams = []; + foreach (\Stripe\Util\Util::flattenParams($params) as $pair) { + $flatParams[$pair[0]] = $pair[1]; + } + return static::_create($flatParams, $opts); } } diff --git a/vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php b/vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php index c9155ca..32a6517 100644 --- a/vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php +++ b/vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php @@ -44,6 +44,8 @@ public static function instance() protected $enablePersistentConnections = null; + protected $enableHttp2 = null; + protected $curlHandle = null; /** @@ -68,6 +70,8 @@ public function __construct($defaultOptions = null, $randomGenerator = null) // TODO: curl_reset requires PHP >= 5.5.0. Once we drop support for PHP 5.4, we can simply // initialize this to true. $this->enablePersistentConnections = function_exists('curl_reset'); + + $this->enableHttp2 = $this->canSafelyUseHttp2(); } public function __destruct() @@ -110,6 +114,22 @@ public function setEnablePersistentConnections($enable) $this->enablePersistentConnections = $enable; } + /** + * @return boolean + */ + public function getEnableHttp2() + { + return $this->enableHttp2; + } + + /** + * @param boolean $enable + */ + public function setEnableHttp2($enable) + { + $this->enableHttp2 = $enable; + } + // USER DEFINED TIMEOUTS const DEFAULT_TIMEOUT = 80; @@ -185,7 +205,7 @@ public function request($method, $absUrl, $headers, $params, $hasFile) // It is only safe to retry network failures on POST requests if we // add an Idempotency-Key header if (($method == 'post') && (Stripe::$maxNetworkRetries > 0)) { - if (!isset($headers['Idempotency-Key'])) { + if (!$this->hasHeader($headers, "Idempotency-Key")) { array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid()); } } @@ -228,7 +248,7 @@ public function request($method, $absUrl, $headers, $params, $hasFile) $opts[CURLOPT_SSL_VERIFYPEER] = false; } - if (!isset($opts[CURLOPT_HTTP_VERSION])) { + if (!isset($opts[CURLOPT_HTTP_VERSION]) && $this->getEnableHttp2()) { // For HTTPS requests, enable HTTP/2, if supported $opts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2TLS; } @@ -406,4 +426,35 @@ private function resetCurlHandle() $this->initCurlHandle(); } } + + /** + * Indicates whether it is safe to use HTTP/2 or not. + * + * @return boolean + */ + private function canSafelyUseHttp2() + { + // Versions of curl older than 7.60.0 don't respect GOAWAY frames + // (cf. https://github.com/curl/curl/issues/2416), which Stripe use. + $curlVersion = curl_version()['version']; + return (version_compare($curlVersion, '7.60.0') >= 0); + } + + /** + * Checks if a list of headers contains a specific header name. + * + * @param string[] $headers + * @param string $name + * @return boolean + */ + private function hasHeader($headers, $name) + { + foreach ($headers as $header) { + if (strncasecmp($header, "{$name}: ", strlen($name) + 2) === 0) { + return true; + } + } + + return false; + } } diff --git a/vendor/stripe/stripe-php/lib/Invoice.php b/vendor/stripe/stripe-php/lib/Invoice.php index 2740959..6e0ec9d 100644 --- a/vendor/stripe/stripe-php/lib/Invoice.php +++ b/vendor/stripe/stripe-php/lib/Invoice.php @@ -7,6 +7,8 @@ * * @property string $id * @property string $object + * @property string $account_country + * @property string $account_name * @property int $amount_due * @property int $amount_paid * @property int $amount_remaining @@ -19,9 +21,17 @@ * @property string $charge * @property int $created * @property string $currency - * @property mixed $custom_fields + * @property array $custom_fields * @property string $customer + * @property mixed $customer_address + * @property string $customer_email + * @property string $customer_name + * @property string $customer_phone + * @property mixed $customer_shipping + * @property array $customer_tax_ids + * @property string $default_payment_method * @property string $default_source + * @property array $default_tax_rates * @property string $description * @property Discount $discount * @property int $due_date @@ -35,8 +45,11 @@ * @property int $next_payment_attempt * @property string $number * @property bool $paid + * @property string $payment_intent * @property int $period_end * @property int $period_start + * @property int $post_payment_credit_notes_amount + * @property int $pre_payment_credit_notes_amount * @property string $receipt_number * @property int $starting_balance * @property string $statement_descriptor @@ -46,9 +59,9 @@ * @property int $subscription_proration_date * @property int $subtotal * @property int $tax - * @property float $tax_percent * @property mixed $threshold_reason * @property int $total + * @property array $total_tax_amounts * @property int $webhooks_delivered_at * * @package Stripe diff --git a/vendor/stripe/stripe-php/lib/InvoiceItem.php b/vendor/stripe/stripe-php/lib/InvoiceItem.php index 1401564..02ca0f2 100644 --- a/vendor/stripe/stripe-php/lib/InvoiceItem.php +++ b/vendor/stripe/stripe-php/lib/InvoiceItem.php @@ -22,6 +22,7 @@ * @property int $quantity * @property string $subscription * @property string $subscription_item + * @property array $tax_rates * @property int $unit_amount * * @package Stripe diff --git a/vendor/stripe/stripe-php/lib/InvoiceLineItem.php b/vendor/stripe/stripe-php/lib/InvoiceLineItem.php index e69c6bb..e8e8c88 100644 --- a/vendor/stripe/stripe-php/lib/InvoiceLineItem.php +++ b/vendor/stripe/stripe-php/lib/InvoiceLineItem.php @@ -20,6 +20,8 @@ * @property int $quantity * @property string $subscription * @property string $subscription_item + * @property array $tax_amounts + * @property array $tax_rates * @property string $type * * @package Stripe diff --git a/vendor/stripe/stripe-php/lib/Person.php b/vendor/stripe/stripe-php/lib/Person.php index 500f491..56241c4 100644 --- a/vendor/stripe/stripe-php/lib/Person.php +++ b/vendor/stripe/stripe-php/lib/Person.php @@ -41,6 +41,21 @@ class Person extends ApiResource use ApiOperations\Delete; use ApiOperations\Update; + /** + * Possible string representations of a person's gender. + * @link https://stripe.com/docs/api/persons/object#person_object-gender + */ + const GENDER_MALE = 'male'; + const GENDER_FEMALE = 'female'; + + /** + * Possible string representations of a person's verification status. + * @link https://stripe.com/docs/api/persons/object#person_object-verification-status + */ + const VERIFICATION_STATUS_PENDING = 'pending'; + const VERIFICATION_STATUS_UNVERIFIED = 'unverified'; + const VERIFICATION_STATUS_VERIFIED = 'verified'; + /** * @return string The API URL for this Stripe account reversal. */ diff --git a/vendor/stripe/stripe-php/lib/Stripe.php b/vendor/stripe/stripe-php/lib/Stripe.php index 6d8cbd3..370dde7 100644 --- a/vendor/stripe/stripe-php/lib/Stripe.php +++ b/vendor/stripe/stripe-php/lib/Stripe.php @@ -55,7 +55,7 @@ class Stripe // @var float Initial delay between retries, in seconds private static $initialNetworkRetryDelay = 0.5; - const VERSION = '6.31.2'; + const VERSION = '6.34.2'; /** * @return string The API key used for requests. diff --git a/vendor/stripe/stripe-php/lib/Subscription.php b/vendor/stripe/stripe-php/lib/Subscription.php index 4357e93..8b57d46 100644 --- a/vendor/stripe/stripe-php/lib/Subscription.php +++ b/vendor/stripe/stripe-php/lib/Subscription.php @@ -18,7 +18,9 @@ * @property int $current_period_start * @property string $customer * @property int $days_until_due + * @property string $default_payment_method * @property string $default_source + * @property array $default_tax_rates * @property Discount $discount * @property int $ended_at * @property Collection $items diff --git a/vendor/stripe/stripe-php/lib/SubscriptionItem.php b/vendor/stripe/stripe-php/lib/SubscriptionItem.php index 22ed8a1..5baa540 100644 --- a/vendor/stripe/stripe-php/lib/SubscriptionItem.php +++ b/vendor/stripe/stripe-php/lib/SubscriptionItem.php @@ -13,6 +13,7 @@ * @property Plan $plan * @property int $quantity * @property string $subscription + * @property array $tax_rates * * @package Stripe */ diff --git a/vendor/stripe/stripe-php/lib/TaxId.php b/vendor/stripe/stripe-php/lib/TaxId.php new file mode 100644 index 0000000..2993e2d --- /dev/null +++ b/vendor/stripe/stripe-php/lib/TaxId.php @@ -0,0 +1,80 @@ + 'Stripe\\Checkout\\Session', \Stripe\CountrySpec::OBJECT_NAME => 'Stripe\\CountrySpec', \Stripe\Coupon::OBJECT_NAME => 'Stripe\\Coupon', + \Stripe\CreditNote::OBJECT_NAME => 'Stripe\\CreditNote', \Stripe\Customer::OBJECT_NAME => 'Stripe\\Customer', \Stripe\Discount::OBJECT_NAME => 'Stripe\\Discount', \Stripe\Dispute::OBJECT_NAME => 'Stripe\\Dispute', @@ -131,6 +132,8 @@ public static function convertToStripeObject($resp, $opts) \Stripe\SubscriptionItem::OBJECT_NAME => 'Stripe\\SubscriptionItem', \Stripe\SubscriptionSchedule::OBJECT_NAME => 'Stripe\\SubscriptionSchedule', \Stripe\SubscriptionScheduleRevision::OBJECT_NAME => 'Stripe\\SubscriptionScheduleRevision', + \Stripe\TaxId::OBJECT_NAME => 'Stripe\\TaxId', + \Stripe\TaxRate::OBJECT_NAME => 'Stripe\\TaxRate', \Stripe\ThreeDSecure::OBJECT_NAME => 'Stripe\\ThreeDSecure', \Stripe\Terminal\ConnectionToken::OBJECT_NAME => 'Stripe\\Terminal\\ConnectionToken', \Stripe\Terminal\Location::OBJECT_NAME => 'Stripe\\Terminal\\Location',