From 25b373ece15ea21f50b0755972b135062cea592f Mon Sep 17 00:00:00 2001 From: AntonLV Date: Wed, 9 Dec 2020 15:52:08 +0300 Subject: [PATCH] Ticket #3040 - Updated Stripe API --- ...alls.yml => .coveralls.github-actions.yml} | 3 +- plugins/stripe/.editorconfig | 20 + plugins/stripe/.gitignore | 14 + plugins/stripe/.php_cs.dist | 38 + plugins/stripe/.travis.yml | 40 - plugins/stripe/CHANGELOG.md | 1217 +++++++++++++--- plugins/stripe/CODE_OF_CONDUCT.md | 77 + plugins/stripe/LICENSE | 2 +- plugins/stripe/Makefile | 36 + plugins/stripe/README.md | 78 +- plugins/stripe/VERSION | 2 +- plugins/stripe/build.php | 31 +- plugins/stripe/composer.json | 22 +- plugins/stripe/data/ca-certificates.crt | 1262 +++++++---------- plugins/stripe/init.php | 319 +++-- plugins/stripe/lib/Account.php | 443 ++++-- plugins/stripe/lib/AccountLink.php | 26 + plugins/stripe/lib/AlipayAccount.php | 51 +- plugins/stripe/lib/ApiOperations/All.php | 17 +- plugins/stripe/lib/ApiOperations/Create.php | 9 +- plugins/stripe/lib/ApiOperations/Delete.php | 9 +- .../lib/ApiOperations/NestedResource.php | 50 +- plugins/stripe/lib/ApiOperations/Request.php | 26 +- plugins/stripe/lib/ApiOperations/Retrieve.php | 11 +- plugins/stripe/lib/ApiOperations/Update.php | 20 +- plugins/stripe/lib/ApiRequestor.php | 336 +++-- plugins/stripe/lib/ApiResource.php | 50 +- plugins/stripe/lib/ApiResponse.php | 29 +- plugins/stripe/lib/ApplePayDomain.php | 13 +- plugins/stripe/lib/ApplicationFee.php | 98 +- plugins/stripe/lib/ApplicationFeeRefund.php | 48 +- plugins/stripe/lib/Balance.php | 37 +- plugins/stripe/lib/BalanceTransaction.php | 82 +- plugins/stripe/lib/BankAccount.php | 119 +- plugins/stripe/lib/BaseStripeClient.php | 269 ++++ plugins/stripe/lib/BillingPortal/Session.php | 32 + plugins/stripe/lib/BitcoinReceiver.php | 52 +- plugins/stripe/lib/BitcoinTransaction.php | 15 +- plugins/stripe/lib/Capability.php | 87 ++ plugins/stripe/lib/Card.php | 141 +- plugins/stripe/lib/Charge.php | 271 ++-- plugins/stripe/lib/Checkout/Session.php | 88 ++ plugins/stripe/lib/Collection.php | 230 ++- plugins/stripe/lib/CountrySpec.php | 27 +- plugins/stripe/lib/Coupon.php | 44 +- plugins/stripe/lib/CreditNote.php | 111 ++ plugins/stripe/lib/CreditNoteLineItem.php | 26 + plugins/stripe/lib/Customer.php | 273 ++-- .../stripe/lib/CustomerBalanceTransaction.php | 103 ++ plugins/stripe/lib/Discount.php | 7 +- plugins/stripe/lib/Dispute.php | 103 +- plugins/stripe/lib/EphemeralKey.php | 36 +- plugins/stripe/lib/Error/Api.php | 7 - plugins/stripe/lib/Error/ApiConnection.php | 7 - plugins/stripe/lib/Error/Authentication.php | 7 - plugins/stripe/lib/Error/Base.php | 69 - plugins/stripe/lib/Error/Card.php | 40 - plugins/stripe/lib/Error/Idempotency.php | 7 - plugins/stripe/lib/Error/InvalidRequest.php | 23 - .../stripe/lib/Error/OAuth/InvalidClient.php | 10 - .../stripe/lib/Error/OAuth/InvalidRequest.php | 11 - .../stripe/lib/Error/OAuth/InvalidScope.php | 10 - plugins/stripe/lib/Error/OAuth/OAuthBase.php | 23 - .../lib/Error/OAuth/UnsupportedGrantType.php | 11 - .../Error/OAuth/UnsupportedResponseType.php | 11 - plugins/stripe/lib/Error/Permission.php | 7 - plugins/stripe/lib/Error/RateLimit.php | 7 - .../lib/Error/SignatureVerification.php | 20 - plugins/stripe/lib/ErrorObject.php | 164 +++ plugins/stripe/lib/Event.php | 318 +++-- .../lib/Exception/ApiConnectionException.php | 12 + .../lib/Exception/ApiErrorException.php | 219 +++ .../lib/Exception/AuthenticationException.php | 11 + .../lib/Exception/BadMethodCallException.php | 7 + .../stripe/lib/Exception/CardException.php | 84 ++ .../lib/Exception/ExceptionInterface.php | 22 + .../lib/Exception/IdempotencyException.php | 11 + .../Exception/InvalidArgumentException.php | 7 + .../lib/Exception/InvalidRequestException.php | 60 + .../Exception/OAuth/ExceptionInterface.php | 10 + .../OAuth/InvalidClientException.php | 12 + .../OAuth/InvalidGrantException.php} | 6 +- .../OAuth/InvalidRequestException.php | 11 + .../Exception/OAuth/InvalidScopeException.php | 10 + .../Exception/OAuth/OAuthErrorException.php | 19 + .../OAuth/UnknownOAuthErrorException.php | 12 + .../OAuth/UnsupportedGrantTypeException.php | 11 + .../UnsupportedResponseTypeException.php | 11 + .../lib/Exception/PermissionException.php | 11 + .../lib/Exception/RateLimitException.php | 12 + .../SignatureVerificationException.php | 74 + .../Exception/UnexpectedValueException.php | 7 + .../Exception/UnknownApiErrorException.php | 12 + plugins/stripe/lib/ExchangeRate.php | 21 +- plugins/stripe/lib/File.php | 81 ++ plugins/stripe/lib/FileLink.php | 30 +- plugins/stripe/lib/FileUpload.php | 37 - .../stripe/lib/HttpClient/ClientInterface.php | 13 +- plugins/stripe/lib/HttpClient/CurlClient.php | 422 ++++-- plugins/stripe/lib/Invoice.php | 270 +++- plugins/stripe/lib/InvoiceItem.php | 54 +- plugins/stripe/lib/InvoiceLineItem.php | 45 +- plugins/stripe/lib/IssuerFraudRecord.php | 25 - plugins/stripe/lib/Issuing/Authorization.php | 84 +- plugins/stripe/lib/Issuing/Card.php | 60 +- plugins/stripe/lib/Issuing/CardDetails.php | 6 +- plugins/stripe/lib/Issuing/Cardholder.php | 37 +- plugins/stripe/lib/Issuing/Dispute.php | 51 +- plugins/stripe/lib/Issuing/Transaction.php | 46 +- plugins/stripe/lib/LineItem.php | 26 + plugins/stripe/lib/LoginLink.php | 15 +- plugins/stripe/lib/Mandate.php | 27 + plugins/stripe/lib/OAuth.php | 44 +- plugins/stripe/lib/OAuthErrorObject.php | 31 + plugins/stripe/lib/Order.php | 89 +- plugins/stripe/lib/OrderItem.php | 7 +- plugins/stripe/lib/OrderReturn.php | 31 +- plugins/stripe/lib/PaymentIntent.php | 129 +- plugins/stripe/lib/PaymentMethod.php | 86 ++ plugins/stripe/lib/Payout.php | 129 +- plugins/stripe/lib/Person.php | 111 ++ plugins/stripe/lib/Plan.php | 63 +- plugins/stripe/lib/Price.php | 62 + plugins/stripe/lib/Product.php | 59 +- plugins/stripe/lib/PromotionCode.php | 33 + .../stripe/lib/Radar/EarlyFraudWarning.php | 37 + plugins/stripe/lib/Radar/ValueList.php | 35 + plugins/stripe/lib/Radar/ValueListItem.php | 31 + plugins/stripe/lib/Recipient.php | 58 +- plugins/stripe/lib/RecipientTransfer.php | 11 +- plugins/stripe/lib/Refund.php | 59 +- plugins/stripe/lib/Reporting/ReportRun.php | 37 + plugins/stripe/lib/Reporting/ReportType.php | 34 + plugins/stripe/lib/RequestTelemetry.php | 26 + plugins/stripe/lib/Review.php | 66 + plugins/stripe/lib/SKU.php | 45 +- .../stripe/lib/Service/AbstractService.php | 79 ++ .../lib/Service/AbstractServiceFactory.php | 59 + .../stripe/lib/Service/AccountLinkService.php | 25 + plugins/stripe/lib/Service/AccountService.php | 381 +++++ .../lib/Service/ApplePayDomainService.php | 70 + .../lib/Service/ApplicationFeeService.php | 125 ++ plugins/stripe/lib/Service/BalanceService.php | 26 + .../lib/Service/BalanceTransactionService.php | 47 + .../BillingPortalServiceFactory.php | 25 + .../Service/BillingPortal/SessionService.php | 23 + plugins/stripe/lib/Service/ChargeService.php | 101 ++ .../Checkout/CheckoutServiceFactory.php | 25 + .../lib/Service/Checkout/SessionService.php | 73 + .../stripe/lib/Service/CoreServiceFactory.php | 125 ++ .../stripe/lib/Service/CountrySpecService.php | 39 + plugins/stripe/lib/Service/CouponService.php | 104 ++ .../stripe/lib/Service/CreditNoteService.php | 156 ++ .../stripe/lib/Service/CustomerService.php | 353 +++++ plugins/stripe/lib/Service/DisputeService.php | 83 ++ .../lib/Service/EphemeralKeyService.php | 43 + plugins/stripe/lib/Service/EventService.php | 44 + .../lib/Service/ExchangeRateService.php | 41 + .../stripe/lib/Service/FileLinkService.php | 70 + plugins/stripe/lib/Service/FileService.php | 66 + .../stripe/lib/Service/InvoiceItemService.php | 93 ++ plugins/stripe/lib/Service/InvoiceService.php | 272 ++++ .../Service/Issuing/AuthorizationService.php | 97 ++ .../lib/Service/Issuing/CardService.php | 73 + .../lib/Service/Issuing/CardholderService.php | 74 + .../lib/Service/Issuing/DisputeService.php | 99 ++ .../Service/Issuing/IssuingServiceFactory.php | 33 + .../Service/Issuing/TransactionService.php | 59 + plugins/stripe/lib/Service/MandateService.php | 24 + plugins/stripe/lib/Service/OAuthService.php | 150 ++ .../stripe/lib/Service/OrderReturnService.php | 42 + plugins/stripe/lib/Service/OrderService.php | 109 ++ .../lib/Service/PaymentIntentService.php | 181 +++ .../lib/Service/PaymentMethodService.php | 121 ++ plugins/stripe/lib/Service/PayoutService.php | 127 ++ plugins/stripe/lib/Service/PlanService.php | 91 ++ plugins/stripe/lib/Service/PriceService.php | 72 + plugins/stripe/lib/Service/ProductService.php | 92 ++ .../lib/Service/PromotionCodeService.php | 72 + .../Radar/EarlyFraudWarningService.php | 43 + .../lib/Service/Radar/RadarServiceFactory.php | 29 + .../Service/Radar/ValueListItemService.php | 74 + .../lib/Service/Radar/ValueListService.php | 93 ++ plugins/stripe/lib/Service/RefundService.php | 76 + .../Service/Reporting/ReportRunService.php | 57 + .../Service/Reporting/ReportTypeService.php | 41 + .../Reporting/ReportingServiceFactory.php | 27 + plugins/stripe/lib/Service/ReviewService.php | 58 + .../lib/Service/SetupAttemptService.php | 23 + .../stripe/lib/Service/SetupIntentService.php | 127 ++ .../Sigma/ScheduledQueryRunService.php | 39 + .../lib/Service/Sigma/SigmaServiceFactory.php | 25 + plugins/stripe/lib/Service/SkuService.php | 95 ++ plugins/stripe/lib/Service/SourceService.php | 110 ++ .../lib/Service/SubscriptionItemService.php | 151 ++ .../Service/SubscriptionScheduleService.php | 113 ++ .../lib/Service/SubscriptionService.php | 124 ++ plugins/stripe/lib/Service/TaxRateService.php | 71 + .../Terminal/ConnectionTokenService.php | 25 + .../lib/Service/Terminal/LocationService.php | 87 ++ .../lib/Service/Terminal/ReaderService.php | 87 ++ .../Terminal/TerminalServiceFactory.php | 29 + plugins/stripe/lib/Service/TokenService.php | 42 + plugins/stripe/lib/Service/TopupService.php | 89 ++ .../stripe/lib/Service/TransferService.php | 175 +++ .../lib/Service/WebhookEndpointService.php | 97 ++ plugins/stripe/lib/SetupAttempt.php | 32 + plugins/stripe/lib/SetupIntent.php | 114 ++ .../stripe/lib/Sigma/ScheduledQueryRun.php | 36 +- plugins/stripe/lib/SingletonApiResource.php | 14 +- plugins/stripe/lib/Source.php | 170 ++- plugins/stripe/lib/SourceTransaction.php | 9 +- plugins/stripe/lib/Stripe.php | 108 +- plugins/stripe/lib/StripeClient.php | 77 + plugins/stripe/lib/StripeClientInterface.php | 56 + plugins/stripe/lib/StripeObject.php | 240 ++-- plugins/stripe/lib/Subscription.php | 115 +- plugins/stripe/lib/SubscriptionItem.php | 80 +- plugins/stripe/lib/SubscriptionSchedule.php | 74 + plugins/stripe/lib/TaxId.php | 106 ++ plugins/stripe/lib/TaxRate.php | 38 + .../stripe/lib/Terminal/ConnectionToken.php | 23 + plugins/stripe/lib/Terminal/Location.php | 30 + plugins/stripe/lib/Terminal/Reader.php | 35 + plugins/stripe/lib/ThreeDSecure.php | 25 +- plugins/stripe/lib/Token.php | 56 +- plugins/stripe/lib/Topup.php | 62 +- plugins/stripe/lib/Transfer.php | 132 +- plugins/stripe/lib/TransferReversal.php | 61 +- plugins/stripe/lib/UsageRecord.php | 47 +- plugins/stripe/lib/UsageRecordSummary.php | 19 + .../stripe/lib/Util/AutoPagingIterator.php | 61 - .../stripe/lib/Util/CaseInsensitiveArray.php | 72 + plugins/stripe/lib/Util/DefaultLogger.php | 17 +- plugins/stripe/lib/Util/LoggerInterface.php | 2 - plugins/stripe/lib/Util/ObjectTypes.php | 99 ++ plugins/stripe/lib/Util/RandomGenerator.php | 8 +- plugins/stripe/lib/Util/RequestOptions.php | 117 +- plugins/stripe/lib/Util/Set.php | 4 +- plugins/stripe/lib/Util/Util.php | 311 ++-- plugins/stripe/lib/Webhook.php | 42 +- plugins/stripe/lib/WebhookEndpoint.php | 41 + plugins/stripe/lib/WebhookSignature.php | 91 +- plugins/stripe/phpdoc.dist.xml | 31 + plugins/stripe/phpstan-baseline.neon | 12 + plugins/stripe/phpstan.neon.dist | 10 + plugins/stripe/phpunit.no_autoload.xml | 15 - plugins/stripe/phpunit.xml | 15 - plugins/stripe/update_certs.php | 26 +- 249 files changed, 15479 insertions(+), 3941 deletions(-) rename plugins/stripe/{.coveralls.yml => .coveralls.github-actions.yml} (63%) create mode 100644 plugins/stripe/.editorconfig create mode 100644 plugins/stripe/.php_cs.dist delete mode 100644 plugins/stripe/.travis.yml create mode 100644 plugins/stripe/CODE_OF_CONDUCT.md create mode 100644 plugins/stripe/Makefile mode change 100755 => 100644 plugins/stripe/build.php create mode 100644 plugins/stripe/lib/AccountLink.php create mode 100644 plugins/stripe/lib/BaseStripeClient.php create mode 100644 plugins/stripe/lib/BillingPortal/Session.php create mode 100644 plugins/stripe/lib/Capability.php create mode 100644 plugins/stripe/lib/Checkout/Session.php create mode 100644 plugins/stripe/lib/CreditNote.php create mode 100644 plugins/stripe/lib/CreditNoteLineItem.php create mode 100644 plugins/stripe/lib/CustomerBalanceTransaction.php delete mode 100644 plugins/stripe/lib/Error/Api.php delete mode 100644 plugins/stripe/lib/Error/ApiConnection.php delete mode 100644 plugins/stripe/lib/Error/Authentication.php delete mode 100644 plugins/stripe/lib/Error/Base.php delete mode 100644 plugins/stripe/lib/Error/Card.php delete mode 100644 plugins/stripe/lib/Error/Idempotency.php delete mode 100644 plugins/stripe/lib/Error/InvalidRequest.php delete mode 100644 plugins/stripe/lib/Error/OAuth/InvalidClient.php delete mode 100644 plugins/stripe/lib/Error/OAuth/InvalidRequest.php delete mode 100644 plugins/stripe/lib/Error/OAuth/InvalidScope.php delete mode 100644 plugins/stripe/lib/Error/OAuth/OAuthBase.php delete mode 100644 plugins/stripe/lib/Error/OAuth/UnsupportedGrantType.php delete mode 100644 plugins/stripe/lib/Error/OAuth/UnsupportedResponseType.php delete mode 100644 plugins/stripe/lib/Error/Permission.php delete mode 100644 plugins/stripe/lib/Error/RateLimit.php delete mode 100644 plugins/stripe/lib/Error/SignatureVerification.php create mode 100644 plugins/stripe/lib/ErrorObject.php create mode 100644 plugins/stripe/lib/Exception/ApiConnectionException.php create mode 100644 plugins/stripe/lib/Exception/ApiErrorException.php create mode 100644 plugins/stripe/lib/Exception/AuthenticationException.php create mode 100644 plugins/stripe/lib/Exception/BadMethodCallException.php create mode 100644 plugins/stripe/lib/Exception/CardException.php create mode 100644 plugins/stripe/lib/Exception/ExceptionInterface.php create mode 100644 plugins/stripe/lib/Exception/IdempotencyException.php create mode 100644 plugins/stripe/lib/Exception/InvalidArgumentException.php create mode 100644 plugins/stripe/lib/Exception/InvalidRequestException.php create mode 100644 plugins/stripe/lib/Exception/OAuth/ExceptionInterface.php create mode 100644 plugins/stripe/lib/Exception/OAuth/InvalidClientException.php rename plugins/stripe/lib/{Error/OAuth/InvalidGrant.php => Exception/OAuth/InvalidGrantException.php} (57%) create mode 100644 plugins/stripe/lib/Exception/OAuth/InvalidRequestException.php create mode 100644 plugins/stripe/lib/Exception/OAuth/InvalidScopeException.php create mode 100644 plugins/stripe/lib/Exception/OAuth/OAuthErrorException.php create mode 100644 plugins/stripe/lib/Exception/OAuth/UnknownOAuthErrorException.php create mode 100644 plugins/stripe/lib/Exception/OAuth/UnsupportedGrantTypeException.php create mode 100644 plugins/stripe/lib/Exception/OAuth/UnsupportedResponseTypeException.php create mode 100644 plugins/stripe/lib/Exception/PermissionException.php create mode 100644 plugins/stripe/lib/Exception/RateLimitException.php create mode 100644 plugins/stripe/lib/Exception/SignatureVerificationException.php create mode 100644 plugins/stripe/lib/Exception/UnexpectedValueException.php create mode 100644 plugins/stripe/lib/Exception/UnknownApiErrorException.php create mode 100644 plugins/stripe/lib/File.php delete mode 100644 plugins/stripe/lib/FileUpload.php delete mode 100644 plugins/stripe/lib/IssuerFraudRecord.php create mode 100644 plugins/stripe/lib/LineItem.php create mode 100644 plugins/stripe/lib/Mandate.php create mode 100644 plugins/stripe/lib/OAuthErrorObject.php create mode 100644 plugins/stripe/lib/PaymentMethod.php create mode 100644 plugins/stripe/lib/Person.php create mode 100644 plugins/stripe/lib/Price.php create mode 100644 plugins/stripe/lib/PromotionCode.php create mode 100644 plugins/stripe/lib/Radar/EarlyFraudWarning.php create mode 100644 plugins/stripe/lib/Radar/ValueList.php create mode 100644 plugins/stripe/lib/Radar/ValueListItem.php create mode 100644 plugins/stripe/lib/Reporting/ReportRun.php create mode 100644 plugins/stripe/lib/Reporting/ReportType.php create mode 100644 plugins/stripe/lib/RequestTelemetry.php create mode 100644 plugins/stripe/lib/Review.php create mode 100644 plugins/stripe/lib/Service/AbstractService.php create mode 100644 plugins/stripe/lib/Service/AbstractServiceFactory.php create mode 100644 plugins/stripe/lib/Service/AccountLinkService.php create mode 100644 plugins/stripe/lib/Service/AccountService.php create mode 100644 plugins/stripe/lib/Service/ApplePayDomainService.php create mode 100644 plugins/stripe/lib/Service/ApplicationFeeService.php create mode 100644 plugins/stripe/lib/Service/BalanceService.php create mode 100644 plugins/stripe/lib/Service/BalanceTransactionService.php create mode 100644 plugins/stripe/lib/Service/BillingPortal/BillingPortalServiceFactory.php create mode 100644 plugins/stripe/lib/Service/BillingPortal/SessionService.php create mode 100644 plugins/stripe/lib/Service/ChargeService.php create mode 100644 plugins/stripe/lib/Service/Checkout/CheckoutServiceFactory.php create mode 100644 plugins/stripe/lib/Service/Checkout/SessionService.php create mode 100644 plugins/stripe/lib/Service/CoreServiceFactory.php create mode 100644 plugins/stripe/lib/Service/CountrySpecService.php create mode 100644 plugins/stripe/lib/Service/CouponService.php create mode 100644 plugins/stripe/lib/Service/CreditNoteService.php create mode 100644 plugins/stripe/lib/Service/CustomerService.php create mode 100644 plugins/stripe/lib/Service/DisputeService.php create mode 100644 plugins/stripe/lib/Service/EphemeralKeyService.php create mode 100644 plugins/stripe/lib/Service/EventService.php create mode 100644 plugins/stripe/lib/Service/ExchangeRateService.php create mode 100644 plugins/stripe/lib/Service/FileLinkService.php create mode 100644 plugins/stripe/lib/Service/FileService.php create mode 100644 plugins/stripe/lib/Service/InvoiceItemService.php create mode 100644 plugins/stripe/lib/Service/InvoiceService.php create mode 100644 plugins/stripe/lib/Service/Issuing/AuthorizationService.php create mode 100644 plugins/stripe/lib/Service/Issuing/CardService.php create mode 100644 plugins/stripe/lib/Service/Issuing/CardholderService.php create mode 100644 plugins/stripe/lib/Service/Issuing/DisputeService.php create mode 100644 plugins/stripe/lib/Service/Issuing/IssuingServiceFactory.php create mode 100644 plugins/stripe/lib/Service/Issuing/TransactionService.php create mode 100644 plugins/stripe/lib/Service/MandateService.php create mode 100644 plugins/stripe/lib/Service/OAuthService.php create mode 100644 plugins/stripe/lib/Service/OrderReturnService.php create mode 100644 plugins/stripe/lib/Service/OrderService.php create mode 100644 plugins/stripe/lib/Service/PaymentIntentService.php create mode 100644 plugins/stripe/lib/Service/PaymentMethodService.php create mode 100644 plugins/stripe/lib/Service/PayoutService.php create mode 100644 plugins/stripe/lib/Service/PlanService.php create mode 100644 plugins/stripe/lib/Service/PriceService.php create mode 100644 plugins/stripe/lib/Service/ProductService.php create mode 100644 plugins/stripe/lib/Service/PromotionCodeService.php create mode 100644 plugins/stripe/lib/Service/Radar/EarlyFraudWarningService.php create mode 100644 plugins/stripe/lib/Service/Radar/RadarServiceFactory.php create mode 100644 plugins/stripe/lib/Service/Radar/ValueListItemService.php create mode 100644 plugins/stripe/lib/Service/Radar/ValueListService.php create mode 100644 plugins/stripe/lib/Service/RefundService.php create mode 100644 plugins/stripe/lib/Service/Reporting/ReportRunService.php create mode 100644 plugins/stripe/lib/Service/Reporting/ReportTypeService.php create mode 100644 plugins/stripe/lib/Service/Reporting/ReportingServiceFactory.php create mode 100644 plugins/stripe/lib/Service/ReviewService.php create mode 100644 plugins/stripe/lib/Service/SetupAttemptService.php create mode 100644 plugins/stripe/lib/Service/SetupIntentService.php create mode 100644 plugins/stripe/lib/Service/Sigma/ScheduledQueryRunService.php create mode 100644 plugins/stripe/lib/Service/Sigma/SigmaServiceFactory.php create mode 100644 plugins/stripe/lib/Service/SkuService.php create mode 100644 plugins/stripe/lib/Service/SourceService.php create mode 100644 plugins/stripe/lib/Service/SubscriptionItemService.php create mode 100644 plugins/stripe/lib/Service/SubscriptionScheduleService.php create mode 100644 plugins/stripe/lib/Service/SubscriptionService.php create mode 100644 plugins/stripe/lib/Service/TaxRateService.php create mode 100644 plugins/stripe/lib/Service/Terminal/ConnectionTokenService.php create mode 100644 plugins/stripe/lib/Service/Terminal/LocationService.php create mode 100644 plugins/stripe/lib/Service/Terminal/ReaderService.php create mode 100644 plugins/stripe/lib/Service/Terminal/TerminalServiceFactory.php create mode 100644 plugins/stripe/lib/Service/TokenService.php create mode 100644 plugins/stripe/lib/Service/TopupService.php create mode 100644 plugins/stripe/lib/Service/TransferService.php create mode 100644 plugins/stripe/lib/Service/WebhookEndpointService.php create mode 100644 plugins/stripe/lib/SetupAttempt.php create mode 100644 plugins/stripe/lib/SetupIntent.php create mode 100644 plugins/stripe/lib/StripeClient.php create mode 100644 plugins/stripe/lib/StripeClientInterface.php create mode 100644 plugins/stripe/lib/SubscriptionSchedule.php create mode 100644 plugins/stripe/lib/TaxId.php create mode 100644 plugins/stripe/lib/TaxRate.php create mode 100644 plugins/stripe/lib/Terminal/ConnectionToken.php create mode 100644 plugins/stripe/lib/Terminal/Location.php create mode 100644 plugins/stripe/lib/Terminal/Reader.php create mode 100644 plugins/stripe/lib/UsageRecordSummary.php delete mode 100644 plugins/stripe/lib/Util/AutoPagingIterator.php create mode 100644 plugins/stripe/lib/Util/CaseInsensitiveArray.php create mode 100644 plugins/stripe/lib/Util/ObjectTypes.php create mode 100644 plugins/stripe/lib/WebhookEndpoint.php create mode 100644 plugins/stripe/phpdoc.dist.xml create mode 100644 plugins/stripe/phpstan-baseline.neon create mode 100644 plugins/stripe/phpstan.neon.dist delete mode 100644 plugins/stripe/phpunit.no_autoload.xml delete mode 100644 plugins/stripe/phpunit.xml mode change 100755 => 100644 plugins/stripe/update_certs.php diff --git a/plugins/stripe/.coveralls.yml b/plugins/stripe/.coveralls.github-actions.yml similarity index 63% rename from plugins/stripe/.coveralls.yml rename to plugins/stripe/.coveralls.github-actions.yml index a343c9a746..40ff9a76b3 100644 --- a/plugins/stripe/.coveralls.yml +++ b/plugins/stripe/.coveralls.github-actions.yml @@ -1,4 +1,3 @@ -service_name: travis-ci -src_dir: . +service_name: github-actions coverage_clover: clover.xml json_path: coveralls-upload.json diff --git a/plugins/stripe/.editorconfig b/plugins/stripe/.editorconfig new file mode 100644 index 0000000000..174e9120bf --- /dev/null +++ b/plugins/stripe/.editorconfig @@ -0,0 +1,20 @@ +; https://editorconfig.org/ + +root = true + +[*] +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true +end_of_line = lf +charset = utf-8 + +[*.{json,yml}] +indent_size = 2 + +[*.neon] +indent_style = tab + +[Makefile] +indent_style = tab diff --git a/plugins/stripe/.gitignore b/plugins/stripe/.gitignore index 17b94183ba..db88f6676d 100644 --- a/plugins/stripe/.gitignore +++ b/plugins/stripe/.gitignore @@ -1,3 +1,6 @@ +# Ignore build files +build/* + # Mac OS X dumps these all over the place. .DS_Store @@ -15,3 +18,14 @@ clover.xml # Ignore IDE's configuration files .idea + +# Ignore PHP CS Fixer local config and cache +.php_cs +.php_cs.cache + +# Ignore PHPStan local config +.phpstan.neon + +# Ignore phpDocumentor's local config and artifacts +.phpdoc/* +phpdoc.xml diff --git a/plugins/stripe/.php_cs.dist b/plugins/stripe/.php_cs.dist new file mode 100644 index 0000000000..83660ffcd1 --- /dev/null +++ b/plugins/stripe/.php_cs.dist @@ -0,0 +1,38 @@ +setRiskyAllowed(true) + ->setRules([ + // Rulesets + '@PSR2' => true, + '@PhpCsFixer' => true, + '@PhpCsFixer:risky' => true, + '@PHP56Migration:risky' => true, + '@PHPUnit57Migration:risky' => true, + + // Additional rules + 'fopen_flags' => true, + 'linebreak_after_opening_tag' => true, + 'native_function_invocation' => true, + + // --- Diffs from @PhpCsFixer / @PhpCsFixer:risky --- + + // This is just prettier / easier to read. + 'concat_space' => ['spacing' => 'one'], + + // This causes strange ordering with codegen'd classes. We might be + // able to enable this if we update codegen to output class elements + // in the correct order. + 'ordered_class_elements' => false, + + // Keep this disabled to avoid unnecessary diffs in PHPDoc comments of + // codegen'd classes. + 'phpdoc_align' => false, + + // This is a "risky" rule that causes a bug in our codebase. + // Specifically, in `StripeObject.updateAttributes` we construct new + // `StripeObject`s for metadata. We can't use `self` there because it + // needs to be a raw `StripeObject`. + 'self_accessor' => false, + ]) +; diff --git a/plugins/stripe/.travis.yml b/plugins/stripe/.travis.yml deleted file mode 100644 index 64df4c112f..0000000000 --- a/plugins/stripe/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -sudo: false - -language: php - -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - hhvm - -env: - global: - - STRIPE_MOCK_VERSION=0.25.0 - matrix: - - AUTOLOAD=1 - - AUTOLOAD=0 - -cache: - directories: - - $HOME/.composer/cache/files - - stripe-mock - -before_install: - # Unpack and start stripe-mock so that the test suite can talk to it - - | - if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then - mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/ - curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" - tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/" - fi - - | - stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock > /dev/null & - STRIPE_MOCK_PID=$! - -script: ./build.php ${AUTOLOAD} - -after_script: ./vendor/bin/coveralls -v diff --git a/plugins/stripe/CHANGELOG.md b/plugins/stripe/CHANGELOG.md index 654f08a82f..935912c7c8 100644 --- a/plugins/stripe/CHANGELOG.md +++ b/plugins/stripe/CHANGELOG.md @@ -1,516 +1,1311 @@ # Changelog +## 7.66.1 - 2020-12-01 +* [#1054](https://github.com/stripe/stripe-php/pull/1054) Improve error message for invalid keys in StripeClient + +## 7.66.0 - 2020-11-24 +* [#1053](https://github.com/stripe/stripe-php/pull/1053) Update PHPDocs + +## 7.65.0 - 2020-11-19 +* [#1050](https://github.com/stripe/stripe-php/pull/1050) Added constants for `proration_behavior` on `Subscription` + +## 7.64.0 - 2020-11-18 +* [#1049](https://github.com/stripe/stripe-php/pull/1049) Update PHPDocs + +## 7.63.0 - 2020-11-17 +* [#1048](https://github.com/stripe/stripe-php/pull/1048) Update PHPDocs +* [#1046](https://github.com/stripe/stripe-php/pull/1046) Force IPv4 resolving + +## 7.62.0 - 2020-11-09 +* [#1041](https://github.com/stripe/stripe-php/pull/1041) Add missing constants on `Event` +* [#1038](https://github.com/stripe/stripe-php/pull/1038) Update PHPDocs + +## 7.61.0 - 2020-10-20 +* [#1030](https://github.com/stripe/stripe-php/pull/1030) Add support for `jp_rn` and `ru_kpp` as a `type` on `TaxId` + +## 7.60.0 - 2020-10-15 +* [#1027](https://github.com/stripe/stripe-php/pull/1027) Warn if opts are in params + +## 7.58.0 - 2020-10-14 +* [#1026](https://github.com/stripe/stripe-php/pull/1026) Add support for the Payout Reverse API + +## 7.57.0 - 2020-09-29 +* [#1020](https://github.com/stripe/stripe-php/pull/1020) Add support for the `SetupAttempt` resource and List API + +## 7.56.0 - 2020-09-25 +* [#1019](https://github.com/stripe/stripe-php/pull/1019) Update PHPDocs + +## 7.55.0 - 2020-09-24 +* [#1018](https://github.com/stripe/stripe-php/pull/1018) Multiple API changes + * Updated PHPDocs + * Added `TYPE_CONTRIBUTION` as a constant on `BalanceTransaction` + +## 7.54.0 - 2020-09-23 +* [#1017](https://github.com/stripe/stripe-php/pull/1017) Updated PHPDoc + +## 7.53.1 - 2020-09-22 +* [#1015](https://github.com/stripe/stripe-php/pull/1015) Bugfix: don't error on systems with php_uname in disablefunctions with whitespace + +## 7.53.0 - 2020-09-21 +* [#1016](https://github.com/stripe/stripe-php/pull/1016) Updated PHPDocs + +## 7.52.0 - 2020-09-08 +* [#1010](https://github.com/stripe/stripe-php/pull/1010) Update PHPDocs + +## 7.51.0 - 2020-09-02 +* [#1007](https://github.com/stripe/stripe-php/pull/1007) Multiple API changes + * Add support for the Issuing Dispute Submit API + * Add constants for `payment_status` on Checkout `Session` +* [#1003](https://github.com/stripe/stripe-php/pull/1003) Add trim to getSignatures to allow for leading whitespace. + +## 7.50.0 - 2020-08-28 +* [#1005](https://github.com/stripe/stripe-php/pull/1005) Updated PHPDocs + +## 7.49.0 - 2020-08-19 +* [#998](https://github.com/stripe/stripe-php/pull/998) PHPDocs updated + +## 7.48.0 - 2020-08-17 +* [#997](https://github.com/stripe/stripe-php/pull/997) PHPDocs updated +* [#996](https://github.com/stripe/stripe-php/pull/996) Fixing telemetry + +## 7.47.0 - 2020-08-13 +* [#994](https://github.com/stripe/stripe-php/pull/994) Nullable balance_transactions on issuing disputes +* [#991](https://github.com/stripe/stripe-php/pull/991) Fix invalid return types in OAuthService + +## 7.46.1 - 2020-08-07 +* [#990](https://github.com/stripe/stripe-php/pull/990) PHPdoc changes + +## 7.46.0 - 2020-08-05 +* [#989](https://github.com/stripe/stripe-php/pull/989) Add support for the `PromotionCode` resource and APIs + +## 7.45.0 - 2020-07-28 +* [#981](https://github.com/stripe/stripe-php/pull/981) PHPdoc updates + +## 7.44.0 - 2020-07-20 +* [#948](https://github.com/stripe/stripe-php/pull/948) Add `first()` and `last()` functions to `Collection` + +## 7.43.0 - 2020-07-17 +* [#975](https://github.com/stripe/stripe-php/pull/975) Add support for `political_exposure` on `Person` + +## 7.42.0 - 2020-07-15 +* [#974](https://github.com/stripe/stripe-php/pull/974) Add new constants for `purpose` on `File` + +## 7.41.1 - 2020-07-15 +* [#973](https://github.com/stripe/stripe-php/pull/973) Multiple PHPDoc fixes + +## 7.41.0 - 2020-07-14 +* [#971](https://github.com/stripe/stripe-php/pull/971) Adds enum values for `billing_address_collection` on Checkout `Session` + +## 7.40.0 - 2020-07-06 +* [#964](https://github.com/stripe/stripe-php/pull/964) Add OAuthService + +## 7.39.0 - 2020-06-25 +* [#960](https://github.com/stripe/stripe-php/pull/960) Add constants for `payment_behavior` on `Subscription` + +## 7.38.0 - 2020-06-24 +* [#959](https://github.com/stripe/stripe-php/pull/959) Add multiple constants missing for `Event` + +## 7.37.2 - 2020-06-23 +* [#957](https://github.com/stripe/stripe-php/pull/957) Updated PHPDocs + +## 7.37.1 - 2020-06-11 +* [#952](https://github.com/stripe/stripe-php/pull/952) Improve PHPDoc + +## 7.37.0 - 2020-06-09 +* [#950](https://github.com/stripe/stripe-php/pull/950) Add support for `id_npwp` and `my_frp` as `type` on `TaxId` + +## 7.36.2 - 2020-06-03 +* [#946](https://github.com/stripe/stripe-php/pull/946) Update PHPDoc + +## 7.36.1 - 2020-05-28 +* [#938](https://github.com/stripe/stripe-php/pull/938) Remove extra array_keys() call. +* [#942](https://github.com/stripe/stripe-php/pull/942) fix autopagination for service methods + +## 7.36.0 - 2020-05-21 +* [#937](https://github.com/stripe/stripe-php/pull/937) Add support for `ae_trn`, `cl_tin` and `sa_vat` as `type` on `TaxId` + +## 7.35.0 - 2020-05-20 +* [#936](https://github.com/stripe/stripe-php/pull/936) Add `anticipation_repayment` as a `type` on `BalanceTransaction` + +## 7.34.0 - 2020-05-18 +* [#934](https://github.com/stripe/stripe-php/pull/934) Add support for `issuing_dispute` as a `type` on `BalanceTransaction` + +## 7.33.1 - 2020-05-15 +* [#933](https://github.com/stripe/stripe-php/pull/933) Services bugfix: convert nested null params to empty strings + +## 7.33.0 - 2020-05-14 +* [#771](https://github.com/stripe/stripe-php/pull/771) Introduce client/services API. The [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0) contains before & after examples of the backwards-compatible changes. + +## 7.32.1 - 2020-05-13 +* [#932](https://github.com/stripe/stripe-php/pull/932) Fix multiple PHPDoc + +## 7.32.0 - 2020-05-11 +* [#931](https://github.com/stripe/stripe-php/pull/931) Add support for the `LineItem` resource and APIs + +## 7.31.0 - 2020-05-01 +* [#927](https://github.com/stripe/stripe-php/pull/927) Add support for new tax IDs + +## 7.30.0 - 2020-04-29 +* [#924](https://github.com/stripe/stripe-php/pull/924) Add support for the `Price` resource and APIs + +## 7.29.0 - 2020-04-22 +* [#920](https://github.com/stripe/stripe-php/pull/920) Add support for the `Session` resource and APIs on the `BillingPortal` namespace + +## 7.28.1 - 2020-04-10 +* [#915](https://github.com/stripe/stripe-php/pull/915) Improve PHPdocs for many classes + +## 7.28.0 - 2020-04-03 +* [#912](https://github.com/stripe/stripe-php/pull/912) Preserve backwards compatibility for typoed `TYPE_ADJUSTEMENT` enum. +* [#911](https://github.com/stripe/stripe-php/pull/911) Codegenerated PHPDoc for nested resources +* [#902](https://github.com/stripe/stripe-php/pull/902) Update docstrings for nested resources + +## 7.27.3 - 2020-03-18 +* [#899](https://github.com/stripe/stripe-php/pull/899) Convert keys to strings in `StripeObject::toArray()` + +## 7.27.2 - 2020-03-13 +* [#894](https://github.com/stripe/stripe-php/pull/894) Multiple PHPDocs changes + +## 7.27.1 - 2020-03-03 +* [#890](https://github.com/stripe/stripe-php/pull/890) Update PHPdoc + +## 7.27.0 - 2020-02-28 +* [#889](https://github.com/stripe/stripe-php/pull/889) Add new constants for `type` on `TaxId` + +## 7.26.0 - 2020-02-26 +* [#886](https://github.com/stripe/stripe-php/pull/886) Add support for listing Checkout `Session` +* [#883](https://github.com/stripe/stripe-php/pull/883) Add PHPDoc class descriptions + +## 7.25.0 - 2020-02-14 +* [#879](https://github.com/stripe/stripe-php/pull/879) Make `\Stripe\Collection` implement `\Countable` +* [#875](https://github.com/stripe/stripe-php/pull/875) Last set of PHP-CS-Fixer updates +* [#874](https://github.com/stripe/stripe-php/pull/874) Enable php_unit_internal_class rule +* [#873](https://github.com/stripe/stripe-php/pull/873) Add support for phpDocumentor in Makefile +* [#872](https://github.com/stripe/stripe-php/pull/872) Another batch of PHP-CS-Fixer rule updates +* [#871](https://github.com/stripe/stripe-php/pull/871) Fix a few PHPDoc comments +* [#870](https://github.com/stripe/stripe-php/pull/870) More PHP-CS-Fixer tweaks + +## 7.24.0 - 2020-02-10 +* [#862](https://github.com/stripe/stripe-php/pull/862) Better PHPDoc +* [#865](https://github.com/stripe/stripe-php/pull/865) Get closer to `@PhpCsFixer` standard ruleset + +## 7.23.0 - 2020-02-05 +* [#860](https://github.com/stripe/stripe-php/pull/860) Add PHPDoc types for expandable fields +* [#858](https://github.com/stripe/stripe-php/pull/858) Use `native_function_invocation` PHPStan rule +* [#857](https://github.com/stripe/stripe-php/pull/857) Update PHPDoc on nested resources +* [#855](https://github.com/stripe/stripe-php/pull/855) PHPDoc: `StripeObject` -> `ErrorObject` where appropriate +* [#837](https://github.com/stripe/stripe-php/pull/837) Autogen diff +* [#854](https://github.com/stripe/stripe-php/pull/854) Upgrade PHPStan and fix settings +* [#850](https://github.com/stripe/stripe-php/pull/850) Yet more PHPDoc updates + +## 7.22.0 - 2020-01-31 +* [#849](https://github.com/stripe/stripe-php/pull/849) Add new constants for `type` on `TaxId` +* [#843](https://github.com/stripe/stripe-php/pull/843) Even more PHPDoc fixes +* [#841](https://github.com/stripe/stripe-php/pull/841) More PHPDoc fixes + +## 7.21.1 - 2020-01-29 +* [#840](https://github.com/stripe/stripe-php/pull/840) Update phpdocs across multiple resources. + +## 7.21.0 - 2020-01-28 +* [#839](https://github.com/stripe/stripe-php/pull/839) Add support for `TYPE_ES_CIF` on `TaxId` + +## 7.20.0 - 2020-01-23 +* [#836](https://github.com/stripe/stripe-php/pull/836) Add new type values for `TaxId` + +## 7.19.1 - 2020-01-14 +* [#831](https://github.com/stripe/stripe-php/pull/831) Fix incorrect `UnexpectedValueException` instantiation + +## 7.19.0 - 2020-01-14 +* [#830](https://github.com/stripe/stripe-php/pull/830) Add support for `CreditNoteLineItem` + +## 7.18.0 - 2020-01-13 +* [#829](https://github.com/stripe/stripe-php/pull/829) Don't call php_uname function if disabled by php.ini + +## 7.17.0 - 2020-01-08 +* [#821](https://github.com/stripe/stripe-php/pull/821) Improve PHPDoc types for `ApiErrorException.get/setJsonBody()` methods + +## 7.16.0 - 2020-01-06 +* [#826](https://github.com/stripe/stripe-php/pull/826) Rename remaining `$options` to `$opts` +* [#825](https://github.com/stripe/stripe-php/pull/825) Update PHPDoc + +## 7.15.0 - 2020-01-06 +* [#824](https://github.com/stripe/stripe-php/pull/824) Add constant `TYPE_SG_UEN` to `TaxId` + +## 7.14.2 - 2019-12-04 +* [#816](https://github.com/stripe/stripe-php/pull/816) Disable autoloader when checking for `Throwable` + +## 7.14.1 - 2019-11-26 +* [#812](https://github.com/stripe/stripe-php/pull/812) Fix invalid PHPdoc on `Subscription` + +## 7.14.0 - 2019-11-26 +* [#811](https://github.com/stripe/stripe-php/pull/811) Add support for `CreditNote` preview. + +## 7.13.0 - 2019-11-19 +* [#808](https://github.com/stripe/stripe-php/pull/808) Add support for listing lines on an Invoice directly via `Invoice::allLines()` + +## 7.12.0 - 2019-11-08 + +- [#805](https://github.com/stripe/stripe-php/pull/805) Add Source::allSourceTransactions and SubscriptionItem::allUsageRecordSummaries +- [#798](https://github.com/stripe/stripe-php/pull/798) The argument of `array_key_exists` cannot be `null` +- [#803](https://github.com/stripe/stripe-php/pull/803) Removed unwanted got + +## 7.11.0 - 2019-11-06 + +- [#797](https://github.com/stripe/stripe-php/pull/797) Add support for reverse pagination + +## 7.10.0 - 2019-11-05 + +- [#795](https://github.com/stripe/stripe-php/pull/795) Add support for `Mandate` + +## 7.9.0 - 2019-11-05 + +- [#794](https://github.com/stripe/stripe-php/pull/794) Add PHPDoc to `ApiResponse` +- [#792](https://github.com/stripe/stripe-php/pull/792) Use single quotes for `OBJECT_NAME` constants + +## 7.8.0 - 2019-11-05 + +- [#790](https://github.com/stripe/stripe-php/pull/790) Mark nullable fields in PHPDoc +- [#788](https://github.com/stripe/stripe-php/pull/788) Early codegen fixes +- [#787](https://github.com/stripe/stripe-php/pull/787) Use PHPStan in Travis CI + +## 7.7.1 - 2019-10-25 + +- [#781](https://github.com/stripe/stripe-php/pull/781) Fix telemetry header +- [#780](https://github.com/stripe/stripe-php/pull/780) Contributor Convenant + +## 7.7.0 - 2019-10-23 + +- [#776](https://github.com/stripe/stripe-php/pull/776) Add `CAPABILITY_TRANSFERS` to `Account` +- [#778](https://github.com/stripe/stripe-php/pull/778) Add support for `TYPE_MX_RFC` type on `TaxId` + +## 7.6.0 - 2019-10-22 + +- [#770](https://github.com/stripe/stripe-php/pull/770) Add missing constants for Customer's `TaxId` + +## 7.5.0 - 2019-10-18 + +- [#768](https://github.com/stripe/stripe-php/pull/768) Redact API key in `RequestOptions` debug info + +## 7.4.0 - 2019-10-15 + +- [#764](https://github.com/stripe/stripe-php/pull/764) Add support for HTTP request monitoring callback + +## 7.3.1 - 2019-10-07 + +- [#755](https://github.com/stripe/stripe-php/pull/755) Respect Stripe-Should-Retry and Retry-After headers + +## 7.3.0 - 2019-10-02 + +- [#752](https://github.com/stripe/stripe-php/pull/752) Add `payment_intent.canceled` and `setup_intent.canceled` events +- [#749](https://github.com/stripe/stripe-php/pull/749) Call `toArray()` on objects only + +## 7.2.2 - 2019-09-24 + +- [#746](https://github.com/stripe/stripe-php/pull/746) Add missing decline codes + +## 7.2.1 - 2019-09-23 + +- [#744](https://github.com/stripe/stripe-php/pull/744) Added new PHPDoc + +## 7.2.0 - 2019-09-17 + +- [#738](https://github.com/stripe/stripe-php/pull/738) Added missing constants for `SetupIntent` events + +## 7.1.1 - 2019-09-16 + +- [#737](https://github.com/stripe/stripe-php/pull/737) Added new PHPDoc + +## 7.1.0 - 2019-09-13 + +- [#736](https://github.com/stripe/stripe-php/pull/736) Make `CaseInsensitiveArray` countable and traversable + +## 7.0.2 - 2019-09-06 + +- [#729](https://github.com/stripe/stripe-php/pull/729) Fix usage of `SignatureVerificationException` in PHPDoc blocks + +## 7.0.1 - 2019-09-05 + +- [#728](https://github.com/stripe/stripe-php/pull/728) Clean up Collection + +## 7.0.0 - 2019-09-03 + +Major version release. The [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-guide-for-v7) contains a detailed list of backwards-incompatible changes with upgrade instructions. + +Pull requests included in this release (cf. [#552](https://github.com/stripe/stripe-php/pull/552)) (⚠️ = breaking changes): + +- ⚠️ Drop support for PHP 5.4 ([#551](https://github.com/stripe/stripe-php/pull/551)) +- ⚠️ Drop support for PHP 5.5 ([#554](https://github.com/stripe/stripe-php/pull/554)) +- Bump dependencies ([#553](https://github.com/stripe/stripe-php/pull/553)) +- Remove `CURLFile` check ([#555](https://github.com/stripe/stripe-php/pull/555)) +- Update constant definitions for PHP >= 5.6 ([#556](https://github.com/stripe/stripe-php/pull/556)) +- ⚠️ Remove `FileUpload` alias ([#557](https://github.com/stripe/stripe-php/pull/557)) +- Remove `curl_reset` check ([#570](https://github.com/stripe/stripe-php/pull/570)) +- Use `\Stripe\::class` constant instead of strings ([#643](https://github.com/stripe/stripe-php/pull/643)) +- Use `array_column` to flatten params ([#686](https://github.com/stripe/stripe-php/pull/686)) +- ⚠️ Remove deprecated methods ([#692](https://github.com/stripe/stripe-php/pull/692)) +- ⚠️ Remove `IssuerFraudRecord` ([#696](https://github.com/stripe/stripe-php/pull/696)) +- Update constructors of Stripe exception classes ([#559](https://github.com/stripe/stripe-php/pull/559)) +- Fix remaining TODOs ([#700](https://github.com/stripe/stripe-php/pull/700)) +- Use yield for autopagination ([#703](https://github.com/stripe/stripe-php/pull/703)) +- ⚠️ Rename fake magic methods and rewrite array conversion ([#704](https://github.com/stripe/stripe-php/pull/704)) +- Add `ErrorObject` to Stripe exceptions ([#705](https://github.com/stripe/stripe-php/pull/705)) +- Start using PHP CS Fixer ([#706](https://github.com/stripe/stripe-php/pull/706)) +- Update error messages for nested resource operations ([#708](https://github.com/stripe/stripe-php/pull/708)) +- Upgrade retry logic ([#707](https://github.com/stripe/stripe-php/pull/707)) +- ⚠️ `Collection` improvements / fixes ([#715](https://github.com/stripe/stripe-php/pull/715)) +- ⚠️ Modernize exceptions ([#709](https://github.com/stripe/stripe-php/pull/709)) +- Add constants for error codes ([#716](https://github.com/stripe/stripe-php/pull/716)) +- Update certificate bundle ([#717](https://github.com/stripe/stripe-php/pull/717)) +- Retry requests on a 429 that's a lock timeout ([#718](https://github.com/stripe/stripe-php/pull/718)) +- Fix `toArray()` calls ([#719](https://github.com/stripe/stripe-php/pull/719)) +- Couple of fixes for PHP 7.4 ([#725](https://github.com/stripe/stripe-php/pull/725)) + +## 6.43.1 - 2019-08-29 + +- [#722](https://github.com/stripe/stripe-php/pull/722) Make `LoggerInterface::error` compatible with its PSR-3 counterpart +- [#714](https://github.com/stripe/stripe-php/pull/714) Add `pending_setup_intent` property in `Subscription` +- [#713](https://github.com/stripe/stripe-php/pull/713) Add typehint to `ApiResponse` +- [#712](https://github.com/stripe/stripe-php/pull/712) Fix comment +- [#701](https://github.com/stripe/stripe-php/pull/701) Start testing PHP 7.3 + +## 6.43.0 - 2019-08-09 + +- [#694](https://github.com/stripe/stripe-php/pull/694) Add `SubscriptionItem::createUsageRecord` method + +## 6.42.0 - 2019-08-09 + +- [#688](https://github.com/stripe/stripe-php/pull/688) Remove `SubscriptionScheduleRevision` + - Note that this is technically a breaking change, however we've chosen to release it as a minor version in light of the fact that this resource and its API methods were virtually unused. + +## 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 + +## 6.34.6 - 2019-05-13 + +- [#654](https://github.com/stripe/stripe-php/pull/654) Fix typo in definition of `Event::PAYMENT_METHOD_ATTACHED` constant + +## 6.34.5 - 2019-05-06 + +- [#647](https://github.com/stripe/stripe-php/pull/647) Set the return type to static for more operations + +## 6.34.4 - 2019-05-06 + +- [#650](https://github.com/stripe/stripe-php/pull/650) Add missing constants for Event types + +## 6.34.3 - 2019-05-01 + +- [#644](https://github.com/stripe/stripe-php/pull/644) Update return type to `static` to improve static analysis +- [#645](https://github.com/stripe/stripe-php/pull/645) Fix constant for `payment_intent.payment_failed` + +## 6.34.2 - 2019-04-26 + +- [#642](https://github.com/stripe/stripe-php/pull/642) Fix an issue where existing idempotency keys would be overwritten when using automatic retries + +## 6.34.1 - 2019-04-25 + +- [#640](https://github.com/stripe/stripe-php/pull/640) Add missing phpdocs + +## 6.34.0 - 2019-04-24 + +- [#626](https://github.com/stripe/stripe-php/pull/626) Add support for the `TaxRate` resource and APIs +- [#639](https://github.com/stripe/stripe-php/pull/639) Fix multiple phpdoc issues + +## 6.33.0 - 2019-04-22 + +- [#630](https://github.com/stripe/stripe-php/pull/630) Add support for the `TaxId` resource and APIs + +## 6.32.1 - 2019-04-19 + +- [#636](https://github.com/stripe/stripe-php/pull/636) Correct type of `$personId` in PHPDoc + +## 6.32.0 - 2019-04-18 + +- [#621](https://github.com/stripe/stripe-php/pull/621) Add support for `CreditNote` + +## 6.31.5 - 2019-04-12 + +- [#628](https://github.com/stripe/stripe-php/pull/628) Add constants for `person.*` event types +- [#628](https://github.com/stripe/stripe-php/pull/628) Add missing constants for `Account` and `Person` + +## 6.31.4 - 2019-04-05 + +- [#624](https://github.com/stripe/stripe-php/pull/624) Fix encoding of nested parameters in multipart requests + +## 6.31.3 - 2019-04-02 + +- [#623](https://github.com/stripe/stripe-php/pull/623) Only use HTTP/2 with curl >= 7.60.0 + +## 6.31.2 - 2019-03-25 + +- [#619](https://github.com/stripe/stripe-php/pull/619) Fix PHPDoc return types for list methods for nested resources + +## 6.31.1 - 2019-03-22 + +- [#612](https://github.com/stripe/stripe-php/pull/612) Add a lot of constants +- [#614](https://github.com/stripe/stripe-php/pull/614) Add missing subscription status constants + +## 6.31.0 - 2019-03-18 + +- [#600](https://github.com/stripe/stripe-php/pull/600) Add support for the `PaymentMethod` resource and APIs +- [#606](https://github.com/stripe/stripe-php/pull/606) Add support for retrieving a Checkout `Session` +- [#611](https://github.com/stripe/stripe-php/pull/611) Add support for deleting a Terminal `Location` and `Reader` + +## 6.30.5 - 2019-03-11 + +- [#607](https://github.com/stripe/stripe-php/pull/607) Correctly handle case where a metadata key is called `metadata` + +## 6.30.4 - 2019-02-27 + +- [#602](https://github.com/stripe/stripe-php/pull/602) Add `subscription_schedule` to `Subscription` for PHPDoc. + +## 6.30.3 - 2019-02-26 + +- [#603](https://github.com/stripe/stripe-php/pull/603) Improve PHPDoc on the `Source` object to cover all types of Sources currently supported. + +## 6.30.2 - 2019-02-25 + +- [#601](https://github.com/stripe/stripe-php/pull/601) Fix PHPDoc across multiple resources and add support for new events. + +## 6.30.1 - 2019-02-16 + +- [#599](https://github.com/stripe/stripe-php/pull/599) Fix PHPDoc for `SubscriptionSchedule` and `SubscriptionScheduleRevision` + +## 6.30.0 - 2019-02-12 + +- [#590](https://github.com/stripe/stripe-php/pull/590) Add support for `SubscriptionSchedule` and `SubscriptionScheduleRevision` + +## 6.29.3 - 2019-01-31 + +- [#592](https://github.com/stripe/stripe-php/pull/592) Some more PHPDoc fixes + +## 6.29.2 - 2019-01-31 + +- [#591](https://github.com/stripe/stripe-php/pull/591) Fix PHPDoc for nested resources + +## 6.29.1 - 2019-01-25 + +- [#566](https://github.com/stripe/stripe-php/pull/566) Fix dangling message contents +- [#586](https://github.com/stripe/stripe-php/pull/586) Don't overwrite `CURLOPT_HTTP_VERSION` option + +## 6.29.0 - 2019-01-23 + +- [#579](https://github.com/stripe/stripe-php/pull/579) Rename `CheckoutSession` to `Session` and move it under the `Checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach. + +## 6.28.1 - 2019-01-21 + +- [#580](https://github.com/stripe/stripe-php/pull/580) Properly serialize `individual` on `Account` objects + +## 6.28.0 - 2019-01-03 + +- [#576](https://github.com/stripe/stripe-php/pull/576) Add support for iterating directly over `Collection` instances + +## 6.27.0 - 2018-12-21 + +- [#571](https://github.com/stripe/stripe-php/pull/571) Add support for the `CheckoutSession` resource + +## 6.26.0 - 2018-12-11 + +- [#568](https://github.com/stripe/stripe-php/pull/568) Enable persistent connections + +## 6.25.0 - 2018-12-10 + +- [#567](https://github.com/stripe/stripe-php/pull/567) Add support for account links + +## 6.24.0 - 2018-11-28 + +- [#562](https://github.com/stripe/stripe-php/pull/562) Add support for the Review resource +- [#564](https://github.com/stripe/stripe-php/pull/564) Add event name constants for subscription schedule aborted/expiring + +## 6.23.0 - 2018-11-27 + +- [#542](https://github.com/stripe/stripe-php/pull/542) Add support for `ValueList` and `ValueListItem` for Radar + +## 6.22.1 - 2018-11-20 + +- [#561](https://github.com/stripe/stripe-php/pull/561) Add cast and some docs to telemetry introduced in 6.22.0/549 + +## 6.22.0 - 2018-11-15 + +- [#549](https://github.com/stripe/stripe-php/pull/549) Add support for client telemetry + +## 6.21.1 - 2018-11-12 + +- [#548](https://github.com/stripe/stripe-php/pull/548) Don't mutate `Exception` class properties from `OAuthBase` error + +## 6.21.0 - 2018-11-08 + +- [#537](https://github.com/stripe/stripe-php/pull/537) Add new API endpoints for the `Invoice` resource. + +## 6.20.1 - 2018-11-07 + +- [#546](https://github.com/stripe/stripe-php/pull/546) Drop files from the Composer package that aren't needed in the release + +## 6.20.0 - 2018-10-30 + +- [#536](https://github.com/stripe/stripe-php/pull/536) Add support for the `Person` resource +- [#541](https://github.com/stripe/stripe-php/pull/541) Add support for the `WebhookEndpoint` resource + +## 6.19.5 - 2018-10-17 + +- [#539](https://github.com/stripe/stripe-php/pull/539) Fix methods on `\Stripe\PaymentIntent` to properly pass arguments to the API. + +## 6.19.4 - 2018-10-11 + +- [#534](https://github.com/stripe/stripe-php/pull/534) Fix PSR-4 autoloading for `\Stripe\FileUpload` class alias + +## 6.19.3 - 2018-10-09 + +- [#530](https://github.com/stripe/stripe-php/pull/530) Add constants for `flow` (`FLOW_*`), `status` (`STATUS_*`) and `usage` (`USAGE_*`) on `\Stripe\Source` + +## 6.19.2 - 2018-10-08 + +- [#531](https://github.com/stripe/stripe-php/pull/531) Store HTTP response headers in case-insensitive array + +## 6.19.1 - 2018-09-25 + +- [#526](https://github.com/stripe/stripe-php/pull/526) Ignore null values in request parameters + +## 6.19.0 - 2018-09-24 + +- [#523](https://github.com/stripe/stripe-php/pull/523) Add support for Stripe Terminal + +## 6.18.0 - 2018-09-24 + +- [#520](https://github.com/stripe/stripe-php/pull/520) Rename `\Stripe\FileUpload` to `\Stripe\File` + +## 6.17.2 - 2018-09-18 + +- [#522](https://github.com/stripe/stripe-php/pull/522) Fix warning when adding a new additional owner to an existing array + +## 6.17.1 - 2018-09-14 + +- [#517](https://github.com/stripe/stripe-php/pull/517) Integer-index encode all sequential arrays + +## 6.17.0 - 2018-09-05 + +- [#514](https://github.com/stripe/stripe-php/pull/514) Add support for reporting resources + +## 6.16.0 - 2018-08-23 + +- [#509](https://github.com/stripe/stripe-php/pull/509) Add support for usage record summaries + ## 6.15.0 - 2018-08-03 -* [#504](https://github.com/stripe/stripe-php/pull/504) Add cancel support for topups + +- [#504](https://github.com/stripe/stripe-php/pull/504) Add cancel support for topups ## 6.14.0 - 2018-08-02 -* [#505](https://github.com/stripe/stripe-php/pull/505) Add support for file links + +- [#505](https://github.com/stripe/stripe-php/pull/505) Add support for file links ## 6.13.0 - 2018-07-31 -* [#502](https://github.com/stripe/stripe-php/pull/502) Add `isDeleted()` method to `\Stripe\StripeObject` + +- [#502](https://github.com/stripe/stripe-php/pull/502) Add `isDeleted()` method to `\Stripe\StripeObject` ## 6.12.0 - 2018-07-28 -* [#501](https://github.com/stripe/stripe-php/pull/501) Add support for scheduled query runs (`\Stripe\Sigma\ScheduledQueryRun`) for Sigma + +- [#501](https://github.com/stripe/stripe-php/pull/501) Add support for scheduled query runs (`\Stripe\Sigma\ScheduledQueryRun`) for Sigma ## 6.11.0 - 2018-07-26 -* [#500](https://github.com/stripe/stripe-php/pull/500) Add support for Stripe Issuing + +- [#500](https://github.com/stripe/stripe-php/pull/500) Add support for Stripe Issuing ## 6.10.4 - 2018-07-19 -* [#498](https://github.com/stripe/stripe-php/pull/498) Internal improvements to the `\Stripe\ApiResource.classUrl()` method + +- [#498](https://github.com/stripe/stripe-php/pull/498) Internal improvements to the `\Stripe\ApiResource.classUrl()` method ## 6.10.3 - 2018-07-16 -* [#497](https://github.com/stripe/stripe-php/pull/497) Use HTTP/2 only for HTTPS requests + +- [#497](https://github.com/stripe/stripe-php/pull/497) Use HTTP/2 only for HTTPS requests ## 6.10.2 - 2018-07-11 -* [#494](https://github.com/stripe/stripe-php/pull/494) Enable HTTP/2 support + +- [#494](https://github.com/stripe/stripe-php/pull/494) Enable HTTP/2 support ## 6.10.1 - 2018-07-10 -* [#493](https://github.com/stripe/stripe-php/pull/493) Add PHPDoc for `auto_advance` on `\Stripe\Invoice` + +- [#493](https://github.com/stripe/stripe-php/pull/493) Add PHPDoc for `auto_advance` on `\Stripe\Invoice` ## 6.10.0 - 2018-06-28 -* [#488](https://github.com/stripe/stripe-php/pull/488) Add support for `$appPartnerId` to `Stripe::setAppInfo()` + +- [#488](https://github.com/stripe/stripe-php/pull/488) Add support for `$appPartnerId` to `Stripe::setAppInfo()` ## 6.9.0 - 2018-06-28 -* [#487](https://github.com/stripe/stripe-php/pull/487) Add support for payment intents + +- [#487](https://github.com/stripe/stripe-php/pull/487) Add support for payment intents ## 6.8.2 - 2018-06-24 -* [#486](https://github.com/stripe/stripe-php/pull/486) Make `Account.deauthorize()` return the `StripeObject` from the API + +- [#486](https://github.com/stripe/stripe-php/pull/486) Make `Account.deauthorize()` return the `StripeObject` from the API ## 6.8.1 - 2018-06-13 -* [#472](https://github.com/stripe/stripe-php/pull/472) Added phpDoc for `ApiRequestor` and others, especially regarding thrown errors + +- [#472](https://github.com/stripe/stripe-php/pull/472) Added phpDoc for `ApiRequestor` and others, especially regarding thrown errors ## 6.8.0 - 2018-06-13 -* [#481](https://github.com/stripe/stripe-php/pull/481) Add new `\Stripe\Discount` and `\Stripe\OrderItem` classes, add more PHPDoc describing object attributes + +- [#481](https://github.com/stripe/stripe-php/pull/481) Add new `\Stripe\Discount` and `\Stripe\OrderItem` classes, add more PHPDoc describing object attributes ## 6.7.4 - 2018-05-29 -* [#480](https://github.com/stripe/stripe-php/pull/480) PHPDoc changes for API version 2018-05-21 and the addition of the new `CHARGE_EXPIRED` event type + +- [#480](https://github.com/stripe/stripe-php/pull/480) PHPDoc changes for API version 2018-05-21 and the addition of the new `CHARGE_EXPIRED` event type ## 6.7.3 - 2018-05-28 -* [#479](https://github.com/stripe/stripe-php/pull/479) Fix unnecessary traits on `\Stripe\InvoiceLineItem` + +- [#479](https://github.com/stripe/stripe-php/pull/479) Fix unnecessary traits on `\Stripe\InvoiceLineItem` ## 6.7.2 - 2018-05-28 -* [#471](https://github.com/stripe/stripe-php/pull/471) Add `OBJECT_NAME` constant to all API resource classes, add `\Stripe\InvoiceLineItem` class + +- [#471](https://github.com/stripe/stripe-php/pull/471) Add `OBJECT_NAME` constant to all API resource classes, add `\Stripe\InvoiceLineItem` class ## 6.7.1 - 2018-05-13 -* [#468](https://github.com/stripe/stripe-php/pull/468) Update fields in PHP docs for accuracy + +- [#468](https://github.com/stripe/stripe-php/pull/468) Update fields in PHP docs for accuracy ## 6.7.0 - 2018-05-09 -* [#466](https://github.com/stripe/stripe-php/pull/466) Add support for issuer fraud records + +- [#466](https://github.com/stripe/stripe-php/pull/466) Add support for issuer fraud records ## 6.6.0 - 2018-04-11 -* [#460](https://github.com/stripe/stripe-php/pull/460) Add support for flexible billing primitives + +- [#460](https://github.com/stripe/stripe-php/pull/460) Add support for flexible billing primitives ## 6.5.0 - 2018-04-05 -* [#461](https://github.com/stripe/stripe-php/pull/461) Don't zero keys on non-`metadata` subobjects + +- [#461](https://github.com/stripe/stripe-php/pull/461) Don't zero keys on non-`metadata` subobjects ## 6.4.2 - 2018-03-17 -* [#458](https://github.com/stripe/stripe-php/pull/458) Add PHPDoc for `account` on `\Stripe\Event` + +- [#458](https://github.com/stripe/stripe-php/pull/458) Add PHPDoc for `account` on `\Stripe\Event` ## 6.4.1 - 2018-03-02 -* [#455](https://github.com/stripe/stripe-php/pull/455) Fix namespaces in PHPDoc -* [#456](https://github.com/stripe/stripe-php/pull/456) Fix namespaces for some exceptions + +- [#455](https://github.com/stripe/stripe-php/pull/455) Fix namespaces in PHPDoc +- [#456](https://github.com/stripe/stripe-php/pull/456) Fix namespaces for some exceptions ## 6.4.0 - 2018-02-28 -* [#453](https://github.com/stripe/stripe-php/pull/453) Add constants for `reason` (`REASON_*`) and `status` (`STATUS_*`) on `\Stripe\Dispute` + +- [#453](https://github.com/stripe/stripe-php/pull/453) Add constants for `reason` (`REASON_*`) and `status` (`STATUS_*`) on `\Stripe\Dispute` ## 6.3.2 - 2018-02-27 -* [#452](https://github.com/stripe/stripe-php/pull/452) Add PHPDoc for `amount_paid` and `amount_remaining` on `\Stripe\Invoice` + +- [#452](https://github.com/stripe/stripe-php/pull/452) Add PHPDoc for `amount_paid` and `amount_remaining` on `\Stripe\Invoice` ## 6.3.1 - 2018-02-26 -* [#443](https://github.com/stripe/stripe-php/pull/443) Add event types as constants to `\Stripe\Event` class + +- [#443](https://github.com/stripe/stripe-php/pull/443) Add event types as constants to `\Stripe\Event` class ## 6.3.0 - 2018-02-23 -* [#450](https://github.com/stripe/stripe-php/pull/450) Add support for `code` attribute on all Stripe exceptions + +- [#450](https://github.com/stripe/stripe-php/pull/450) Add support for `code` attribute on all Stripe exceptions ## 6.2.0 - 2018-02-21 -* [#440](https://github.com/stripe/stripe-php/pull/440) Add support for topups -* [#442](https://github.com/stripe/stripe-php/pull/442) Fix PHPDoc for `\Stripe\Error\SignatureVerification` + +- [#440](https://github.com/stripe/stripe-php/pull/440) Add support for topups +- [#442](https://github.com/stripe/stripe-php/pull/442) Fix PHPDoc for `\Stripe\Error\SignatureVerification` ## 6.1.0 - 2018-02-12 -* [#435](https://github.com/stripe/stripe-php/pull/435) Fix header persistence on `Collection` objects -* [#436](https://github.com/stripe/stripe-php/pull/436) Introduce new `Idempotency` error class + +- [#435](https://github.com/stripe/stripe-php/pull/435) Fix header persistence on `Collection` objects +- [#436](https://github.com/stripe/stripe-php/pull/436) Introduce new `Idempotency` error class ## 6.0.0 - 2018-02-07 + Major version release. List of backwards incompatible changes to watch out for: -+ The minimum PHP version is now 5.4.0. If you're using PHP 5.3 or older, consider upgrading to a more recent version. -* `\Stripe\AttachedObject` no longer exists. Attributes that used to be instances of `\Stripe\AttachedObject` (such as `metadata`) are now instances of `\Stripe\StripeObject`. -+ Attributes that used to be PHP arrays (such as `legal_entity->additional_owners` on `\Stripe\Account` instances) are now instances of `\Stripe\StripeObject`, except when they are empty. `\Stripe\StripeObject` has array semantics so this should not be an issue unless you are actively checking types. -* `\Stripe\Collection` now derives from `\Stripe\StripeObject` rather than from `\Stripe\ApiResource`. + +- The minimum PHP version is now 5.4.0. If you're using PHP 5.3 or older, consider upgrading to a more recent version. + +* `\Stripe\AttachedObject` no longer exists. Attributes that used to be instances of `\Stripe\AttachedObject` (such as `metadata`) are now instances of `\Stripe\StripeObject`. + +- Attributes that used to be PHP arrays (such as `legal_entity->additional_owners` on `\Stripe\Account` instances) are now instances of `\Stripe\StripeObject`, except when they are empty. `\Stripe\StripeObject` has array semantics so this should not be an issue unless you are actively checking types. + +* `\Stripe\Collection` now derives from `\Stripe\StripeObject` rather than from `\Stripe\ApiResource`. Pull requests included in this release: -* [#410](https://github.com/stripe/stripe-php/pull/410) Drop support for PHP 5.3 -* [#411](https://github.com/stripe/stripe-php/pull/411) Use traits for common API operations -* [#414](https://github.com/stripe/stripe-php/pull/414) Use short array syntax -* [#404](https://github.com/stripe/stripe-php/pull/404) Fix serialization logic -* [#417](https://github.com/stripe/stripe-php/pull/417) Remove `ExternalAccount` class -* [#418](https://github.com/stripe/stripe-php/pull/418) Increase test coverage -* [#421](https://github.com/stripe/stripe-php/pull/421) Update CA bundle and add script for future updates -* [#422](https://github.com/stripe/stripe-php/pull/422) Use vendored CA bundle for all requests -* [#428](https://github.com/stripe/stripe-php/pull/428) Support for automatic request retries + +- [#410](https://github.com/stripe/stripe-php/pull/410) Drop support for PHP 5.3 +- [#411](https://github.com/stripe/stripe-php/pull/411) Use traits for common API operations +- [#414](https://github.com/stripe/stripe-php/pull/414) Use short array syntax +- [#404](https://github.com/stripe/stripe-php/pull/404) Fix serialization logic +- [#417](https://github.com/stripe/stripe-php/pull/417) Remove `ExternalAccount` class +- [#418](https://github.com/stripe/stripe-php/pull/418) Increase test coverage +- [#421](https://github.com/stripe/stripe-php/pull/421) Update CA bundle and add script for future updates +- [#422](https://github.com/stripe/stripe-php/pull/422) Use vendored CA bundle for all requests +- [#428](https://github.com/stripe/stripe-php/pull/428) Support for automatic request retries ## 5.9.2 - 2018-02-07 -* [#431](https://github.com/stripe/stripe-php/pull/431) Update PHPDoc @property tags for latest API version + +- [#431](https://github.com/stripe/stripe-php/pull/431) Update PHPDoc @property tags for latest API version ## 5.9.1 - 2018-02-06 -* [#427](https://github.com/stripe/stripe-php/pull/427) Add and update PHPDoc @property tags on all API resources + +- [#427](https://github.com/stripe/stripe-php/pull/427) Add and update PHPDoc @property tags on all API resources ## 5.9.0 - 2018-01-17 -* [#421](https://github.com/stripe/stripe-php/pull/421) Updated bundled CA certificates -* [#423](https://github.com/stripe/stripe-php/pull/423) Escape unsanitized input in OAuth example + +- [#421](https://github.com/stripe/stripe-php/pull/421) Updated bundled CA certificates +- [#423](https://github.com/stripe/stripe-php/pull/423) Escape unsanitized input in OAuth example ## 5.8.0 - 2017-12-20 -* [#403](https://github.com/stripe/stripe-php/pull/403) Add `__debugInfo()` magic method to `StripeObject` + +- [#403](https://github.com/stripe/stripe-php/pull/403) Add `__debugInfo()` magic method to `StripeObject` ## 5.7.0 - 2017-11-28 -* [#390](https://github.com/stripe/stripe-php/pull/390) Remove some unsupported API methods -* [#391](https://github.com/stripe/stripe-php/pull/391) Alphabetize the list of API resources in `Util::convertToStripeObject()` and add missing resources -* [#393](https://github.com/stripe/stripe-php/pull/393) Fix expiry date update for card sources + +- [#390](https://github.com/stripe/stripe-php/pull/390) Remove some unsupported API methods +- [#391](https://github.com/stripe/stripe-php/pull/391) Alphabetize the list of API resources in `Util::convertToStripeObject()` and add missing resources +- [#393](https://github.com/stripe/stripe-php/pull/393) Fix expiry date update for card sources ## 5.6.0 - 2017-10-31 -* [#386](https://github.com/stripe/stripe-php/pull/386) Support for exchange rates APIs + +- [#386](https://github.com/stripe/stripe-php/pull/386) Support for exchange rates APIs ## 5.5.1 - 2017-10-30 -* [#387](https://github.com/stripe/stripe-php/pull/387) Allow `personal_address_kana` and `personal_address_kanji` to be updated on an account + +- [#387](https://github.com/stripe/stripe-php/pull/387) Allow `personal_address_kana` and `personal_address_kanji` to be updated on an account ## 5.5.0 - 2017-10-27 -* [#385](https://github.com/stripe/stripe-php/pull/385) Support for listing source transactions + +- [#385](https://github.com/stripe/stripe-php/pull/385) Support for listing source transactions ## 5.4.0 - 2017-10-24 -* [#383](https://github.com/stripe/stripe-php/pull/383) Add static methods to manipulate resources from parent - * `Account` gains methods for external accounts and login links (e.g. `createExternalAccount`, `createLoginLink`) - * `ApplicationFee` gains methods for refunds - * `Customer` gains methods for sources - * `Transfer` gains methods for reversals + +- [#383](https://github.com/stripe/stripe-php/pull/383) Add static methods to manipulate resources from parent + - `Account` gains methods for external accounts and login links (e.g. `createExternalAccount`, `createLoginLink`) + - `ApplicationFee` gains methods for refunds + - `Customer` gains methods for sources + - `Transfer` gains methods for reversals ## 5.3.0 - 2017-10-11 -* [#378](https://github.com/stripe/stripe-php/pull/378) Rename source `delete` to `detach` (and deprecate the former) + +- [#378](https://github.com/stripe/stripe-php/pull/378) Rename source `delete` to `detach` (and deprecate the former) ## 5.2.3 - 2017-09-27 -* Add PHPDoc for `Card` + +- Add PHPDoc for `Card` ## 5.2.2 - 2017-09-20 -* Fix deserialization mapping of `FileUpload` objects + +- Fix deserialization mapping of `FileUpload` objects ## 5.2.1 - 2017-09-14 -* Serialized `shipping` nested attribute + +- Serialized `shipping` nested attribute ## 5.2.0 - 2017-08-29 -* Add support for `InvalidClient` OAuth error + +- Add support for `InvalidClient` OAuth error ## 5.1.3 - 2017-08-14 -* Allow `address_kana` and `address_kanji` to be updated for custom accounts + +- Allow `address_kana` and `address_kanji` to be updated for custom accounts ## 5.1.2 - 2017-08-01 -* Fix documented return type of `autoPagingIterator()` (was missing namespace) + +- Fix documented return type of `autoPagingIterator()` (was missing namespace) ## 5.1.1 - 2017-07-03 -* Fix order returns to use the right URL `/v1/order_returns` + +- Fix order returns to use the right URL `/v1/order_returns` ## 5.1.0 - 2017-06-30 -* Add support for OAuth + +- Add support for OAuth ## 5.0.0 - 2017-06-27 -* `pay` on invoice now takes params as well as opts + +- `pay` on invoice now takes params as well as opts ## 4.13.0 - 2017-06-19 -* Add support for ephemeral keys + +- Add support for ephemeral keys ## 4.12.0 - 2017-06-05 -* Clients can implement `getUserAgentInfo()` to add additional user agent information + +- Clients can implement `getUserAgentInfo()` to add additional user agent information ## 4.11.0 - 2017-06-05 -* Implement `Countable` for `AttachedObject` (`metadata` and `additional_owners`) + +- Implement `Countable` for `AttachedObject` (`metadata` and `additional_owners`) ## 4.10.0 - 2017-05-25 -* Add support for login links + +- Add support for login links ## 4.9.1 - 2017-05-10 -* Fix docs to include arrays on `$id` parameter for retrieve methods + +- Fix docs to include arrays on `$id` parameter for retrieve methods ## 4.9.0 - 2017-04-28 -* Support for checking webhook signatures + +- Support for checking webhook signatures ## 4.8.1 - 2017-04-24 -* Allow nested field `payout_schedule` to be updated + +- Allow nested field `payout_schedule` to be updated ## 4.8.0 - 2017-04-20 -* Add `\Stripe\Stripe::setLogger()` to support an external PSR-3 compatible logger + +- Add `\Stripe\Stripe::setLogger()` to support an external PSR-3 compatible logger ## 4.7.0 - 2017-04-10 -* Add support for payouts and recipient transfers + +- Add support for payouts and recipient transfers ## 4.6.0 - 2017-04-06 -* Please see 4.7.0 instead (no-op release) + +- Please see 4.7.0 instead (no-op release) ## 4.5.1 - 2017-03-22 -* Remove hard dependency on cURL + +- Remove hard dependency on cURL ## 4.5.0 - 2017-03-20 -* Support for detaching sources from customers + +- Support for detaching sources from customers ## 4.4.2 - 2017-02-27 -* Correct handling of `owner` parameter when updating sources + +- Correct handling of `owner` parameter when updating sources ## 4.4.1 - 2017-02-24 -* Correct the error check on a bad JSON decoding + +- Correct the error check on a bad JSON decoding ## 4.4.0 - 2017-01-18 -* Add support for updating sources + +- Add support for updating sources ## 4.3.0 - 2016-11-30 -* Add support for verifying sources + +- Add support for verifying sources ## 4.2.0 - 2016-11-21 -* Add retrieve method for 3-D Secure resources + +- Add retrieve method for 3-D Secure resources ## 4.1.1 - 2016-10-21 -* Add docblock with model properties for `Plan` + +- Add docblock with model properties for `Plan` ## 4.1.0 - 2016-10-18 -* Support for 403 status codes (permission denied) + +- Support for 403 status codes (permission denied) ## 4.0.1 - 2016-10-17 -* Fix transfer reversal materialization -* Fixes for some property definitions in docblocks + +- Fix transfer reversal materialization +- Fixes for some property definitions in docblocks ## 4.0.0 - 2016-09-28 -* Support for subscription items -* Drop attempt to force TLS 1.2: please note that this could be breaking if you're using old OS distributions or packages and upgraded recently (so please make sure to test your integration!) + +- Support for subscription items +- Drop attempt to force TLS 1.2: please note that this could be breaking if you're using old OS distributions or packages and upgraded recently (so please make sure to test your integration!) ## 3.23.0 - 2016-09-15 -* Add support for Apple Pay domains + +- Add support for Apple Pay domains ## 3.22.0 - 2016-09-13 -* Add `Stripe::setAppInfo` to allow plugins to register user agent information + +- Add `Stripe::setAppInfo` to allow plugins to register user agent information ## 3.21.0 - 2016-08-25 -* Add `Source` model for generic payment sources + +- Add `Source` model for generic payment sources ## 3.20.0 - 2016-08-08 -* Add `getDeclineCode` to card errors + +- Add `getDeclineCode` to card errors ## 3.19.0 - 2016-07-29 -* Opt requests directly into TLS 1.2 where OpenSSL >= 1.0.1 (see #277 for context) + +- Opt requests directly into TLS 1.2 where OpenSSL >= 1.0.1 (see #277 for context) ## 3.18.0 - 2016-07-28 -* Add new `STATUS_` constants for subscriptions + +- Add new `STATUS_` constants for subscriptions ## 3.17.1 - 2016-07-28 -* Fix auto-paging iterator so that it plays nicely with `iterator_to_array` + +- Fix auto-paging iterator so that it plays nicely with `iterator_to_array` ## 3.17.0 - 2016-07-14 -* Add field annotations to model classes for better editor hinting + +- Add field annotations to model classes for better editor hinting ## 3.16.0 - 2016-07-12 -* Add `ThreeDSecure` model for 3-D secure payments + +- Add `ThreeDSecure` model for 3-D secure payments ## 3.15.0 - 2016-06-29 -* Add static `update` method to all resources that can be changed. + +- Add static `update` method to all resources that can be changed. ## 3.14.3 - 2016-06-20 -* Make sure that cURL never sends `Expects: 100-continue`, even on large request bodies + +- Make sure that cURL never sends `Expects: 100-continue`, even on large request bodies ## 3.14.2 - 2016-06-03 -* Add `inventory` under `SKU` to list of keys that have nested data and can be updated + +- Add `inventory` under `SKU` to list of keys that have nested data and can be updated ## 3.14.1 - 2016-05-27 -* Fix some inconsistencies in PHPDoc + +- Fix some inconsistencies in PHPDoc ## 3.14.0 - 2016-05-25 -* Add support for returning Relay orders + +- Add support for returning Relay orders ## 3.13.0 - 2016-05-04 -* Add `list`, `create`, `update`, `retrieve`, and `delete` methods to the Subscription class + +- Add `list`, `create`, `update`, `retrieve`, and `delete` methods to the Subscription class ## 3.12.1 - 2016-04-07 -* Additional check on value arrays for some extra safety + +- Additional check on value arrays for some extra safety ## 3.12.0 - 2016-03-31 -* Fix bug `refreshFrom` on `StripeObject` would not take an `$opts` array -* Fix bug where `$opts` not passed to parent `save` method in `Account` -* Fix bug where non-existent variable was referenced in `reverse` in `Transfer` -* Update CA cert bundle for compatibility with OpenSSL versions below 1.0.1 + +- Fix bug `refreshFrom` on `StripeObject` would not take an `$opts` array +- Fix bug where `$opts` not passed to parent `save` method in `Account` +- Fix bug where non-existent variable was referenced in `reverse` in `Transfer` +- Update CA cert bundle for compatibility with OpenSSL versions below 1.0.1 ## 3.11.0 - 2016-03-22 -* Allow `CurlClient` to be initialized with default `CURLOPT_*` options + +- Allow `CurlClient` to be initialized with default `CURLOPT_*` options ## 3.10.1 - 2016-03-22 -* Fix bug where request params and options were ignored in `ApplicationFee`'s `refund.` + +- Fix bug where request params and options were ignored in `ApplicationFee`'s `refund.` ## 3.10.0 - 2016-03-15 -* Add `reject` on `Account` to support the new API feature + +- Add `reject` on `Account` to support the new API feature ## 3.9.2 - 2016-03-04 -* Fix error when an object's metadata is set more than once + +- Fix error when an object's metadata is set more than once ## 3.9.1 - 2016-02-24 -* Fix encoding behavior of nested arrays for requests (see #227) + +- Fix encoding behavior of nested arrays for requests (see #227) ## 3.9.0 - 2016-02-09 -* Add automatic pagination mechanism with `autoPagingIterator()` -* Allow global account ID to be set with `Stripe::setAccountId()` + +- Add automatic pagination mechanism with `autoPagingIterator()` +- Allow global account ID to be set with `Stripe::setAccountId()` ## 3.8.0 - 2016-02-08 -* Add `CountrySpec` model for looking up country payment information + +- Add `CountrySpec` model for looking up country payment information ## 3.7.1 - 2016-02-01 -* Update bundled CA certs + +- Update bundled CA certs ## 3.7.0 - 2016-01-27 -* Support deleting Relay products and SKUs + +- Support deleting Relay products and SKUs ## 3.6.0 - 2016-01-05 -* Allow configuration of HTTP client timeouts + +- Allow configuration of HTTP client timeouts ## 3.5.0 - 2015-12-01 -* Add a verification routine for external accounts + +- Add a verification routine for external accounts ## 3.4.0 - 2015-09-14 -* Products, SKUs, and Orders -- https://stripe.com/relay + +- Products, SKUs, and Orders -- https://stripe.com/relay ## 3.3.0 - 2015-09-11 -* Add support for 429 Rate Limit response + +- Add support for 429 Rate Limit response ## 3.2.0 - 2015-08-17 -* Add refund listing and retrieval without an associated charge + +- Add refund listing and retrieval without an associated charge ## 3.1.0 - 2015-08-03 -* Add dispute listing and retrieval -* Add support for manage account deletion + +- Add dispute listing and retrieval +- Add support for manage account deletion ## 3.0.0 - 2015-07-28 -* Rename `\Stripe\Object` to `\Stripe\StripeObject` (PHP 7 compatibility) -* Rename `getCode` and `getParam` in exceptions to `getStripeCode` and `getStripeParam` -* Add support for calling `json_encode` on Stripe objects in PHP 5.4+ -* Start supporting/testing PHP 7 + +- Rename `\Stripe\Object` to `\Stripe\StripeObject` (PHP 7 compatibility) +- Rename `getCode` and `getParam` in exceptions to `getStripeCode` and `getStripeParam` +- Add support for calling `json_encode` on Stripe objects in PHP 5.4+ +- Start supporting/testing PHP 7 ## 2.3.0 - 2015-07-06 -* Add request ID to all Stripe exceptions + +- Add request ID to all Stripe exceptions ## 2.2.0 - 2015-06-01 -* Add support for Alipay accounts as sources -* Add support for bank accounts as sources (private beta) -* Add support for bank accounts and cards as external_accounts on Account objects + +- Add support for Alipay accounts as sources +- Add support for bank accounts as sources (private beta) +- Add support for bank accounts and cards as external_accounts on Account objects ## 2.1.4 - 2015-05-13 -* Fix CA certificate file path (thanks @lphilps & @matthewarkin) + +- Fix CA certificate file path (thanks @lphilps & @matthewarkin) ## 2.1.3 - 2015-05-12 -* Fix to account updating to permit `tos_acceptance` and `personal_address` to be set properly -* Fix to Transfer reversal creation (thanks @neatness!) -* Network requests are now done through a swappable class for easier mocking + +- Fix to account updating to permit `tos_acceptance` and `personal_address` to be set properly +- Fix to Transfer reversal creation (thanks @neatness!) +- Network requests are now done through a swappable class for easier mocking ## 2.1.2 - 2015-04-10 -* Remove SSL cert revokation checking (all pre-Heartbleed certs have expired) -* Bug fixes to account updating + +- Remove SSL cert revokation checking (all pre-Heartbleed certs have expired) +- Bug fixes to account updating ## 2.1.1 - 2015-02-27 -* Support transfer reversals + +- Support transfer reversals ## 2.1.0 - 2015-02-19 -* Support new API version (2015-02-18) -* Added Bitcoin Receiever update and delete actions -* Edited tests to prefer "source" over "card" as per new API version + +- Support new API version (2015-02-18) +- Added Bitcoin Receiever update and delete actions +- Edited tests to prefer "source" over "card" as per new API version ## 2.0.1 - 2015-02-16 -* Fix to fetching endpoints that use a non-default baseUrl (`FileUpload`) + +- Fix to fetching endpoints that use a non-default baseUrl (`FileUpload`) ## 2.0.0 - 2015-02-14 -* Bumped minimum version to 5.3.3 -* Switched to Stripe namespace instead of Stripe_ class name prefiexes (thanks @chadicus!) -* Switched tests to PHPUnit (thanks @chadicus!) -* Switched style guide to PSR2 (thanks @chadicus!) -* Added $opts hash to the end of most methods: this permits passing 'idempotency_key', 'stripe_account', or 'stripe_version'. The last 2 will persist across multiple object loads. -* Added support for retrieving Account by ID + +- Bumped minimum version to 5.3.3 +- Switched to Stripe namespace instead of Stripe\_ class name prefiexes (thanks @chadicus!) +- Switched tests to PHPUnit (thanks @chadicus!) +- Switched style guide to PSR2 (thanks @chadicus!) +- Added \$opts hash to the end of most methods: this permits passing 'idempotency_key', 'stripe_account', or 'stripe_version'. The last 2 will persist across multiple object loads. +- Added support for retrieving Account by ID ## 1.18.0 - 2015-01-21 -* Support making bitcoin charges through BitcoinReceiver source object + +- Support making bitcoin charges through BitcoinReceiver source object ## 1.17.5 - 2014-12-23 -* Adding support for creating file uploads. + +- Adding support for creating file uploads. ## 1.17.4 - 2014-12-15 -* Saving objects fetched with a custom key now works (thanks @JustinHook & @jpasilan) -* Added methods for reporting charges as safe or fraudulent and for specifying the reason for refunds + +- Saving objects fetched with a custom key now works (thanks @JustinHook & @jpasilan) +- Added methods for reporting charges as safe or fraudulent and for specifying the reason for refunds ## 1.17.3 - 2014-11-06 -* Better handling of HHVM support for SSL certificate blacklist checking. + +- Better handling of HHVM support for SSL certificate blacklist checking. ## 1.17.2 - 2014-09-23 -* Coupons now are backed by a `Stripe_Coupon` instead of `Stripe_Object`, and support updating metadata -* Running operations (`create`, `retrieve`, `all`) on upcoming invoice items now works + +- Coupons now are backed by a `Stripe_Coupon` instead of `Stripe_Object`, and support updating metadata +- Running operations (`create`, `retrieve`, `all`) on upcoming invoice items now works ## 1.17.1 - 2014-07-31 -* Requests now send Content-Type header + +- Requests now send Content-Type header ## 1.17.0 - 2014-07-29 -* Application Fee refunds now a list instead of array -* HHVM now works -* Small bug fixes (thanks @bencromwell & @fastest963) -* `__toString` now returns the name of the object in addition to its JSON representation + +- Application Fee refunds now a list instead of array +- HHVM now works +- Small bug fixes (thanks @bencromwell & @fastest963) +- `__toString` now returns the name of the object in addition to its JSON representation ## 1.16.0 - 2014-06-17 -* Add metadata for refunds and disputes + +- Add metadata for refunds and disputes ## 1.15.0 - 2014-05-28 -* Support canceling transfers + +- Support canceling transfers ## 1.14.1 - 2014-05-21 -* Support cards for recipients. + +- Support cards for recipients. ## 1.13.1 - 2014-05-15 -* Fix bug in account resource where `id` wasn't in the result + +- Fix bug in account resource where `id` wasn't in the result ## 1.13.0 - 2014-04-10 -* Add support for certificate blacklisting -* Update ca bundle -* Drop support for HHVM (Temporarily) + +- Add support for certificate blacklisting +- Update ca bundle +- Drop support for HHVM (Temporarily) ## 1.12.0 - 2014-04-01 -* Add Stripe_RateLimitError for catching rate limit errors. -* Update to Zend coding style (thanks, @jpiasetz) + +- Add Stripe_RateLimitError for catching rate limit errors. +- Update to Zend coding style (thanks, @jpiasetz) ## 1.11.0 - 2014-01-29 -* Add support for multiple subscriptions per customer + +- Add support for multiple subscriptions per customer ## 1.10.1 - 2013-12-02 -* Add new ApplicationFee + +- Add new ApplicationFee ## 1.9.1 - 2013-11-08 -* Fix a bug where a null nestable object causes warnings to fire. + +- Fix a bug where a null nestable object causes warnings to fire. ## 1.9.0 - 2013-10-16 -* Add support for metadata API. + +- Add support for metadata API. ## 1.8.4 - 2013-09-18 -* Add support for closing disputes. + +- Add support for closing disputes. ## 1.8.3 - 2013-08-13 -* Add new Balance and BalanceTransaction + +- Add new Balance and BalanceTransaction ## 1.8.2 - 2013-08-12 -* Add support for unsetting attributes by updating to NULL. Setting properties to a blank string is now an error. + +- Add support for unsetting attributes by updating to NULL. Setting properties to a blank string is now an error. ## 1.8.1 - 2013-07-12 -* Add support for multiple cards API (Stripe API version 2013-07-12: https://stripe.com/docs/upgrades#2013-07-05) + +- Add support for multiple cards API (Stripe API version 2013-07-12: https://stripe.com/docs/upgrades#2013-07-05) ## 1.8.0 - 2013-04-11 -* Allow Transfers to be creatable -* Add new Recipient resource + +- Allow Transfers to be creatable +- Add new Recipient resource ## 1.7.15 - 2013-02-21 -* Add 'id' to the list of permanent object attributes + +- Add 'id' to the list of permanent object attributes ## 1.7.14 - 2013-02-20 -* Don't re-encode strings that are already encoded in UTF-8. If you were previously using plan or coupon objects with UTF-8 IDs, they may have been treated as ISO-8859-1 (Latin-1) and encoded to UTF-8 a 2nd time. You may now need to pass the IDs to utf8_encode before passing them to Stripe_Plan::retrieve or Stripe_Coupon::retrieve. -* Ensure that all input is encoded in UTF-8 before submitting it to Stripe's servers. (github issue #27) +- Don't re-encode strings that are already encoded in UTF-8. If you were previously using plan or coupon objects with UTF-8 IDs, they may have been treated as ISO-8859-1 (Latin-1) and encoded to UTF-8 a 2nd time. You may now need to pass the IDs to utf8_encode before passing them to Stripe_Plan::retrieve or Stripe_Coupon::retrieve. +- Ensure that all input is encoded in UTF-8 before submitting it to Stripe's servers. (github issue #27) ## 1.7.13 - 2013-02-01 -* Add support for passing options when retrieving Stripe objects e.g., Stripe_Charge::retrieve(array("id"=>"foo", "expand" => array("customer"))); Stripe_Charge::retrieve("foo") will continue to work + +- Add support for passing options when retrieving Stripe objects e.g., Stripe_Charge::retrieve(array("id"=>"foo", "expand" => array("customer"))); Stripe_Charge::retrieve("foo") will continue to work ## 1.7.12 - 2013-01-15 -* Add support for setting a Stripe API version override + +- Add support for setting a Stripe API version override ## 1.7.11 - 2012-12-30 -* Version bump to cleanup constants and such (fix issue #26) + +- Version bump to cleanup constants and such (fix issue #26) ## 1.7.10 - 2012-11-08 -* Add support for updating charge disputes. -* Fix bug preventing retrieval of null attributes + +- Add support for updating charge disputes. +- Fix bug preventing retrieval of null attributes ## 1.7.9 - 2012-11-08 -* Fix usage under autoloaders such as the one generated by composer (fix issue #22) + +- Fix usage under autoloaders such as the one generated by composer (fix issue #22) ## 1.7.8 - 2012-10-30 -* Add support for creating invoices. -* Add support for new invoice lines return format -* Add support for new list objects + +- Add support for creating invoices. +- Add support for new invoice lines return format +- Add support for new list objects ## 1.7.7 - 2012-09-14 -* Get all of the various version numbers in the repo in sync (no other changes) + +- Get all of the various version numbers in the repo in sync (no other changes) ## 1.7.6 - 2012-08-31 -* Add update and pay methods to Invoice resource + +- Add update and pay methods to Invoice resource ## 1.7.5 - 2012-08-23 -* Change internal function names so that Stripe_SingletonApiRequest is E_STRICT-clean (github issue #16) + +- Change internal function names so that Stripe_SingletonApiRequest is E_STRICT-clean (github issue #16) ## 1.7.4 - 2012-08-21 -* Bugfix so that Stripe objects (e.g. Customer, Charge objects) used in API calls are transparently converted to their object IDs + +- Bugfix so that Stripe objects (e.g. Customer, Charge objects) used in API calls are transparently converted to their object IDs ## 1.7.3 - 2012-08-15 -* Add new Account resource + +- Add new Account resource ## 1.7.2 - 2012-06-26 -* Make clearer that you should be including lib/Stripe.php, not test/Stripe.php (github issue #14) + +- Make clearer that you should be including lib/Stripe.php, not test/Stripe.php (github issue #14) ## 1.7.1 - 2012-05-24 -* Add missing argument to Stripe_InvalidRequestError constructor in Stripe_ApiResource::instanceUrl. Fixes a warning when Stripe_ApiResource::instanceUrl is called on a resource with no ID (fix issue #12) + +- Add missing argument to Stripe_InvalidRequestError constructor in Stripe_ApiResource::instanceUrl. Fixes a warning when Stripe_ApiResource::instanceUrl is called on a resource with no ID (fix issue #12) ## 1.7.0 - 2012-05-17 -* Support Composer and Packagist (github issue #9) -* Add new deleteDiscount method to Stripe_Customer -* Add new Transfer resource -* Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will support Basic auth for the indefinite future, but recommends Bearer auth when possible going forward) -* Numerous test suite improvements + +- Support Composer and Packagist (github issue #9) +- Add new deleteDiscount method to Stripe_Customer +- Add new Transfer resource +- Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will support Basic auth for the indefinite future, but recommends Bearer auth when possible going forward) +- Numerous test suite improvements diff --git a/plugins/stripe/CODE_OF_CONDUCT.md b/plugins/stripe/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..349f5a0bfd --- /dev/null +++ b/plugins/stripe/CODE_OF_CONDUCT.md @@ -0,0 +1,77 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at conduct@stripe.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq + diff --git a/plugins/stripe/LICENSE b/plugins/stripe/LICENSE index a21757e4fc..847c705ad3 100644 --- a/plugins/stripe/LICENSE +++ b/plugins/stripe/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2010-2015 Stripe +Copyright (c) 2010-2019 Stripe, Inc. (https://stripe.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/stripe/Makefile b/plugins/stripe/Makefile new file mode 100644 index 0000000000..78c5868162 --- /dev/null +++ b/plugins/stripe/Makefile @@ -0,0 +1,36 @@ +export PHPDOCUMENTOR_VERSION := v3.0.0-rc +export PHPSTAN_VERSION := 0.12.18 + +vendor: composer.json + composer install + +vendor/bin/phpstan: vendor + curl -sfL https://github.com/phpstan/phpstan/releases/download/$(PHPSTAN_VERSION)/phpstan.phar -o vendor/bin/phpstan + chmod +x vendor/bin/phpstan + +vendor/bin/phpdoc: vendor + curl -sfL https://github.com/phpDocumentor/phpDocumentor/releases/download/$(PHPDOCUMENTOR_VERSION)/phpDocumentor.phar -o vendor/bin/phpdoc + chmod +x vendor/bin/phpdoc + +test: vendor + vendor/bin/phpunit +.PHONY: test + +fmt: vendor + vendor/bin/php-cs-fixer fix -v --using-cache=no . +.PHONY: fmt + +fmtcheck: vendor + vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no . +.PHONY: fmtcheck + +phpdoc: vendor/bin/phpdoc + vendor/bin/phpdoc + +phpstan: vendor/bin/phpstan + php -d memory_limit=512M vendor/bin/phpstan analyse lib tests +.PHONY: phpstan + +phpstan-baseline: vendor/bin/phpstan + php -d memory_limit=512M vendor/bin/phpstan analyse lib tests --generate-baseline +.PHONY: phpstan-baseline diff --git a/plugins/stripe/README.md b/plugins/stripe/README.md index 8dca764d7d..1be6aa1bef 100644 --- a/plugins/stripe/README.md +++ b/plugins/stripe/README.md @@ -6,11 +6,15 @@ [![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 -PHP 5.4.0 and later. +PHP 5.6.0 and later. ## Composer @@ -38,9 +42,9 @@ require_once('/path/to/stripe-php/init.php'); The bindings require the following extensions in order to work properly: -- [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer -- [`json`](https://secure.php.net/manual/en/book.json.php) -- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String) +- [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer +- [`json`](https://secure.php.net/manual/en/book.json.php) +- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String) If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available. @@ -49,36 +53,36 @@ If you use Composer, these dependencies should be handled automatically. If you Simple usage looks like: ```php -\Stripe\Stripe::setApiKey('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); -$charge = \Stripe\Charge::create(['amount' => 2000, 'currency' => 'usd', 'source' => 'tok_189fqt2eZvKYlo2CTGBeg6Uq']); -echo $charge; +$stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); +$customer = $stripe->customers->create([ + 'description' => 'example customer', + 'email' => 'email@example.com', + 'payment_method' => 'pm_card_visa', +]); +echo $customer; ``` -## Documentation +### Client/service patterns vs legacy patterns -Please see https://stripe.com/docs/api for up-to-date documentation. +You can continue to use the legacy integration patterns used prior to version [7.33.0](https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#7330---2020-05-14). Review the [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0) for the backwards-compatible client/services pattern changes. -## Legacy Version Support +## Documentation -### PHP 5.3 +See the [PHP API docs](https://stripe.com/docs/api/php#intro). -If you are using PHP 5.3, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. +## Legacy Version Support -### PHP 5.2 +### PHP 5.4 & 5.5 -If you are using PHP 5.2, you can download v1.18.0 ([zip](https://github.com/stripe/stripe-php/archive/v1.18.0.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v1.18.0.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. +If you are using PHP 5.4 or 5.5, you can download v6.21.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.21.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v6.21.1.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. -This legacy version may be included via `require_once("/path/to/stripe-php/lib/Stripe.php");`, and used like: +### PHP 5.3 -```php -Stripe::setApiKey('d8e8fca2dc0f896fd7cb4cb0031ba249'); -$charge = Stripe_Charge::create(array('source' => 'tok_XXXXXXXX', 'amount' => 2000, 'currency' => 'usd')); -echo $charge; -``` +If you are using PHP 5.3, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. ## Custom Request Timeouts -*NOTE:* We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic. +_NOTE:_ We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic. To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient. @@ -125,8 +129,10 @@ end up there instead of `error_log`: You can access the data from the last API response on any object via `getLastResponse()`. ```php -$charge = \Stripe\Charge::create(['amount' => 2000, 'currency' => 'usd', 'source' => 'tok_visa']); -echo $charge->getLastResponse()->headers['Request-Id']; +$customer = $stripe->customers->create([ + 'description' => 'example customer', +]); +echo $customer->getLastResponse()->headers['Request-Id']; ``` ### SSL / TLS compatibility issues @@ -147,12 +153,12 @@ one that uses [Stripe Connect][connect], it's also possible to set a per-request key and/or account: ```php -\Stripe\Charge::all([], [ +$customers = $stripe->customers->all([],[ 'api_key' => 'sk_test_...', 'stripe_account' => 'acct_...' ]); -\Stripe\Charge::retrieve("ch_18atAXCdGbJFKhCuBAa4532Z", [ +$stripe->customers->retrieve('cus_123456789', [], [ 'api_key' => 'sk_test_...', 'stripe_account' => 'acct_...' ]); @@ -179,6 +185,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: @@ -220,6 +237,12 @@ Update bundled CA certificates from the [Mozilla cURL release][curl]: ./update_certs.php ``` +The library uses [PHP CS Fixer][php-cs-fixer] for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with: + +```bash +./vendor/bin/php-cs-fixer fix -v . +``` + ## Attention plugin developers Are you writing a plugin that integrates Stripe and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example: @@ -237,6 +260,7 @@ See the "SSL / TLS compatibility issues" paragraph above for full context. If yo [composer]: https://getcomposer.org/ [connect]: https://stripe.com/connect [curl]: http://curl.haxx.se/docs/caextract.html -[psr3]: http://www.php-fig.org/psr/psr-3/ [idempotency-keys]: https://stripe.com/docs/api/php#idempotent_requests +[php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer +[psr3]: http://www.php-fig.org/psr/psr-3/ [stripe-mock]: https://github.com/stripe/stripe-mock diff --git a/plugins/stripe/VERSION b/plugins/stripe/VERSION index a3748c5621..0de24fd303 100644 --- a/plugins/stripe/VERSION +++ b/plugins/stripe/VERSION @@ -1 +1 @@ -6.15.0 +7.66.1 diff --git a/plugins/stripe/build.php b/plugins/stripe/build.php old mode 100755 new mode 100644 index cd053e2bae..37360ffef9 --- a/plugins/stripe/build.php +++ b/plugins/stripe/build.php @@ -1,36 +1,25 @@ #!/usr/bin/env php =5.4.0", + "php": ">=5.6.0", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*" }, "require-dev": { - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "~0.6.1", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^5.7", + "php-coveralls/php-coveralls": "^2.1", + "squizlabs/php_codesniffer": "^3.3", + "symfony/process": "~3.4", + "friendsofphp/php-cs-fixer": "2.16.5" }, "autoload": { - "psr-4": { "Stripe\\" : "lib/" } + "psr-4": { + "Stripe\\": "lib/" + } + }, + "autoload-dev": { + "psr-4": { + "Stripe\\": [ + "tests/", + "tests/Stripe/" + ] + } }, "extra": { "branch-alias": { diff --git a/plugins/stripe/data/ca-certificates.crt b/plugins/stripe/data/ca-certificates.crt index 39ba33683c..65be2181db 100644 --- a/plugins/stripe/data/ca-certificates.crt +++ b/plugins/stripe/data/ca-certificates.crt @@ -1,7 +1,7 @@ ## ## Bundle of CA Root Certificates ## -## Certificate data from Mozilla as of: Wed Sep 20 03:12:05 2017 GMT +## Certificate data from Mozilla as of: Wed Aug 28 03:12:10 2019 GMT ## ## This is a bundle of X.509 certificates of public Certificate Authorities ## (CA). These were automatically extracted from Mozilla's root certificates @@ -14,7 +14,7 @@ ## Just configure this file as the SSLCACertificateFile. ## ## Conversion done with mk-ca-bundle.pl version 1.27. -## SHA256: 2b2dbe5244e0047e088c597998883a913f6c5fffd1cb5c0fe5a368c8466cb2ec +## SHA256: fffa309937c3be940649293f749b8207fabc6eb224e50e4bb3f2c5e44e0d6a6b ## @@ -261,47 +261,6 @@ gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS -----END CERTIFICATE----- -Visa eCommerce Root -=================== ------BEGIN CERTIFICATE----- -MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG -EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug -QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2 -WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm -VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv -bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL -F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b -RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0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dvkrOYCJ5JdL -kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ -89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K -Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P -NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq -hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+ -GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg -GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/ -0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS -qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw== ------END CERTIFICATE----- - Comodo AAA Services root ======================== -----BEGIN CERTIFICATE----- @@ -465,60 +424,6 @@ EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH llpwrN9M -----END CERTIFICATE----- -Camerfirma Chambers of Commerce Root -==================================== ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe -QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i -ZXJzaWduLm9yZzEiMCA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9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi -fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD -L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN -UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n -ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1 -erfutGWaIZDgqtCYvDi1czyL+Nw= ------END CERTIFICATE----- - -Camerfirma Global Chambersign Root -================================== ------BEGIN CERTIFICATE----- -MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe -QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i -ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx -NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt -YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg -MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw -ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J -1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/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P8A== ------END CERTIFICATE----- - XRamp Global CA Root ==================== -----BEGIN CERTIFICATE----- @@ -591,47 +496,6 @@ KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3 QBFGmh95DmK/D5fs4C8fF5Q= -----END CERTIFICATE----- -StartCom Certification Authority -================================ ------BEGIN CERTIFICATE----- -MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN -U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu -ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0 -NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk -LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg -U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw -ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y -o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/ -Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d -eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt -2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z -6+hsTXBbKWW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CGSAGG+EIBDQQrFilT -dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC -AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh -3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm -vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk -fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3 -fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ -EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq -yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl -1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/ -lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro -g14= ------END CERTIFICATE----- - Taiwan GRCA =========== -----BEGIN CERTIFICATE----- @@ -770,30 +634,6 @@ RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ -----END CERTIFICATE----- -DST ACES CA X6 -============== ------BEGIN CERTIFICATE----- -MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdW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kQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t -Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq -nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs -vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3 -oKfN5XozNmr6mis= ------END CERTIFICATE----- - SwissSign Gold CA - G2 ====================== -----BEGIN CERTIFICATE----- @@ -1036,27 +876,6 @@ FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= -----END CERTIFICATE----- -Security Communication EV RootCA1 -================================= ------BEGIN CERTIFICATE----- -MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc -U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh -dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE -BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl -Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO -/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX -WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z -ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4 -bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK -9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG -SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm -iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG -Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW -mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW -T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490 ------END CERTIFICATE----- - OISTE WISeKey Global Root GA CA =============================== -----BEGIN CERTIFICATE----- @@ -1177,34 +996,6 @@ sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw= -----END CERTIFICATE----- -T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3 -============================================================================================================================= ------BEGIN CERTIFICATE----- -MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BA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FDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR -6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL -hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd -BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF -MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4 -N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT -y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh -LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M -dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI= ------END CERTIFICATE----- - certSIGN ROOT CA ================ -----BEGIN CERTIFICATE----- @@ -1452,37 +1243,6 @@ y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061 lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I= -----END CERTIFICATE----- -ACEDICOM Root -============= ------BEGIN CERTIFICATE----- -MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD -T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4 -MDQxODE2MjQyMloXDTI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ljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg -aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP -eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk -zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1 -ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI -KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq -nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE -I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp -MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o -tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA== ------END CERTIFICATE----- - Microsec e-Szigno Root CA 2009 ============================== -----BEGIN CERTIFICATE----- @@ -1843,37 +1603,6 @@ Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= -----END CERTIFICATE----- -Certinomis - Autorité Racine -============================ ------BEGIN CERTIFICATE----- -MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1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B/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G -A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ -KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x -WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva -R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40 -nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B -CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv -JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE -qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b -WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE -wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/ -vgt2Fl43N+bYdJeimUV5 ------END CERTIFICATE----- - TWCA Root Certification Authority ================================= -----BEGIN CERTIFICATE----- @@ -2022,75 +1751,6 @@ l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl iB6XzCGcKQENZetX2fNXlrtIzYE= -----END CERTIFICATE----- -StartCom Certification Authority -================================ ------BEGIN CERTIFICATE----- -MIIHhzCCBW+gAwIBA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vkrKTlMeIFw6T -tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX -e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA -2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs -HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE -JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib -D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8= ------END CERTIFICATE----- - -StartCom Certification Authority G2 -=================================== ------BEGIN CERTIFICATE----- -MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN -U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg -RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE -ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp -dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O -o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG -4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi -Aez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YXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc -l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm -7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm -obp573PYtlNXLfbQ4ddI ------END CERTIFICATE----- - Buypass Class 2 Root CA ======================= -----BEGIN CERTIFICATE----- @@ -2197,31 +1857,6 @@ uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU dcGWxZ0= -----END CERTIFICATE----- -TURKTRUST Certificate Services Provider Root 2007 -================================================= ------BEGIN CERTIFICATE----- -MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF -bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP -MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg -QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X -DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl -a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN -BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp -bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N -YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv -KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya -KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT -rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC -AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s -Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I -aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO -Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb -BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK -poRq0Tl9 ------END CERTIFICATE----- - D-TRUST Root Class 3 CA 2 2009 ============================== -----BEGIN CERTIFICATE----- @@ -2271,84 +1906,6 @@ NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv w9y4AyHqnxbxLFS1 -----END CERTIFICATE----- -PSCProcert -========== ------B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cz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y -eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km ------END CERTIFICATE----- - -CA Disig Root R1 -================ ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw -EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp -ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx -EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp -c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy -3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8 -u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2 -m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk -CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa -YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6 -vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL -LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX -ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is -XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ -04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR -xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B -LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM -CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb -VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85 -YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS -ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix -lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N -UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ -a7+h89n07eLw4+1knj0vllJPgFOL ------END CERTIFICATE----- - CA Disig Root R2 ================ -----BEGIN CERTIFICATE----- @@ -2752,66 +2309,6 @@ G48BtieVU+i2iW1bvGjUI+iLUaJW+f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aixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6 -yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj/feTZU7n85iY -r83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6jBAyvd0zaziGfjk9DgNyp115 -j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0A -kLppRQjbbpCBhqcqBT/mhDn4t/lXX0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97 -qA4bLJyuQHCH2u2nFoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Y -jj4Du9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10lO1Hm13ZB -ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv -T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO -kI26oQ== ------END CERTIFICATE----- - COMODO RSA Certification Authority ================================== -----BEGIN CERTIFICATE----- @@ -3116,61 +2613,6 @@ kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su -----END CERTIFICATE----- -TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5 -==================================================== ------BEGIN CERTIFICATE----- -MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN -BgNVBAc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3GglE9Rc8qPo -BP5yCccLqh0lVX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq -URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nfpeYVhDfwwvJl -lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8 -B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU= ------END CERTIFICATE----- - -Certinomis - Root CA -==================== ------BEGIN CERTIFICATE----- -MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK -Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg -LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx -EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD -ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos -P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo -d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap -z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00 -8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x -RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4L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4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM -cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr -hkIGuUE= ------END CERTIFICATE----- - OISTE WISeKey Global Root GB CA =============================== -----BEGIN CERTIFICATE----- @@ -3193,42 +2635,6 @@ HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM= -----END CERTIFICATE----- -Certification Authority of WoSign G2 -==================================== ------BEGIN CERTIFICATE----- -MIIDfDCCAmSgAwIBAgIQayXaioidfLwPBbOxemFFRDANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQG -EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxLTArBgNVBAMTJENlcnRpZmljYXRpb24g -QXV0aG9yaXR5IG9mIFdvU2lnbiBHMjAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMFgx -CzAJBgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEtMCsGA1UEAxMkQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkgb2YgV29TaWduIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -CgKCAQEAvsXEoCKASU+/2YcRxlPhuw+9YH+v9oIOH9ywjj2X4FA8jzrvZjtFB5sg+OPXJYY1kBai -XW8wGQiHC38Gsp1ij96vkqVg1CuAmlI/9ZqD6TRay9nVYlzmDuDfBpgOgHzKtB0TiGsOqCR3A9Du -W/PKaZE1OVbFbeP3PU9ekzgkyhjpJMuSA93MHD0JcOQg5PGurLtzaaNjOg9FD6FKmsLRY6zLEPg9 -5k4ot+vElbGs/V6r+kHLXZ1L3PR8du9nfwB6jdKgGlxNIuG12t12s9R23164i5jIFFTMaxeSt+BK -v0mUYQs4kI9dJGwlezt52eJ+na2fmKEG/HgUYFf47oB3sQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC -AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU+mCp62XF3RYUCE4MD42b4Pdkr2cwDQYJKoZI -hvcNAQELBQADggEBAFfDejaCnI2Y4qtAqkePx6db7XznPWZaOzG73/MWM5H8fHulwqZm46qwtyeY -P0nXYGdnPzZPSsvxFPpahygc7Y9BMsaV+X3avXtbwrAh449G3CE4Q3RM+zD4F3LBMvzIkRfEzFg3 -TgvMWvchNSiDbGAtROtSjFA9tWwS1/oJu2yySrHFieT801LYYRf+epSEj3m2M1m6D8QL4nCgS3gu -+sif/a+RZQp4OBXllxcU3fngLDT4ONCEIgDAFFEYKwLcMFrw6AF8NTojrwjkr6qOKEJJLvD1mTS+ -7Q9LGOHSJDy7XUe3IfKN0QqZjuNuPq1w4I+5ysxugTH2e5x6eeRncRg= ------END CERTIFICATE----- - -CA WoSign ECC Root -================== ------BEGIN CERTIFICATE----- -MIICCTCCAY+gAwIBAgIQaEpYcIBr8I8C+vbe6LCQkDAKBggqhkjOPQQDAzBGMQswCQYDVQQGEwJD -TjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMTEkNBIFdvU2lnbiBFQ0MgUm9v -dDAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMEYxCzAJBgNVBAYTAkNOMRowGAYDVQQK -ExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAxMSQ0EgV29TaWduIEVDQyBSb290MHYwEAYHKoZI -zj0CAQYFK4EEACIDYgAE4f2OuEMkq5Z7hcK6C62N4DrjJLnSsb6IOsq/Srj57ywvr1FQPEd1bPiU -t5v8KB7FVMxjnRZLU8HnIKvNrCXSf4/CwVqCXjCLelTOA7WRf6qU0NGKSMyCBSah1VES1ns2o0Iw -QDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqv3VWqP2h4syhf3R -MluARZPzA7gwCgYIKoZIzj0EAwMDaAAwZQIxAOSkhLCB1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0 -Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu -a/GRspBl9JrmkO5K ------END CERTIFICATE----- - SZAFIR ROOT CA2 =============== -----BEGIN CERTIFICATE----- @@ -3333,126 +2739,6 @@ GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR -----END CERTIFICATE----- -Certplus Root CA G1 -=================== ------BEGIN CERTIFICATE----- -MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV -BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe -Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD -ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN -r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx -Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj -BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/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TuEVV/xuZDDC -VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/ -+mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+ -qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo= ------END CERTIFICATE----- - -Certplus Root CA G2 -=================== ------BEGIN CERTIFICATE----- -MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT -AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x -NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0 -cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA -BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN -Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD -AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud -IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV -HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl -vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw== ------END CERTIFICATE----- - -OpenTrust Root CA G1 -==================== ------BEGIN CERTIFICATE----- -MIIFbzCCA1egAwIBAgISESCzk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hVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px -N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E -PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv -uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK -n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh -X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80 -nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm -GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/ -bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o -4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA -OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx ------END CERTIFICATE----- - -OpenTrust Root CA G2 -==================== ------BEGIN CERTIFICATE----- -MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV -BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy -MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM -C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yTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG -S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp -EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ -6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr -gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo -SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0 -YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm -u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK ------END CERTIFICATE----- - -OpenTrust Root CA G3 -==================== ------BEGIN CERTIFICATE----- -MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT -AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X -DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w -ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA -IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B -ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB -/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf -BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM -BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta -3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB ------END CERTIFICATE----- - ISRG Root X1 ============ -----BEGIN CERTIFICATE----- @@ -3644,3 +2930,547 @@ lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= -----END CERTIFICATE----- + +GDCA TrustAUTH R5 ROOT +====================== +-----BEGIN CERTIFICATE----- +MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw +BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD +DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow +YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ +IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy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wm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u +/ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F +hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs +J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC +jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g== +-----END CERTIFICATE----- + +SSL.com Root Certification Authority RSA +======================================== +-----BEGIN CERTIFICATE----- +MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM +BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x +MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw +MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx +EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM +LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD +ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C +Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8 +P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ej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+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ +vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI +Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y +wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI +WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k= +-----END CERTIFICATE----- + +SSL.com Root Certification Authority ECC +======================================== +-----BEGIN CERTIFICATE----- +MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV +BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv +BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy +MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO +BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv +bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA +BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+ +8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR +hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT +jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW +e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z +5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl +-----END CERTIFICATE----- + +SSL.com EV Root Certification Authority RSA R2 +============================================== +-----BEGIN CERTIFICATE----- +MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w +DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u +MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy +MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI +DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD +VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN +BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh +hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w +cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO +Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+ +B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53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EQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1 +hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX +9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w== +-----END CERTIFICATE----- + +SSL.com EV Root Certification Authority ECC +=========================================== +-----BEGIN CERTIFICATE----- +MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV +BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy +BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw +MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx +EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM +LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB +BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy +3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O +BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe +5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ +N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm +m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg== +-----END CERTIFICATE----- + +GlobalSign Root CA - R6 +======================= +-----BEGIN CERTIFICATE----- +MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX +R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds +b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i +YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs +U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss +grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE +3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF +vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM +PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+ +azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O +WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy +CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP +0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN +b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE +AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV +HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN +nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0 +lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY +BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym +Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr +3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1 +0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T +uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK +oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t +JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA= +-----END CERTIFICATE----- + +OISTE WISeKey Global Root GC CA +=============================== +-----BEGIN CERTIFICATE----- +MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGE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21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm +ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b +gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq +4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr +tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo +pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0 +sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql +CFF1pkgl +-----END CERTIFICATE----- + +GTS Root R2 +=========== +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG +EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv +b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG +A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk +k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo +7JUle3ah5mm5hRm9iYz+re026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MAuhd +-----END CERTIFICATE----- + +GTS Root R4 +=========== +-----BEGIN CERTIFICATE----- +MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV +UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg +UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE +ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq +hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa +6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj +QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV +2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI +N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x +zPKwTdb+mciUqXWi4w== +-----END CERTIFICATE----- + +UCA Global G2 Root +================== +-----BEGIN CERTIFICATE----- +MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG +EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x +NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU +cnVzdDEbMBkGA1UEAww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vuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9 +yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX +c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo +jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk +bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x +ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn +RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A== +-----END CERTIFICATE----- + +UCA Extended Validation Root +============================ +-----BEGIN CERTIFICATE----- +MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG +EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u +IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G +A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs +iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF +Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4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BNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi +GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc +GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi +djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr +dhh2n1ax +-----END CERTIFICATE----- + +Certigna Root CA +================ +-----BEGIN CERTIFICATE----- +MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE +BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ +MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda +MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz +MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC +DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX +stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz +KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8 +JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16 +XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhP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F+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ +6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH +hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG +MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2 +vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q +NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q ++Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih +U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx +iN66zB+Afko= +-----END CERTIFICATE----- + +emSign ECC Root CA - G3 +======================= +-----BEGIN CERTIFICATE----- +MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG +A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg +MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4 +MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11 +ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g +RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc +58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr +MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC +AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D +CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7 +jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj +-----END CERTIFICATE----- + +emSign Root CA - C1 +=================== +-----BEGIN CERTIFICATE----- +MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx +EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp +Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE +BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD +ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up +ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/ +Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX +OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V +I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms +lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+ +XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD +ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp +/6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1 +NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9 +wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ +BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI= +-----END CERTIFICATE----- + +emSign ECC Root CA - C3 +======================= +-----BEGIN CERTIFICATE----- +MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG +A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF +Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE +BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD +ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd +6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9 +SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA +B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA +MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU +ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ== +-----END CERTIFICATE----- + +Hongkong Post Root CA 3 +======================= +-----BEGIN CERTIFICATE----- +MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG +A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK +Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2 +MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv +bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX +SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz +iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf +jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim +5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe +sL4jp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7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY +hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB +60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq +dBb9HxEGmpv0 +-----END CERTIFICATE----- diff --git a/plugins/stripe/init.php b/plugins/stripe/init.php index 822cb63993..11ac713da5 100644 --- a/plugins/stripe/init.php +++ b/plugins/stripe/init.php @@ -1,119 +1,238 @@ create and manage Express or + * Custom accounts. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|\Stripe\StripeObject $business_profile Business information about the account. + * @property null|string $business_type The business type. + * @property \Stripe\StripeObject $capabilities + * @property bool $charges_enabled Whether the account can create live charges. + * @property \Stripe\StripeObject $company + * @property string $country The account's country. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $default_currency Three-letter ISO currency code representing the default currency for the account. This must be a currency that Stripe supports in the account's country. + * @property bool $details_submitted Whether account details have been submitted. Standard accounts cannot receive payouts before this is true. + * @property null|string $email The primary user's email address. + * @property \Stripe\Collection $external_accounts External accounts (bank accounts and debit cards) currently attached to this account + * @property \Stripe\Person $individual

This is an object representing a person associated with a Stripe account.

Related guide: Handling Identity Verification with the API.

+ * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property bool $payouts_enabled Whether Stripe can send payouts to this account. + * @property \Stripe\StripeObject $requirements + * @property null|\Stripe\StripeObject $settings Options for customizing how the account functions within Stripe. + * @property \Stripe\StripeObject $tos_acceptance + * @property string $type The Stripe account type. Can be standard, express, or custom. */ class Account extends ApiResource { - - const OBJECT_NAME = "account"; + const OBJECT_NAME = 'account'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\NestedResource; + use ApiOperations\Update; + + const BUSINESS_TYPE_COMPANY = 'company'; + const BUSINESS_TYPE_GOVERNMENT_ENTITY = 'government_entity'; + const BUSINESS_TYPE_INDIVIDUAL = 'individual'; + const BUSINESS_TYPE_NON_PROFIT = 'non_profit'; + + const CAPABILITY_CARD_PAYMENTS = 'card_payments'; + const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments'; + const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments'; + const CAPABILITY_TRANSFERS = 'transfers'; + + const CAPABILITY_STATUS_ACTIVE = 'active'; + const CAPABILITY_STATUS_INACTIVE = 'inactive'; + const CAPABILITY_STATUS_PENDING = 'pending'; + + const TYPE_CUSTOM = 'custom'; + const TYPE_EXPRESS = 'express'; + const TYPE_STANDARD = 'standard'; + use ApiOperations\Retrieve { retrieve as protected _retrieve; } - use ApiOperations\Update; public static function getSavedNestedResources() { static $savedNestedResources = null; - if ($savedNestedResources === null) { + if (null === $savedNestedResources) { $savedNestedResources = new Util\Set([ 'external_account', 'bank_account', ]); } + return $savedNestedResources; } - const PATH_EXTERNAL_ACCOUNTS = '/external_accounts'; - const PATH_LOGIN_LINKS = '/login_links'; - public function instanceUrl() { - if ($this['id'] === null) { + if (null === $this['id']) { return '/v1/account'; + } + + return parent::instanceUrl(); + } + + public function serializeParameters($force = false) + { + $update = parent::serializeParameters($force); + if (isset($this->_values['legal_entity'])) { + $entity = $this['legal_entity']; + if (isset($entity->_values['additional_owners'])) { + $owners = $entity['additional_owners']; + $entityUpdate = isset($update['legal_entity']) ? $update['legal_entity'] : []; + $entityUpdate['additional_owners'] = $this->serializeAdditionalOwners($entity, $owners); + $update['legal_entity'] = $entityUpdate; + } + } + if (isset($this->_values['individual'])) { + $individual = $this['individual']; + if (($individual instanceof Person) && !isset($update['individual'])) { + $update['individual'] = $individual->serializeParameters($force); + } + } + + return $update; + } + + private function serializeAdditionalOwners($legalEntity, $additionalOwners) + { + if (isset($legalEntity->_originalValues['additional_owners'])) { + $originalValue = $legalEntity->_originalValues['additional_owners']; } else { - return parent::instanceUrl(); + $originalValue = []; + } + if (($originalValue) && (\count($originalValue) > \count($additionalOwners))) { + throw new Exception\InvalidArgumentException( + 'You cannot delete an item from an array, you must instead set a new array' + ); + } + + $updateArr = []; + foreach ($additionalOwners as $i => $v) { + $update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v; + + if ([] !== $update) { + if (!$originalValue || + !\array_key_exists($i, $originalValue) || + ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { + $updateArr[$i] = $update; + } + } } + + return $updateArr; } /** - * @param array|string|null $id The ID of the account to retrieve, or an - * options array containing an `id` key. - * @param array|string|null $opts + * @param null|array|string $id the ID of the account to retrieve, or an + * options array containing an `id` key + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Account + * @return \Stripe\Account */ public static function retrieve($id = null, $opts = null) { - if (!$opts && is_string($id) && substr($id, 0, 3) === 'sk_') { + if (!$opts && \is_string($id) && 'sk_' === \substr($id, 0, 3)) { $opts = $id; $id = null; } + return self::_retrieve($id, $opts); } /** - * @param array|null $params - * @param array|string|null $opts + * @param null|array $clientId + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\StripeObject object containing the response from the API + */ + public function deauthorize($clientId = null, $opts = null) + { + $params = [ + 'client_id' => $clientId, + 'stripe_user_id' => $this->id, + ]; + + return OAuth::deauthorize($params, $opts); + } + + /** + * @param null|array $params + * @param null|array|string $opts * - * @return Account The rejected account. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of persons + */ + public function persons($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/persons'; + list($response, $opts) = $this->_request('get', $url, $params, $opts); + $obj = Util\Util::convertToStripeObject($response, $opts); + $obj->setLastResponse($response); + + return $obj; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Account the rejected account */ public function reject($params = null, $opts = null) { $url = $this->instanceUrl() . '/reject'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } + /* + * Capabilities methods + * We can not add the capabilities() method today as the Account object already has a + * capabilities property which is a hash and not the sub-list of capabilities. + */ + + const PATH_CAPABILITIES = '/capabilities'; + /** - * @param array|null $clientId - * @param array|string|null $opts + * @param string $id the ID of the account on which to retrieve the capabilities + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return StripeObject Object containing the response from the API. + * @return \Stripe\Collection the list of capabilities */ - public function deauthorize($clientId = null, $opts = null) + public static function allCapabilities($id, $params = null, $opts = null) { - $params = [ - 'client_id' => $clientId, - 'stripe_user_id' => $this->id, - ]; - return OAuth::deauthorize($params, $opts); + return self::_allNestedResources($id, static::PATH_CAPABILITIES, $params, $opts); } /** - * @param array|null $id The ID of the account on which to create the external account. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the account to which the capability belongs + * @param string $capabilityId the ID of the capability to retrieve + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return BankAccount|Card + * @return \Stripe\Capability + */ + public static function retrieveCapability($id, $capabilityId, $params = null, $opts = null) + { + return self::_retrieveNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts); + } + + /** + * @param string $id the ID of the account to which the capability belongs + * @param string $capabilityId the ID of the capability to update + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Capability + */ + public static function updateCapability($id, $capabilityId, $params = null, $opts = null) + { + return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts); + } + + const PATH_EXTERNAL_ACCOUNTS = '/external_accounts'; + + /** + * @param string $id the ID of the account on which to retrieve the external accounts + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of external accounts (BankAccount or Card) + */ + public static function allExternalAccounts($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts); + } + + /** + * @param string $id the ID of the account on which to create the external account + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BankAccount|\Stripe\Card */ public static function createExternalAccount($id, $params = null, $opts = null) { @@ -135,12 +294,29 @@ public static function createExternalAccount($id, $params = null, $opts = null) } /** - * @param array|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 array|null $params - * @param array|string|null $opts + * @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 null|array $params + * @param null|array|string $opts * - * @return BankAccount|Card + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BankAccount|\Stripe\Card + */ + public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null) + { + return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); + } + + /** + * @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 null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BankAccount|\Stripe\Card */ public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null) { @@ -148,93 +324,108 @@ public static function retrieveExternalAccount($id, $externalAccountId, $params } /** - * @param array|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 array|null $params - * @param array|string|null $opts + * @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 null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return BankAccount|Card + * @return \Stripe\BankAccount|\Stripe\Card */ public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } + const PATH_LOGIN_LINKS = '/login_links'; + /** - * @param array|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 array|null $params - * @param array|string|null $opts + * @param string $id the ID of the account on which to create the login link + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return BankAccount|Card + * @return \Stripe\LoginLink */ - public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null) + public static function createLoginLink($id, $params = null, $opts = null) { - return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); + return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts); } + const PATH_PERSONS = '/persons'; + /** - * @param array|null $id The ID of the account on which to retrieve the external accounts. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the account on which to retrieve the persons + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return BankAccount|Card + * @return \Stripe\Collection the list of persons */ - public static function allExternalAccounts($id, $params = null, $opts = null) + public static function allPersons($id, $params = null, $opts = null) { - return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts); + return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts); } /** - * @param array|null $id The ID of the account on which to create the login link. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the account on which to create the person + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return LoginLink + * @return \Stripe\Person */ - public static function createLoginLink($id, $params = null, $opts = null) + public static function createPerson($id, $params = null, $opts = null) { - return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts); + return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts); } - public function serializeParameters($force = false) + /** + * @param string $id the ID of the account to which the person belongs + * @param string $personId the ID of the person to delete + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Person + */ + public static function deletePerson($id, $personId, $params = null, $opts = null) { - $update = parent::serializeParameters($force); - if (isset($this->_values['legal_entity'])) { - $entity = $this['legal_entity']; - if (isset($entity->_values['additional_owners'])) { - $owners = $entity['additional_owners']; - $entityUpdate = isset($update['legal_entity']) ? $update['legal_entity'] : []; - $entityUpdate['additional_owners'] = $this->serializeAdditionalOwners($entity, $owners); - $update['legal_entity'] = $entityUpdate; - } - } - return $update; + return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } - private function serializeAdditionalOwners($legalEntity, $additionalOwners) + /** + * @param string $id the ID of the account to which the person belongs + * @param string $personId the ID of the person to retrieve + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Person + */ + public static function retrievePerson($id, $personId, $params = null, $opts = null) { - if (isset($legalEntity->_originalValues['additional_owners'])) { - $originalValue = $legalEntity->_originalValues['additional_owners']; - } else { - $originalValue = []; - } - if (($originalValue) && (count($originalValue) > count($additionalOwners))) { - throw new \InvalidArgumentException( - "You cannot delete an item from an array, you must instead set a new array" - ); - } - - $updateArr = []; - foreach ($additionalOwners as $i => $v) { - $update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v; + return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); + } - if ($update !== []) { - if (!$originalValue || ($update != $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { - $updateArr[$i] = $update; - } - } - } - return $updateArr; + /** + * @param string $id the ID of the account to which the person belongs + * @param string $personId the ID of the person to update + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Person + */ + public static function updatePerson($id, $personId, $params = null, $opts = null) + { + return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } } diff --git a/plugins/stripe/lib/AccountLink.php b/plugins/stripe/lib/AccountLink.php new file mode 100644 index 0000000000..24a9e68aa5 --- /dev/null +++ b/plugins/stripe/lib/AccountLink.php @@ -0,0 +1,26 @@ +Connect + * Onboarding. + * + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property int $expires_at The timestamp at which this account link will expire. + * @property string $url The URL for the account link. + */ +class AccountLink extends ApiResource +{ + const OBJECT_NAME = 'account_link'; + + use ApiOperations\Create; +} diff --git a/plugins/stripe/lib/AlipayAccount.php b/plugins/stripe/lib/AlipayAccount.php index 70a281bd76..1d6a5096ff 100644 --- a/plugins/stripe/lib/AlipayAccount.php +++ b/plugins/stripe/lib/AlipayAccount.php @@ -3,17 +3,14 @@ namespace Stripe; /** - * Class AlipayAccount - * - * @package Stripe + * Class AlipayAccount. * * @deprecated Alipay accounts are deprecated. Please use the sources API instead. - * @link https://stripe.com/docs/sources/alipay + * @see https://stripe.com/docs/sources/alipay */ class AlipayAccount extends ApiResource { - - const OBJECT_NAME = "alipay_account"; + const OBJECT_NAME = 'alipay_account'; use ApiOperations\Delete; use ApiOperations\Update; @@ -29,44 +26,50 @@ public function instanceUrl() $parent = $this['customer']; $path = 'sources'; } else { - $msg = "Alipay accounts cannot be accessed without a customer ID."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Alipay accounts cannot be accessed without a customer ID.'; + + throw new Exception\UnexpectedValueException($msg); } - $parentExtn = urlencode(Util\Util::utf8($parent)); - $extn = urlencode(Util\Util::utf8($this['id'])); - return "$base/$parentExtn/$path/$extn"; + $parentExtn = \urlencode(Util\Util::utf8($parent)); + $extn = \urlencode(Util\Util::utf8($this['id'])); + + return "{$base}/{$parentExtn}/{$path}/{$extn}"; } /** * @param array|string $_id - * @param array|string|null $_opts + * @param null|array|string $_opts * - * @throws \Stripe\Error\InvalidRequest + * @throws \Stripe\Exception\BadMethodCallException * * @deprecated Alipay accounts are deprecated. Please use the sources API instead. - * @link https://stripe.com/docs/sources/alipay + * @see https://stripe.com/docs/sources/alipay */ public static function retrieve($_id, $_opts = null) { - $msg = "Alipay accounts cannot be accessed without a customer ID. " . - "Retrieve an Alipay account using \$customer->sources->retrieve('alipay_account_id') instead."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Alipay accounts cannot be retrieved without a customer ID. ' . + 'Retrieve an Alipay account using `Customer::retrieveSource(' . + "'customer_id', 'alipay_account_id')`."; + + throw new Exception\BadMethodCallException($msg); } /** * @param string $_id - * @param array|null $_params - * @param array|string|null $_options + * @param null|array $_params + * @param null|array|string $_options * - * @throws \Stripe\Error\InvalidRequest + * @throws \Stripe\Exception\BadMethodCallException * * @deprecated Alipay accounts are deprecated. Please use the sources API instead. - * @link https://stripe.com/docs/sources/alipay + * @see https://stripe.com/docs/sources/alipay */ public static function update($_id, $_params = null, $_options = null) { - $msg = "Alipay accounts cannot be accessed without a customer ID. " . - "Call save() on \$customer->sources->retrieve('alipay_account_id') instead."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Alipay accounts cannot be updated without a customer ID. ' . + 'Update an Alipay account using `Customer::updateSource(' . + "'customer_id', 'alipay_account_id', \$updateParams)`."; + + throw new Exception\BadMethodCallException($msg); } } diff --git a/plugins/stripe/lib/ApiOperations/All.php b/plugins/stripe/lib/ApiOperations/All.php index 2762748f95..ff2955d186 100644 --- a/plugins/stripe/lib/ApiOperations/All.php +++ b/plugins/stripe/lib/ApiOperations/All.php @@ -10,8 +10,10 @@ trait All { /** - * @param array|null $params - * @param array|string|null $opts + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Collection of ApiResources */ @@ -22,13 +24,14 @@ public static function all($params = null, $opts = null) list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); - if (!is_a($obj, 'Stripe\\Collection')) { - $class = get_class($obj); - $message = "Expected type \"Stripe\\Collection\", got \"$class\" instead"; - throw new \Stripe\Error\Api($message); + if (!($obj instanceof \Stripe\Collection)) { + throw new \Stripe\Exception\UnexpectedValueException( + 'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.' + ); } $obj->setLastResponse($response); - $obj->setRequestParams($params); + $obj->setFilters($params); + return $obj; } } diff --git a/plugins/stripe/lib/ApiOperations/Create.php b/plugins/stripe/lib/ApiOperations/Create.php index 0fb341d029..c4351321d4 100644 --- a/plugins/stripe/lib/ApiOperations/Create.php +++ b/plugins/stripe/lib/ApiOperations/Create.php @@ -10,10 +10,12 @@ trait Create { /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $options * - * @return \Stripe\ApiResource The created resource. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return static the created resource */ public static function create($params = null, $options = null) { @@ -23,6 +25,7 @@ public static function create($params = null, $options = null) list($response, $opts) = static::_staticRequest('post', $url, $params, $options); $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); + return $obj; } } diff --git a/plugins/stripe/lib/ApiOperations/Delete.php b/plugins/stripe/lib/ApiOperations/Delete.php index 7df6797919..c6082ff9f4 100644 --- a/plugins/stripe/lib/ApiOperations/Delete.php +++ b/plugins/stripe/lib/ApiOperations/Delete.php @@ -10,10 +10,12 @@ trait Delete { /** - * @param array|null $params - * @param array|string|null $opts + * @param null|array $params + * @param null|array|string $opts * - * @return \Stripe\ApiResource The deleted resource. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return static the deleted resource */ public function delete($params = null, $opts = null) { @@ -22,6 +24,7 @@ public function delete($params = null, $opts = null) $url = $this->instanceUrl(); list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/ApiOperations/NestedResource.php b/plugins/stripe/lib/ApiOperations/NestedResource.php index 1c3a73f45d..180cacd2cc 100644 --- a/plugins/stripe/lib/ApiOperations/NestedResource.php +++ b/plugins/stripe/lib/ApiOperations/NestedResource.php @@ -12,8 +12,8 @@ trait NestedResource /** * @param string $method * @param string $url - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $options * * @return \Stripe\StripeObject */ @@ -24,92 +24,112 @@ protected static function _nestedResourceOperation($method, $url, $params = null list($response, $opts) = static::_staticRequest($method, $url, $params, $options); $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); + return $obj; } /** * @param string $id * @param string $nestedPath - * @param string|null $nestedId + * @param null|string $nestedId * * @return string */ protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null) { $url = static::resourceUrl($id) . $nestedPath; - if ($nestedId !== null) { - $url .= "/$nestedId"; + if (null !== $nestedId) { + $url .= "/{$nestedId}"; } + return $url; } /** * @param string $id * @param string $nestedPath - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $options + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\StripeObject */ protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath); + return self::_nestedResourceOperation('post', $url, $params, $options); } /** * @param string $id * @param string $nestedPath - * @param array|null $params - * @param array|string|null $options + * @param null|string $nestedId + * @param null|array $params + * @param null|array|string $options + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\StripeObject */ protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); + return self::_nestedResourceOperation('get', $url, $params, $options); } /** * @param string $id * @param string $nestedPath - * @param array|null $params - * @param array|string|null $options + * @param null|string $nestedId + * @param null|array $params + * @param null|array|string $options + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\StripeObject */ protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); + return self::_nestedResourceOperation('post', $url, $params, $options); } /** * @param string $id * @param string $nestedPath - * @param array|null $params - * @param array|string|null $options + * @param null|string $nestedId + * @param null|array $params + * @param null|array|string $options + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\StripeObject */ protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); + return self::_nestedResourceOperation('delete', $url, $params, $options); } /** * @param string $id * @param string $nestedPath - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $options + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\StripeObject */ protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null) { $url = static::_nestedResourceUrl($id, $nestedPath); + return self::_nestedResourceOperation('get', $url, $params, $options); } } diff --git a/plugins/stripe/lib/ApiOperations/Request.php b/plugins/stripe/lib/ApiOperations/Request.php index c6b06585ad..e300dc13fb 100644 --- a/plugins/stripe/lib/ApiOperations/Request.php +++ b/plugins/stripe/lib/ApiOperations/Request.php @@ -10,18 +10,19 @@ trait Request { /** - * @param array|null|mixed $params The list of parameters to validate + * @param null|array|mixed $params The list of parameters to validate * - * @throws \Stripe\Error\Api if $params exists and is not an array + * @throws \Stripe\Exception\InvalidArgumentException if $params exists and is not an array */ protected static function _validateParams($params = null) { - if ($params && !is_array($params)) { - $message = "You must pass an array as the first argument to Stripe API " - . "method calls. (HINT: an example call to create a charge " + if ($params && !\is_array($params)) { + $message = 'You must pass an array as the first argument to Stripe API ' + . 'method calls. (HINT: an example call to create a charge ' . "would be: \"Stripe\\Charge::create(['amount' => 100, " . "'currency' => 'usd', 'source' => 'tok_1234'])\")"; - throw new \Stripe\Error\Api($message); + + throw new \Stripe\Exception\InvalidArgumentException($message); } } @@ -29,7 +30,9 @@ protected static function _validateParams($params = null) * @param string $method HTTP method ('get', 'post', etc.) * @param string $url URL for the request * @param array $params list of parameters for the request - * @param array|string|null $options + * @param null|array|string $options + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return array tuple containing (the JSON response, $options) */ @@ -38,6 +41,7 @@ protected function _request($method, $url, $params = [], $options = null) $opts = $this->_opts->merge($options); list($resp, $options) = static::_staticRequest($method, $url, $params, $opts); $this->setLastResponse($resp); + return [$resp->json, $options]; } @@ -45,16 +49,20 @@ protected function _request($method, $url, $params = [], $options = null) * @param string $method HTTP method ('get', 'post', etc.) * @param string $url URL for the request * @param array $params list of parameters for the request - * @param array|string|null $options + * @param null|array|string $options + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return array tuple containing (the JSON response, $options) */ protected static function _staticRequest($method, $url, $params, $options) { $opts = \Stripe\Util\RequestOptions::parse($options); - $requestor = new \Stripe\ApiRequestor($opts->apiKey, static::baseUrl()); + $baseUrl = isset($opts->apiBase) ? $opts->apiBase : static::baseUrl(); + $requestor = new \Stripe\ApiRequestor($opts->apiKey, $baseUrl); list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers); $opts->discardNonPersistentHeaders(); + return [$response, $opts]; } } diff --git a/plugins/stripe/lib/ApiOperations/Retrieve.php b/plugins/stripe/lib/ApiOperations/Retrieve.php index a037326b3e..5170afb327 100644 --- a/plugins/stripe/lib/ApiOperations/Retrieve.php +++ b/plugins/stripe/lib/ApiOperations/Retrieve.php @@ -11,17 +11,20 @@ trait Retrieve { /** - * @param array|string $id The ID of the API resource to retrieve, - * or an options array containing an `id` key. - * @param array|string|null $opts + * @param array|string $id the ID of the API resource to retrieve, + * or an options array containing an `id` key + * @param null|array|string $opts * - * @return \Stripe\StripeObject + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return static */ public static function retrieve($id, $opts = null) { $opts = \Stripe\Util\RequestOptions::parse($opts); $instance = new static($id, $opts); $instance->refresh(); + return $instance; } } diff --git a/plugins/stripe/lib/ApiOperations/Update.php b/plugins/stripe/lib/ApiOperations/Update.php index 0683e77af1..688f0808a7 100644 --- a/plugins/stripe/lib/ApiOperations/Update.php +++ b/plugins/stripe/lib/ApiOperations/Update.php @@ -11,11 +11,13 @@ trait Update { /** - * @param string $id The ID of the resource to update. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the resource to update + * @param null|array $params + * @param null|array|string $opts * - * @return \Stripe\ApiResource The updated resource. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return static the updated resource */ public static function update($id, $params = null, $opts = null) { @@ -25,22 +27,26 @@ public static function update($id, $params = null, $opts = null) list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); + return $obj; } /** - * @param array|string|null $opts + * @param null|array|string $opts * - * @return \Stripe\ApiResource The saved resource. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return static the saved resource */ public function save($opts = null) { $params = $this->serializeParameters(); - if (count($params) > 0) { + if (\count($params) > 0) { $url = $this->instanceUrl(); list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); } + return $this; } } diff --git a/plugins/stripe/lib/ApiRequestor.php b/plugins/stripe/lib/ApiRequestor.php index 4a147d01ad..d3d7e7af10 100644 --- a/plugins/stripe/lib/ApiRequestor.php +++ b/plugins/stripe/lib/ApiRequestor.php @@ -3,14 +3,12 @@ namespace Stripe; /** - * Class ApiRequestor - * - * @package Stripe + * Class ApiRequestor. */ class ApiRequestor { /** - * @var string|null + * @var null|string */ private $_apiKey; @@ -24,11 +22,18 @@ class ApiRequestor */ private static $_httpClient; + /** + * @var RequestTelemetry + */ + private static $requestTelemetry; + + private static $OPTIONS_KEYS = ['api_key', 'idempotency_key', 'stripe_account', 'stripe_version', 'api_base']; + /** * ApiRequestor constructor. * - * @param string|null $apiKey - * @param string|null $apiBase + * @param null|string $apiKey + * @param null|string $apiBase */ public function __construct($apiKey = null, $apiBase = null) { @@ -40,53 +45,71 @@ public function __construct($apiKey = null, $apiBase = null) } /** + * Creates a telemetry json blob for use in 'X-Stripe-Client-Telemetry' headers. + * * @static * - * @param ApiResource|bool|array|mixed $d + * @param RequestTelemetry $requestTelemetry * - * @return ApiResource|array|string|mixed + * @return string + */ + private static function _telemetryJson($requestTelemetry) + { + $payload = [ + 'last_request_metrics' => [ + 'request_id' => $requestTelemetry->requestId, + 'request_duration_ms' => $requestTelemetry->requestDuration, + ], + ]; + + $result = \json_encode($payload); + if (false !== $result) { + return $result; + } + Stripe::getLogger()->error('Serializing telemetry payload failed!'); + + return '{}'; + } + + /** + * @static + * + * @param ApiResource|array|bool|mixed $d + * + * @return ApiResource|array|mixed|string */ private static function _encodeObjects($d) { if ($d instanceof ApiResource) { return Util\Util::utf8($d->id); - } elseif ($d === true) { + } + if (true === $d) { return 'true'; - } elseif ($d === false) { + } + if (false === $d) { return 'false'; - } elseif (is_array($d)) { + } + if (\is_array($d)) { $res = []; foreach ($d as $k => $v) { $res[$k] = self::_encodeObjects($v); } + return $res; - } else { - return Util\Util::utf8($d); } + + return Util\Util::utf8($d); } /** * @param string $method * @param string $url - * @param array|null $params - * @param array|null $headers + * @param null|array $params + * @param null|array $headers + * + * @throws Exception\ApiErrorException * - * @return array An array whose first element is an API response and second - * element is the API key used to make the request. - * @throws Error\Api - * @throws Error\Authentication - * @throws Error\Card - * @throws Error\InvalidRequest - * @throws Error\OAuth\InvalidClient - * @throws Error\OAuth\InvalidGrant - * @throws Error\OAuth\InvalidRequest - * @throws Error\OAuth\InvalidScope - * @throws Error\OAuth\UnsupportedGrantType - * @throws Error\OAuth\UnsupportedResponseType - * @throws Error\Permission - * @throws Error\RateLimit - * @throws Error\Idempotency - * @throws Error\ApiConnection + * @return array tuple containing (ApiReponse, API key) */ public function request($method, $url, $params = null, $headers = null) { @@ -96,48 +119,32 @@ public function request($method, $url, $params = null, $headers = null) $this->_requestRaw($method, $url, $params, $headers); $json = $this->_interpretResponse($rbody, $rcode, $rheaders); $resp = new ApiResponse($rbody, $rcode, $rheaders, $json); + return [$resp, $myApiKey]; } /** - * @param string $rbody A JSON string. + * @param string $rbody a JSON string * @param int $rcode * @param array $rheaders * @param array $resp * - * @throws Error\InvalidRequest if the error is caused by the user. - * @throws Error\Authentication if the error is caused by a lack of - * permissions. - * @throws Error\Permission if the error is caused by insufficient - * permissions. - * @throws Error\Card if the error is the error code is 402 (payment - * required) - * @throws Error\InvalidRequest if the error is caused by the user. - * @throws Error\Idempotency if the error is caused by an idempotency key. - * @throws Error\OAuth\InvalidClient - * @throws Error\OAuth\InvalidGrant - * @throws Error\OAuth\InvalidRequest - * @throws Error\OAuth\InvalidScope - * @throws Error\OAuth\UnsupportedGrantType - * @throws Error\OAuth\UnsupportedResponseType - * @throws Error\Permission if the error is caused by insufficient - * permissions. - * @throws Error\RateLimit if the error is caused by too many requests - * hitting the API. - * @throws Error\Api otherwise. + * @throws Exception\UnexpectedValueException + * @throws Exception\ApiErrorException */ public function handleErrorResponse($rbody, $rcode, $rheaders, $resp) { - if (!is_array($resp) || !isset($resp['error'])) { - $msg = "Invalid response object from API: $rbody " - . "(HTTP response code was $rcode)"; - throw new Error\Api($msg, $rcode, $rbody, $resp, $rheaders); + if (!\is_array($resp) || !isset($resp['error'])) { + $msg = "Invalid response object from API: {$rbody} " + . "(HTTP response code was {$rcode})"; + + throw new Exception\UnexpectedValueException($msg); } $errorData = $resp['error']; $error = null; - if (is_string($errorData)) { + if (\is_string($errorData)) { $error = self::_specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorData); } if (!$error) { @@ -156,7 +163,7 @@ public function handleErrorResponse($rbody, $rcode, $rheaders, $resp) * @param array $resp * @param array $errorData * - * @return Error\RateLimit|Error\Idempotency|Error\InvalidRequest|Error\Authentication|Error\Card|Error\Permission|Error\Api + * @return Exception\ApiErrorException */ private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData) { @@ -164,44 +171,45 @@ private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $err $param = isset($errorData['param']) ? $errorData['param'] : null; $code = isset($errorData['code']) ? $errorData['code'] : null; $type = isset($errorData['type']) ? $errorData['type'] : null; + $declineCode = isset($errorData['decline_code']) ? $errorData['decline_code'] : null; switch ($rcode) { case 400: // 'rate_limit' code is deprecated, but left here for backwards compatibility // for API versions earlier than 2015-09-08 - if ($code == 'rate_limit') { - return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders); + if ('rate_limit' === $code) { + return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); } - if ($type == 'idempotency_error') { - return new Error\Idempotency($msg, $rcode, $rbody, $resp, $rheaders); + if ('idempotency_error' === $type) { + return Exception\IdempotencyException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); } - // intentional fall-through + // no break case 404: - return new Error\InvalidRequest($msg, $param, $rcode, $rbody, $resp, $rheaders); + return Exception\InvalidRequestException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); case 401: - return new Error\Authentication($msg, $rcode, $rbody, $resp, $rheaders); + return Exception\AuthenticationException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); case 402: - return new Error\Card($msg, $param, $code, $rcode, $rbody, $resp, $rheaders); + return Exception\CardException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $declineCode, $param); case 403: - return new Error\Permission($msg, $rcode, $rbody, $resp, $rheaders); + return Exception\PermissionException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); case 429: - return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders); + return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); default: - return new Error\Api($msg, $rcode, $rbody, $resp, $rheaders); + return Exception\UnknownApiErrorException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); } } /** * @static * - * @param string|bool $rbody + * @param bool|string $rbody * @param int $rcode * @param array $rheaders * @param array $resp * @param string $errorCode * - * @return null|Error\OAuth\InvalidClient|Error\OAuth\InvalidGrant|Error\OAuth\InvalidRequest|Error\OAuth\InvalidScope|Error\OAuth\UnsupportedGrantType|Error\OAuth\UnsupportedResponseType + * @return Exception\OAuth\OAuthErrorException */ private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorCode) { @@ -209,20 +217,20 @@ private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $e switch ($errorCode) { case 'invalid_client': - return new Error\OAuth\InvalidClient($errorCode, $description, $rcode, $rbody, $resp, $rheaders); + return Exception\OAuth\InvalidClientException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'invalid_grant': - return new Error\OAuth\InvalidGrant($errorCode, $description, $rcode, $rbody, $resp, $rheaders); + return Exception\OAuth\InvalidGrantException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'invalid_request': - return new Error\OAuth\InvalidRequest($errorCode, $description, $rcode, $rbody, $resp, $rheaders); + return Exception\OAuth\InvalidRequestException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'invalid_scope': - return new Error\OAuth\InvalidScope($errorCode, $description, $rcode, $rbody, $resp, $rheaders); + return Exception\OAuth\InvalidScopeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'unsupported_grant_type': - return new Error\OAuth\UnsupportedGrantType($errorCode, $description, $rcode, $rbody, $resp, $rheaders); + return Exception\OAuth\UnsupportedGrantTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); case 'unsupported_response_type': - return new Error\OAuth\UnsupportedResponseType($errorCode, $description, $rcode, $rbody, $resp, $rheaders); + return Exception\OAuth\UnsupportedResponseTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); + default: + return Exception\OAuth\UnknownOAuthErrorException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); } - - return null; } /** @@ -234,18 +242,40 @@ private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $e */ private static function _formatAppInfo($appInfo) { - if ($appInfo !== null) { + if (null !== $appInfo) { $string = $appInfo['name']; - if ($appInfo['version'] !== null) { + if (null !== $appInfo['version']) { $string .= '/' . $appInfo['version']; } - if ($appInfo['url'] !== null) { + if (null !== $appInfo['url']) { $string .= ' (' . $appInfo['url'] . ')'; } + return $string; - } else { - return null; } + + return null; + } + + /** + * @static + * + * @param string $disabledFunctionsOutput - String value of the 'disable_function' setting, as output by \ini_get('disable_functions') + * @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled + * @param mixed $disableFunctionsOutput + * + * @return bool + */ + private static function _isDisabled($disableFunctionsOutput, $functionName) + { + $disabledFunctions = \explode(',', $disableFunctionsOutput); + foreach ($disabledFunctions as $disabledFunction) { + if (\trim($disabledFunction) === $functionName) { + return true; + } + } + + return false; } /** @@ -260,8 +290,9 @@ private static function _defaultHeaders($apiKey, $clientInfo = null) { $uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION; - $langVersion = phpversion(); - $uname = php_uname(); + $langVersion = \PHP_VERSION; + $uname_disabled = static::_isDisabled(\ini_get('disable_functions'), 'php_uname'); + $uname = $uname_disabled ? '(disabled)' : \php_uname(); $appInfo = Stripe::getAppInfo(); $ua = [ @@ -272,31 +303,30 @@ private static function _defaultHeaders($apiKey, $clientInfo = null) 'uname' => $uname, ]; if ($clientInfo) { - $ua = array_merge($clientInfo, $ua); + $ua = \array_merge($clientInfo, $ua); } - if ($appInfo !== null) { + if (null !== $appInfo) { $uaString .= ' ' . self::_formatAppInfo($appInfo); $ua['application'] = $appInfo; } - $defaultHeaders = [ - 'X-Stripe-Client-User-Agent' => json_encode($ua), + return [ + 'X-Stripe-Client-User-Agent' => \json_encode($ua), 'User-Agent' => $uaString, 'Authorization' => 'Bearer ' . $apiKey, ]; - return $defaultHeaders; } /** * @param string $method * @param string $url - * @param array $params - * @param array $headers + * @param array $params + * @param array $headers + * + * @throws Exception\AuthenticationException + * @throws Exception\ApiConnectionException * * @return array - * @throws Error\Api - * @throws Error\ApiConnection - * @throws Error\Authentication */ private function _requestRaw($method, $url, $params, $headers) { @@ -310,18 +340,34 @@ private function _requestRaw($method, $url, $params, $headers) . '"Stripe::setApiKey()". You can generate API keys from ' . 'the Stripe web interface. See https://stripe.com/api for ' . 'details, or email support@stripe.com if you have any questions.'; - throw new Error\Authentication($msg); + + throw new Exception\AuthenticationException($msg); } // Clients can supply arbitrary additional keys to be included in the // X-Stripe-Client-User-Agent header via the optional getUserAgentInfo() // method $clientUAInfo = null; - if (method_exists($this->httpClient(), 'getUserAgentInfo')) { + if (\method_exists($this->httpClient(), 'getUserAgentInfo')) { $clientUAInfo = $this->httpClient()->getUserAgentInfo(); } - $absUrl = $this->_apiBase.$url; + if ($params && \is_array($params)) { + $optionKeysInParams = \array_filter( + static::$OPTIONS_KEYS, + function ($key) use ($params) { + return \array_key_exists($key, $params); + } + ); + if (\count($optionKeysInParams) > 0) { + $message = \sprintf('Options found in $params: %s. Options should ' + . 'be passed in their own array after $params. (HINT: pass an ' + . 'empty array to $params if you do not have any.)', \implode(', ', $optionKeysInParams)); + \trigger_error($message, \E_USER_WARNING); + } + } + + $absUrl = $this->_apiBase . $url; $params = self::_encodeObjects($params); $defaultHeaders = $this->_defaultHeaders($myApiKey, $clientUAInfo); if (Stripe::$apiVersion) { @@ -332,13 +378,16 @@ private function _requestRaw($method, $url, $params, $headers) $defaultHeaders['Stripe-Account'] = Stripe::$accountId; } + if (Stripe::$enableTelemetry && null !== self::$requestTelemetry) { + $defaultHeaders['X-Stripe-Client-Telemetry'] = self::_telemetryJson(self::$requestTelemetry); + } + $hasFile = false; - $hasCurlFile = class_exists('\CURLFile', false); foreach ($params as $k => $v) { - if (is_resource($v)) { + if (\is_resource($v)) { $hasFile = true; - $params[$k] = self::_processResourceParam($v, $hasCurlFile); - } elseif ($hasCurlFile && $v instanceof \CURLFile) { + $params[$k] = self::_processResourceParam($v); + } elseif ($v instanceof \CURLFile) { $hasFile = true; } } @@ -349,13 +398,15 @@ private function _requestRaw($method, $url, $params, $headers) $defaultHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; } - $combinedHeaders = array_merge($defaultHeaders, $headers); + $combinedHeaders = \array_merge($defaultHeaders, $headers); $rawHeaders = []; foreach ($combinedHeaders as $header => $value) { $rawHeaders[] = $header . ': ' . $value; } + $requestStartMs = Util\Util::currentTimeMillis(); + list($rbody, $rcode, $rheaders) = $this->httpClient()->request( $method, $absUrl, @@ -363,37 +414,43 @@ private function _requestRaw($method, $url, $params, $headers) $params, $hasFile ); + + if (isset($rheaders['request-id']) + && \is_string($rheaders['request-id']) + && \strlen($rheaders['request-id']) > 0) { + self::$requestTelemetry = new RequestTelemetry( + $rheaders['request-id'], + Util\Util::currentTimeMillis() - $requestStartMs + ); + } + return [$rbody, $rcode, $rheaders, $myApiKey]; } /** * @param resource $resource - * @param bool $hasCurlFile + * + * @throws Exception\InvalidArgumentException * * @return \CURLFile|string - * @throws Error\Api */ - private function _processResourceParam($resource, $hasCurlFile) + private function _processResourceParam($resource) { - if (get_resource_type($resource) !== 'stream') { - throw new Error\Api( + if ('stream' !== \get_resource_type($resource)) { + throw new Exception\InvalidArgumentException( 'Attempted to upload a resource that is not a stream' ); } - $metaData = stream_get_meta_data($resource); - if ($metaData['wrapper_type'] !== 'plainfile') { - throw new Error\Api( + $metaData = \stream_get_meta_data($resource); + if ('plainfile' !== $metaData['wrapper_type']) { + throw new Exception\InvalidArgumentException( 'Only plainfile resource streams are supported' ); } - if ($hasCurlFile) { - // We don't have the filename or mimetype, but the API doesn't care - return new \CURLFile($metaData['uri']); - } else { - return '@'.$metaData['uri']; - } + // We don't have the filename or mimetype, but the API doesn't care + return new \CURLFile($metaData['uri']); } /** @@ -401,34 +458,26 @@ private function _processResourceParam($resource, $hasCurlFile) * @param int $rcode * @param array $rheaders * - * @return mixed - * @throws Error\Api - * @throws Error\Authentication - * @throws Error\Card - * @throws Error\InvalidRequest - * @throws Error\OAuth\InvalidClient - * @throws Error\OAuth\InvalidGrant - * @throws Error\OAuth\InvalidRequest - * @throws Error\OAuth\InvalidScope - * @throws Error\OAuth\UnsupportedGrantType - * @throws Error\OAuth\UnsupportedResponseType - * @throws Error\Permission - * @throws Error\RateLimit - * @throws Error\Idempotency + * @throws Exception\UnexpectedValueException + * @throws Exception\ApiErrorException + * + * @return array */ private function _interpretResponse($rbody, $rcode, $rheaders) { - $resp = json_decode($rbody, true); - $jsonError = json_last_error(); - if ($resp === null && $jsonError !== JSON_ERROR_NONE) { - $msg = "Invalid response body from API: $rbody " - . "(HTTP response code was $rcode, json_last_error() was $jsonError)"; - throw new Error\Api($msg, $rcode, $rbody); + $resp = \json_decode($rbody, true); + $jsonError = \json_last_error(); + if (null === $resp && \JSON_ERROR_NONE !== $jsonError) { + $msg = "Invalid response body from API: {$rbody} " + . "(HTTP response code was {$rcode}, json_last_error() was {$jsonError})"; + + throw new Exception\UnexpectedValueException($msg, $rcode); } if ($rcode < 200 || $rcode >= 300) { $this->handleErrorResponse($rbody, $rcode, $rheaders, $resp); } + return $resp; } @@ -442,6 +491,16 @@ public static function setHttpClient($client) self::$_httpClient = $client; } + /** + * @static + * + * Resets any stateful telemetry data + */ + public static function resetTelemetry() + { + self::$requestTelemetry = null; + } + /** * @return HttpClient\ClientInterface */ @@ -450,6 +509,7 @@ private function httpClient() if (!self::$_httpClient) { self::$_httpClient = HttpClient\CurlClient::instance(); } + return self::$_httpClient; } } diff --git a/plugins/stripe/lib/ApiResource.php b/plugins/stripe/lib/ApiResource.php index fe59432168..064f99c1a8 100644 --- a/plugins/stripe/lib/ApiResource.php +++ b/plugins/stripe/lib/ApiResource.php @@ -3,9 +3,7 @@ namespace Stripe; /** - * Class ApiResource - * - * @package Stripe + * Class ApiResource. */ abstract class ApiResource extends StripeObject { @@ -21,14 +19,15 @@ abstract class ApiResource extends StripeObject public static function getSavedNestedResources() { static $savedNestedResources = null; - if ($savedNestedResources === null) { + if (null === $savedNestedResources) { $savedNestedResources = new Util\Set(); } + return $savedNestedResources; } /** - * @var boolean A flag that can be set a behavior that will cause this + * @var bool A flag that can be set a behavior that will cause this * resource to be encoded and sent up along with an update of its parent * resource. This is usually not desirable because resources are updated * individually on their own endpoints, but there are certain cases, @@ -39,16 +38,17 @@ public static function getSavedNestedResources() public function __set($k, $v) { parent::__set($k, $v); - $v = $this->$k; + $v = $this->{$k}; if ((static::getSavedNestedResources()->includes($k)) && ($v instanceof ApiResource)) { $v->saveWithParent = true; } - return $v; } /** - * @return ApiResource The refreshed resource. + * @throws Exception\ApiErrorException + * + * @return ApiResource the refreshed resource */ public function refresh() { @@ -63,11 +63,12 @@ public function refresh() ); $this->setLastResponse($response); $this->refreshFrom($response->json, $this->_opts); + return $this; } /** - * @return string The base URL for the given class. + * @return string the base URL for the given class */ public static function baseUrl() { @@ -75,35 +76,42 @@ public static function baseUrl() } /** - * @return string The endpoint URL for the given class. + * @return string the endpoint URL for the given class */ public static function classUrl() { // Replace dots with slashes for namespaced resources, e.g. if the object's name is // "foo.bar", then its URL will be "/v1/foo/bars". - $base = str_replace('.', '/', static::OBJECT_NAME); - return "/v1/${base}s"; + $base = \str_replace('.', '/', static::OBJECT_NAME); + + return "/v1/{$base}s"; } /** - * @return string The instance endpoint URL for the given class. + * @param null|string $id the ID of the resource + * + * @throws Exception\UnexpectedValueException if $id is null + * + * @return string the instance endpoint URL for the given class */ public static function resourceUrl($id) { - if ($id === null) { - $class = get_called_class(); - $message = "Could not determine which URL to request: " - . "$class instance has invalid ID: $id"; - throw new Error\InvalidRequest($message, null); + if (null === $id) { + $class = static::class; + $message = 'Could not determine which URL to request: ' + . "{$class} instance has invalid ID: {$id}"; + + throw new Exception\UnexpectedValueException($message); } $id = Util\Util::utf8($id); $base = static::classUrl(); - $extn = urlencode($id); - return "$base/$extn"; + $extn = \urlencode($id); + + return "{$base}/{$extn}"; } /** - * @return string The full API URL for this API resource. + * @return string the full API URL for this API resource */ public function instanceUrl() { diff --git a/plugins/stripe/lib/ApiResponse.php b/plugins/stripe/lib/ApiResponse.php index 31f54a50df..e7ee2e9a90 100644 --- a/plugins/stripe/lib/ApiResponse.php +++ b/plugins/stripe/lib/ApiResponse.php @@ -2,25 +2,38 @@ namespace Stripe; +use Stripe\Util\CaseInsensitiveArray; + /** - * Class ApiResponse - * - * @package Stripe + * Class ApiResponse. */ class ApiResponse { + /** + * @var null|array|CaseInsensitiveArray + */ public $headers; + + /** + * @var string + */ public $body; + + /** + * @var null|array + */ public $json; + + /** + * @var int + */ public $code; /** * @param string $body - * @param integer $code - * @param array|null $headers - * @param array|null $json - * - * @return obj An APIResponse + * @param int $code + * @param null|array|CaseInsensitiveArray $headers + * @param null|array $json */ public function __construct($body, $code, $headers, $json) { diff --git a/plugins/stripe/lib/ApplePayDomain.php b/plugins/stripe/lib/ApplePayDomain.php index ea84220a7a..5f9489d47d 100644 --- a/plugins/stripe/lib/ApplePayDomain.php +++ b/plugins/stripe/lib/ApplePayDomain.php @@ -1,16 +1,19 @@ true if the object exists in live mode or the value false if the object exists in test mode. */ class ApplePayDomain extends ApiResource { - - const OBJECT_NAME = "apple_pay_domain"; + const OBJECT_NAME = 'apple_pay_domain'; use ApiOperations\All; use ApiOperations\Create; diff --git a/plugins/stripe/lib/ApplicationFee.php b/plugins/stripe/lib/ApplicationFee.php index 0ec423eaaa..88aeed6455 100644 --- a/plugins/stripe/lib/ApplicationFee.php +++ b/plugins/stripe/lib/ApplicationFee.php @@ -1,31 +1,28 @@ ISO currency code, in lowercase. Must be a supported currency. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string|\Stripe\Charge $originating_transaction ID of the corresponding charge on the platform account, if this fee was the result of a charge using the destination parameter. + * @property bool $refunded Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false. + * @property \Stripe\Collection $refunds A list of refunds that have been applied to the fee. */ class ApplicationFee extends ApiResource { - - const OBJECT_NAME = "application_fee"; + const OBJECT_NAME = 'application_fee'; use ApiOperations\All; use ApiOperations\NestedResource; @@ -34,24 +31,27 @@ class ApplicationFee extends ApiResource const PATH_REFUNDS = '/refunds'; /** - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the application fee on which to retrieve the fee refunds + * @param null|array $params + * @param null|array|string $opts * - * @return ApplicationFee The refunded application fee. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of fee refunds */ - public function refund($params = null, $opts = null) + public static function allRefunds($id, $params = null, $opts = null) { - $this->refunds->create($params, $opts); - $this->refresh(); - return $this; + return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts); } /** - * @param array|null $id The ID of the application fee on which to create the refund. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the application fee on which to create the fee refund + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApplicationFeeRefund + * @return \Stripe\ApplicationFeeRefund */ public static function createRefund($id, $params = null, $opts = null) { @@ -59,12 +59,14 @@ public static function createRefund($id, $params = null, $opts = null) } /** - * @param array|null $id The ID of the application fee to which the refund belongs. - * @param array|null $refundId The ID of the refund to retrieve. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the application fee to which the fee refund belongs + * @param string $refundId the ID of the fee refund to retrieve + * @param null|array $params + * @param null|array|string $opts * - * @return ApplicationFeeRefund + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ApplicationFeeRefund */ public static function retrieveRefund($id, $refundId, $params = null, $opts = null) { @@ -72,27 +74,17 @@ public static function retrieveRefund($id, $refundId, $params = null, $opts = nu } /** - * @param array|null $id The ID of the application fee to which the refund belongs. - * @param array|null $refundId The ID of the refund to update. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the application fee to which the fee refund belongs + * @param string $refundId the ID of the fee refund to update + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApplicationFeeRefund + * @return \Stripe\ApplicationFeeRefund */ public static function updateRefund($id, $refundId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts); } - - /** - * @param array|null $id The ID of the application fee on which to retrieve the refunds. - * @param array|null $params - * @param array|string|null $opts - * - * @return ApplicationFeeRefund - */ - public static function allRefunds($id, $params = null, $opts = null) - { - return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts); - } } diff --git a/plugins/stripe/lib/ApplicationFeeRefund.php b/plugins/stripe/lib/ApplicationFeeRefund.php index 91d7e9d2bc..dc7c34bac2 100644 --- a/plugins/stripe/lib/ApplicationFeeRefund.php +++ b/plugins/stripe/lib/ApplicationFeeRefund.php @@ -1,41 +1,46 @@ Application Fee Refund objects allow you to refund an application + * fee that has previously been created but not yet refunded. Funds will be + * refunded to the Stripe account from which the fee was originally collected. * - * @property string $id - * @property string $object - * @property int $amount - * @property string $balance_transaction - * @property int $created - * @property string $currency - * @property string $fee - * @property StripeObject $metadata + * Related guide: Refunding + * Application Fees. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount, in %s. + * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property string|\Stripe\ApplicationFee $fee ID of the application fee that was refunded. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. */ class ApplicationFeeRefund extends ApiResource { - - const OBJECT_NAME = "fee_refund"; + const OBJECT_NAME = 'fee_refund'; use ApiOperations\Update { save as protected _save; } /** - * @return string The API URL for this Stripe refund. + * @return string the API URL for this Stripe refund */ public function instanceUrl() { $id = $this['id']; $fee = $this['fee']; if (!$id) { - throw new Error\InvalidRequest( - "Could not determine which URL to request: " . - "class instance has invalid ID: $id", + throw new Exception\UnexpectedValueException( + 'Could not determine which URL to request: ' . + "class instance has invalid ID: {$id}", null ); } @@ -43,15 +48,16 @@ public function instanceUrl() $fee = Util\Util::utf8($fee); $base = ApplicationFee::classUrl(); - $feeExtn = urlencode($fee); - $extn = urlencode($id); - return "$base/$feeExtn/refunds/$extn"; + $feeExtn = \urlencode($fee); + $extn = \urlencode($id); + + return "{$base}/{$feeExtn}/refunds/{$extn}"; } /** - * @param array|string|null $opts + * @param null|array|string $opts * - * @return ApplicationFeeRefund The saved refund. + * @return ApplicationFeeRefund the saved refund */ public function save($opts = null) { diff --git a/plugins/stripe/lib/Balance.php b/plugins/stripe/lib/Balance.php index 25f88ae74c..0fdc2850c4 100644 --- a/plugins/stripe/lib/Balance.php +++ b/plugins/stripe/lib/Balance.php @@ -1,27 +1,42 @@ transactions + * that contributed to the balance (charges, payouts, and so forth). + * + * The available and pending amounts for each currency are broken down further by + * payment source types. * - * @property string $object - * @property array $available - * @property array $connect_reserved - * @property bool $livemode - * @property array $pending + * Related guide: Understanding Connect + * Account Balances. * - * @package Stripe + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\StripeObject[] $available Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the Transfers API or Payouts API. The available balance for each currency and payment type can be found in the source_types property. + * @property \Stripe\StripeObject[] $connect_reserved Funds held due to negative balances on connected Custom accounts. The connect reserve balance for each currency and payment type can be found in the source_types property. + * @property \Stripe\StripeObject[] $instant_available Funds that can be paid out using Instant Payouts. + * @property \Stripe\StripeObject $issuing + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject[] $pending Funds that are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the source_types property. */ class Balance extends SingletonApiResource { - - const OBJECT_NAME = "balance"; + const OBJECT_NAME = 'balance'; /** - * @param array|string|null $opts + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Balance + * @return \Stripe\Balance */ public static function retrieve($opts = null) { diff --git a/plugins/stripe/lib/BalanceTransaction.php b/plugins/stripe/lib/BalanceTransaction.php index cd9b79ae67..d7ddea4303 100644 --- a/plugins/stripe/lib/BalanceTransaction.php +++ b/plugins/stripe/lib/BalanceTransaction.php @@ -1,41 +1,71 @@ Balance + * Transaction Types. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Gross amount of the transaction, in %s. + * @property int $available_on The date the transaction's net funds will become available in the Stripe balance. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|float $exchange_rate The exchange rate used, if applicable, for this transaction. Specifically, if money was converted from currency A to currency B, then the amount in currency A, times exchange_rate, would be the amount in currency B. For example, suppose you charged a customer 10.00 EUR. Then the PaymentIntent's amount would be 1000 and currency would be eur. Suppose this was converted into 12.34 USD in your Stripe account. Then the BalanceTransaction's amount would be 1234, currency would be usd, and exchange_rate would be 1.234. + * @property int $fee Fees (in %s) paid for this transaction. + * @property \Stripe\StripeObject[] $fee_details Detailed breakdown of fees (in %s) paid for this transaction. + * @property int $net Net amount of the transaction, in %s. + * @property string $reporting_category Learn more about how reporting categories can help you understand balance transactions from an accounting perspective. + * @property null|string|\Stripe\StripeObject $source The Stripe object to which this transaction is related. + * @property string $status If the transaction's net funds are available in the Stripe balance yet. Either available or pending. + * @property string $type Transaction type: adjustment, advance, advance_funding, anticipation_repayment, application_fee, application_fee_refund, charge, connect_collection_transfer, contribution, issuing_authorization_hold, issuing_authorization_release, issuing_dispute, issuing_transaction, payment, payment_failure_refund, payment_refund, payout, payout_cancel, payout_failure, refund, refund_failure, reserve_transaction, reserved_funds, stripe_fee, stripe_fx_fee, tax_fee, topup, topup_reversal, transfer, transfer_cancel, transfer_failure, or transfer_refund. Learn more about balance transaction types and what they represent. If you are looking to classify transactions for accounting purposes, you might want to consider reporting_category instead. */ class BalanceTransaction extends ApiResource { - - const OBJECT_NAME = "balance_transaction"; + const OBJECT_NAME = 'balance_transaction'; use ApiOperations\All; 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. - */ - public static function classUrl() - { - return "/v1/balance/history"; - } + const TYPE_ADJUSTMENT = 'adjustment'; + const TYPE_ADVANCE = 'advance'; + const TYPE_ADVANCE_FUNDING = 'advance_funding'; + const TYPE_ANTICIPATION_REPAYMENT = 'anticipation_repayment'; + 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_CONTRIBUTION = 'contribution'; + const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold'; + const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release'; + const TYPE_ISSUING_DISPUTE = 'issuing_dispute'; + 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/plugins/stripe/lib/BankAccount.php b/plugins/stripe/lib/BankAccount.php index 019a4d87cb..40eca41c5f 100644 --- a/plugins/stripe/lib/BankAccount.php +++ b/plugins/stripe/lib/BankAccount.php @@ -1,36 +1,58 @@ Customer objects. + * + * On the other hand External Accounts are + * transfer destinations on Account objects for Custom accounts. They + * can be bank accounts or debit cards as well, and are documented in the links + * above. * - * @property string $id - * @property string $object - * @property string $account - * @property string $account_holder_name - * @property string $account_holder_type - * @property string $bank_name - * @property string $country - * @property string $currency - * @property string $customer - * @property bool $default_for_currency - * @property string $fingerprint - * @property string $last4 - * @property StripeObject $metadata - * @property string $routing_number - * @property string $status + * Related guide: Bank Debits and + * Transfers. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string|\Stripe\Account $account The ID of the account that the bank account is associated with. + * @property null|string $account_holder_name The name of the person or business that owns the bank account. + * @property null|string $account_holder_type The type of entity that holds the account. This can be either individual or company. + * @property null|string[] $available_payout_methods A set of available payout methods for this bank account. Only values from this set should be passed as the method when creating a payout. + * @property null|string $bank_name Name of the bank associated with the routing number (e.g., WELLS FARGO). + * @property string $country Two-letter ISO code representing the country the bank account is located in. + * @property string $currency Three-letter ISO code for the currency paid out to the bank account. + * @property null|string|\Stripe\Customer $customer The ID of the customer that the bank account is associated with. + * @property null|bool $default_for_currency Whether this bank account is the default external account for its currency. + * @property null|string $fingerprint Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. + * @property string $last4 The last four digits of the bank account number. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $routing_number The routing transit number for the bank account. + * @property string $status

For bank accounts, possible values are new, validated, verified, verification_failed, or errored. A bank account that hasn't had any activity or validation performed is new. If Stripe can determine that the bank account exists, its status will be validated. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be verified. If the verification failed for any reason, such as microdeposit failure, the status will be verification_failed. If a transfer sent to this bank account fails, we'll set the status to errored and will not continue to send transfers until the bank details are updated.

For external accounts, possible values are new and errored. Validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply. If a transfer fails, the status is set to errored and transfers are stopped until account details are updated.

*/ class BankAccount extends ApiResource { - - const OBJECT_NAME = "bank_account"; + const OBJECT_NAME = 'bank_account'; use ApiOperations\Delete; use ApiOperations\Update; + /** + * Possible string representations of the bank verification status. + * + * @see 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. @@ -46,54 +68,65 @@ public function instanceUrl() $parent = $this['account']; $path = 'external_accounts'; } else { - $msg = "Bank accounts cannot be accessed without a customer ID or account ID."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Bank accounts cannot be accessed without a customer ID or account ID.'; + + throw new Exception\UnexpectedValueException($msg, null); } - $parentExtn = urlencode(Util\Util::utf8($parent)); - $extn = urlencode(Util\Util::utf8($this['id'])); - return "$base/$parentExtn/$path/$extn"; + $parentExtn = \urlencode(Util\Util::utf8($parent)); + $extn = \urlencode(Util\Util::utf8($this['id'])); + + return "{$base}/{$parentExtn}/{$path}/{$extn}"; } /** * @param array|string $_id - * @param array|string|null $_opts + * @param null|array|string $_opts * - * @throws \Stripe\Error\InvalidRequest + * @throws \Stripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { - $msg = "Bank accounts cannot be accessed without a customer ID or account ID. " . - "Retrieve a bank account using \$customer->sources->retrieve('bank_account_id') or " . - "\$account->external_accounts->retrieve('bank_account_id') instead."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Bank accounts cannot be retrieved without a customer ID or ' . + 'an account ID. Retrieve a bank account using ' . + "`Customer::retrieveSource('customer_id', " . + "'bank_account_id')` or `Account::retrieveExternalAccount(" . + "'account_id', 'bank_account_id')`."; + + throw new Exception\BadMethodCallException($msg); } /** * @param string $_id - * @param array|null $_params - * @param array|string|null $_options + * @param null|array $_params + * @param null|array|string $_options * - * @throws \Stripe\Error\InvalidRequest + * @throws \Stripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { - $msg = "Bank accounts cannot be accessed without a customer ID or account ID. " . - "Call save() on \$customer->sources->retrieve('bank_account_id') or " . - "\$account->external_accounts->retrieve('bank_account_id') instead."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Bank accounts cannot be updated without a customer ID or an ' . + 'account ID. Update a bank account using ' . + "`Customer::updateSource('customer_id', 'bank_account_id', " . + '$updateParams)` or `Account::updateExternalAccount(' . + "'account_id', 'bank_account_id', \$updateParams)`."; + + throw new Exception\BadMethodCallException($msg); } - /** - * @param array|null $params - * @param array|string|null $options + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return BankAccount The verified bank account. + * @return BankAccount the verified bank account */ - public function verify($params = null, $options = null) + public function verify($params = null, $opts = null) { $url = $this->instanceUrl() . '/verify'; - list($response, $opts) = $this->_request('post', $url, $params, $options); + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/BaseStripeClient.php b/plugins/stripe/lib/BaseStripeClient.php new file mode 100644 index 0000000000..5499fe3a84 --- /dev/null +++ b/plugins/stripe/lib/BaseStripeClient.php @@ -0,0 +1,269 @@ + */ + private $config; + + /** @var \Stripe\Util\RequestOptions */ + private $defaultOpts; + + /** + * Initializes a new instance of the {@link BaseStripeClient} class. + * + * The constructor takes a single argument. The argument can be a string, in which case it + * should be the API key. It can also be an array with various configuration settings. + * + * Configuration settings include the following options: + * + * - api_key (null|string): the Stripe API key, to be used in regular API requests. + * - client_id (null|string): the Stripe client ID, to be used in OAuth requests. + * - stripe_account (null|string): a Stripe account ID. If set, all requests sent by the client + * will automatically use the {@code Stripe-Account} header with that account ID. + * - stripe_version (null|string): a Stripe API verion. If set, all requests sent by the client + * will include the {@code Stripe-Version} header with that API version. + * + * The following configuration settings are also available, though setting these should rarely be necessary + * (only useful if you want to send requests to a mock server like stripe-mock): + * + * - api_base (string): the base URL for regular API requests. Defaults to + * {@link DEFAULT_API_BASE}. + * - connect_base (string): the base URL for OAuth requests. Defaults to + * {@link DEFAULT_CONNECT_BASE}. + * - files_base (string): the base URL for file creation requests. Defaults to + * {@link DEFAULT_FILES_BASE}. + * + * @param array|string $config the API key as a string, or an array containing + * the client configuration settings + */ + public function __construct($config = []) + { + if (\is_string($config)) { + $config = ['api_key' => $config]; + } elseif (!\is_array($config)) { + throw new \Stripe\Exception\InvalidArgumentException('$config must be a string or an array'); + } + + $config = \array_merge($this->getDefaultConfig(), $config); + $this->validateConfig($config); + + $this->config = $config; + + $this->defaultOpts = \Stripe\Util\RequestOptions::parse([ + 'stripe_account' => $config['stripe_account'], + 'stripe_version' => $config['stripe_version'], + ]); + } + + /** + * Gets the API key used by the client to send requests. + * + * @return null|string the API key used by the client to send requests + */ + public function getApiKey() + { + return $this->config['api_key']; + } + + /** + * Gets the client ID used by the client in OAuth requests. + * + * @return null|string the client ID used by the client in OAuth requests + */ + public function getClientId() + { + return $this->config['client_id']; + } + + /** + * Gets the base URL for Stripe's API. + * + * @return string the base URL for Stripe's API + */ + public function getApiBase() + { + return $this->config['api_base']; + } + + /** + * Gets the base URL for Stripe's OAuth API. + * + * @return string the base URL for Stripe's OAuth API + */ + public function getConnectBase() + { + return $this->config['connect_base']; + } + + /** + * Gets the base URL for Stripe's Files API. + * + * @return string the base URL for Stripe's Files API + */ + public function getFilesBase() + { + return $this->config['files_base']; + } + + /** + * Sends a request to Stripe's API. + * + * @param string $method the HTTP method + * @param string $path the path of the request + * @param array $params the parameters of the request + * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request + * + * @return \Stripe\StripeObject the object returned by Stripe's API + */ + public function request($method, $path, $params, $opts) + { + $opts = $this->defaultOpts->merge($opts, true); + $baseUrl = $opts->apiBase ?: $this->getApiBase(); + $requestor = new \Stripe\ApiRequestor($this->apiKeyForRequest($opts), $baseUrl); + list($response, $opts->apiKey) = $requestor->request($method, $path, $params, $opts->headers); + $opts->discardNonPersistentHeaders(); + $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); + $obj->setLastResponse($response); + + return $obj; + } + + /** + * Sends a request to Stripe's API. + * + * @param string $method the HTTP method + * @param string $path the path of the request + * @param array $params the parameters of the request + * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request + * + * @return \Stripe\Collection of ApiResources + */ + public function requestCollection($method, $path, $params, $opts) + { + $obj = $this->request($method, $path, $params, $opts); + if (!($obj instanceof \Stripe\Collection)) { + $received_class = \get_class($obj); + $msg = "Expected to receive `Stripe\\Collection` object from Stripe API. Instead received `{$received_class}`."; + + throw new \Stripe\Exception\UnexpectedValueException($msg); + } + $obj->setFilters($params); + + return $obj; + } + + /** + * @param \Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\AuthenticationException + * + * @return string + */ + private function apiKeyForRequest($opts) + { + $apiKey = $opts->apiKey ?: $this->getApiKey(); + + if (null === $apiKey) { + $msg = 'No API key provided. Set your API key when constructing the ' + . 'StripeClient instance, or provide it on a per-request basis ' + . 'using the `api_key` key in the $opts argument.'; + + throw new \Stripe\Exception\AuthenticationException($msg); + } + + return $apiKey; + } + + /** + * TODO: replace this with a private constant when we drop support for PHP < 5. + * + * @return array + */ + private function getDefaultConfig() + { + return [ + 'api_key' => null, + 'client_id' => null, + 'stripe_account' => null, + 'stripe_version' => null, + 'api_base' => self::DEFAULT_API_BASE, + 'connect_base' => self::DEFAULT_CONNECT_BASE, + 'files_base' => self::DEFAULT_FILES_BASE, + ]; + } + + /** + * @param array $config + * + * @throws \Stripe\Exception\InvalidArgumentException + */ + private function validateConfig($config) + { + // api_key + if (null !== $config['api_key'] && !\is_string($config['api_key'])) { + throw new \Stripe\Exception\InvalidArgumentException('api_key must be null or a string'); + } + + if (null !== $config['api_key'] && ('' === $config['api_key'])) { + $msg = 'api_key cannot be the empty string'; + + throw new \Stripe\Exception\InvalidArgumentException($msg); + } + + if (null !== $config['api_key'] && (\preg_match('/\s/', $config['api_key']))) { + $msg = 'api_key cannot contain whitespace'; + + throw new \Stripe\Exception\InvalidArgumentException($msg); + } + + // client_id + if (null !== $config['client_id'] && !\is_string($config['client_id'])) { + throw new \Stripe\Exception\InvalidArgumentException('client_id must be null or a string'); + } + + // stripe_account + if (null !== $config['stripe_account'] && !\is_string($config['stripe_account'])) { + throw new \Stripe\Exception\InvalidArgumentException('stripe_account must be null or a string'); + } + + // stripe_version + if (null !== $config['stripe_version'] && !\is_string($config['stripe_version'])) { + throw new \Stripe\Exception\InvalidArgumentException('stripe_version must be null or a string'); + } + + // api_base + if (!\is_string($config['api_base'])) { + throw new \Stripe\Exception\InvalidArgumentException('api_base must be a string'); + } + + // connect_base + if (!\is_string($config['connect_base'])) { + throw new \Stripe\Exception\InvalidArgumentException('connect_base must be a string'); + } + + // files_base + if (!\is_string($config['files_base'])) { + throw new \Stripe\Exception\InvalidArgumentException('files_base must be a string'); + } + + // check absence of extra keys + $extraConfigKeys = \array_diff(\array_keys($config), \array_keys($this->getDefaultConfig())); + if (!empty($extraConfigKeys)) { + // Wrap in single quote to more easily catch trailing spaces errors + $invalidKeys = "'" . \implode("', '", $extraConfigKeys) . "'"; + + throw new \Stripe\Exception\InvalidArgumentException('Found unknown key(s) in configuration array: ' . $invalidKeys); + } + } +} diff --git a/plugins/stripe/lib/BillingPortal/Session.php b/plugins/stripe/lib/BillingPortal/Session.php new file mode 100644 index 0000000000..ec01275ac4 --- /dev/null +++ b/plugins/stripe/lib/BillingPortal/Session.php @@ -0,0 +1,32 @@ +Billing + * customer portal. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $customer The ID of the customer for this session. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property string $return_url The URL to which Stripe should send customers when they click on the link to return to your website. + * @property string $url The short-lived URL of the session giving customers access to the customer portal. + */ +class Session extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'billing_portal.session'; + + use \Stripe\ApiOperations\Create; +} diff --git a/plugins/stripe/lib/BitcoinReceiver.php b/plugins/stripe/lib/BitcoinReceiver.php index b4cc5291b5..208610a0f1 100644 --- a/plugins/stripe/lib/BitcoinReceiver.php +++ b/plugins/stripe/lib/BitcoinReceiver.php @@ -1,19 +1,39 @@ currency that you are collecting as payment. + * @property int $amount_received The amount of currency to which bitcoin_amount_received has been converted. + * @property int $bitcoin_amount The amount of bitcoin that the customer should send to fill the receiver. The bitcoin_amount is denominated in Satoshi: there are 10^8 Satoshi in one bitcoin. + * @property int $bitcoin_amount_received The amount of bitcoin that has been sent by the customer to this receiver. + * @property string $bitcoin_uri This URI can be displayed to the customer as a clickable link (to activate their bitcoin client) or as a QR code (for mobile wallets). + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO code for the currency to which the bitcoin will be converted. + * @property null|string $customer The customer ID of the bitcoin receiver. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|string $email The customer's email address, set by the API call that creates the receiver. + * @property bool $filled This flag is initially false and updates to true when the customer sends the bitcoin_amount to this receiver. + * @property string $inbound_address A bitcoin address that is specific to this receiver. The customer can send bitcoin to this address to fill the receiver. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $payment The ID of the payment created from the receiver, if any. Hidden when viewing the receiver with a publishable key. + * @property null|string $refund_address The refund address of this bitcoin receiver. + * @property \Stripe\Collection $transactions A list with one entry for each time that the customer sent bitcoin to the receiver. Hidden when viewing the receiver with a publishable key. + * @property bool $uncaptured_funds This receiver contains uncaptured funds that can be used for a payment or refunded. + * @property null|bool $used_for_payment Indicate if this source is used for payment. */ class BitcoinReceiver extends ApiResource { - - const OBJECT_NAME = "bitcoin_receiver"; + const OBJECT_NAME = 'bitcoin_receiver'; use ApiOperations\All; use ApiOperations\Retrieve; @@ -24,7 +44,7 @@ class BitcoinReceiver extends ApiResource */ public static function classUrl() { - return "/v1/bitcoin/receivers"; + return '/v1/bitcoin/receivers'; } /** @@ -37,13 +57,15 @@ public function instanceUrl() $base = Customer::classUrl(); $parent = $this['customer']; $path = 'sources'; - $parentExtn = urlencode(Util\Util::utf8($parent)); - $extn = urlencode(Util\Util::utf8($this['id'])); - return "$base/$parentExtn/$path/$extn"; - } else { - $base = BitcoinReceiver::classUrl(); - $extn = urlencode(Util\Util::utf8($this['id'])); - return "$base/$extn"; + $parentExtn = \urlencode(Util\Util::utf8($parent)); + $extn = \urlencode(Util\Util::utf8($this['id'])); + + return "{$base}/{$parentExtn}/{$path}/{$extn}"; } + + $base = BitcoinReceiver::classUrl(); + $extn = \urlencode(Util\Util::utf8($this['id'])); + + return "{$base}/{$extn}"; } } diff --git a/plugins/stripe/lib/BitcoinTransaction.php b/plugins/stripe/lib/BitcoinTransaction.php index 8269fd216e..3aa7118504 100644 --- a/plugins/stripe/lib/BitcoinTransaction.php +++ b/plugins/stripe/lib/BitcoinTransaction.php @@ -1,14 +1,19 @@ currency that the transaction was converted to in real-time. + * @property int $bitcoin_amount The amount of bitcoin contained in the transaction. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO code for the currency to which this transaction was converted. + * @property string $receiver The receiver to which this transaction was sent. */ class BitcoinTransaction extends ApiResource { - - const OBJECT_NAME = "bitcoin_transaction"; + const OBJECT_NAME = 'bitcoin_transaction'; } diff --git a/plugins/stripe/lib/Capability.php b/plugins/stripe/lib/Capability.php new file mode 100644 index 0000000000..3580df60b7 --- /dev/null +++ b/plugins/stripe/lib/Capability.php @@ -0,0 +1,87 @@ +Account + * capabilities. + * + * @property string $id The identifier for the capability. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string|\Stripe\Account $account The account for which the capability enables functionality. + * @property bool $requested Whether the capability has been requested. + * @property null|int $requested_at Time at which the capability was requested. Measured in seconds since the Unix epoch. + * @property \Stripe\StripeObject $requirements + * @property string $status The status of the capability. Can be active, inactive, pending, or unrequested. + */ +class Capability extends ApiResource +{ + const OBJECT_NAME = 'capability'; + + use ApiOperations\Update; + + const STATUS_ACTIVE = 'active'; + const STATUS_INACTIVE = 'inactive'; + const STATUS_PENDING = 'pending'; + const STATUS_UNREQUESTED = 'unrequested'; + + /** + * @return string the API URL for this Stripe account reversal + */ + public function instanceUrl() + { + $id = $this['id']; + $account = $this['account']; + if (!$id) { + throw new Exception\UnexpectedValueException( + 'Could not determine which URL to request: ' . + "class instance has invalid ID: {$id}", + null + ); + } + $id = Util\Util::utf8($id); + $account = Util\Util::utf8($account); + + $base = Account::classUrl(); + $accountExtn = \urlencode($account); + $extn = \urlencode($id); + + return "{$base}/{$accountExtn}/capabilities/{$extn}"; + } + + /** + * @param array|string $_id + * @param null|array|string $_opts + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function retrieve($_id, $_opts = null) + { + $msg = 'Capabilities cannot be retrieved without an account ID. ' . + 'Retrieve a capability using `Account::retrieveCapability(' . + "'account_id', 'capability_id')`."; + + throw new Exception\BadMethodCallException($msg); + } + + /** + * @param string $_id + * @param null|array $_params + * @param null|array|string $_options + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function update($_id, $_params = null, $_options = null) + { + $msg = 'Capabilities cannot be updated without an account ID. ' . + 'Update a capability using `Account::updateCapability(' . + "'account_id', 'capability_id', \$updateParams)`."; + + throw new Exception\BadMethodCallException($msg); + } +} diff --git a/plugins/stripe/lib/Card.php b/plugins/stripe/lib/Card.php index 686080ee8c..106cd1811a 100644 --- a/plugins/stripe/lib/Card.php +++ b/plugins/stripe/lib/Card.php @@ -1,49 +1,81 @@ Card Payments + * with Sources. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string|\Stripe\Account $account The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead. + * @property null|string $address_city City/District/Suburb/Town/Village. + * @property null|string $address_country Billing address country, if provided when creating card. + * @property null|string $address_line1 Address line 1 (Street address/PO Box/Company name). + * @property null|string $address_line1_check If address_line1 was provided, results of the check: pass, fail, unavailable, or unchecked. + * @property null|string $address_line2 Address line 2 (Apartment/Suite/Unit/Building). + * @property null|string $address_state State/County/Province/Region. + * @property null|string $address_zip ZIP or postal code. + * @property null|string $address_zip_check If address_zip was provided, results of the check: pass, fail, unavailable, or unchecked. + * @property null|string[] $available_payout_methods A set of available payout methods for this card. Only values from this set should be passed as the method when creating a payout. + * @property string $brand Card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown. + * @property null|string $country Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + * @property null|string $currency Three-letter ISO code for currency. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. + * @property null|string|\Stripe\Customer $customer The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead. + * @property null|string $cvc_check If a CVC was provided, results of the check: pass, fail, unavailable, or unchecked. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see Check if a card is valid without a charge. + * @property null|bool $default_for_currency Whether this card is the default external account for its currency. + * @property null|string $dynamic_last4 (For tokenized numbers only.) The last four digits of the device account number. + * @property int $exp_month Two-digit number representing the card's expiration month. + * @property int $exp_year Four-digit number representing the card's expiration year. + * @property null|string $fingerprint Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + * @property string $funding Card funding type. Can be credit, debit, prepaid, or unknown. + * @property string $last4 The last four digits of the card. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $name Cardholder name. + * @property null|string|\Stripe\Recipient $recipient The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead. + * @property null|string $tokenization_method If the card number is tokenized, this is the method that was used. Can be android_pay (includes Google Pay), apple_pay, masterpass, visa_checkout, or null. */ class Card extends ApiResource { - - const OBJECT_NAME = "card"; + const OBJECT_NAME = 'card'; use ApiOperations\Delete; use ApiOperations\Update; + /** + * Possible string representations of the CVC check status. + * + * @see https://stripe.com/docs/api/cards/object#card_object-cvc_check + */ + const CVC_CHECK_FAIL = 'fail'; + const CVC_CHECK_PASS = 'pass'; + const CVC_CHECK_UNAVAILABLE = 'unavailable'; + const CVC_CHECK_UNCHECKED = 'unchecked'; + + /** + * Possible string representations of the funding of the card. + * + * @see https://stripe.com/docs/api/cards/object#card_object-funding + */ + const FUNDING_CREDIT = 'credit'; + const FUNDING_DEBIT = 'debit'; + const FUNDING_PREPAID = 'prepaid'; + const FUNDING_UNKNOWN = 'unknown'; + + /** + * Possible string representations of the tokenization method when using Apple Pay or Google Pay. + * + * @see https://stripe.com/docs/api/cards/object#card_object-tokenization_method + */ + const TOKENIZATION_METHOD_APPLE_PAY = 'apple_pay'; + const TOKENIZATION_METHOD_GOOGLE_PAY = 'google_pay'; + /** * @return string The instance URL for this resource. It needs to be special * cased because cards are nested resources that may belong to different @@ -64,42 +96,47 @@ public function instanceUrl() $parent = $this['recipient']; $path = 'cards'; } else { - $msg = "Cards cannot be accessed without a customer ID, account ID or recipient ID."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Cards cannot be accessed without a customer ID, account ID or recipient ID.'; + + throw new Exception\UnexpectedValueException($msg); } - $parentExtn = urlencode(Util\Util::utf8($parent)); - $extn = urlencode(Util\Util::utf8($this['id'])); - return "$base/$parentExtn/$path/$extn"; + $parentExtn = \urlencode(Util\Util::utf8($parent)); + $extn = \urlencode(Util\Util::utf8($this['id'])); + + return "{$base}/{$parentExtn}/{$path}/{$extn}"; } /** * @param array|string $_id - * @param array|string|null $_opts + * @param null|array|string $_opts * - * @throws \Stripe\Error\InvalidRequest + * @throws \Stripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { - $msg = "Cards cannot be accessed without a customer, recipient or account ID. " . - "Retrieve a card using \$customer->sources->retrieve('card_id'), " . - "\$recipient->cards->retrieve('card_id'), or"; - "\$account->external_accounts->retrieve('card_id') instead."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Cards cannot be retrieved without a customer ID or an ' . + 'account ID. Retrieve a card using ' . + "`Customer::retrieveSource('customer_id', 'card_id')` or " . + "`Account::retrieveExternalAccount('account_id', 'card_id')`."; + + throw new Exception\BadMethodCallException($msg); } /** * @param string $_id - * @param array|null $_params - * @param array|string|null $_options + * @param null|array $_params + * @param null|array|string $_options * - * @throws \Stripe\Error\InvalidRequest + * @throws \Stripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { - $msg = "Cards cannot be accessed without a customer, recipient or account ID. " . - "Call save() on \$customer->sources->retrieve('card_id'), " . - "\$recipient->cards->retrieve('card_id'), or"; - "\$account->external_accounts->retrieve('card_id') instead."; - throw new Error\InvalidRequest($msg, null); + $msg = 'Cards cannot be updated without a customer ID or an ' . + 'account ID. Update a card using ' . + "`Customer::updateSource('customer_id', 'card_id', " . + '$updateParams)` or `Account::updateExternalAccount(' . + "'account_id', 'card_id', \$updateParams)`."; + + throw new Exception\BadMethodCallException($msg); } } diff --git a/plugins/stripe/lib/Charge.php b/plugins/stripe/lib/Charge.php index 96988f61a6..799bede85c 100644 --- a/plugins/stripe/lib/Charge.php +++ b/plugins/stripe/lib/Charge.php @@ -1,191 +1,146 @@ Charge object. You + * can retrieve and refund individual charges as well as list all charges. Charges + * are identified by a unique, random ID. * - * @property string $id - * @property string $object - * @property int $amount - * @property int $amount_refunded - * @property string $application - * @property string $application_fee - * @property string $balance_transaction - * @property bool $captured - * @property int $created - * @property string $currency - * @property string $customer - * @property string $description - * @property string $destination - * @property string $dispute - * @property string $failure_code - * @property string $failure_message - * @property mixed $fraud_details - * @property string $invoice - * @property bool $livemode - * @property StripeObject $metadata - * @property string $on_behalf_of - * @property string $order - * @property mixed $outcome - * @property bool $paid - * @property string $receipt_email - * @property string $receipt_number - * @property bool $refunded - * @property Collection $refunds - * @property string $review - * @property mixed $shipping - * @property mixed $source - * @property string $source_transfer - * @property string $statement_descriptor - * @property string $status - * @property string $transfer - * @property string $transfer_group + * Related guide: Accept a + * payment with the Charges API. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount intended to be collected by this payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + * @property int $amount_captured Amount in %s captured (can be less than the amount attribute on the charge if a partial capture was made). + * @property int $amount_refunded Amount in %s refunded (can be less than the amount attribute on the charge if a partial refund was issued). + * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the charge. + * @property null|string|\Stripe\ApplicationFee $application_fee The application fee (if any) for the charge. See the Connect documentation for details. + * @property null|int $application_fee_amount The amount of the application fee (if any) requested for the charge. See the Connect documentation for details. + * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this charge on your account balance (not including refunds or disputes). + * @property \Stripe\StripeObject $billing_details + * @property null|string $calculated_statement_descriptor The full statement descriptor that is passed to card networks, and that is displayed on your customers' credit card and bank statements. Allows you to see what the statement descriptor looks like after the static and dynamic portions are combined. + * @property bool $captured If the charge was created without capturing, this Boolean represents whether it is still uncaptured or has since been captured. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string|\Stripe\Customer $customer ID of the customer this charge is for if one exists. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|string|\Stripe\Account $destination ID of an existing, connected Stripe account to transfer funds to if transfer_data was specified in the charge request. + * @property null|string|\Stripe\Dispute $dispute Details about the dispute if the charge has been disputed. + * @property bool $disputed Whether the charge has been disputed. + * @property null|string $failure_code Error code explaining reason for charge failure if available (see the errors section for a list of codes). + * @property null|string $failure_message Message to user further explaining reason for charge failure if available. + * @property null|\Stripe\StripeObject $fraud_details Information on fraud assessments for the charge. + * @property null|string|\Stripe\Invoice $invoice ID of the invoice this charge is for if one exists. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string|\Stripe\Account $on_behalf_of The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the Connect documentation for details. + * @property null|string|\Stripe\Order $order ID of the order this charge is for if one exists. + * @property null|\Stripe\StripeObject $outcome Details about whether the payment was accepted, and why. See understanding declines for details. + * @property bool $paid true if the charge succeeded, or was successfully authorized for later capture. + * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent associated with this charge, if one exists. + * @property null|string $payment_method ID of the payment method used in this charge. + * @property null|\Stripe\StripeObject $payment_method_details Details about the payment method at the time of the transaction. + * @property null|string $receipt_email This is the email address that the receipt for this charge was sent to. + * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this charge. This attribute will be null until a receipt has been sent. + * @property null|string $receipt_url This is the URL to view the receipt for this charge. The receipt is kept up-to-date to the latest state of the charge, including any refunds. If the charge is for an Invoice, the receipt will be stylized as an Invoice receipt. + * @property bool $refunded Whether the charge has been fully refunded. If the charge is only partially refunded, this attribute will still be false. + * @property \Stripe\Collection $refunds A list of refunds that have been applied to the charge. + * @property null|string|\Stripe\Review $review ID of the review associated with this charge if one exists. + * @property null|\Stripe\StripeObject $shipping Shipping information for the charge. + * @property null|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It contains the Source, Card, or BankAccount object used for the charge. For details about the payment method used for this charge, refer to payment_method or payment_method_details instead. + * @property null|string|\Stripe\Transfer $source_transfer The transfer ID which created this charge. Only present if the charge came from another Stripe account. See the Connect documentation for details. + * @property null|string $statement_descriptor For card charges, use statement_descriptor_suffix instead. Otherwise, you can use this value as the complete description of a charge on your customers’ statements. Must contain at least one letter, maximum 22 characters. + * @property null|string $statement_descriptor_suffix Provides information about the charge that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + * @property string $status The status of the payment is either succeeded, pending, or failed. + * @property string|\Stripe\Transfer $transfer ID of the transfer to the destination account (only applicable if the charge was created using the destination parameter). + * @property null|\Stripe\StripeObject $transfer_data An optional dictionary including the account to automatically transfer to as part of a destination charge. See the Connect documentation for details. + * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the Connect documentation for details. */ class Charge extends ApiResource { - - const OBJECT_NAME = "charge"; + const OBJECT_NAME = 'charge'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; + const STATUS_FAILED = 'failed'; + const STATUS_PENDING = 'pending'; + const STATUS_SUCCEEDED = 'succeeded'; + /** * Possible string representations of decline codes. - * These strings are applicable to the decline_code property of the \Stripe\Error\Card exception. - * @link https://stripe.com/docs/declines/codes + * These strings are applicable to the decline_code property of the \Stripe\Exception\CardException exception. + * + * @see https://stripe.com/docs/declines/codes */ - const DECLINED_APPROVE_WITH_ID = 'approve_with_id'; - const DECLINED_CALL_ISSUER = 'call_issuer'; - const DECLINED_CARD_NOT_SUPPORTED = 'card_not_supported'; - const DECLINED_CARD_VELOCITY_EXCEEDED = 'card_velocity_exceeded'; - const DECLINED_CURRENCY_NOT_SUPPORTED = 'currency_not_supported'; - const DECLINED_DO_NOT_HONOR = 'do_not_honor'; - const DECLINED_DO_NOT_TRY_AGAIN = 'do_not_try_again'; - const DECLINED_DUPLICATED_TRANSACTION = 'duplicate_transaction'; - const DECLINED_EXPIRED_CARD = 'expired_card'; - const DECLINED_FRAUDULENT = 'fraudulent'; - const DECLINED_GENERIC_DECLINE = 'generic_decline'; - const DECLINED_INCORRECT_NUMBER = 'incorrect_number'; - const DECLINED_INCORRECT_CVC = 'incorrect_cvc'; - const DECLINED_INCORRECT_PIN = 'incorrect_pin'; - const DECLINED_INCORRECT_ZIP = 'incorrect_zip'; - const DECLINED_INSUFFICIENT_FUNDS = 'insufficient_funds'; - const DECLINED_INVALID_ACCOUNT = 'invalid_account'; - const DECLINED_INVALID_AMOUNT = 'invalid_amount'; - const DECLINED_INVALID_CVC = 'invalid_cvc'; - const DECLINED_INVALID_EXPIRY_YEAR = 'invalid_expiry_year'; - const DECLINED_INVALID_NUMBER = 'invalid_number'; - const DECLINED_INVALID_PIN = 'invalid_pin'; - const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available'; - const DECLINED_LOST_CARD = 'lost_card'; + const DECLINED_AUTHENTICATION_REQUIRED = 'authentication_required'; + const DECLINED_APPROVE_WITH_ID = 'approve_with_id'; + const DECLINED_CALL_ISSUER = 'call_issuer'; + const DECLINED_CARD_NOT_SUPPORTED = 'card_not_supported'; + const DECLINED_CARD_VELOCITY_EXCEEDED = 'card_velocity_exceeded'; + const DECLINED_CURRENCY_NOT_SUPPORTED = 'currency_not_supported'; + const DECLINED_DO_NOT_HONOR = 'do_not_honor'; + const DECLINED_DO_NOT_TRY_AGAIN = 'do_not_try_again'; + const DECLINED_DUPLICATED_TRANSACTION = 'duplicate_transaction'; + const DECLINED_EXPIRED_CARD = 'expired_card'; + const DECLINED_FRAUDULENT = 'fraudulent'; + const DECLINED_GENERIC_DECLINE = 'generic_decline'; + const DECLINED_INCORRECT_NUMBER = 'incorrect_number'; + const DECLINED_INCORRECT_CVC = 'incorrect_cvc'; + const DECLINED_INCORRECT_PIN = 'incorrect_pin'; + const DECLINED_INCORRECT_ZIP = 'incorrect_zip'; + const DECLINED_INSUFFICIENT_FUNDS = 'insufficient_funds'; + const DECLINED_INVALID_ACCOUNT = 'invalid_account'; + const DECLINED_INVALID_AMOUNT = 'invalid_amount'; + const DECLINED_INVALID_CVC = 'invalid_cvc'; + const DECLINED_INVALID_EXPIRY_YEAR = 'invalid_expiry_year'; + const DECLINED_INVALID_NUMBER = 'invalid_number'; + 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'; - const DECLINED_PICKUP_CARD = 'pickup_card'; - const DECLINED_PIN_TRY_EXCEEDED = 'pin_try_exceeded'; - const DECLINED_PROCESSING_ERROR = 'processing_error'; - const DECLINED_REENTER_TRANSACTION = 'reenter_transaction'; - const DECLINED_RESTRICTED_CARD = 'restricted_card'; - const DECLINED_REVOCATION_OF_ALL_AUTHORIZATIONS = 'revocation_of_all_authorizations'; - const DECLINED_REVOCATION_OF_AUTHORIZATION = 'revocation_of_authorization'; - const DECLINED_SECURITY_VIOLATION = 'security_violation'; - const DECLINED_SERVICE_NOT_ALLOWED = 'service_not_allowed'; - const DECLINED_STOLEN_CARD = 'stolen_card'; - const DECLINED_STOP_PAYMENT_ORDER = 'stop_payment_order'; - const DECLINED_TESTMODE_DECLINE = 'testmode_decline'; - const DECLINED_TRANSACTION_NOT_ALLOWED = 'transaction_not_allowed'; - const DECLINED_TRY_AGAIN_LATER = 'try_again_later'; - const DECLINED_WITHDRAWAL_COUNT_LIMIT_EXCEEDED = 'withdrawal_count_limit_exceeded'; + const DECLINED_NO_ACTION_TAKEN = 'no_action_taken'; + const DECLINED_NOT_PERMITTED = 'not_permitted'; + const DECLINED_OFFLINE_PIN_REQUIRED = 'offline_pin_required'; + const DECLINED_ONLINE_OR_OFFLINE_PIN_REQUIRED = 'online_or_offline_pin_required'; + const DECLINED_PICKUP_CARD = 'pickup_card'; + const DECLINED_PIN_TRY_EXCEEDED = 'pin_try_exceeded'; + const DECLINED_PROCESSING_ERROR = 'processing_error'; + const DECLINED_REENTER_TRANSACTION = 'reenter_transaction'; + const DECLINED_RESTRICTED_CARD = 'restricted_card'; + const DECLINED_REVOCATION_OF_ALL_AUTHORIZATIONS = 'revocation_of_all_authorizations'; + const DECLINED_REVOCATION_OF_AUTHORIZATION = 'revocation_of_authorization'; + const DECLINED_SECURITY_VIOLATION = 'security_violation'; + const DECLINED_SERVICE_NOT_ALLOWED = 'service_not_allowed'; + const DECLINED_STOLEN_CARD = 'stolen_card'; + const DECLINED_STOP_PAYMENT_ORDER = 'stop_payment_order'; + const DECLINED_TESTMODE_DECLINE = 'testmode_decline'; + const DECLINED_TRANSACTION_NOT_ALLOWED = 'transaction_not_allowed'; + const DECLINED_TRY_AGAIN_LATER = 'try_again_later'; + const DECLINED_WITHDRAWAL_COUNT_LIMIT_EXCEEDED = 'withdrawal_count_limit_exceeded'; /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts * - * @return Charge The refunded charge. - */ - public function refund($params = null, $options = null) - { - $url = $this->instanceUrl() . '/refund'; - list($response, $opts) = $this->_request('post', $url, $params, $options); - $this->refreshFrom($response, $opts); - return $this; - } - - /** - * @param array|null $params - * @param array|string|null $options + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Charge The captured charge. + * @return Charge the captured charge */ - public function capture($params = null, $options = null) + public function capture($params = null, $opts = null) { $url = $this->instanceUrl() . '/capture'; - list($response, $opts) = $this->_request('post', $url, $params, $options); - $this->refreshFrom($response, $opts); - return $this; - } - - /** - * @param array|null $params - * @param array|string|null $options - * - * @deprecated Use the `save` method on the Dispute object - * - * @return array The updated dispute. - */ - public function updateDispute($params = null, $options = null) - { - $url = $this->instanceUrl() . '/dispute'; - list($response, $opts) = $this->_request('post', $url, $params, $options); - $this->refreshFrom(['dispute' => $response], $opts, true); - return $this->dispute; - } - - /** - * @param array|string|null $options - * - * @deprecated Use the `close` method on the Dispute object - * - * @return Charge The updated charge. - */ - public function closeDispute($options = null) - { - $url = $this->instanceUrl() . '/dispute/close'; - list($response, $opts) = $this->_request('post', $url, null, $options); - $this->refreshFrom($response, $opts); - return $this; - } - - /** - * @param array|string|null $opts - * - * @return Charge The updated charge. - */ - public function markAsFraudulent($opts = null) - { - $params = ['fraud_details' => ['user_report' => 'fraudulent']]; - $url = $this->instanceUrl(); list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); - return $this; - } - /** - * @param array|string|null $opts - * - * @return Charge The updated charge. - */ - public function markAsSafe($opts = null) - { - $params = ['fraud_details' => ['user_report' => 'safe']]; - $url = $this->instanceUrl(); - list($response, $opts) = $this->_request('post', $url, $params, $opts); - $this->refreshFrom($response, $opts); return $this; } } diff --git a/plugins/stripe/lib/Checkout/Session.php b/plugins/stripe/lib/Checkout/Session.php new file mode 100644 index 0000000000..464a2b9a5c --- /dev/null +++ b/plugins/stripe/lib/Checkout/Session.php @@ -0,0 +1,88 @@ +Checkout. We recommend + * creating a new Session each time your customer attempts to pay. + * + * Once payment is successful, the Checkout Session will contain a reference to the + * Customer, and either the + * successful PaymentIntent or an + * active Subscription. + * + * You can create a Checkout Session on your server and pass its ID to the client + * to begin Checkout. + * + * Related guide: Checkout + * Server Quickstart. + * + * @property string $id Unique identifier for the object. Used to pass to redirectToCheckout in Stripe.js. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|bool $allow_promotion_codes Enables user redeemable promotion codes. + * @property null|int $amount_subtotal Total of all items before discounts or taxes are applied. + * @property null|int $amount_total Total of all items after discounts and taxes are applied. + * @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address. + * @property string $cancel_url The URL the customer will be directed to if they decide to cancel payment and return to your website. + * @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the session with your internal systems. + * @property null|string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string|\Stripe\Customer $customer The ID of the customer for this session. For Checkout Sessions in payment or subscription mode, Checkout will create a new customer object based on information provided during the session unless an existing customer was provided when the session was created. + * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the customer attribute. + * @property \Stripe\Collection $line_items The line items purchased by the customer. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or auto, the browser's locale is used. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $mode The mode of the Checkout Session. + * @property null|string|\Stripe\PaymentIntent $payment_intent The ID of the PaymentIntent for Checkout Sessions in payment mode. + * @property string[] $payment_method_types A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept. + * @property string $payment_status The payment status of the Checkout Session, one of paid, unpaid, or no_payment_required. You can use this value to decide when to fulfill your customer's order. + * @property null|string|\Stripe\SetupIntent $setup_intent The ID of the SetupIntent for Checkout Sessions in setup mode. + * @property null|\Stripe\StripeObject $shipping Shipping information for this Checkout Session. + * @property null|\Stripe\StripeObject $shipping_address_collection When set, provides configuration for Checkout to collect a shipping address from a customer. + * @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. submit_type can only be specified on Checkout Sessions in payment mode, but not Checkout Sessions in subscription or setup mode. + * @property null|string|\Stripe\Subscription $subscription The ID of the subscription for Checkout Sessions in subscription mode. + * @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful. + * @property null|\Stripe\StripeObject $total_details Tax and discount details for the computed total amount. + */ +class Session extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'checkout.session'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\NestedResource; + use \Stripe\ApiOperations\Retrieve; + + const BILLING_ADDRESS_COLLECTION_AUTO = 'auto'; + const BILLING_ADDRESS_COLLECTION_REQUIRED = 'required'; + + const PAYMENT_STATUS_NO_PAYMENT_REQUIRED = 'no_payment_required'; + const PAYMENT_STATUS_PAID = 'paid'; + const PAYMENT_STATUS_UNPAID = 'unpaid'; + + const SUBMIT_TYPE_AUTO = 'auto'; + const SUBMIT_TYPE_BOOK = 'book'; + const SUBMIT_TYPE_DONATE = 'donate'; + const SUBMIT_TYPE_PAY = 'pay'; + + const PATH_LINE_ITEMS = '/line_items'; + + /** + * @param string $id the ID of the session on which to retrieve the items + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of items + */ + public static function allLineItems($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_LINE_ITEMS, $params, $opts); + } +} diff --git a/plugins/stripe/lib/Collection.php b/plugins/stripe/lib/Collection.php index 64fd9f3284..ec5bebb7a4 100644 --- a/plugins/stripe/lib/Collection.php +++ b/plugins/stripe/lib/Collection.php @@ -3,95 +3,277 @@ namespace Stripe; /** - * Class Collection + * Class Collection. * * @property string $object * @property string $url * @property bool $has_more - * @property mixed $data - * - * @package Stripe + * @property \Stripe\StripeObject[] $data */ -class Collection extends StripeObject +class Collection extends StripeObject implements \Countable, \IteratorAggregate { - - const OBJECT_NAME = "list"; + const OBJECT_NAME = 'list'; use ApiOperations\Request; - protected $_requestParams = []; + /** @var array */ + protected $filters = []; /** - * @return string The base URL for the given class. + * @return string the base URL for the given class */ public static function baseUrl() { return Stripe::$apiBase; } - public function setRequestParams($params) + /** + * Returns the filters. + * + * @return array the filters + */ + public function getFilters() + { + return $this->filters; + } + + /** + * Sets the filters, removing paging options. + * + * @param array $filters the filters + */ + public function setFilters($filters) + { + $this->filters = $filters; + } + + public function offsetGet($k) { - $this->_requestParams = $params; + if (\is_string($k)) { + return parent::offsetGet($k); + } + $msg = "You tried to access the {$k} index, but Collection " . + 'types only support string keys. (HINT: List calls ' . + 'return an object with a `data` (which is the data ' . + "array). You likely want to call ->data[{$k}])"; + + throw new Exception\InvalidArgumentException($msg); } public function all($params = null, $opts = null) { + self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); list($response, $opts) = $this->_request('get', $url, $params, $opts); - $this->_requestParams = $params; - return Util\Util::convertToStripeObject($response, $opts); + $obj = Util\Util::convertToStripeObject($response, $opts); + if (!($obj instanceof \Stripe\Collection)) { + throw new \Stripe\Exception\UnexpectedValueException( + 'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.' + ); + } + $obj->setFilters($params); + + return $obj; } public function create($params = null, $opts = null) { + self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); list($response, $opts) = $this->_request('post', $url, $params, $opts); - $this->_requestParams = $params; + return Util\Util::convertToStripeObject($response, $opts); } public function retrieve($id, $params = null, $opts = null) { + self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); $id = Util\Util::utf8($id); - $extn = urlencode($id); + $extn = \urlencode($id); list($response, $opts) = $this->_request( 'get', - "$url/$extn", + "{$url}/{$extn}", $params, $opts ); - $this->_requestParams = $params; + return Util\Util::convertToStripeObject($response, $opts); } /** - * @return Util\AutoPagingIterator An iterator that can be used to iterate - * across all objects across all pages. As page boundaries are + * @return int the number of objects in the current page + */ + public function count() + { + return \count($this->data); + } + + /** + * @return \ArrayIterator an iterator that can be used to iterate + * across objects in the current page + */ + public function getIterator() + { + return new \ArrayIterator($this->data); + } + + /** + * @return \ArrayIterator an iterator that can be used to iterate + * backwards across objects in the current page + */ + public function getReverseIterator() + { + return new \ArrayIterator(\array_reverse($this->data)); + } + + /** + * @return \Generator|StripeObject[] A generator that can be used to + * iterate across all objects across all pages. As page boundaries are * encountered, the next page will be fetched automatically for * continued iteration. */ public function autoPagingIterator() { - return new Util\AutoPagingIterator($this, $this->_requestParams); + $page = $this; + + while (true) { + $filters = $this->filters ?: []; + if (\array_key_exists('ending_before', $filters) && + !\array_key_exists('starting_after', $filters)) { + foreach ($page->getReverseIterator() as $item) { + yield $item; + } + $page = $page->previousPage(); + } else { + foreach ($page as $item) { + yield $item; + } + $page = $page->nextPage(); + } + + if ($page->isEmpty()) { + break; + } + } + } + + /** + * Returns an empty collection. This is returned from {@see nextPage()} + * when we know that there isn't a next page in order to replicate the + * behavior of the API when it attempts to return a page beyond the last. + * + * @param null|array|string $opts + * + * @return Collection + */ + public static function emptyCollection($opts = null) + { + return Collection::constructFrom(['data' => []], $opts); + } + + /** + * Returns true if the page object contains no element. + * + * @return bool + */ + public function isEmpty() + { + return empty($this->data); + } + + /** + * Fetches the next page in the resource list (if there is one). + * + * This method will try to respect the limit of the current page. If none + * was given, the default limit will be fetched again. + * + * @param null|array $params + * @param null|array|string $opts + * + * @return Collection + */ + public function nextPage($params = null, $opts = null) + { + if (!$this->has_more) { + return static::emptyCollection($opts); + } + + $lastId = \end($this->data)->id; + + $params = \array_merge( + $this->filters ?: [], + ['starting_after' => $lastId], + $params ?: [] + ); + + return $this->all($params, $opts); + } + + /** + * Fetches the previous page in the resource list (if there is one). + * + * This method will try to respect the limit of the current page. If none + * was given, the default limit will be fetched again. + * + * @param null|array $params + * @param null|array|string $opts + * + * @return Collection + */ + public function previousPage($params = null, $opts = null) + { + if (!$this->has_more) { + return static::emptyCollection($opts); + } + + $firstId = $this->data[0]->id; + + $params = \array_merge( + $this->filters ?: [], + ['ending_before' => $firstId], + $params ?: [] + ); + + return $this->all($params, $opts); + } + + /** + * Gets the first item from the current page. Returns `null` if the current page is empty. + * + * @return null|\Stripe\StripeObject + */ + public function first() + { + return \count($this->data) > 0 ? $this->data[0] : null; + } + + /** + * Gets the last item from the current page. Returns `null` if the current page is empty. + * + * @return null|\Stripe\StripeObject + */ + public function last() + { + return \count($this->data) > 0 ? $this->data[\count($this->data) - 1] : null; } private function extractPathAndUpdateParams($params) { - $url = parse_url($this->url); + $url = \parse_url($this->url); if (!isset($url['path'])) { - throw new Error\Api("Could not parse list url into parts: $url"); + throw new Exception\UnexpectedValueException("Could not parse list url into parts: {$url}"); } if (isset($url['query'])) { // If the URL contains a query param, parse it out into $params so they // don't interact weirdly with each other. $query = []; - parse_str($url['query'], $query); - $params = array_merge($params ?: [], $query); + \parse_str($url['query'], $query); + $params = \array_merge($params ?: [], $query); } return [$url['path'], $params]; diff --git a/plugins/stripe/lib/CountrySpec.php b/plugins/stripe/lib/CountrySpec.php index fe25a99694..223afb316a 100644 --- a/plugins/stripe/lib/CountrySpec.php +++ b/plugins/stripe/lib/CountrySpec.php @@ -1,24 +1,29 @@ an online guide. * - * @package Stripe + * @property string $id Unique identifier for the object. Represented as the ISO country code for this country. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string $default_currency The default currency for this country. This applies to both payment methods and bank accounts. + * @property \Stripe\StripeObject $supported_bank_account_currencies Currencies that can be accepted in the specific country (for transfers). + * @property string[] $supported_payment_currencies Currencies that can be accepted in the specified country (for payments). + * @property string[] $supported_payment_methods Payment methods available in the specified country. You may need to enable some payment methods (e.g., ACH) on your account before they appear in this list. The stripe payment method refers to charging through your platform. + * @property string[] $supported_transfer_countries Countries that can accept transfers from the specified country. + * @property \Stripe\StripeObject $verification_fields */ class CountrySpec extends ApiResource { - - const OBJECT_NAME = "country_spec"; + const OBJECT_NAME = 'country_spec'; use ApiOperations\All; use ApiOperations\Retrieve; diff --git a/plugins/stripe/lib/Coupon.php b/plugins/stripe/lib/Coupon.php index 23564c0ae5..41afdcfc9b 100644 --- a/plugins/stripe/lib/Coupon.php +++ b/plugins/stripe/lib/Coupon.php @@ -1,31 +1,37 @@ invoices or orders. Coupons do + * not work with conventional one-off charges. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|int $amount_off Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer. + * @property \Stripe\StripeObject $applies_to + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $currency If amount_off has been set, the three-letter ISO code for the currency of the amount to take off. + * @property string $duration One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount. + * @property null|int $duration_in_months If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|int $max_redemptions Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $name Name of the coupon displayed to customers on for instance invoices or receipts. + * @property null|float $percent_off Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead. + * @property null|int $redeem_by Date after which the coupon can no longer be redeemed. + * @property int $times_redeemed Number of times this coupon has been applied to a customer. + * @property bool $valid Taking account of the above properties, whether this coupon can still be applied to a customer. */ class Coupon extends ApiResource { - - const OBJECT_NAME = "coupon"; + const OBJECT_NAME = 'coupon'; use ApiOperations\All; use ApiOperations\Create; diff --git a/plugins/stripe/lib/CreditNote.php b/plugins/stripe/lib/CreditNote.php new file mode 100644 index 0000000000..cc523a9f7a --- /dev/null +++ b/plugins/stripe/lib/CreditNote.php @@ -0,0 +1,111 @@ +Credit Notes. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount The integer amount in %s representing the total amount of the credit note, including tax. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property string|\Stripe\Customer $customer ID of the customer. + * @property null|string|\Stripe\CustomerBalanceTransaction $customer_balance_transaction Customer balance transaction related to this credit note. + * @property int $discount_amount The integer amount in %s representing the total amount of discount that was credited. + * @property \Stripe\StripeObject[] $discount_amounts The aggregate amounts calculated per discount for all line items. + * @property string|\Stripe\Invoice $invoice ID of the invoice. + * @property \Stripe\Collection $lines Line items that make up the credit note + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string $memo Customer-facing text that appears on the credit note PDF. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $number A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice. + * @property null|int $out_of_band_amount Amount that was credited outside of Stripe. + * @property string $pdf The link to download the PDF of the credit note. + * @property null|string $reason Reason for issuing this credit note, one of duplicate, fraudulent, order_change, or product_unsatisfactory + * @property null|string|\Stripe\Refund $refund Refund related to this credit note. + * @property string $status Status of this credit note, one of issued or void. Learn more about voiding credit notes. + * @property int $subtotal The integer amount in %s representing the amount of the credit note, excluding tax and invoice level discounts. + * @property \Stripe\StripeObject[] $tax_amounts The aggregate amounts calculated per tax rate for all line items. + * @property int $total The integer amount in %s representing the total amount of the credit note, including tax and all discount. + * @property string $type Type of this credit note, one of pre_payment or post_payment. A pre_payment credit note means it was issued when the invoice was open. A post_payment credit note means it was issued when the invoice was paid. + * @property null|int $voided_at The time that the credit note was voided. + */ +class CreditNote extends ApiResource +{ + const OBJECT_NAME = 'credit_note'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\NestedResource; + use ApiOperations\Retrieve; + use ApiOperations\Update; + + const REASON_DUPLICATE = 'duplicate'; + const REASON_FRAUDULENT = 'fraudulent'; + const REASON_ORDER_CHANGE = 'order_change'; + const REASON_PRODUCT_UNSATISFACTORY = 'product_unsatisfactory'; + + const STATUS_ISSUED = 'issued'; + const STATUS_VOID = 'void'; + + const TYPE_POST_PAYMENT = 'post_payment'; + const TYPE_PRE_PAYMENT = 'pre_payment'; + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CreditNote the previewed credit note + */ + public static function preview($params = null, $opts = null) + { + $url = static::classUrl() . '/preview'; + list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); + $obj = Util\Util::convertToStripeObject($response->json, $opts); + $obj->setLastResponse($response); + + return $obj; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return CreditNote the voided credit note + */ + public function voidCreditNote($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/void'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + const PATH_LINES = '/lines'; + + /** + * @param string $id the ID of the credit note on which to retrieve the credit note line items + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of credit note line items + */ + public static function allLines($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_LINES, $params, $opts); + } +} diff --git a/plugins/stripe/lib/CreditNoteLineItem.php b/plugins/stripe/lib/CreditNoteLineItem.php new file mode 100644 index 0000000000..254886b75d --- /dev/null +++ b/plugins/stripe/lib/CreditNoteLineItem.php @@ -0,0 +1,26 @@ +true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|int $quantity The number of units of product being credited. + * @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item + * @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item. + * @property string $type The type of the credit note line item, one of invoice_line_item or custom_line_item. When the type is invoice_line_item there is an additional invoice_line_item property on the resource the value of which is the id of the credited line item on the invoice. + * @property null|int $unit_amount The cost of each unit of product being credited. + * @property null|string $unit_amount_decimal Same as unit_amount, but contains a decimal value with at most 12 decimal places. + */ +class CreditNoteLineItem extends ApiResource +{ + const OBJECT_NAME = 'credit_note_line_item'; +} diff --git a/plugins/stripe/lib/Customer.php b/plugins/stripe/lib/Customer.php index f44872c4ff..c3a42cd8aa 100644 --- a/plugins/stripe/lib/Customer.php +++ b/plugins/stripe/lib/Customer.php @@ -1,34 +1,47 @@ Customer objects allow you to perform recurring charges, and to + * track multiple charges, that are associated with the same customer. The API + * allows you to create, delete, and update your customers. You can retrieve + * individual customers as well as a list of all your customers. * - * @property string $id - * @property string $object - * @property int $account_balance - * @property string $business_vat_id - * @property string $created - * @property string $currency - * @property string $default_source - * @property bool $delinquent - * @property string $description - * @property Discount $discount - * @property string $email - * @property string $invoice_prefix - * @property bool $livemode - * @property StripeObject $metadata - * @property mixed $shipping - * @property Collection $sources - * @property Collection $subscriptions + * Related guide: Save a card during + * payment. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|\Stripe\StripeObject $address The customer's address. + * @property int $balance Current balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $currency Three-letter ISO code for the currency the customer can be charged in for recurring billing purposes. + * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source

ID of the default payment source for the customer.

If you are using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method field instead.

+ * @property null|bool $delinquent

When the customer's latest invoice is billed by charging automatically, delinquent is true if the invoice's latest charge failed. When the customer's latest invoice is billed by sending an invoice, delinquent is true if the invoice isn't paid by its due date.

If an invoice is marked uncollectible by dunning, delinquent doesn't get reset to false.

+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|\Stripe\Discount $discount Describes the current discount active on the customer, if there is one. + * @property null|string $email The customer's email address. + * @property null|string $invoice_prefix The prefix for the customer used to generate unique invoice numbers. + * @property \Stripe\StripeObject $invoice_settings + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $name The customer's full name or business name. + * @property int $next_invoice_sequence The suffix of the customer's next invoice number, e.g., 0001. + * @property null|string $phone The customer's phone number. + * @property null|string[] $preferred_locales The customer's preferred locales (languages), ordered by preference. + * @property null|\Stripe\StripeObject $shipping Mailing and shipping address for the customer. Appears on invoices emailed to this customer. + * @property \Stripe\Collection $sources The customer's payment sources, if any. + * @property \Stripe\Collection $subscriptions The customer's current subscriptions, if any. + * @property null|string $tax_exempt Describes the customer's tax exemption status. One of none, exempt, or reverse. When set to reverse, invoice and receipt PDFs include the text "Reverse charge". + * @property \Stripe\Collection $tax_ids The customer's tax IDs. */ class Customer extends ApiResource { - - const OBJECT_NAME = "customer"; + const OBJECT_NAME = 'customer'; use ApiOperations\All; use ApiOperations\Create; @@ -37,126 +50,149 @@ class Customer extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; + const TAX_EXEMPT_EXEMPT = 'exempt'; + const TAX_EXEMPT_NONE = 'none'; + const TAX_EXEMPT_REVERSE = 'reverse'; + public static function getSavedNestedResources() { static $savedNestedResources = null; - if ($savedNestedResources === null) { + if (null === $savedNestedResources) { $savedNestedResources = new Util\Set([ 'source', ]); } + return $savedNestedResources; } - const PATH_SOURCES = '/sources'; - /** - * @param array|null $params + * @param null|array $params + * @param null|array|string $opts * - * @return InvoiceItem The resulting invoice item. + * @return \Stripe\Customer the updated customer */ - public function addInvoiceItem($params = null) + public function deleteDiscount($params = null, $opts = null) { - $params = $params ?: []; - $params['customer'] = $this->id; - $ii = InvoiceItem::create($params, $this->_opts); - return $ii; + $url = $this->instanceUrl() . '/discount'; + list($response, $opts) = $this->_request('delete', $url, $params, $opts); + $this->refreshFrom(['discount' => null], $opts, true); } + const PATH_BALANCE_TRANSACTIONS = '/balance_transactions'; + /** - * @param array|null $params + * @param string $id the ID of the customer on which to retrieve the customer balance transactions + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return array An array of the customer's Invoices. + * @return \Stripe\Collection the list of customer balance transactions */ - public function invoices($params = null) + public static function allBalanceTransactions($id, $params = null, $opts = null) { - $params = $params ?: []; - $params['customer'] = $this->id; - $invoices = Invoice::all($params, $this->_opts); - return $invoices; + return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); } /** - * @param array|null $params + * @param string $id the ID of the customer on which to create the customer balance transaction + * @param null|array $params + * @param null|array|string $opts * - * @return array An array of the customer's InvoiceItems. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CustomerBalanceTransaction */ - public function invoiceItems($params = null) + public static function createBalanceTransaction($id, $params = null, $opts = null) { - $params = $params ?: []; - $params['customer'] = $this->id; - $iis = InvoiceItem::all($params, $this->_opts); - return $iis; + return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts); } /** - * @param array|null $params + * @param string $id the ID of the customer to which the customer balance transaction belongs + * @param string $balanceTransactionId the ID of the customer balance transaction to retrieve + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return array An array of the customer's Charges. + * @return \Stripe\CustomerBalanceTransaction */ - public function charges($params = null) + public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) { - $params = $params ?: []; - $params['customer'] = $this->id; - $charges = Charge::all($params, $this->_opts); - return $charges; + return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); } /** - * @param array|null $params + * @param string $id the ID of the customer to which the customer balance transaction belongs + * @param string $balanceTransactionId the ID of the customer balance transaction to update + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Subscription The updated subscription. + * @return \Stripe\CustomerBalanceTransaction */ - public function updateSubscription($params = null) + public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null) { - $url = $this->instanceUrl() . '/subscription'; - list($response, $opts) = $this->_request('post', $url, $params); - $this->refreshFrom(['subscription' => $response], $opts, true); - return $this->subscription; + return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts); } + const PATH_SOURCES = '/sources'; + /** - * @param array|null $params + * @param string $id the ID of the customer on which to retrieve the payment sources + * @param null|array $params + * @param null|array|string $opts * - * @return Subscription The cancelled subscription. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of payment sources (AlipayAccount, BankAccount, BitcoinReceiver, Card or Source) */ - public function cancelSubscription($params = null) + public static function allSources($id, $params = null, $opts = null) { - $url = $this->instanceUrl() . '/subscription'; - list($response, $opts) = $this->_request('delete', $url, $params); - $this->refreshFrom(['subscription' => $response], $opts, true); - return $this->subscription; + return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts); } /** - * @return Customer The updated customer. + * @param string $id the ID of the customer on which to create the payment source + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source */ - public function deleteDiscount() + public static function createSource($id, $params = null, $opts = null) { - $url = $this->instanceUrl() . '/discount'; - list($response, $opts) = $this->_request('delete', $url); - $this->refreshFrom(['discount' => null], $opts, true); + return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts); } /** - * @param array|null $id The ID of the customer on which to create the source. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the customer to which the payment source belongs + * @param string $sourceId the ID of the payment source to delete + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApiResource + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source */ - public static function createSource($id, $params = null, $opts = null) + public static function deleteSource($id, $sourceId, $params = null, $opts = null) { - return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts); + return self::_deleteNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); } /** - * @param array|null $id The ID of the customer to which the source belongs. - * @param array|null $sourceId The ID of the source to retrieve. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the customer to which the payment source belongs + * @param string $sourceId the ID of the payment source to retrieve + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApiResource + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source */ public static function retrieveSource($id, $sourceId, $params = null, $opts = null) { @@ -164,40 +200,77 @@ public static function retrieveSource($id, $sourceId, $params = null, $opts = nu } /** - * @param array|null $id The ID of the customer to which the source belongs. - * @param array|null $sourceId The ID of the source to update. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the customer to which the payment source belongs + * @param string $sourceId the ID of the payment source to update + * @param null|array $params + * @param null|array|string $opts * - * @return ApiResource + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source */ public static function updateSource($id, $sourceId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); } + const PATH_TAX_IDS = '/tax_ids'; + /** - * @param array|null $id The ID of the customer to which the source belongs. - * @param array|null $sourceId The ID of the source to delete. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the customer on which to retrieve the tax ids + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApiResource + * @return \Stripe\Collection the list of tax ids */ - public static function deleteSource($id, $sourceId, $params = null, $opts = null) + public static function allTaxIds($id, $params = null, $opts = null) { - return self::_deleteNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts); + return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts); } /** - * @param array|null $id The ID of the customer on which to retrieve the sources. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the customer on which to create the tax id + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return ApiResource + * @return \Stripe\TaxId */ - public static function allSources($id, $params = null, $opts = null) + public static function createTaxId($id, $params = null, $opts = null) { - return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts); + return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts); + } + + /** + * @param string $id the ID of the customer to which the tax id belongs + * @param string $taxIdId the ID of the tax id to delete + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxId + */ + public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null) + { + return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); + } + + /** + * @param string $id the ID of the customer to which the tax id belongs + * @param string $taxIdId the ID of the tax id to retrieve + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxId + */ + public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null) + { + return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts); } } diff --git a/plugins/stripe/lib/CustomerBalanceTransaction.php b/plugins/stripe/lib/CustomerBalanceTransaction.php new file mode 100644 index 0000000000..8c306760db --- /dev/null +++ b/plugins/stripe/lib/CustomerBalanceTransaction.php @@ -0,0 +1,103 @@ +balance + * value, which denotes a debit or credit that's automatically applied to their + * next invoice upon finalization. You may modify the value directly by using the + * update customer API, + * or by creating a Customer Balance Transaction, which increments or decrements + * the customer's balance by the specified amount. + * + * Related guide: Customer Balance to + * learn more. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's balance. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string|\Stripe\CreditNote $credit_note The ID of the credit note (if any) related to the transaction. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property string|\Stripe\Customer $customer The ID of the customer the transaction belongs to. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property int $ending_balance The customer's balance after the transaction was applied. A negative value decreases the amount due on the customer's next invoice. A positive value increases the amount due on the customer's next invoice. + * @property null|string|\Stripe\Invoice $invoice The ID of the invoice (if any) related to the transaction. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $type Transaction type: adjustment, applied_to_invoice, credit_note, initial, invoice_too_large, invoice_too_small, unspent_receiver_credit, or unapplied_from_invoice. See the Customer Balance page to learn more about transaction types. + */ +class CustomerBalanceTransaction extends ApiResource +{ + const OBJECT_NAME = 'customer_balance_transaction'; + + const TYPE_ADJUSTMENT = 'adjustment'; + const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice'; + const TYPE_CREDIT_NOTE = 'credit_note'; + const TYPE_INITIAL = 'initial'; + const TYPE_INVOICE_TOO_LARGE = 'invoice_too_large'; + const TYPE_INVOICE_TOO_SMALL = 'invoice_too_small'; + const TYPE_UNSPENT_RECEIVER_CREDIT = 'unspent_receiver_credit'; + + const TYPE_ADJUSTEMENT = 'adjustment'; + + /** + * @return string the API URL for this balance transaction + */ + public function instanceUrl() + { + $id = $this['id']; + $customer = $this['customer']; + if (!$id) { + throw new Exception\UnexpectedValueException( + "Could not determine which URL to request: class instance has invalid ID: {$id}", + null + ); + } + $id = Util\Util::utf8($id); + $customer = Util\Util::utf8($customer); + + $base = Customer::classUrl(); + $customerExtn = \urlencode($customer); + $extn = \urlencode($id); + + return "{$base}/{$customerExtn}/balance_transactions/{$extn}"; + } + + /** + * @param array|string $_id + * @param null|array|string $_opts + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function retrieve($_id, $_opts = null) + { + $msg = 'Customer Balance Transactions cannot be retrieved without a ' . + 'customer ID. Retrieve a Customer Balance Transaction using ' . + "`Customer::retrieveBalanceTransaction('customer_id', " . + "'balance_transaction_id')`."; + + throw new Exception\BadMethodCallException($msg); + } + + /** + * @param string $_id + * @param null|array $_params + * @param null|array|string $_options + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function update($_id, $_params = null, $_options = null) + { + $msg = 'Customer Balance Transactions cannot be updated without a ' . + 'customer ID. Update a Customer Balance Transaction using ' . + "`Customer::updateBalanceTransaction('customer_id', " . + "'balance_transaction_id', \$updateParams)`."; + + throw new Exception\BadMethodCallException($msg); + } +} diff --git a/plugins/stripe/lib/Discount.php b/plugins/stripe/lib/Discount.php index a72d12bc6e..d4656052e3 100644 --- a/plugins/stripe/lib/Discount.php +++ b/plugins/stripe/lib/Discount.php @@ -3,7 +3,7 @@ namespace Stripe; /** - * Class Discount + * Class Discount. * * @property string $object * @property Coupon $coupon @@ -11,11 +11,8 @@ * @property int $end * @property int $start * @property string $subscription - * - * @package Stripe */ class Discount extends StripeObject { - - const OBJECT_NAME = "discount"; + const OBJECT_NAME = 'discount'; } diff --git a/plugins/stripe/lib/Dispute.php b/plugins/stripe/lib/Dispute.php index c4a9566760..5772accc53 100644 --- a/plugins/stripe/lib/Dispute.php +++ b/plugins/stripe/lib/Dispute.php @@ -1,77 +1,82 @@ Disputes and Fraud + * documentation. * - * @property string $id - * @property string $object - * @property int $amount - * @property BalanceTransaction[] $balance_transactions - * @property string $charge - * @property int $created - * @property string $currency - * @property mixed $evidence - * @property mixed $evidence_details - * @property bool $is_charge_refundable - * @property bool $livemode - * @property StripeObject $metadata - * @property string $reason - * @property string $status + * Related guide: Disputes and + * Fraud. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Disputed amount. Usually the amount of the charge, but can differ (usually because of currency fluctuation or because only part of the order is disputed). + * @property \Stripe\BalanceTransaction[] $balance_transactions List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute. + * @property string|\Stripe\Charge $charge ID of the charge that was disputed. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property \Stripe\StripeObject $evidence + * @property \Stripe\StripeObject $evidence_details + * @property bool $is_charge_refundable If true, it is still possible to refund the disputed payment. Once the payment has been fully refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $network_reason_code Network-dependent reason code for the dispute. + * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent that was disputed. + * @property string $reason Reason given by cardholder for dispute. Possible values are bank_cannot_process, check_returned, credit_not_processed, customer_initiated, debit_not_authorized, duplicate, fraudulent, general, incorrect_account_details, insufficient_funds, product_not_received, product_unacceptable, subscription_canceled, or unrecognized. Read more about dispute reasons. + * @property string $status Current status of dispute. Possible values are warning_needs_response, warning_under_review, warning_closed, needs_response, under_review, charge_refunded, won, or lost. */ class Dispute extends ApiResource { - - const OBJECT_NAME = "dispute"; + const OBJECT_NAME = 'dispute'; use ApiOperations\All; use ApiOperations\Retrieve; use ApiOperations\Update; - /** - * Possible string representations of dispute reasons. - * @link https://stripe.com/docs/api#dispute_object - */ - const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process'; - const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed'; - const REASON_CUSTOMER_INITIATED = 'customer_initiated'; - const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized'; - const REASON_DUPLICATE = 'duplicate'; - const REASON_FRAUDULENT = 'fraudulent'; - const REASON_GENERAL = 'general'; + const REASON_BANK_CANNOT_PROCESS = 'bank_cannot_process'; + const REASON_CHECK_RETURNED = 'check_returned'; + const REASON_CREDIT_NOT_PROCESSED = 'credit_not_processed'; + const REASON_CUSTOMER_INITIATED = 'customer_initiated'; + const REASON_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized'; + const REASON_DUPLICATE = 'duplicate'; + const REASON_FRAUDULENT = 'fraudulent'; + const REASON_GENERAL = 'general'; const REASON_INCORRECT_ACCOUNT_DETAILS = 'incorrect_account_details'; - const REASON_INSUFFICIENT_FUNDS = 'insufficient_funds'; - const REASON_PRODUCT_NOT_RECEIVED = 'product_not_received'; - const REASON_PRODUCT_UNACCEPTABLE = 'product_unacceptable'; - const REASON_SUBSCRIPTION_CANCELED = 'subscription_canceled'; - const REASON_UNRECOGNIZED = 'unrecognized'; + const REASON_INSUFFICIENT_FUNDS = 'insufficient_funds'; + const REASON_PRODUCT_NOT_RECEIVED = 'product_not_received'; + const REASON_PRODUCT_UNACCEPTABLE = 'product_unacceptable'; + const REASON_SUBSCRIPTION_CANCELED = 'subscription_canceled'; + const REASON_UNRECOGNIZED = 'unrecognized'; - /** - * Possible string representations of dispute statuses. - * @link https://stripe.com/docs/api#dispute_object - */ - const STATUS_CHARGE_REFUNDED = 'charge_refunded'; - const STATUS_LOST = 'lost'; - const STATUS_NEEDS_RESPONSE = 'needs_response'; - const STATUS_UNDER_REVIEW = 'under_review'; - const STATUS_WARNING_CLOSED = 'warning_closed'; + const STATUS_CHARGE_REFUNDED = 'charge_refunded'; + const STATUS_LOST = 'lost'; + const STATUS_NEEDS_RESPONSE = 'needs_response'; + const STATUS_UNDER_REVIEW = 'under_review'; + const STATUS_WARNING_CLOSED = 'warning_closed'; const STATUS_WARNING_NEEDS_RESPONSE = 'warning_needs_response'; - const STATUS_WARNING_UNDER_REVIEW = 'warning_under_review'; - const STATUS_WON = 'won'; + const STATUS_WARNING_UNDER_REVIEW = 'warning_under_review'; + const STATUS_WON = 'won'; /** - * @param array|string|null $options + * @param null|array|string $opts * - * @return Dispute The closed dispute. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Dispute the closed dispute */ - public function close($options = null) + // TODO: add $params to standardize signature + public function close($opts = null) { $url = $this->instanceUrl() . '/close'; - list($response, $opts) = $this->_request('post', $url, null, $options); + list($response, $opts) = $this->_request('post', $url, null, $opts); $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/EphemeralKey.php b/plugins/stripe/lib/EphemeralKey.php index 5ed4646b4f..544f0d7850 100644 --- a/plugins/stripe/lib/EphemeralKey.php +++ b/plugins/stripe/lib/EphemeralKey.php @@ -1,41 +1,43 @@ true if the object exists in live mode or the value false if the object exists in test mode. + * @property string $secret The key's secret. You can use this value to make authorized requests to the Stripe API. * @property array $associated_objects - * - * @package Stripe */ class EphemeralKey extends ApiResource { + const OBJECT_NAME = 'ephemeral_key'; - const OBJECT_NAME = "ephemeral_key"; + use ApiOperations\Delete; use ApiOperations\Create { create as protected _create; } - use ApiOperations\Delete; /** - * @param array|null $params - * @param array|string|null $opts + * @param null|array $params + * @param null|array|string $opts * - * @return EphemeralKey The created key. + * @throws \Stripe\Exception\InvalidArgumentException if stripe_version is missing + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\EphemeralKey the created key */ public static function create($params = null, $opts = null) { - if (!$opts['stripe_version']) { - throw new \InvalidArgumentException('stripe_version must be specified to create an ephemeral key'); + if (!$opts || !isset($opts['stripe_version'])) { + throw new Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key'); } + return self::_create($params, $opts); } } diff --git a/plugins/stripe/lib/Error/Api.php b/plugins/stripe/lib/Error/Api.php deleted file mode 100644 index dc7d069efd..0000000000 --- a/plugins/stripe/lib/Error/Api.php +++ /dev/null @@ -1,7 +0,0 @@ -httpStatus = $httpStatus; - $this->httpBody = $httpBody; - $this->jsonBody = $jsonBody; - $this->httpHeaders = $httpHeaders; - $this->requestId = null; - - // TODO: make this a proper constructor argument in the next major - // release. - $this->stripeCode = isset($jsonBody["error"]["code"]) ? $jsonBody["error"]["code"] : null; - - if ($httpHeaders && isset($httpHeaders['Request-Id'])) { - $this->requestId = $httpHeaders['Request-Id']; - } - } - - public function getStripeCode() - { - return $this->stripeCode; - } - - public function getHttpStatus() - { - return $this->httpStatus; - } - - public function getHttpBody() - { - return $this->httpBody; - } - - public function getJsonBody() - { - return $this->jsonBody; - } - - public function getHttpHeaders() - { - return $this->httpHeaders; - } - - public function getRequestId() - { - return $this->requestId; - } - - public function __toString() - { - $id = $this->requestId ? " from API request '{$this->requestId}'": ""; - $message = explode("\n", parent::__toString()); - $message[0] .= $id; - return implode("\n", $message); - } -} diff --git a/plugins/stripe/lib/Error/Card.php b/plugins/stripe/lib/Error/Card.php deleted file mode 100644 index f3ff343d89..0000000000 --- a/plugins/stripe/lib/Error/Card.php +++ /dev/null @@ -1,40 +0,0 @@ -stripeParam = $stripeParam; - - // TODO: once Error\Base accepts the error code as an argument, pass it - // in the call to parent::__construct() and stop setting it here. - $this->stripeCode = $stripeCode; - - // This one is not like the others because it was added later and we're - // trying to do our best not to change the public interface of this class' - // constructor. - // TODO: make this a proper constructor argument in the next major - // release. - $this->declineCode = isset($jsonBody["error"]["decline_code"]) ? $jsonBody["error"]["decline_code"] : null; - } - - public function getDeclineCode() - { - return $this->declineCode; - } - - public function getStripeParam() - { - return $this->stripeParam; - } -} diff --git a/plugins/stripe/lib/Error/Idempotency.php b/plugins/stripe/lib/Error/Idempotency.php deleted file mode 100644 index ea44d12e4e..0000000000 --- a/plugins/stripe/lib/Error/Idempotency.php +++ /dev/null @@ -1,7 +0,0 @@ -stripeParam = $stripeParam; - } - - public function getStripeParam() - { - return $this->stripeParam; - } -} diff --git a/plugins/stripe/lib/Error/OAuth/InvalidClient.php b/plugins/stripe/lib/Error/OAuth/InvalidClient.php deleted file mode 100644 index b47346cde5..0000000000 --- a/plugins/stripe/lib/Error/OAuth/InvalidClient.php +++ /dev/null @@ -1,10 +0,0 @@ -code = $code; - } - - public function getErrorCode() - { - return $this->code; - } -} diff --git a/plugins/stripe/lib/Error/OAuth/UnsupportedGrantType.php b/plugins/stripe/lib/Error/OAuth/UnsupportedGrantType.php deleted file mode 100644 index 421adc9964..0000000000 --- a/plugins/stripe/lib/Error/OAuth/UnsupportedGrantType.php +++ /dev/null @@ -1,11 +0,0 @@ -sigHeader = $sigHeader; - } - - public function getSigHeader() - { - return $this->sigHeader; - } -} diff --git a/plugins/stripe/lib/ErrorObject.php b/plugins/stripe/lib/ErrorObject.php new file mode 100644 index 0000000000..a9fe1a3b27 --- /dev/null +++ b/plugins/stripe/lib/ErrorObject.php @@ -0,0 +1,164 @@ + null, + 'code' => null, + 'decline_code' => null, + 'doc_url' => null, + 'message' => null, + 'param' => null, + 'payment_intent' => null, + 'payment_method' => null, + 'setup_intent' => null, + 'source' => null, + 'type' => null, + ], $values); + parent::refreshFrom($values, $opts, $partial); + } +} diff --git a/plugins/stripe/lib/Event.php b/plugins/stripe/lib/Event.php index 19845c68ad..518c5d4134 100644 --- a/plugins/stripe/lib/Event.php +++ b/plugins/stripe/lib/Event.php @@ -1,119 +1,231 @@ Event object. For example, when a charge succeeds, we create a + * charge.succeeded event; and when an invoice payment attempt fails, + * we create an invoice.payment_failed event. Note that many API + * requests may cause multiple events to be created. For example, if you create a + * new subscription for a customer, you will receive both a + * customer.subscription.created event and a + * charge.succeeded event. + * + * Events occur when the state of another API resource changes. The state of that + * resource at the time of the change is embedded in the event's data field. For + * example, a charge.succeeded event will contain a charge, and an + * invoice.payment_failed event will contain an invoice. + * + * As with other API resources, you can use endpoints to retrieve an individual event or a list of events from the API. + * We also have a separate webhooks system for sending the + * Event objects directly to an endpoint on your server. Webhooks are + * managed in your account + * settings, and our Using + * Webhooks guide will help you get set up. * - * @property string $id - * @property string $object - * @property string $account - * @property string $api_version - * @property int $created - * @property mixed $data - * @property bool $livemode - * @property int $pending_webhooks - * @property mixed $request - * @property string $type + * When using Connect, you can also + * receive notifications of events that occur in connected accounts. For these + * events, there will be an additional account attribute in the + * received Event object. * - * @package Stripe + * NOTE: Right now, access to events through the Retrieve Event API is + * guaranteed only for 30 days. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string $account The connected account that originated the event. + * @property null|string $api_version The Stripe API version used to render data. Note: This property is populated only for events on or after October 31, 2014. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property \Stripe\StripeObject $data + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property int $pending_webhooks Number of webhooks that have yet to be successfully delivered (i.e., to return a 20x response) to the URLs you've specified. + * @property null|\Stripe\StripeObject $request Information on the API request that instigated the event. + * @property string $type Description of the event (e.g., invoice.created or charge.refunded). */ class Event extends ApiResource { + const OBJECT_NAME = 'event'; - const OBJECT_NAME = "event"; + use ApiOperations\All; + use ApiOperations\Retrieve; - /** + /** * Possible string representations of event types. - * @link https://stripe.com/docs/api#event_types + * + * @see https://stripe.com/docs/api#event_types */ - const ACCOUNT_UPDATED = 'account.updated'; - const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized'; - const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created'; - const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted'; - const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated'; - const APPLICATION_FEE_CREATED = 'application_fee.created'; - const APPLICATION_FEE_REFUNDED = 'application_fee.refunded'; - const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated'; - const BALANCE_AVAILABLE = 'balance.available'; - const CHARGE_CAPTURED = 'charge.captured'; - const CHARGE_EXPIRED = 'charge.expired'; - const CHARGE_FAILED = 'charge.failed'; - const CHARGE_PENDING = 'charge.pending'; - const CHARGE_REFUNDED = 'charge.refunded'; - const CHARGE_SUCCEEDED = 'charge.succeeded'; - const CHARGE_UPDATED = 'charge.updated'; - const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed'; - const CHARGE_DISPUTE_CREATED = 'charge.dispute.created'; - const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated'; - const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn'; - const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated'; - const CHARGE_REFUND_UPDATED = 'charge.refund.updated'; - const COUPON_CREATED = 'coupon.created'; - const COUPON_DELETED = 'coupon.deleted'; - const COUPON_UPDATED = 'coupon.updated'; - const CUSTOMER_CREATED = 'customer.created'; - const CUSTOMER_DELETED = 'customer.deleted'; - const CUSTOMER_UPDATED = 'customer.updated'; - const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created'; - const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted'; - const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated'; - const CUSTOMER_SOURCE_CREATED = 'customer.source.created'; - const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted'; - const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring'; - const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated'; - const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created'; - const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted'; + const ACCOUNT_UPDATED = 'account.updated'; + const ACCOUNT_APPLICATION_AUTHORIZED = 'account.application.authorized'; + const ACCOUNT_APPLICATION_DEAUTHORIZED = 'account.application.deauthorized'; + const ACCOUNT_EXTERNAL_ACCOUNT_CREATED = 'account.external_account.created'; + const ACCOUNT_EXTERNAL_ACCOUNT_DELETED = 'account.external_account.deleted'; + const ACCOUNT_EXTERNAL_ACCOUNT_UPDATED = 'account.external_account.updated'; + const APPLICATION_FEE_CREATED = 'application_fee.created'; + const APPLICATION_FEE_REFUNDED = 'application_fee.refunded'; + const APPLICATION_FEE_REFUND_UPDATED = 'application_fee.refund.updated'; + const BALANCE_AVAILABLE = 'balance.available'; + const CAPABILITY_UPDATED = 'capability.updated'; + const CHARGE_CAPTURED = 'charge.captured'; + const CHARGE_EXPIRED = 'charge.expired'; + const CHARGE_FAILED = 'charge.failed'; + const CHARGE_PENDING = 'charge.pending'; + const CHARGE_REFUNDED = 'charge.refunded'; + const CHARGE_SUCCEEDED = 'charge.succeeded'; + const CHARGE_UPDATED = 'charge.updated'; + const CHARGE_DISPUTE_CLOSED = 'charge.dispute.closed'; + const CHARGE_DISPUTE_CREATED = 'charge.dispute.created'; + const CHARGE_DISPUTE_FUNDS_REINSTATED = 'charge.dispute.funds_reinstated'; + const CHARGE_DISPUTE_FUNDS_WITHDRAWN = 'charge.dispute.funds_withdrawn'; + const CHARGE_DISPUTE_UPDATED = 'charge.dispute.updated'; + const CHARGE_REFUND_UPDATED = 'charge.refund.updated'; + const CHECKOUT_SESSION_ASYNC_PAYMENT_FAILED = 'checkout.session.async_payment_failed'; + const CHECKOUT_SESSION_ASYNC_PAYMENT_SUCCEEDED = 'checkout.session.async_payment_succeeded'; + const CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed'; + 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'; + const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created'; + const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted'; + const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated'; + const CUSTOMER_SOURCE_CREATED = 'customer.source.created'; + const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted'; + const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring'; + const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated'; + const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created'; + const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted'; + const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_APPLIED = 'customer.subscription.pending_update_applied'; + const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_EXPIRED = 'customer.subscription.pending_update_expired'; const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end'; - const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated'; - const FILE_CREATED = 'file.created'; - const INVOICE_CREATED = 'invoice.created'; - const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed'; - const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded'; - const INVOICE_SENT = 'invoice.sent'; - const INVOICE_UPCOMING = 'invoice.upcoming'; - const INVOICE_UPDATED = 'invoice.updated'; - const INVOICEITEM_CREATED = 'invoiceitem.created'; - const INVOICEITEM_DELETED = 'invoiceitem.deleted'; - const INVOICEITEM_UPDATED = 'invoiceitem.updated'; - const ORDER_CREATED = 'order.created'; - const ORDER_PAYMENT_FAILED = 'order.payment_failed'; - const ORDER_PAYMENT_SUCCEEDED = 'order.payment_succeeded'; - const ORDER_UPDATED = 'order.updated'; - const ORDER_RETURN_CREATED = 'order_return.created'; - const PAYOUT_CANCELED = 'payout.canceled'; - const PAYOUT_CREATED = 'payout.created'; - const PAYOUT_FAILED = 'payout.failed'; - const PAYOUT_PAID = 'payout.paid'; - const PAYOUT_UPDATED = 'payout.updated'; - const PING = 'ping'; - const PLAN_CREATED = 'plan.created'; - const PLAN_DELETED = 'plan.deleted'; - const PLAN_UPDATED = 'plan.updated'; - const PRODUCT_CREATED = 'product.created'; - const PRODUCT_DELETED = 'product.deleted'; - const PRODUCT_UPDATED = 'product.updated'; - const RECIPIENT_CREATED = 'recipient.created'; - const RECIPIENT_DELETED = 'recipient.deleted'; - const RECIPIENT_UPDATED = 'recipient.updated'; - const REVIEW_CLOSED = 'review.closed'; - const REVIEW_OPENED = 'review.opened'; - const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created'; - const SKU_CREATED = 'sku.created'; - const SKU_DELETED = 'sku.deleted'; - const SKU_UPDATED = 'sku.updated'; - const SOURCE_CANCELED = 'source.canceled'; - const SOURCE_CHARGEABLE = 'source.chargeable'; - const SOURCE_FAILED = 'source.failed'; - const SOURCE_MANDATE_NOTIFICATION = 'source.mandate_notification'; - const SOURCE_TRANSACTION_CREATED = 'source.transaction.created'; - const TOPUP_CREATED = 'topup.created'; - const TOPUP_FAILED = 'topup.failed'; - const TOPUP_SUCCEEDED = 'topup.succeeded'; - const TRANSFER_CREATED = 'transfer.created'; - const TRANSFER_REVERSED = 'transfer.reversed'; - const TRANSFER_UPDATED = 'transfer.updated'; - - use ApiOperations\All; - use ApiOperations\Retrieve; + const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated'; + const CUSTOMER_TAX_ID_CREATED = 'customer.tax_id.created'; + const CUSTOMER_TAX_ID_DELETED = 'customer.tax_id.deleted'; + const CUSTOMER_TAX_ID_UPDATED = 'customer.tax_id.updated'; + const FILE_CREATED = 'file.created'; + const INVOICE_CREATED = 'invoice.created'; + const INVOICE_DELETED = 'invoice.deleted'; + const INVOICE_FINALIZATION_FAILED = 'invoice.finalization_failed'; + const INVOICE_FINALIZED = 'invoice.finalized'; + const INVOICE_MARKED_UNCOLLECTIBLE = 'invoice.marked_uncollectible'; + const INVOICE_PAID = 'invoice.paid'; + const INVOICE_PAYMENT_ACTION_REQUIRED = 'invoice.payment_action_required'; + const INVOICE_PAYMENT_FAILED = 'invoice.payment_failed'; + const INVOICE_PAYMENT_SUCCEEDED = 'invoice.payment_succeeded'; + const INVOICE_SENT = 'invoice.sent'; + const INVOICE_UPCOMING = 'invoice.upcoming'; + const INVOICE_UPDATED = 'invoice.updated'; + const INVOICE_VOIDED = 'invoice.voided'; + const INVOICEITEM_CREATED = 'invoiceitem.created'; + const INVOICEITEM_DELETED = 'invoiceitem.deleted'; + const INVOICEITEM_UPDATED = 'invoiceitem.updated'; + const ISSUER_FRAUD_RECORD_CREATED = 'issuer_fraud_record.created'; + const ISSUING_AUTHORIZATION_CREATED = 'issuing_authorization.created'; + const ISSUING_AUTHORIZATION_REQUEST = 'issuing_authorization.request'; + const ISSUING_AUTHORIZATION_UPDATED = 'issuing_authorization.updated'; + const ISSUING_CARD_CREATED = 'issuing_card.created'; + const ISSUING_CARD_UPDATED = 'issuing_card.updated'; + const ISSUING_CARDHOLDER_CREATED = 'issuing_cardholder.created'; + const ISSUING_CARDHOLDER_UPDATED = 'issuing_cardholder.updated'; + const ISSUING_DISPUTE_CLOSED = 'issuing_dispute.closed'; + const ISSUING_DISPUTE_CREATED = 'issuing_dispute.created'; + const ISSUING_DISPUTE_FUNDS_REINSTATED = 'issuing_dispute.funds_reinstated'; + const ISSUING_DISPUTE_SUBMITTED = 'issuing_dispute.submitted'; + const ISSUING_DISPUTE_UPDATED = 'issuing_dispute.updated'; + const ISSUING_TRANSACTION_CREATED = 'issuing_transaction.created'; + const ISSUING_TRANSACTION_UPDATED = 'issuing_transaction.updated'; + const MANDATE_UPDATED = 'mandate.updated'; + const ORDER_CREATED = 'order.created'; + const ORDER_PAYMENT_FAILED = 'order.payment_failed'; + const ORDER_PAYMENT_SUCCEEDED = 'order.payment_succeeded'; + const ORDER_UPDATED = 'order.updated'; + const ORDER_RETURN_CREATED = 'order_return.created'; + const PAYMENT_INTENT_AMOUNT_CAPTURABLE_UPDATED = 'payment_intent.amount_capturable_updated'; + const PAYMENT_INTENT_CANCELED = 'payment_intent.canceled'; + const PAYMENT_INTENT_CREATED = 'payment_intent.created'; + const PAYMENT_INTENT_PAYMENT_FAILED = 'payment_intent.payment_failed'; + const PAYMENT_INTENT_PROCESSING = 'payment_intent.processing'; + const PAYMENT_INTENT_REQUIRES_ACTION = 'payment_intent.requires_action'; + const PAYMENT_INTENT_SUCCEEDED = 'payment_intent.succeeded'; + const PAYMENT_METHOD_ATTACHED = 'payment_method.attached'; + const PAYMENT_METHOD_AUTOMATICALLY_UPDATED = 'payment_method.automatically_updated'; + const PAYMENT_METHOD_CARD_AUTOMATICALLY_UPDATED = 'payment_method.card_automatically_updated'; + const PAYMENT_METHOD_DETACHED = 'payment_method.detached'; + const PAYMENT_METHOD_UPDATED = 'payment_method.updated'; + const PAYOUT_CANCELED = 'payout.canceled'; + const PAYOUT_CREATED = 'payout.created'; + 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'; + const PLAN_UPDATED = 'plan.updated'; + const PRICE_CREATED = 'price.created'; + const PRICE_DELETED = 'price.deleted'; + const PRICE_UPDATED = 'price.updated'; + const PRODUCT_CREATED = 'product.created'; + const PRODUCT_DELETED = 'product.deleted'; + const PRODUCT_UPDATED = 'product.updated'; + const PROMOTION_CODE_CREATED = 'promotion_code.created'; + const PROMOTION_CODE_DELETED = 'promotion_code.deleted'; + const PROMOTION_CODE_UPDATED = 'promotion_code.updated'; + const RADAR_EARLY_FRAUD_WARNING_CREATED = 'radar.early_fraud_warning.created'; + const RADAR_EARLY_FRAUD_WARNING_UPDATED = 'radar.early_fraud_warning.updated'; + const RECIPIENT_CREATED = 'recipient.created'; + const RECIPIENT_DELETED = 'recipient.deleted'; + const RECIPIENT_UPDATED = 'recipient.updated'; + const REPORTING_REPORT_RUN_FAILED = 'reporting.report_run.failed'; + const REPORTING_REPORT_RUN_SUCCEEDED = 'reporting.report_run.succeeded'; + const REPORTING_REPORT_TYPE_UPDATED = 'reporting.report_type.updated'; + const REVIEW_CLOSED = 'review.closed'; + const REVIEW_OPENED = 'review.opened'; + const SETUP_INTENT_CANCELED = 'setup_intent.canceled'; + const SETUP_INTENT_CREATED = 'setup_intent.created'; + const SETUP_INTENT_REQUIRES_ACTION = 'setup_intent.requires_action'; + const SETUP_INTENT_SETUP_FAILED = 'setup_intent.setup_failed'; + const SETUP_INTENT_SUCCEEDED = 'setup_intent.succeeded'; + const SIGMA_SCHEDULED_QUERY_RUN_CREATED = 'sigma.scheduled_query_run.created'; + const SKU_CREATED = 'sku.created'; + const SKU_DELETED = 'sku.deleted'; + const SKU_UPDATED = 'sku.updated'; + const SOURCE_CANCELED = 'source.canceled'; + const SOURCE_CHARGEABLE = 'source.chargeable'; + const SOURCE_FAILED = 'source.failed'; + const SOURCE_MANDATE_NOTIFICATION = 'source.mandate_notification'; + const SOURCE_REFUND_ATTRIBUTES_REQUIRED = 'source.refund_attributes_required'; + const SOURCE_TRANSACTION_CREATED = 'source.transaction.created'; + const SOURCE_TRANSACTION_UPDATED = 'source.transaction.updated'; + const SUBSCRIPTION_SCHEDULE_ABORTED = 'subscription_schedule.aborted'; + const SUBSCRIPTION_SCHEDULE_CANCELED = 'subscription_schedule.canceled'; + const SUBSCRIPTION_SCHEDULE_COMPLETED = 'subscription_schedule.completed'; + const SUBSCRIPTION_SCHEDULE_CREATED = 'subscription_schedule.created'; + 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'; + const TOPUP_REVERSED = 'topup.reversed'; + const TOPUP_SUCCEEDED = 'topup.succeeded'; + const TRANSFER_CREATED = 'transfer.created'; + const TRANSFER_REVERSED = 'transfer.reversed'; + const TRANSFER_UPDATED = 'transfer.updated'; } diff --git a/plugins/stripe/lib/Exception/ApiConnectionException.php b/plugins/stripe/lib/Exception/ApiConnectionException.php new file mode 100644 index 0000000000..33f2ede9ef --- /dev/null +++ b/plugins/stripe/lib/Exception/ApiConnectionException.php @@ -0,0 +1,12 @@ +setHttpStatus($httpStatus); + $instance->setHttpBody($httpBody); + $instance->setJsonBody($jsonBody); + $instance->setHttpHeaders($httpHeaders); + $instance->setStripeCode($stripeCode); + + $instance->setRequestId(null); + if ($httpHeaders && isset($httpHeaders['Request-Id'])) { + $instance->setRequestId($httpHeaders['Request-Id']); + } + + $instance->setError($instance->constructErrorObject()); + + return $instance; + } + + /** + * Gets the Stripe error object. + * + * @return null|\Stripe\ErrorObject + */ + public function getError() + { + return $this->error; + } + + /** + * Sets the Stripe error object. + * + * @param null|\Stripe\ErrorObject $error + */ + public function setError($error) + { + $this->error = $error; + } + + /** + * Gets the HTTP body as a string. + * + * @return null|string + */ + public function getHttpBody() + { + return $this->httpBody; + } + + /** + * Sets the HTTP body as a string. + * + * @param null|string $httpBody + */ + public function setHttpBody($httpBody) + { + $this->httpBody = $httpBody; + } + + /** + * Gets the HTTP headers array. + * + * @return null|array|\Stripe\Util\CaseInsensitiveArray + */ + public function getHttpHeaders() + { + return $this->httpHeaders; + } + + /** + * Sets the HTTP headers array. + * + * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders + */ + public function setHttpHeaders($httpHeaders) + { + $this->httpHeaders = $httpHeaders; + } + + /** + * Gets the HTTP status code. + * + * @return null|int + */ + public function getHttpStatus() + { + return $this->httpStatus; + } + + /** + * Sets the HTTP status code. + * + * @param null|int $httpStatus + */ + public function setHttpStatus($httpStatus) + { + $this->httpStatus = $httpStatus; + } + + /** + * Gets the JSON deserialized body. + * + * @return null|array + */ + public function getJsonBody() + { + return $this->jsonBody; + } + + /** + * Sets the JSON deserialized body. + * + * @param null|array $jsonBody + */ + public function setJsonBody($jsonBody) + { + $this->jsonBody = $jsonBody; + } + + /** + * Gets the Stripe request ID. + * + * @return null|string + */ + public function getRequestId() + { + return $this->requestId; + } + + /** + * Sets the Stripe request ID. + * + * @param null|string $requestId + */ + public function setRequestId($requestId) + { + $this->requestId = $requestId; + } + + /** + * Gets the Stripe error code. + * + * Cf. the `CODE_*` constants on {@see \Stripe\ErrorObject} for possible + * values. + * + * @return null|string + */ + public function getStripeCode() + { + return $this->stripeCode; + } + + /** + * Sets the Stripe error code. + * + * @param null|string $stripeCode + */ + public function setStripeCode($stripeCode) + { + $this->stripeCode = $stripeCode; + } + + /** + * Returns the string representation of the exception. + * + * @return string + */ + public function __toString() + { + $statusStr = (null === $this->getHttpStatus()) ? '' : "(Status {$this->getHttpStatus()}) "; + $idStr = (null === $this->getRequestId()) ? '' : "(Request {$this->getRequestId()}) "; + + return "{$statusStr}{$idStr}{$this->getMessage()}"; + } + + protected function constructErrorObject() + { + if (null === $this->jsonBody || !\array_key_exists('error', $this->jsonBody)) { + return null; + } + + return \Stripe\ErrorObject::constructFrom($this->jsonBody['error']); + } +} diff --git a/plugins/stripe/lib/Exception/AuthenticationException.php b/plugins/stripe/lib/Exception/AuthenticationException.php new file mode 100644 index 0000000000..9e5c718b11 --- /dev/null +++ b/plugins/stripe/lib/Exception/AuthenticationException.php @@ -0,0 +1,11 @@ +setDeclineCode($declineCode); + $instance->setStripeParam($stripeParam); + + return $instance; + } + + /** + * Gets the decline code. + * + * @return null|string + */ + public function getDeclineCode() + { + return $this->declineCode; + } + + /** + * Sets the decline code. + * + * @param null|string $declineCode + */ + public function setDeclineCode($declineCode) + { + $this->declineCode = $declineCode; + } + + /** + * Gets the parameter related to the error. + * + * @return null|string + */ + public function getStripeParam() + { + return $this->stripeParam; + } + + /** + * Sets the parameter related to the error. + * + * @param null|string $stripeParam + */ + public function setStripeParam($stripeParam) + { + $this->stripeParam = $stripeParam; + } +} diff --git a/plugins/stripe/lib/Exception/ExceptionInterface.php b/plugins/stripe/lib/Exception/ExceptionInterface.php new file mode 100644 index 0000000000..c84f37de7f --- /dev/null +++ b/plugins/stripe/lib/Exception/ExceptionInterface.php @@ -0,0 +1,22 @@ +setStripeParam($stripeParam); + + return $instance; + } + + /** + * Gets the parameter related to the error. + * + * @return null|string + */ + public function getStripeParam() + { + return $this->stripeParam; + } + + /** + * Sets the parameter related to the error. + * + * @param null|string $stripeParam + */ + public function setStripeParam($stripeParam) + { + $this->stripeParam = $stripeParam; + } +} diff --git a/plugins/stripe/lib/Exception/OAuth/ExceptionInterface.php b/plugins/stripe/lib/Exception/OAuth/ExceptionInterface.php new file mode 100644 index 0000000000..dd42662018 --- /dev/null +++ b/plugins/stripe/lib/Exception/OAuth/ExceptionInterface.php @@ -0,0 +1,10 @@ +jsonBody) { + return null; + } + + return \Stripe\OAuthErrorObject::constructFrom($this->jsonBody); + } +} diff --git a/plugins/stripe/lib/Exception/OAuth/UnknownOAuthErrorException.php b/plugins/stripe/lib/Exception/OAuth/UnknownOAuthErrorException.php new file mode 100644 index 0000000000..c8dba29bf0 --- /dev/null +++ b/plugins/stripe/lib/Exception/OAuth/UnknownOAuthErrorException.php @@ -0,0 +1,12 @@ +setHttpBody($httpBody); + $instance->setSigHeader($sigHeader); + + return $instance; + } + + /** + * Gets the HTTP body as a string. + * + * @return null|string + */ + public function getHttpBody() + { + return $this->httpBody; + } + + /** + * Sets the HTTP body as a string. + * + * @param null|string $httpBody + */ + public function setHttpBody($httpBody) + { + $this->httpBody = $httpBody; + } + + /** + * Gets the `Stripe-Signature` HTTP header. + * + * @return null|string + */ + public function getSigHeader() + { + return $this->sigHeader; + } + + /** + * Sets the `Stripe-Signature` HTTP header. + * + * @param null|string $sigHeader + */ + public function setSigHeader($sigHeader) + { + $this->sigHeader = $sigHeader; + } +} diff --git a/plugins/stripe/lib/Exception/UnexpectedValueException.php b/plugins/stripe/lib/Exception/UnexpectedValueException.php new file mode 100644 index 0000000000..0a629edf74 --- /dev/null +++ b/plugins/stripe/lib/Exception/UnexpectedValueException.php @@ -0,0 +1,7 @@ +Exchange Rate objects allow you to determine the rates that Stripe + * is currently using to convert from one currency to another. Since this number is + * variable throughout the day, there are various reasons why you might want to + * know the current rate (for example, to dynamically price an item for a user with + * a default payment in a foreign currency). + * + * If you want a guarantee that the charge is made with a certain exchange rate you + * expect is current, you can pass in exchange_rate to charges + * endpoints. If the value is no longer up to date, the charge won't go through. + * Please refer to our Exchange + * Rates API guide for more details. * - * @package Stripe + * @property string $id Unique identifier for the object. Represented as the three-letter ISO currency code in lowercase. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\StripeObject $rates Hash where the keys are supported currencies and the values are the exchange rate at which the base id currency converts to the key currency. */ class ExchangeRate extends ApiResource { - - const OBJECT_NAME = "exchange_rate"; + const OBJECT_NAME = 'exchange_rate'; use ApiOperations\All; use ApiOperations\Retrieve; diff --git a/plugins/stripe/lib/File.php b/plugins/stripe/lib/File.php new file mode 100644 index 0000000000..d73bed8421 --- /dev/null +++ b/plugins/stripe/lib/File.php @@ -0,0 +1,81 @@ +create file request (for + * example, when uploading dispute evidence) or it may have been created by Stripe + * (for example, the results of a Sigma scheduled + * query). + * + * Related guide: File Upload + * Guide. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|int $expires_at The time at which the file expires and is no longer available in epoch seconds. + * @property null|string $filename A filename for the file, suitable for saving to a filesystem. + * @property null|\Stripe\Collection $links A list of file links that point at this file. + * @property string $purpose The purpose of the uploaded file. + * @property int $size The size in bytes of the file object. + * @property null|string $title A user friendly title for the document. + * @property null|string $type The type of the file returned (e.g., csv, pdf, jpg, or png). + * @property null|string $url The URL from which the file can be downloaded using your live secret API key. + */ +class File extends ApiResource +{ + const OBJECT_NAME = 'file'; + + use ApiOperations\All; + use ApiOperations\Retrieve; + + const PURPOSE_ADDITIONAL_VERIFICATION = 'additional_verification'; + const PURPOSE_BUSINESS_ICON = 'business_icon'; + const PURPOSE_BUSINESS_LOGO = 'business_logo'; + const PURPOSE_CUSTOMER_SIGNATURE = 'customer_signature'; + const PURPOSE_DISPUTE_EVIDENCE = 'dispute_evidence'; + const PURPOSE_IDENTITY_DOCUMENT = 'identity_document'; + const PURPOSE_PCI_DOCUMENT = 'pci_document'; + const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload'; + + // This resource can have two different object names. In latter API + // versions, only `file` is used, but since stripe-php may be used with + // any API version, we need to support deserializing the older + // `file_upload` object into the same class. + const OBJECT_NAME_ALT = 'file_upload'; + + use ApiOperations\Create { + create as protected _create; + } + + public static function classUrl() + { + return '/v1/files'; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\File the created file + */ + public static function create($params = null, $opts = null) + { + $opts = \Stripe\Util\RequestOptions::parse($opts); + if (null === $opts->apiBase) { + $opts->apiBase = Stripe::$apiUploadBase; + } + // Manually flatten params, otherwise curl's multipart encoder will + // choke on nested arrays. + $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0); + + return static::_create($flatParams, $opts); + } +} diff --git a/plugins/stripe/lib/FileLink.php b/plugins/stripe/lib/FileLink.php index 6650e40af6..ce3b10bde6 100644 --- a/plugins/stripe/lib/FileLink.php +++ b/plugins/stripe/lib/FileLink.php @@ -1,27 +1,27 @@ File object with non-Stripe users, you + * can create a FileLink. FileLinks contain a URL that + * can be used to retrieve the contents of the file without authentication. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property bool $expired Whether this link is already expired. + * @property null|int $expires_at Time at which the link expires. + * @property string|\Stripe\File $file The file object this link points to. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $url The publicly accessible URL to download the file. */ class FileLink extends ApiResource { - - const OBJECT_NAME = "file_link"; + const OBJECT_NAME = 'file_link'; use ApiOperations\All; use ApiOperations\Create; diff --git a/plugins/stripe/lib/FileUpload.php b/plugins/stripe/lib/FileUpload.php deleted file mode 100644 index 6a012f6e00..0000000000 --- a/plugins/stripe/lib/FileUpload.php +++ /dev/null @@ -1,37 +0,0 @@ -defaultOptions = $defaultOptions; $this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator(); $this->initUserAgentInfo(); + + $this->enableHttp2 = $this->canSafelyUseHttp2(); + } + + public function __destruct() + { + $this->closeCurlHandle(); } public function initUserAgentInfo() { - $curlVersion = curl_version(); + $curlVersion = \curl_version(); $this->userAgentInfo = [ - 'httplib' => 'curl ' . $curlVersion['version'], + 'httplib' => 'curl ' . $curlVersion['version'], 'ssllib' => $curlVersion['ssl_version'], ]; } @@ -81,6 +99,66 @@ public function getUserAgentInfo() return $this->userAgentInfo; } + /** + * @return bool + */ + public function getEnablePersistentConnections() + { + return $this->enablePersistentConnections; + } + + /** + * @param bool $enable + */ + public function setEnablePersistentConnections($enable) + { + $this->enablePersistentConnections = $enable; + } + + /** + * @return bool + */ + public function getEnableHttp2() + { + return $this->enableHttp2; + } + + /** + * @param bool $enable + */ + public function setEnableHttp2($enable) + { + $this->enableHttp2 = $enable; + } + + /** + * @return null|callable + */ + public function getRequestStatusCallback() + { + return $this->requestStatusCallback; + } + + /** + * Sets a callback that is called after each request. The callback will + * receive the following parameters: + *
    + *
  1. string $rbody The response body
  2. + *
  3. integer $rcode The response status code
  4. + *
  5. \Stripe\Util\CaseInsensitiveArray $rheaders The response headers
  6. + *
  7. integer $errno The curl error number
  8. + *
  9. string|null $message The curl error message
  10. + *
  11. boolean $shouldRetry Whether the request will be retried
  12. + *
  13. integer $numRetries The number of the retry attempt
  14. + *
. + * + * @param null|callable $requestStatusCallback + */ + public function setRequestStatusCallback($requestStatusCallback) + { + $this->requestStatusCallback = $requestStatusCallback; + } + // USER DEFINED TIMEOUTS const DEFAULT_TIMEOUT = 80; @@ -91,13 +169,15 @@ public function getUserAgentInfo() public function setTimeout($seconds) { - $this->timeout = (int) max($seconds, 0); + $this->timeout = (int) \max($seconds, 0); + return $this; } public function setConnectTimeout($seconds) { - $this->connectTimeout = (int) max($seconds, 0); + $this->connectTimeout = (int) \max($seconds, 0); + return $this; } @@ -115,62 +195,52 @@ public function getConnectTimeout() public function request($method, $absUrl, $headers, $params, $hasFile) { - $method = strtolower($method); + $method = \strtolower($method); $opts = []; - if (is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value - $opts = call_user_func_array($this->defaultOptions, func_get_args()); - if (!is_array($opts)) { - throw new Error\Api("Non-array value returned by defaultOptions CurlClient callback"); + if (\is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value + $opts = \call_user_func_array($this->defaultOptions, \func_get_args()); + if (!\is_array($opts)) { + throw new Exception\UnexpectedValueException('Non-array value returned by defaultOptions CurlClient callback'); } - } elseif (is_array($this->defaultOptions)) { // set default curlopts from array + } elseif (\is_array($this->defaultOptions)) { // set default curlopts from array $opts = $this->defaultOptions; } - if ($method == 'get') { + $params = Util\Util::objectsToIds($params); + + if ('get' === $method) { if ($hasFile) { - throw new Error\Api( - "Issuing a GET request with a file parameter" + throw new Exception\UnexpectedValueException( + 'Issuing a GET request with a file parameter' ); } - $opts[CURLOPT_HTTPGET] = 1; - if (count($params) > 0) { - $encoded = Util\Util::urlEncode($params); - $absUrl = "$absUrl?$encoded"; + $opts[\CURLOPT_HTTPGET] = 1; + if (\count($params) > 0) { + $encoded = Util\Util::encodeParameters($params); + $absUrl = "{$absUrl}?{$encoded}"; } - } elseif ($method == 'post') { - $opts[CURLOPT_POST] = 1; - $opts[CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::urlEncode($params); - } elseif ($method == 'delete') { - $opts[CURLOPT_CUSTOMREQUEST] = 'DELETE'; - if (count($params) > 0) { - $encoded = Util\Util::urlEncode($params); - $absUrl = "$absUrl?$encoded"; + } elseif ('post' === $method) { + $opts[\CURLOPT_POST] = 1; + $opts[\CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::encodeParameters($params); + } elseif ('delete' === $method) { + $opts[\CURLOPT_CUSTOMREQUEST] = 'DELETE'; + if (\count($params) > 0) { + $encoded = Util\Util::encodeParameters($params); + $absUrl = "{$absUrl}?{$encoded}"; } } else { - throw new Error\Api("Unrecognized method $method"); + throw new Exception\UnexpectedValueException("Unrecognized method {$method}"); } // 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'])) { - array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid()); + if (('post' === $method) && (Stripe::$maxNetworkRetries > 0)) { + if (!$this->hasHeader($headers, 'Idempotency-Key')) { + \array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid()); } } - // Create a callback to capture HTTP headers for the response - $rheaders = []; - $headerCallback = function ($curl, $header_line) use (&$rheaders) { - // Ignore the HTTP request line (HTTP/1.1 200 OK) - if (strpos($header_line, ":") === false) { - return strlen($header_line); - } - list($key, $value) = explode(":", trim($header_line), 2); - $rheaders[trim($key)] = trim($value); - return strlen($header_line); - }; - // By default for large request body sizes (> 1024 bytes), cURL will // send a request without a body and with a `Expect: 100-continue` // header, which gives the server a chance to respond with an error @@ -183,30 +253,36 @@ public function request($method, $absUrl, $headers, $params, $hasFile) // we'll error under that condition. To compensate for that problem // for the time being, override cURL's behavior by simply always // sending an empty `Expect:` header. - array_push($headers, 'Expect: '); + \array_push($headers, 'Expect: '); $absUrl = Util\Util::utf8($absUrl); - $opts[CURLOPT_URL] = $absUrl; - $opts[CURLOPT_RETURNTRANSFER] = true; - $opts[CURLOPT_CONNECTTIMEOUT] = $this->connectTimeout; - $opts[CURLOPT_TIMEOUT] = $this->timeout; - $opts[CURLOPT_HEADERFUNCTION] = $headerCallback; - $opts[CURLOPT_HTTPHEADER] = $headers; - $opts[CURLOPT_CAINFO] = Stripe::getCABundlePath(); + $opts[\CURLOPT_URL] = $absUrl; + $opts[\CURLOPT_RETURNTRANSFER] = true; + $opts[\CURLOPT_CONNECTTIMEOUT] = $this->connectTimeout; + $opts[\CURLOPT_TIMEOUT] = $this->timeout; + $opts[\CURLOPT_HTTPHEADER] = $headers; + $opts[\CURLOPT_CAINFO] = Stripe::getCABundlePath(); if (!Stripe::getVerifySslCerts()) { - $opts[CURLOPT_SSL_VERIFYPEER] = false; + $opts[\CURLOPT_SSL_VERIFYPEER] = false; + } + + if (!isset($opts[\CURLOPT_HTTP_VERSION]) && $this->getEnableHttp2()) { + // For HTTPS requests, enable HTTP/2, if supported + $opts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2TLS; } - // For HTTPS requests, enable HTTP/2, if supported - $opts[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2TLS; + // Stripe's API servers are only accessible over IPv4. Force IPv4 resolving to avoid + // potential issues (cf. https://github.com/stripe/stripe-php/issues/1045). + $opts[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4; - list($rbody, $rcode) = $this->executeRequestWithRetries($opts, $absUrl); + list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl); return [$rbody, $rcode, $rheaders]; } /** * @param array $opts cURL options + * @param string $absUrl */ private function executeRequestWithRetries($opts, $absUrl) { @@ -215,33 +291,59 @@ private function executeRequestWithRetries($opts, $absUrl) while (true) { $rcode = 0; $errno = 0; + $message = null; + + // Create a callback to capture HTTP headers for the response + $rheaders = new Util\CaseInsensitiveArray(); + $headerCallback = function ($curl, $header_line) use (&$rheaders) { + // Ignore the HTTP request line (HTTP/1.1 200 OK) + if (false === \strpos($header_line, ':')) { + return \strlen($header_line); + } + list($key, $value) = \explode(':', \trim($header_line), 2); + $rheaders[\trim($key)] = \trim($value); + + return \strlen($header_line); + }; + $opts[\CURLOPT_HEADERFUNCTION] = $headerCallback; + + $this->resetCurlHandle(); + \curl_setopt_array($this->curlHandle, $opts); + $rbody = \curl_exec($this->curlHandle); + + if (false === $rbody) { + $errno = \curl_errno($this->curlHandle); + $message = \curl_error($this->curlHandle); + } else { + $rcode = \curl_getinfo($this->curlHandle, \CURLINFO_HTTP_CODE); + } + if (!$this->getEnablePersistentConnections()) { + $this->closeCurlHandle(); + } - $curl = curl_init(); - curl_setopt_array($curl, $opts); - $rbody = curl_exec($curl); + $shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries); - if ($rbody === false) { - $errno = curl_errno($curl); - $message = curl_error($curl); - } else { - $rcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + if (\is_callable($this->getRequestStatusCallback())) { + \call_user_func_array( + $this->getRequestStatusCallback(), + [$rbody, $rcode, $rheaders, $errno, $message, $shouldRetry, $numRetries] + ); } - curl_close($curl); - if ($this->shouldRetry($errno, $rcode, $numRetries)) { - $numRetries += 1; - $sleepSeconds = $this->sleepTime($numRetries); - usleep(intval($sleepSeconds * 1000000)); + if ($shouldRetry) { + ++$numRetries; + $sleepSeconds = $this->sleepTime($numRetries, $rheaders); + \usleep((int) ($sleepSeconds * 1000000)); } else { break; } } - if ($rbody === false) { + if (false === $rbody) { $this->handleCurlError($absUrl, $errno, $message, $numRetries); } - return [$rbody, $rcode]; + return [$rbody, $rcode, $rheaders]; } /** @@ -249,83 +351,117 @@ private function executeRequestWithRetries($opts, $absUrl) * @param int $errno * @param string $message * @param int $numRetries - * @throws Error\ApiConnection + * + * @throws Exception\ApiConnectionException */ private function handleCurlError($url, $errno, $message, $numRetries) { switch ($errno) { - case CURLE_COULDNT_CONNECT: - case CURLE_COULDNT_RESOLVE_HOST: - case CURLE_OPERATION_TIMEOUTED: - $msg = "Could not connect to Stripe ($url). Please check your " - . "internet connection and try again. If this problem persists, " + case \CURLE_COULDNT_CONNECT: + case \CURLE_COULDNT_RESOLVE_HOST: + case \CURLE_OPERATION_TIMEOUTED: + $msg = "Could not connect to Stripe ({$url}). Please check your " + . 'internet connection and try again. If this problem persists, ' . "you should check Stripe's service status at " - . "https://twitter.com/stripestatus, or"; + . 'https://twitter.com/stripestatus, or'; + break; - case CURLE_SSL_CACERT: - case CURLE_SSL_PEER_CERTIFICATE: + case \CURLE_SSL_CACERT: + case \CURLE_SSL_PEER_CERTIFICATE: $msg = "Could not verify Stripe's SSL certificate. Please make sure " - . "that your network is not intercepting certificates. " - . "(Try going to $url in your browser.) " - . "If this problem persists,"; + . 'that your network is not intercepting certificates. ' + . "(Try going to {$url} in your browser.) " + . 'If this problem persists,'; + break; default: - $msg = "Unexpected error communicating with Stripe. " - . "If this problem persists,"; + $msg = 'Unexpected error communicating with Stripe. ' + . 'If this problem persists,'; } - $msg .= " let us know at support@stripe.com."; + $msg .= ' let us know at support@stripe.com.'; - $msg .= "\n\n(Network error [errno $errno]: $message)"; + $msg .= "\n\n(Network error [errno {$errno}]: {$message})"; if ($numRetries > 0) { - $msg .= "\n\nRequest was retried $numRetries times."; + $msg .= "\n\nRequest was retried {$numRetries} times."; } - throw new Error\ApiConnection($msg); + throw new Exception\ApiConnectionException($msg); } /** * Checks if an error is a problem that we should retry on. This includes both * socket errors that may represent an intermittent problem and some special * HTTP statuses. + * * @param int $errno * @param int $rcode + * @param array|\Stripe\Util\CaseInsensitiveArray $rheaders * @param int $numRetries + * * @return bool */ - private function shouldRetry($errno, $rcode, $numRetries) + private function shouldRetry($errno, $rcode, $rheaders, $numRetries) { if ($numRetries >= Stripe::getMaxNetworkRetries()) { return false; } // Retry on timeout-related problems (either on open or read). - if ($errno === CURLE_OPERATION_TIMEOUTED) { + if (\CURLE_OPERATION_TIMEOUTED === $errno) { return true; } // Destination refused the connection, the connection was reset, or a // variety of other connection failures. This could occur from a single // saturated server, so retry in case it's intermittent. - if ($errno === CURLE_COULDNT_CONNECT) { + if (\CURLE_COULDNT_CONNECT === $errno) { return true; } - // 409 conflict - if ($rcode === 409) { + // The API may ask us not to retry (eg; if doing so would be a no-op) + // or advise us to retry (eg; in cases of lock timeouts); we defer to that. + if (isset($rheaders['stripe-should-retry'])) { + if ('false' === $rheaders['stripe-should-retry']) { + return false; + } + if ('true' === $rheaders['stripe-should-retry']) { + return true; + } + } + + // 409 Conflict + if (409 === $rcode) { + return true; + } + + // Retry on 500, 503, and other internal errors. + // + // Note that we expect the stripe-should-retry header to be false + // in most cases when a 500 is returned, since our idempotency framework + // would typically replay it anyway. + if ($rcode >= 500) { return true; } return false; } - private function sleepTime($numRetries) + /** + * Provides the number of seconds to wait before retrying a request. + * + * @param int $numRetries + * @param array|\Stripe\Util\CaseInsensitiveArray $rheaders + * + * @return int + */ + private function sleepTime($numRetries, $rheaders) { // Apply exponential backoff with $initialNetworkRetryDelay on the // number of $numRetries so far as inputs. Do not allow the number to exceed // $maxNetworkRetryDelay. - $sleepSeconds = min( - Stripe::getInitialNetworkRetryDelay() * 1.0 * pow(2, $numRetries - 1), + $sleepSeconds = \min( + Stripe::getInitialNetworkRetryDelay() * 1.0 * 2 ** ($numRetries - 1), Stripe::getMaxNetworkRetryDelay() ); @@ -334,8 +470,80 @@ private function sleepTime($numRetries) $sleepSeconds *= 0.5 * (1 + $this->randomGenerator->randFloat()); // But never sleep less than the base sleep seconds. - $sleepSeconds = max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds); + $sleepSeconds = \max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds); + + // And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask. + $retryAfter = isset($rheaders['retry-after']) ? (float) ($rheaders['retry-after']) : 0.0; + if (\floor($retryAfter) === $retryAfter && $retryAfter <= Stripe::getMaxRetryAfter()) { + $sleepSeconds = \max($sleepSeconds, $retryAfter); + } return $sleepSeconds; } + + /** + * Initializes the curl handle. If already initialized, the handle is closed first. + */ + private function initCurlHandle() + { + $this->closeCurlHandle(); + $this->curlHandle = \curl_init(); + } + + /** + * Closes the curl handle if initialized. Do nothing if already closed. + */ + private function closeCurlHandle() + { + if (null !== $this->curlHandle) { + \curl_close($this->curlHandle); + $this->curlHandle = null; + } + } + + /** + * Resets the curl handle. If the handle is not already initialized, or if persistent + * connections are disabled, the handle is reinitialized instead. + */ + private function resetCurlHandle() + { + if (null !== $this->curlHandle && $this->getEnablePersistentConnections()) { + \curl_reset($this->curlHandle); + } else { + $this->initCurlHandle(); + } + } + + /** + * Indicates whether it is safe to use HTTP/2 or not. + * + * @return bool + */ + 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 bool + */ + private function hasHeader($headers, $name) + { + foreach ($headers as $header) { + if (0 === \strncasecmp($header, "{$name}: ", \strlen($name) + 2)) { + return true; + } + } + + return false; + } } diff --git a/plugins/stripe/lib/Invoice.php b/plugins/stripe/lib/Invoice.php index a87180e5ee..706da0a632 100644 --- a/plugins/stripe/lib/Invoice.php +++ b/plugins/stripe/lib/Invoice.php @@ -1,69 +1,152 @@ invoice + * items, and proration adjustments that may be caused by subscription + * upgrades/downgrades (if necessary). + * + * If your invoice is configured to be billed through automatic charges, Stripe + * automatically finalizes your invoice and attempts payment. Note that finalizing + * the invoice, when + * automatic, does not happen immediately as the invoice is created. Stripe + * waits until one hour after the last webhook was successfully sent (or the last + * webhook timed out after failing). If you (and the platforms you may have + * connected to) have no webhooks configured, Stripe waits one hour after creation + * to finalize the invoice. + * + * If your invoice is configured to be billed by sending an email, then based on + * your email + * settings, Stripe will email the invoice to your customer and await payment. + * These emails can contain a link to a hosted page to pay the invoice. + * + * Stripe applies any customer credit on the account before determining the amount + * due for the invoice (i.e., the amount that will be actually charged). If the + * amount due for the invoice is less than Stripe's minimum allowed + * charge per currency, the invoice is automatically marked paid, and we add + * the amount due to the customer's running account balance which is applied to the + * next invoice. * - * @property string $id - * @property string $object - * @property int $amount_due - * @property int $amount_paid - * @property int $amount_remaining - * @property int $application_fee - * @property int $attempt_count - * @property bool $auto_advance - * @property bool $attempted - * @property string $billing - * @property string $billing_reason - * @property string $charge - * @property bool $closed - * @property string $currency - * @property string $customer - * @property int $date - * @property string $description - * @property Discount $discount - * @property int $due_date - * @property int $ending_balance - * @property bool $forgiven - * @property string $hosted_invoice_url - * @property string $invoice_pdf - * @property Collection $lines - * @property bool $livemode - * @property StripeObject $metadata - * @property int $next_payment_attempt - * @property string $number - * @property bool $paid - * @property int $period_end - * @property int $period_start - * @property string $receipt_number - * @property int $starting_balance - * @property string $statement_descriptor - * @property string $subscription - * @property int $subscription_proration_date - * @property int $subtotal - * @property int $tax - * @property float $tax_percent - * @property int $total - * @property int $webhooks_delivered_at + * More details on the customer's account balance are here. * - * @package Stripe + * Related guide: Send + * Invoices to Customers. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string $account_country The country of the business associated with this invoice, most often the business creating the invoice. + * @property null|string $account_name The public name of the business associated with this invoice, most often the business creating the invoice. + * @property null|(string|\Stripe\TaxId)[] $account_tax_ids The account tax IDs associated with the invoice. Only editable when the invoice is a draft. + * @property int $amount_due Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may be 0. If there is a positive starting_balance for the invoice (the customer owes money), the amount_due will also take that into account. The charge that gets generated for the invoice will be for the amount specified in amount_due. + * @property int $amount_paid The amount, in %s, that was paid. + * @property int $amount_remaining The amount remaining, in %s, that is due. + * @property null|int $application_fee_amount The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. + * @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. + * @property bool $attempted Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your users. + * @property bool $auto_advance Controls whether Stripe will perform automatic collection of the invoice. When false, the invoice's state will not automatically advance without an explicit action. + * @property null|string $billing_reason Indicates the reason why the invoice was created. subscription_cycle indicates an invoice created by a subscription advancing into a new period. subscription_create indicates an invoice created due to creating a subscription. subscription_update indicates an invoice created due to updating a subscription. subscription is set for all old invoices to indicate either a change to a subscription or a period advancement. manual is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The upcoming value is reserved for simulated invoices per the upcoming invoice endpoint. subscription_threshold indicates an invoice created due to a billing threshold being reached. + * @property null|string|\Stripe\Charge $charge ID of the latest charge generated for this invoice, if any. + * @property null|string $collection_method Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|\Stripe\StripeObject[] $custom_fields Custom fields displayed on the invoice. + * @property string|\Stripe\Customer $customer The ID of the customer who will be billed. + * @property null|\Stripe\StripeObject $customer_address The customer's address. Until the invoice is finalized, this field will equal customer.address. Once the invoice is finalized, this field will no longer be updated. + * @property null|string $customer_email The customer's email. Until the invoice is finalized, this field will equal customer.email. Once the invoice is finalized, this field will no longer be updated. + * @property null|string $customer_name The customer's name. Until the invoice is finalized, this field will equal customer.name. Once the invoice is finalized, this field will no longer be updated. + * @property null|string $customer_phone The customer's phone number. Until the invoice is finalized, this field will equal customer.phone. Once the invoice is finalized, this field will no longer be updated. + * @property null|\Stripe\StripeObject $customer_shipping The customer's shipping information. Until the invoice is finalized, this field will equal customer.shipping. Once the invoice is finalized, this field will no longer be updated. + * @property null|string $customer_tax_exempt The customer's tax exempt status. Until the invoice is finalized, this field will equal customer.tax_exempt. Once the invoice is finalized, this field will no longer be updated. + * @property null|\Stripe\StripeObject[] $customer_tax_ids The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as customer.tax_ids. Once the invoice is finalized, this field will no longer be updated. + * @property null|string|\Stripe\PaymentMethod $default_payment_method ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. + * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source. + * @property \Stripe\TaxRate[] $default_tax_rates The tax rates applied to this invoice, if any. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard. + * @property null|\Stripe\Discount $discount Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts. + * @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount. + * @property null|int $due_date The date on which payment for this invoice is due. This value will be null for invoices where collection_method=charge_automatically. + * @property null|int $ending_balance Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null. + * @property null|string $footer Footer displayed on the invoice. + * @property null|string $hosted_invoice_url The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null. + * @property null|string $invoice_pdf The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null. + * @property null|\Stripe\ErrorObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized. + * @property \Stripe\Collection $lines The individual line items that make up the invoice. lines is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|int $next_payment_attempt The time at which payment will next be attempted. This value will be null for invoices where collection_method=send_invoice. + * @property null|string $number A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified. + * @property bool $paid Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance. + * @property null|string|\Stripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. + * @property int $period_end End of the usage period during which invoice items were added to this invoice. + * @property int $period_start Start of the usage period during which invoice items were added to this invoice. + * @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice. + * @property int $pre_payment_credit_notes_amount Total amount of all pre-payment credit notes issued for this invoice. + * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this invoice. + * @property int $starting_balance Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. + * @property null|string $statement_descriptor Extra information about an invoice for the customer's credit card statement. + * @property null|string $status The status of the invoice, one of draft, open, paid, uncollectible, or void. Learn more + * @property \Stripe\StripeObject $status_transitions + * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice was prepared for, if any. + * @property int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations. + * @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated + * @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. + * @property \Stripe\StripeObject $threshold_reason + * @property int $total Total after discounts and taxes. + * @property null|\Stripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items. + * @property \Stripe\StripeObject[] $total_tax_amounts The aggregate amounts calculated per tax rate for all line items. + * @property null|int $webhooks_delivered_at Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have been exhausted. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created. */ class Invoice extends ApiResource { - - const OBJECT_NAME = "invoice"; + const OBJECT_NAME = 'invoice'; use ApiOperations\All; use ApiOperations\Create; + use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; + const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically'; + const BILLING_SEND_INVOICE = 'send_invoice'; + + const BILLING_REASON_MANUAL = 'manual'; + const BILLING_REASON_SUBSCRIPTION = 'subscription'; + const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create'; + const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle'; + const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold'; + const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update'; + const BILLING_REASON_UPCOMING = 'upcoming'; + + const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; + const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; + + const STATUS_DELETED = 'deleted'; + const STATUS_DRAFT = 'draft'; + const STATUS_OPEN = 'open'; + const STATUS_PAID = 'paid'; + const STATUS_UNCOLLECTIBLE = 'uncollectible'; + const STATUS_VOID = 'void'; + + use ApiOperations\NestedResource; + + const PATH_LINES = '/lines'; + /** - * @param array|null $params - * @param array|string|null $opts + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Invoice The upcoming invoice. + * @return \Stripe\Invoice the upcoming invoice */ public static function upcoming($params = null, $opts = null) { @@ -71,17 +154,106 @@ public static function upcoming($params = null, $opts = null) list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); + return $obj; } /** - * @return Invoice The paid invoice. + * @param string $id the ID of the invoice on which to retrieve the lines + * @param null|array $params + * @param null|array|string $opts + * + * @throws StripeExceptionApiErrorException if the request fails + * + * @return \Stripe\Collection the list of lines (InvoiceLineItem) + */ + public static function allLines($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_LINES, $params, $opts); + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Invoice the finalized invoice + */ + public function finalizeInvoice($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/finalize'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Invoice the uncollectible invoice + */ + public function markUncollectible($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/mark_uncollectible'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Invoice the paid invoice */ public function pay($params = null, $opts = null) { $url = $this->instanceUrl() . '/pay'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Invoice the sent invoice + */ + public function sendInvoice($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/send'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Invoice the voided invoice + */ + public function voidInvoice($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/void'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/InvoiceItem.php b/plugins/stripe/lib/InvoiceItem.php index 1401564bcc..6153bbf98b 100644 --- a/plugins/stripe/lib/InvoiceItem.php +++ b/plugins/stripe/lib/InvoiceItem.php @@ -1,35 +1,45 @@ Subscription + * Invoices. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount (in the currency specified) of the invoice item. This should always be equal to unit_amount * quantity. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property string|\Stripe\Customer $customer The ID of the customer who will be billed when this invoice item is billed. + * @property int $date Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property bool $discountable If true, discounts will apply to this invoice item. Always false for prorations. + * @property null|(string|\Stripe\Discount)[] $discounts The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount. + * @property null|string|\Stripe\Invoice $invoice The ID of the invoice this invoice item belongs to. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property \Stripe\StripeObject $period + * @property null|\Stripe\Plan $plan If the invoice item is a proration, the plan of the subscription that the proration was computed for. + * @property null|\Stripe\Price $price The price of the invoice item. + * @property bool $proration Whether the invoice item was created automatically as a proration adjustment when the customer switched plans. + * @property int $quantity Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for. + * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice item has been created for, if any. + * @property string $subscription_item The subscription item that this invoice item has been created for, if any. + * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to the invoice item. When set, the default_tax_rates on the invoice do not apply to this invoice item. + * @property null|int $unit_amount Unit amount (in the currency specified) of the invoice item. + * @property null|string $unit_amount_decimal Same as unit_amount, but contains a decimal value with at most 12 decimal places. */ class InvoiceItem extends ApiResource { - - const OBJECT_NAME = "invoiceitem"; + const OBJECT_NAME = 'invoiceitem'; use ApiOperations\All; use ApiOperations\Create; diff --git a/plugins/stripe/lib/InvoiceLineItem.php b/plugins/stripe/lib/InvoiceLineItem.php index e69c6bbb5e..e579afb6a8 100644 --- a/plugins/stripe/lib/InvoiceLineItem.php +++ b/plugins/stripe/lib/InvoiceLineItem.php @@ -1,30 +1,33 @@ ISO currency code, in lowercase. Must be a supported currency. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|\Stripe\StripeObject[] $discount_amounts The amount of discount calculated per discount for this line item. + * @property bool $discountable If true, discounts will apply to this line item. Always false for prorations. + * @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount. + * @property string $invoice_item The ID of the invoice item associated with this line item if any. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with type=subscription this will reflect the metadata of the subscription that caused the line item to be created. + * @property \Stripe\StripeObject $period + * @property null|\Stripe\Plan $plan The plan of the subscription, if the line item is a subscription or a proration. + * @property null|\Stripe\Price $price The price of the line item. + * @property bool $proration Whether this is a proration. + * @property null|int $quantity The quantity of the subscription, if the line item is a subscription or a proration. + * @property null|string $subscription The subscription that the invoice item pertains to, if any. + * @property string $subscription_item The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription. + * @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item + * @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item. + * @property string $type A string identifying the type of the source of this line item, either an invoiceitem or a subscription. */ class InvoiceLineItem extends ApiResource { - const OBJECT_NAME = "line_item"; + const OBJECT_NAME = 'line_item'; } diff --git a/plugins/stripe/lib/IssuerFraudRecord.php b/plugins/stripe/lib/IssuerFraudRecord.php deleted file mode 100644 index 8db4b31b0b..0000000000 --- a/plugins/stripe/lib/IssuerFraudRecord.php +++ /dev/null @@ -1,25 +0,0 @@ -issued card is used to + * make a purchase, an Issuing Authorization object is created. Authorizations + * must be approved for the purchase to be completed successfully. * - * @property string $id - * @property string $object - * @property bool $approved - * @property string $authorization_method - * @property int $authorized_amount - * @property string $authorized_currency - * @property \Stripe\Collection $balance_transactions - * @property Card $card - * @property Cardholder $cardholder - * @property int $created - * @property int $held_amount - * @property string $held_currency - * @property bool $is_held_amount_controllable - * @property bool $livemode - * @property mixed $merchant_data - * @property \Stripe\StripeObject $metadata - * @property int $pending_authorized_amount - * @property int $pending_held_amount - * @property mixed $request_history - * @property string $status - * @property mixed $request_history - * @property \Stripe\Collection $transactions - * @property mixed $verification_data + * Related guide: Issued Card + * Authorizations. * - * @package Stripe\Issuing + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount The total amount that was authorized or rejected. This amount is in the card's currency and in the smallest currency unit. + * @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in currency and in the smallest currency unit. + * @property bool $approved Whether the authorization has been approved. + * @property string $authorization_method How the card details were provided. + * @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this authorization. + * @property \Stripe\Issuing\Card $card You can create physical or virtual cards that are issued to cardholders. + * @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this authorization belongs. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property int $merchant_amount The total amount that was authorized or rejected. This amount is in the merchant_currency and in the smallest currency unit. + * @property string $merchant_currency The currency that was presented to the cardholder for the authorization. Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property \Stripe\StripeObject $merchant_data + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|\Stripe\StripeObject $pending_request The pending authorization request. This field will only be non-null during an issuing_authorization.request webhook. + * @property \Stripe\StripeObject[] $request_history History of every time the authorization was approved/denied (whether approved/denied by you directly or by Stripe based on your spending_controls). If the merchant changes the authorization by performing an incremental authorization or partial capture, you can look at this field to see the previous states of the authorization. + * @property string $status The current status of the authorization in its lifecycle. + * @property \Stripe\Issuing\Transaction[] $transactions List of transactions associated with this authorization. + * @property \Stripe\StripeObject $verification_data + * @property null|string $wallet What, if any, digital wallet was used for this authorization. One of apple_pay, google_pay, or samsung_pay. */ class Authorization extends \Stripe\ApiResource { - const OBJECT_NAME = "issuing.authorization"; + const OBJECT_NAME = 'issuing.authorization'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Authorization The approved authorization. + * @return Authorization the approved authorization */ - public function approve($params = null, $options = null) + public function approve($params = null, $opts = null) { $url = $this->instanceUrl() . '/approve'; - list($response, $opts) = $this->_request('post', $url, $params, $options); + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts * - * @return Authorization The declined authorization. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Authorization the declined authorization */ - public function decline($params = null, $options = null) + public function decline($params = null, $opts = null) { $url = $this->instanceUrl() . '/decline'; - list($response, $opts) = $this->_request('post', $url, $params, $options); + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/Issuing/Card.php b/plugins/stripe/lib/Issuing/Card.php index 60cc5b4e1b..e0ac774e75 100644 --- a/plugins/stripe/lib/Issuing/Card.php +++ b/plugins/stripe/lib/Issuing/Card.php @@ -1,33 +1,38 @@ create physical or + * virtual cards that are issued to cardholders. * - * @package Stripe\Issuing + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string $brand The brand of the card. + * @property null|string $cancellation_reason The reason why the card was canceled. + * @property \Stripe\Issuing\Cardholder $cardholder

An Issuing Cardholder object represents an individual or business entity who is issued cards.

Related guide: How to create a Cardholder

+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property string $cvc The card's CVC. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with the expand parameter. Additionally, it's only available via the "Retrieve a card" endpoint, not via "List all cards" or any other endpoint. + * @property int $exp_month The expiration month of the card. + * @property int $exp_year The expiration year of the card. + * @property string $last4 The last 4 digits of the card number. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $number The full unredacted card number. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with the expand parameter. Additionally, it's only available via the "Retrieve a card" endpoint, not via "List all cards" or any other endpoint. + * @property null|string|\Stripe\Issuing\Card $replaced_by The latest card that replaces this card, if any. + * @property null|string|\Stripe\Issuing\Card $replacement_for The card this card replaces, if any. + * @property null|string $replacement_reason The reason why the previous card needed to be replaced. + * @property null|\Stripe\StripeObject $shipping Where and how the card will be shipped. + * @property \Stripe\StripeObject $spending_controls + * @property string $status Whether authorizations can be approved on this card. + * @property string $type The type of the card. */ class Card extends \Stripe\ApiResource { - const OBJECT_NAME = "issuing.card"; + const OBJECT_NAME = 'issuing.card'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; @@ -35,17 +40,20 @@ class Card extends \Stripe\ApiResource use \Stripe\ApiOperations\Update; /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts * - * @return CardDetails The card details associated with that issuing card. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\CardDetails the card details associated with that issuing card */ - public function details($params = null, $options = null) + public function details($params = null, $opts = null) { $url = $this->instanceUrl() . '/details'; - list($response, $opts) = $this->_request('get', $url, $params, $options); + list($response, $opts) = $this->_request('get', $url, $params, $opts); $obj = \Stripe\Util\Util::convertToStripeObject($response, $opts); $obj->setLastResponse($response); + return $obj; } } diff --git a/plugins/stripe/lib/Issuing/CardDetails.php b/plugins/stripe/lib/Issuing/CardDetails.php index 65d3919caa..98f4e0b87e 100644 --- a/plugins/stripe/lib/Issuing/CardDetails.php +++ b/plugins/stripe/lib/Issuing/CardDetails.php @@ -3,7 +3,7 @@ namespace Stripe\Issuing; /** - * Class CardDetails + * Class CardDetails. * * @property string $id * @property string $object @@ -12,10 +12,8 @@ * @property int $exp_month * @property int $exp_year * @property string $number - * - * @package Stripe\Issuing */ class CardDetails extends \Stripe\ApiResource { - const OBJECT_NAME = "issuing.card_details"; + const OBJECT_NAME = 'issuing.card_details'; } diff --git a/plugins/stripe/lib/Issuing/Cardholder.php b/plugins/stripe/lib/Issuing/Cardholder.php index ed6c2920a5..931b7ce8e3 100644 --- a/plugins/stripe/lib/Issuing/Cardholder.php +++ b/plugins/stripe/lib/Issuing/Cardholder.php @@ -1,27 +1,36 @@ Cardholder object represents an individual or business + * entity who is issued cards. * - * @property string $id - * @property string $object - * @property mixed $billing - * @property int $created - * @property string $email - * @property bool $livemode - * @property \Stripe\StripeObject $metadata - * @property string $name - * @property string $phone_number - * @property string $status - * @property string $type + * Related guide: How to create a + * Cardholder * - * @package Stripe\Issuing + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\StripeObject $billing + * @property null|\Stripe\StripeObject $company Additional information about a company cardholder. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $email The cardholder's email address. + * @property null|\Stripe\StripeObject $individual Additional information about an individual cardholder. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $name The cardholder's name. This will be printed on cards issued to them. + * @property null|string $phone_number The cardholder's phone number. + * @property \Stripe\StripeObject $requirements + * @property null|\Stripe\StripeObject $spending_controls Rules that control spending across this cardholder's cards. Refer to our documentation for more details. + * @property string $status Specifies whether to permit authorizations on this cardholder's cards. + * @property string $type One of individual or company. */ class Cardholder extends \Stripe\ApiResource { - const OBJECT_NAME = "issuing.cardholder"; + const OBJECT_NAME = 'issuing.cardholder'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; diff --git a/plugins/stripe/lib/Issuing/Dispute.php b/plugins/stripe/lib/Issuing/Dispute.php index d0ae0d2e98..5f24864b45 100644 --- a/plugins/stripe/lib/Issuing/Dispute.php +++ b/plugins/stripe/lib/Issuing/Dispute.php @@ -1,30 +1,53 @@ card issuer, you can dispute + * transactions that the cardholder does not recognize, suspects to be fraudulent, + * or has other issues with. * - * @property string $id - * @property string $object - * @property int $amount - * @property int $created - * @property string $currency - * @property mixed $evidence - * @property bool $livemode - * @property \Stripe\StripeObject $metadata - * @property string $reason - * @property string $status - * @property Transaction $transaction + * Related guide: Disputing + * Transactions * - * @package Stripe\Issuing + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Disputed amount. Usually the amount of the disputed_transaction, but can differ (usually because of currency fluctuation). + * @property null|\Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with the dispute. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency The currency the disputed_transaction was made in. + * @property \Stripe\StripeObject $evidence + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $status Current status of the dispute. + * @property string|\Stripe\Issuing\Transaction $transaction The transaction being disputed. */ class Dispute extends \Stripe\ApiResource { - const OBJECT_NAME = "issuing.dispute"; + const OBJECT_NAME = 'issuing.dispute'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Dispute the submited dispute + */ + public function submit($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/submit'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } } diff --git a/plugins/stripe/lib/Issuing/Transaction.php b/plugins/stripe/lib/Issuing/Transaction.php index 804b48db53..3c44d7ec17 100644 --- a/plugins/stripe/lib/Issuing/Transaction.php +++ b/plugins/stripe/lib/Issuing/Transaction.php @@ -1,33 +1,43 @@ issued card that + * results in funds entering or leaving your Stripe account, such as a completed + * purchase or refund, is represented by an Issuing Transaction + * object. * - * @property string $id - * @property string $object - * @property int $amount - * @property string $authorization - * @property string $balance_transaction - * @property string $card - * @property string $cardholder - * @property int $created - * @property string $currency - * @property string $dispute - * @property bool $livemode - * @property mixed $merchant_data - * @property \Stripe\StripeObject $metadata - * @property string $type + * Related guide: Issued Card + * Transactions. * - * @package Stripe\Issuing + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount The transaction amount, which will be reflected in your balance. This amount is in your currency and in the smallest currency unit. + * @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in currency and in the smallest currency unit. + * @property null|string|\Stripe\Issuing\Authorization $authorization The Authorization object that led to this transaction. + * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction associated with this transaction. + * @property string|\Stripe\Issuing\Card $card The card used to make this transaction. + * @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this transaction belongs. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string|\Stripe\Issuing\Dispute $dispute If you've disputed the transaction, the ID of the dispute. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property int $merchant_amount The amount that the merchant will receive, denominated in merchant_currency and in the smallest currency unit. It will be different from amount if the merchant is taking payment in a different currency. + * @property string $merchant_currency The currency with which the merchant is taking payment. + * @property \Stripe\StripeObject $merchant_data + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|\Stripe\StripeObject $purchase_details Additional purchase information that is optionally provided by the merchant. + * @property string $type The nature of the transaction. */ class Transaction extends \Stripe\ApiResource { - const OBJECT_NAME = "issuing.transaction"; + const OBJECT_NAME = 'issuing.transaction'; use \Stripe\ApiOperations\All; - use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; } diff --git a/plugins/stripe/lib/LineItem.php b/plugins/stripe/lib/LineItem.php new file mode 100644 index 0000000000..d3e55af202 --- /dev/null +++ b/plugins/stripe/lib/LineItem.php @@ -0,0 +1,26 @@ +ISO currency code, in lowercase. Must be a supported currency. + * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name. + * @property \Stripe\StripeObject[] $discounts The discounts applied to the line item. + * @property \Stripe\Price $price

Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.

For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.

Related guides: Set up a subscription, create an invoice, and more about products and prices.

+ * @property null|int $quantity The quantity of products being purchased. + * @property \Stripe\StripeObject[] $taxes The taxes applied to the line item. + */ +class LineItem extends ApiResource +{ + const OBJECT_NAME = 'item'; + + use ApiOperations\All; +} diff --git a/plugins/stripe/lib/LoginLink.php b/plugins/stripe/lib/LoginLink.php index 3a443bf168..3351356b8d 100644 --- a/plugins/stripe/lib/LoginLink.php +++ b/plugins/stripe/lib/LoginLink.php @@ -1,18 +1,15 @@ true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $multi_use + * @property string|\Stripe\PaymentMethod $payment_method ID of the payment method associated with this mandate. + * @property \Stripe\StripeObject $payment_method_details + * @property \Stripe\StripeObject $single_use + * @property string $status The status of the mandate, which indicates whether it can be used to initiate a payment. + * @property string $type The type of the mandate. + */ +class Mandate extends ApiResource +{ + const OBJECT_NAME = 'mandate'; + + use ApiOperations\Retrieve; +} diff --git a/plugins/stripe/lib/OAuth.php b/plugins/stripe/lib/OAuth.php index 416ce49854..7b0886e304 100644 --- a/plugins/stripe/lib/OAuth.php +++ b/plugins/stripe/lib/OAuth.php @@ -7,22 +7,22 @@ abstract class OAuth /** * Generates a URL to Stripe's OAuth form. * - * @param array|null $params - * @param array|null $opts + * @param null|array $params + * @param null|array $opts * - * @return string The URL to Stripe's OAuth form. + * @return string the URL to Stripe's OAuth form */ public static function authorizeUrl($params = null, $opts = null) { $params = $params ?: []; - $base = ($opts && array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; + $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; $params['client_id'] = self::_getClientId($params); - if (!array_key_exists('response_type', $params)) { + if (!\array_key_exists('response_type', $params)) { $params['response_type'] = 'code'; } - $query = Util\Util::urlEncode($params); + $query = Util\Util::encodeParameters($params); return $base . '/oauth/authorize?' . $query; } @@ -31,14 +31,16 @@ public static function authorizeUrl($params = null, $opts = null) * Use an authoriztion code to connect an account to your platform and * fetch the user's credentials. * - * @param array|null $params - * @param array|null $opts + * @param null|array $params + * @param null|array $opts * - * @return StripeObject Object containing the response from the API. + * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails + * + * @return StripeObject object containing the response from the API */ public static function token($params = null, $opts = null) { - $base = ($opts && array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; + $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; $requestor = new ApiRequestor(null, $base); list($response, $apiKey) = $requestor->request( 'post', @@ -46,21 +48,24 @@ public static function token($params = null, $opts = null) $params, null ); + return Util\Util::convertToStripeObject($response->json, $opts); } /** * Disconnects an account from your platform. * - * @param array|null $params - * @param array|null $opts + * @param null|array $params + * @param null|array $opts + * + * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails * - * @return StripeObject Object containing the response from the API. + * @return StripeObject object containing the response from the API */ public static function deauthorize($params = null, $opts = null) { $params = $params ?: []; - $base = ($opts && array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; + $base = ($opts && \array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase; $requestor = new ApiRequestor(null, $base); $params['client_id'] = self::_getClientId($params); list($response, $apiKey) = $requestor->request( @@ -69,16 +74,17 @@ public static function deauthorize($params = null, $opts = null) $params, null ); + return Util\Util::convertToStripeObject($response->json, $opts); } private static function _getClientId($params = null) { - $clientId = ($params && array_key_exists('client_id', $params)) ? $params['client_id'] : null; - if ($clientId === null) { + $clientId = ($params && \array_key_exists('client_id', $params)) ? $params['client_id'] : null; + if (null === $clientId) { $clientId = Stripe::getClientId(); } - if ($clientId === null) { + if (null === $clientId) { $msg = 'No client_id provided. (HINT: set your client_id using ' . '"Stripe::setClientId()". You can find your client_ids ' . 'in your Stripe dashboard at ' @@ -86,8 +92,10 @@ private static function _getClientId($params = null) . 'after registering your account as a platform. See ' . 'https://stripe.com/docs/connect/standard-accounts for details, ' . 'or email support@stripe.com if you have any questions.'; - throw new Error\Authentication($msg); + + throw new Exception\AuthenticationException($msg); } + return $clientId; } } diff --git a/plugins/stripe/lib/OAuthErrorObject.php b/plugins/stripe/lib/OAuthErrorObject.php new file mode 100644 index 0000000000..620c5bb27d --- /dev/null +++ b/plugins/stripe/lib/OAuthErrorObject.php @@ -0,0 +1,31 @@ + null, + 'error_description' => null, + ], $values); + parent::refreshFrom($values, $opts, $partial); + } +} diff --git a/plugins/stripe/lib/Order.php b/plugins/stripe/lib/Order.php index 06c4ad3466..fd3630edb8 100644 --- a/plugins/stripe/lib/Order.php +++ b/plugins/stripe/lib/Order.php @@ -1,40 +1,45 @@ products. You can + * create, retrieve, and pay individual orders, as well as list all orders. Orders + * are identified by a unique, random ID. * - * @property string $id - * @property string $object - * @property int $amount - * @property int $amount_returned - * @property string $application - * @property int $application_fee - * @property string $charge - * @property int $created - * @property string $currency - * @property string $customer - * @property string $email - * @property string $external_coupon_code - * @property OrderItem[] $items - * @property bool $livemode - * @property StripeObject $metadata - * @property Collection $returns - * @property string $selected_shipping_method - * @property mixed $shipping - * @property mixed $shipping_methods - * @property string $status - * @property mixed $status_transitions - * @property int $updated - * @property string $upstream_id + * Related guide: Tax, Shipping, and + * Inventory. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order. + * @property null|int $amount_returned The total amount that was returned to the customer. + * @property null|string $application ID of the Connect Application that created the order. + * @property null|int $application_fee A fee in cents that will be applied to the order and transferred to the application owner’s Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees documentation. + * @property null|string|\Stripe\Charge $charge The ID of the payment used to pay for the order. Present if the order status is paid, fulfilled, or refunded. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string|\Stripe\Customer $customer The customer used for the order. + * @property null|string $email The email address of the customer placing the order. + * @property string $external_coupon_code External coupon code to load for this order. + * @property \Stripe\OrderItem[] $items List of items constituting the order. An order can have up to 25 items. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|\Stripe\Collection $returns A list of returns that have taken place for this order. + * @property null|string $selected_shipping_method The shipping method that is currently selected for this order, if any. If present, it is equal to one of the ids of shipping methods in the shipping_methods array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected the first method. + * @property null|\Stripe\StripeObject $shipping The shipping address for the order. Present if the order is for goods to be shipped. + * @property null|\Stripe\StripeObject[] $shipping_methods A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or when paying it. + * @property string $status Current order status. One of created, paid, canceled, fulfilled, or returned. More details in the Orders Guide. + * @property null|\Stripe\StripeObject $status_transitions The timestamps at which the order status was updated. + * @property null|int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. + * @property string $upstream_id The user's order ID if it is different from the Stripe order ID. */ class Order extends ApiResource { - - const OBJECT_NAME = "order"; + const OBJECT_NAME = 'order'; use ApiOperations\All; use ApiOperations\Create; @@ -42,23 +47,35 @@ class Order extends ApiResource use ApiOperations\Update; /** - * @return Order The paid order. + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\OrderReturn the newly created return */ - public function pay($params = null, $opts = null) + public function returnOrder($params = null, $opts = null) { - $url = $this->instanceUrl() . '/pay'; + $url = $this->instanceUrl() . '/returns'; list($response, $opts) = $this->_request('post', $url, $params, $opts); - $this->refreshFrom($response, $opts); - return $this; + + return Util\Util::convertToStripeObject($response, $opts); } /** - * @return OrderReturn The newly created return. + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Order the paid order */ - public function returnOrder($params = null, $opts = null) + public function pay($params = null, $opts = null) { - $url = $this->instanceUrl() . '/returns'; + $url = $this->instanceUrl() . '/pay'; list($response, $opts) = $this->_request('post', $url, $params, $opts); - return Util\Util::convertToStripeObject($response, $opts); + $this->refreshFrom($response, $opts); + + return $this; } } diff --git a/plugins/stripe/lib/OrderItem.php b/plugins/stripe/lib/OrderItem.php index 26d49b4e75..e2e6e39a28 100644 --- a/plugins/stripe/lib/OrderItem.php +++ b/plugins/stripe/lib/OrderItem.php @@ -3,7 +3,7 @@ namespace Stripe; /** - * Class OrderItem + * Class OrderItem. * * @property string $object * @property int $amount @@ -12,11 +12,8 @@ * @property string $parent * @property int $quantity * @property string $type - * - * @package Stripe */ class OrderItem extends StripeObject { - - const OBJECT_NAME = "order_item"; + const OBJECT_NAME = 'order_item'; } diff --git a/plugins/stripe/lib/OrderReturn.php b/plugins/stripe/lib/OrderReturn.php index f3705e8616..3774482d0d 100644 --- a/plugins/stripe/lib/OrderReturn.php +++ b/plugins/stripe/lib/OrderReturn.php @@ -1,26 +1,31 @@ order items. Returns always + * belong to an order, and may optionally contain a refund. * - * @property string $id - * @property string $object - * @property int $amount - * @property int $created - * @property string $currency - * @property OrderItem[] $items - * @property bool $livemode - * @property string $order - * @property string $refund + * Related guide: Handling + * Returns. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the returned line item. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property \Stripe\OrderItem[] $items The items included in this order return. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string|\Stripe\Order $order The order that this return includes items from. + * @property null|string|\Stripe\Refund $refund The ID of the refund issued for this return. */ class OrderReturn extends ApiResource { - - const OBJECT_NAME = "order_return"; + const OBJECT_NAME = 'order_return'; use ApiOperations\All; use ApiOperations\Retrieve; diff --git a/plugins/stripe/lib/PaymentIntent.php b/plugins/stripe/lib/PaymentIntent.php index 0196e18c77..2d204e9da4 100644 --- a/plugins/stripe/lib/PaymentIntent.php +++ b/plugins/stripe/lib/PaymentIntent.php @@ -1,90 +1,125 @@ multiple + * statuses throughout its lifetime as it interfaces with Stripe.js to perform + * authentication flows and ultimately creates at most one successful charge. * - * @property string $id - * @property string $object - * @property string[] $allowed_source_types - * @property int $amount - * @property int $amount_capturable - * @property int $amount_received - * @property string $application - * @property int $application_fee - * @property int $canceled_at - * @property string $capture_method - * @property Collection $charges - * @property string $client_secret - * @property int $created - * @property string $currency - * @property string $customer - * @property string $description - * @property bool $livemode - * @property StripeObject $metadata - * @property mixed $next_source_action - * @property string $on_behalf_of - * @property string $receipt_email - * @property string $return_url - * @property mixed $shipping - * @property string $source - * @property string $statement_descriptor - * @property string $status - * @property mixed $transfer_data - * @property string $transfer_group + * Related guide: Payment Intents API. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + * @property int $amount_capturable Amount that can be captured from this PaymentIntent. + * @property int $amount_received Amount that was collected by this PaymentIntent. + * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the PaymentIntent. + * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents use case for connected accounts. + * @property null|int $canceled_at Populated when status is canceled, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch. + * @property null|string $cancellation_reason Reason for cancellation of this PaymentIntent, either user-provided (duplicate, fraudulent, requested_by_customer, or abandoned) or generated by Stripe internally (failed_invoice, void_invoice, or automatic). + * @property string $capture_method Controls when the funds will be captured from the customer's account. + * @property \Stripe\Collection $charges Charges that were created by this PaymentIntent, if any. + * @property null|string $client_secret

The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.

The client secret can be used to complete a payment from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

Refer to our docs to accept a payment and learn about how client_secret should be handled.

+ * @property string $confirmation_method + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string|\Stripe\Customer $customer

ID of the Customer this PaymentIntent belongs to, if one exists.

Payment methods attached to other Customers cannot be used with this PaymentIntent.

If present in combination with setup_future_usage, this PaymentIntent's payment method will be attached to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete.

+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|string|\Stripe\Invoice $invoice ID of the invoice that created this PaymentIntent, if it exists. + * @property null|\Stripe\ErrorObject $last_payment_error The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. For more information, see the documentation. + * @property null|\Stripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source. + * @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the funds of the PaymentIntent are intended. See the PaymentIntents use case for connected accounts for details. + * @property null|string|\Stripe\PaymentMethod $payment_method ID of the payment method used in this PaymentIntent. + * @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for this PaymentIntent. + * @property string[] $payment_method_types The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. + * @property null|string $receipt_email Email address that the receipt for the resulting payment will be sent to. If receipt_email is specified for a payment in live mode, a receipt will be sent regardless of your email settings. + * @property null|string|\Stripe\Review $review ID of the review associated with this PaymentIntent, if any. + * @property null|string $setup_future_usage

Indicates that you intend to make future payments with this PaymentIntent's payment method.

Providing this parameter will attach the payment method to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be attached to a Customer after the transaction completes.

When processing card payments, Stripe also uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA.

+ * @property null|\Stripe\StripeObject $shipping Shipping information for this PaymentIntent. + * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $source This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied. + * @property null|string $statement_descriptor For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters. + * @property null|string $statement_descriptor_suffix Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. + * @property string $status Status of this PaymentIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, requires_capture, canceled, or succeeded. Read more about each PaymentIntent status. + * @property null|\Stripe\StripeObject $transfer_data The data with which to automatically create a Transfer when the payment is finalized. See the PaymentIntents use case for connected accounts for details. + * @property null|string $transfer_group A string that identifies the resulting payment as part of a group. See the PaymentIntents use case for connected accounts for details. */ class PaymentIntent extends ApiResource { - - const OBJECT_NAME = "payment_intent"; + const OBJECT_NAME = 'payment_intent'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; + const STATUS_CANCELED = 'canceled'; + const STATUS_PROCESSING = 'processing'; + const STATUS_REQUIRES_ACTION = 'requires_action'; + const STATUS_REQUIRES_CAPTURE = 'requires_capture'; + const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation'; + const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method'; + const STATUS_SUCCEEDED = 'succeeded'; + /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return PaymentIntent The canceled payment intent. + * @return PaymentIntent the canceled payment intent */ - public function cancel($params = null, $options = null) + public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; - list($response, $opts) = $this->_request('post', $url); + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return PaymentIntent The captured payment intent. + * @return PaymentIntent the captured payment intent */ - public function capture($params = null, $options = null) + public function capture($params = null, $opts = null) { $url = $this->instanceUrl() . '/capture'; - list($response, $opts) = $this->_request('post', $url); + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts * - * @return PaymentIntent The confirmed payment intent. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return PaymentIntent the confirmed payment intent */ - public function confirm($params = null, $options = null) + public function confirm($params = null, $opts = null) { $url = $this->instanceUrl() . '/confirm'; - list($response, $opts) = $this->_request('post', $url); + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/PaymentMethod.php b/plugins/stripe/lib/PaymentMethod.php new file mode 100644 index 0000000000..d9c9e2b52c --- /dev/null +++ b/plugins/stripe/lib/PaymentMethod.php @@ -0,0 +1,86 @@ +PaymentIntents to + * collect payments or saved to Customer objects to store instrument details for + * future payments. + * + * Related guides: Payment Methods and + * More Payment + * Scenarios. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\StripeObject $alipay + * @property \Stripe\StripeObject $au_becs_debit + * @property \Stripe\StripeObject $bacs_debit + * @property \Stripe\StripeObject $bancontact + * @property \Stripe\StripeObject $billing_details + * @property \Stripe\StripeObject $card + * @property \Stripe\StripeObject $card_present + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string|\Stripe\Customer $customer The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer. + * @property \Stripe\StripeObject $eps + * @property \Stripe\StripeObject $fpx + * @property \Stripe\StripeObject $giropay + * @property \Stripe\StripeObject $grabpay + * @property \Stripe\StripeObject $ideal + * @property \Stripe\StripeObject $interac_present + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property \Stripe\StripeObject $oxxo + * @property \Stripe\StripeObject $p24 + * @property \Stripe\StripeObject $sepa_debit + * @property \Stripe\StripeObject $sofort + * @property string $type The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. + */ +class PaymentMethod extends ApiResource +{ + const OBJECT_NAME = 'payment_method'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Retrieve; + use ApiOperations\Update; + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return PaymentMethod the attached payment method + */ + public function attach($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/attach'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return PaymentMethod the detached payment method + */ + public function detach($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/detach'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } +} diff --git a/plugins/stripe/lib/Payout.php b/plugins/stripe/lib/Payout.php index 2a21f2055a..46f86181e4 100644 --- a/plugins/stripe/lib/Payout.php +++ b/plugins/stripe/lib/Payout.php @@ -1,69 +1,108 @@ Payout object is created when you receive funds from Stripe, or + * when you initiate a payout to either a bank account or debit card of a connected Stripe account. You + * can retrieve individual payouts, as well as list all payouts. Payouts are made + * on varying schedules, + * depending on your country and industry. * - * @property string $id - * @property string $object - * @property int $amount - * @property int $arrival_date - * @property bool $automatic - * @property string $balance_transaction - * @property int $created - * @property string $currency - * @property string $destination - * @property string $failure_balance_transaction - * @property string $failure_code - * @property string $failure_message - * @property bool $livemode - * @property StripeObject $metadata - * @property string $method - * @property string $recipient - * @property string $source_type - * @property string $statement_descriptor - * @property string $status - * @property string $type + * Related guide: Receiving Payouts. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount (in %s) to be transferred to your bank account or debit card. + * @property int $arrival_date Date the payout is expected to arrive in the bank. This factors in delays like weekends or bank holidays. + * @property bool $automatic Returns true if the payout was created by an automated payout schedule, and false if it was requested manually. + * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this payout on your account balance. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|string|\Stripe\BankAccount|\Stripe\Card $destination ID of the bank account or card the payout was sent to. + * @property null|string|\Stripe\BalanceTransaction $failure_balance_transaction If the payout failed or was canceled, this will be the ID of the balance transaction that reversed the initial balance transaction, and puts the funds from the failed payout back in your balance. + * @property null|string $failure_code Error code explaining reason for payout failure if available. See Types of payout failures for a list of failure codes. + * @property null|string $failure_message Message to user further explaining reason for payout failure if available. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $method The method used to send this payout, which can be standard or instant. instant is only supported for payouts to debit cards. (See Instant payouts for marketplaces for more information.) + * @property null|string|\Stripe\Payout $original_payout If the payout reverses another, this is the ID of the original payout. + * @property null|string|\Stripe\Payout $reversed_by If the payout was reversed, this is the ID of the payout that reverses this payout. + * @property string $source_type The source balance this payout came from. One of card, fpx, or bank_account. + * @property null|string $statement_descriptor Extra information about a payout to be displayed on the user's bank statement. + * @property string $status Current status of the payout: paid, pending, in_transit, canceled or failed. A payout is pending until it is submitted to the bank, when it becomes in_transit. The status then changes to paid if the transaction goes through, or to failed or canceled (within 5 business days). Some failed payouts may initially show as paid but then change to failed. + * @property string $type Can be bank_account or card. */ class Payout extends ApiResource { - - const OBJECT_NAME = "payout"; - - /** - * Types of payout failure codes. - * @link https://stripe.com/docs/api#payout_failures - */ - const FAILURE_ACCOUNT_CLOSED = 'account_closed'; - const FAILURE_ACCOUNT_FROZEN = 'account_frozen'; - const FAILURE_BANK_ACCOUNT_RESTRICTED = 'bank_account_restricted'; - const FAILURE_BANK_OWNERSHIP_CHANGED = 'bank_ownership_changed'; - const FAILURE_COULD_NOT_PROCESS = 'could_not_process'; - const FAILURE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized'; - const FAILURE_DECLINED = 'declined'; - const FAILURE_INCORRECT_ACCOUNT_HOLDER_NAME = 'incorrect_account_holder_name'; - const FAILURE_INSUFFICIENT_FUNDS = 'insufficient_funds'; - const FAILURE_INVALID_ACCOUNT_NUMBER = 'invalid_account_number'; - const FAILURE_INVALID_CURRENCY = 'invalid_currency'; - const FAILURE_NO_ACCOUNT = 'no_account'; - const FAILURE_UNSUPPORTED_CARD = 'unsupported_card'; + const OBJECT_NAME = 'payout'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; + const FAILURE_ACCOUNT_CLOSED = 'account_closed'; + const FAILURE_ACCOUNT_FROZEN = 'account_frozen'; + const FAILURE_BANK_ACCOUNT_RESTRICTED = 'bank_account_restricted'; + const FAILURE_BANK_OWNERSHIP_CHANGED = 'bank_ownership_changed'; + const FAILURE_COULD_NOT_PROCESS = 'could_not_process'; + const FAILURE_DEBIT_NOT_AUTHORIZED = 'debit_not_authorized'; + const FAILURE_DECLINED = 'declined'; + const FAILURE_INCORRECT_ACCOUNT_HOLDER_NAME = 'incorrect_account_holder_name'; + const FAILURE_INSUFFICIENT_FUNDS = 'insufficient_funds'; + const FAILURE_INVALID_ACCOUNT_NUMBER = 'invalid_account_number'; + const FAILURE_INVALID_CURRENCY = 'invalid_currency'; + const FAILURE_NO_ACCOUNT = 'no_account'; + const FAILURE_UNSUPPORTED_CARD = 'unsupported_card'; + + const METHOD_INSTANT = 'instant'; + const METHOD_STANDARD = 'standard'; + + const STATUS_CANCELED = 'canceled'; + const STATUS_FAILED = 'failed'; + const STATUS_IN_TRANSIT = 'in_transit'; + const STATUS_PAID = 'paid'; + const STATUS_PENDING = 'pending'; + + const TYPE_BANK_ACCOUNT = 'bank_account'; + const TYPE_CARD = 'card'; + /** - * @return Payout The canceled payout. + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Payout the canceled payout */ - public function cancel() + public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; - list($response, $opts) = $this->_request('post', $url); + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Payout the reversed payout + */ + public function reverse($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/reverse'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/Person.php b/plugins/stripe/lib/Person.php new file mode 100644 index 0000000000..151870a86f --- /dev/null +++ b/plugins/stripe/lib/Person.php @@ -0,0 +1,111 @@ +Handling + * Identity Verification with the API. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string $account The account the person is associated with. + * @property \Stripe\StripeObject $address + * @property null|\Stripe\StripeObject $address_kana The Kana variation of the person's address (Japan only). + * @property null|\Stripe\StripeObject $address_kanji The Kanji variation of the person's address (Japan only). + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property \Stripe\StripeObject $dob + * @property null|string $email The person's email address. + * @property null|string $first_name The person's first name. + * @property null|string $first_name_kana The Kana variation of the person's first name (Japan only). + * @property null|string $first_name_kanji The Kanji variation of the person's first name (Japan only). + * @property null|string $gender The person's gender (International regulations require either "male" or "female"). + * @property bool $id_number_provided Whether the person's id_number was provided. + * @property null|string $last_name The person's last name. + * @property null|string $last_name_kana The Kana variation of the person's last name (Japan only). + * @property null|string $last_name_kanji The Kanji variation of the person's last name (Japan only). + * @property null|string $maiden_name The person's maiden name. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $phone The person's phone number. + * @property string $political_exposure Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. + * @property \Stripe\StripeObject $relationship + * @property null|\Stripe\StripeObject $requirements Information about the requirements for this person, including what information needs to be collected, and by when. + * @property bool $ssn_last_4_provided Whether the last four digits of the person's Social Security number have been provided (U.S. only). + * @property \Stripe\StripeObject $verification + */ +class Person extends ApiResource +{ + const OBJECT_NAME = 'person'; + + use ApiOperations\Delete; + use ApiOperations\Update; + + const GENDER_FEMALE = 'female'; + const GENDER_MALE = 'male'; + + const POLITICAL_EXPOSURE_EXISTING = 'existing'; + const POLITICAL_EXPOSURE_NONE = 'none'; + + 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 + */ + public function instanceUrl() + { + $id = $this['id']; + $account = $this['account']; + if (!$id) { + throw new Exception\UnexpectedValueException( + 'Could not determine which URL to request: ' . + "class instance has invalid ID: {$id}", + null + ); + } + $id = Util\Util::utf8($id); + $account = Util\Util::utf8($account); + + $base = Account::classUrl(); + $accountExtn = \urlencode($account); + $extn = \urlencode($id); + + return "{$base}/{$accountExtn}/persons/{$extn}"; + } + + /** + * @param array|string $_id + * @param null|array|string $_opts + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function retrieve($_id, $_opts = null) + { + $msg = 'Persons cannot be retrieved without an account ID. Retrieve ' . + "a person using `Account::retrievePerson('account_id', " . + "'person_id')`."; + + throw new Exception\BadMethodCallException($msg); + } + + /** + * @param string $_id + * @param null|array $_params + * @param null|array|string $_options + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function update($_id, $_params = null, $_options = null) + { + $msg = 'Persons cannot be updated without an account ID. Update ' . + "a person using `Account::updatePerson('account_id', " . + "'person_id', \$updateParams)`."; + + throw new Exception\BadMethodCallException($msg); + } +} diff --git a/plugins/stripe/lib/Plan.php b/plugins/stripe/lib/Plan.php index 54a2b58eb3..bff735d78a 100644 --- a/plugins/stripe/lib/Plan.php +++ b/plugins/stripe/lib/Plan.php @@ -1,36 +1,53 @@ Prices API. It replaces the Plans + * API and is backwards compatible to simplify your migration. + * + * Plans define the base price, currency, and billing cycle for recurring purchases + * of products. Products help + * you track inventory or provisioning, and plans help you track pricing. Different + * physical goods or levels of service should be represented by products, and + * pricing options should be represented by plans. This approach lets you change + * prices without having to change your provisioning scheme. * - * @package Stripe + * For example, you might have a single "gold" product that has plans for + * $10/month, $100/year, €9/month, and €90/year. * - * @property string $id - * @property string $object - * @property bool $active - * @property string $aggregate_usage - * @property int $amount - * @property string $billing_scheme - * @property int $created - * @property string $currency - * @property string $interval - * @property int $interval_count - * @property bool $livemode - * @property StripeObject $metadata - * @property string $nickname - * @property string $product - * @property mixed $tiers - * @property string $tiers_mode - * @property mixed $transform_usage - * @property int $trial_period_days - * @property string $usage_type + * Related guides: Set up + * a subscription and more about products and prices. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property bool $active Whether the plan can be used for new purchases. + * @property null|string $aggregate_usage Specifies a usage aggregation strategy for plans of usage_type=metered. Allowed values are sum for summing up all usage during a period, last_during_period for using the last usage record reported within a period, last_ever for using the last usage record ever (across period bounds) or max which uses the usage record with the maximum reported usage during a period. Defaults to sum. + * @property null|int $amount The unit amount in %s to be charged, represented as a whole integer if possible. + * @property null|string $amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. + * @property string $billing_scheme Describes how to compute the price per period. Either per_unit or tiered. per_unit indicates that the fixed amount (specified in amount) will be charged per unit in quantity (for plans with usage_type=licensed), or per unit of total usage (for plans with usage_type=metered). tiered indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property string $interval The frequency at which a subscription is billed. One of day, week, month or year. + * @property int $interval_count The number of intervals (specified in the interval attribute) between subscription billings. For example, interval=month and interval_count=3 bills every 3 months. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $nickname A brief description of the plan, hidden from customers. + * @property null|string|\Stripe\Product $product The product whose pricing this plan determines. + * @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme. + * @property null|string $tiers_mode Defines if the tiering price should be graduated or volume based. In volume-based tiering, the maximum quantity within a period determines the per unit price. In graduated tiering, pricing can change as the quantity grows. + * @property null|\Stripe\StripeObject $transform_usage Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with tiers. + * @property null|int $trial_period_days Default number of trial days when subscribing a customer to this plan using trial_from_plan=true. + * @property string $usage_type Configures how the quantity per period should be determined. Can be either metered or licensed. licensed automatically bills the quantity set when adding it to a subscription. metered aggregates the total usage based on usage records. Defaults to licensed. */ class Plan extends ApiResource { - - const OBJECT_NAME = "plan"; + const OBJECT_NAME = 'plan'; use ApiOperations\All; use ApiOperations\Create; diff --git a/plugins/stripe/lib/Price.php b/plugins/stripe/lib/Price.php new file mode 100644 index 0000000000..9d3c5540e4 --- /dev/null +++ b/plugins/stripe/lib/Price.php @@ -0,0 +1,62 @@ +Products help you track + * inventory or provisioning, and prices help you track payment terms. Different + * physical goods or levels of service should be represented by products, and + * pricing options should be represented by prices. This approach lets you change + * prices without having to change your provisioning scheme. + * + * For example, you might have a single "gold" product that has prices + * for $10/month, $100/year, and €9 once. + * + * Related guides: Set up + * a subscription, create an invoice, + * and more about products + * and prices. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property bool $active Whether the price can be used for new purchases. + * @property string $billing_scheme Describes how to compute the price per period. Either per_unit or tiered. per_unit indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity (for prices with usage_type=licensed), or per unit of total usage (for prices with usage_type=metered). tiered indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string $lookup_key A lookup key used to retrieve prices dynamically from a static string. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $nickname A brief description of the plan, hidden from customers. + * @property string|\Stripe\Product $product The ID of the product this price is associated with. + * @property null|\Stripe\StripeObject $recurring The recurring components of a price such as interval and usage_type. + * @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme. + * @property null|string $tiers_mode Defines if the tiering price should be graduated or volume based. In volume-based tiering, the maximum quantity within a period determines the per unit price. In graduated tiering, pricing can change as the quantity grows. + * @property null|\Stripe\StripeObject $transform_quantity Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with tiers. + * @property string $type One of one_time or recurring depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. + * @property null|int $unit_amount The unit amount in %s to be charged, represented as a whole integer if possible. + * @property null|string $unit_amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. + */ +class Price extends ApiResource +{ + const OBJECT_NAME = 'price'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Retrieve; + use ApiOperations\Update; + + const BILLING_SCHEME_PER_UNIT = 'per_unit'; + const BILLING_SCHEME_TIERED = 'tiered'; + + const TIERS_MODE_GRADUATED = 'graduated'; + const TIERS_MODE_VOLUME = 'volume'; + + const TYPE_ONE_TIME = 'one_time'; + const TYPE_RECURRING = 'recurring'; +} diff --git a/plugins/stripe/lib/Product.php b/plugins/stripe/lib/Product.php index 1087349b40..5afe1f1373 100644 --- a/plugins/stripe/lib/Product.php +++ b/plugins/stripe/lib/Product.php @@ -1,40 +1,53 @@ Prices to + * configure pricing in Checkout and Subscriptions. * - * @property string $id - * @property string $object - * @property bool $active - * @property string[] $attributes - * @property string $caption - * @property int $created - * @property string[] $deactivate_on - * @property string $description - * @property array $images - * @property bool $livemode - * @property StripeObject $metadata - * @property string $name - * @property mixed $package_dimensions - * @property bool $shippable - * @property string $statement_descriptor - * @property string $type - * @property string $unit_label - * @property int $updated - * @property string $url + * Related guides: Set up + * a subscription or accept one-time + * payments with Checkout and more about Products and Prices * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property bool $active Whether the product is currently available for purchase. + * @property null|string[] $attributes A list of up to 5 attributes that each SKU can provide values for (e.g., ["color", "size"]). + * @property null|string $caption A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of type=good. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string[] $deactivate_on An array of connect application identifiers that cannot purchase this product. Only applicable to products of type=good. + * @property null|string $description The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. + * @property string[] $images A list of up to 8 URLs of images for this product, meant to be displayable to the customer. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $name The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions. + * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own package_dimensions. Only applicable to products of type=good. + * @property null|bool $shippable Whether this product is a shipped good. Only applicable to products of type=good. + * @property null|string $statement_descriptor Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used. + * @property string $type The type of the product. The product is either of type good, which is eligible for use with Orders and SKUs, or service, which is eligible for use with Subscriptions and Plans. + * @property null|string $unit_label A label that represents units of this product in Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions. + * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. + * @property null|string $url A URL of a publicly-accessible webpage for this product. Only applicable to products of type=good. */ class Product extends ApiResource { - - const OBJECT_NAME = "product"; + const OBJECT_NAME = 'product'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; + + const TYPE_GOOD = 'good'; + const TYPE_SERVICE = 'service'; } diff --git a/plugins/stripe/lib/PromotionCode.php b/plugins/stripe/lib/PromotionCode.php new file mode 100644 index 0000000000..f4bb0f4f10 --- /dev/null +++ b/plugins/stripe/lib/PromotionCode.php @@ -0,0 +1,33 @@ +invoices or orders. Coupons do not work with conventional one-off charges. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string|\Stripe\Customer $customer The customer that this promotion code can be used by. + * @property null|int $expires_at Date at which the promotion code can no longer be redeemed. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|int $max_redemptions Maximum number of times this promotion code can be redeemed. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property \Stripe\StripeObject $restrictions + * @property int $times_redeemed Number of times this promotion code has been used. + */ +class PromotionCode extends ApiResource +{ + const OBJECT_NAME = 'promotion_code'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Retrieve; + use ApiOperations\Update; +} diff --git a/plugins/stripe/lib/Radar/EarlyFraudWarning.php b/plugins/stripe/lib/Radar/EarlyFraudWarning.php new file mode 100644 index 0000000000..eb1b351c6b --- /dev/null +++ b/plugins/stripe/lib/Radar/EarlyFraudWarning.php @@ -0,0 +1,37 @@ +Early + * Fraud Warnings. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property bool $actionable An EFW is actionable if it has not received a dispute and has not been fully refunded. You may wish to proactively refund a charge that receives an EFW, in order to avoid receiving a dispute later. + * @property string|\Stripe\Charge $charge ID of the charge this early fraud warning is for, optionally expanded. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $fraud_type The type of fraud labelled by the issuer. One of card_never_received, fraudulent_card_application, made_with_counterfeit_card, made_with_lost_card, made_with_stolen_card, misc, unauthorized_use_of_card. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + */ +class EarlyFraudWarning extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'radar.early_fraud_warning'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Retrieve; + + const FRAUD_TYPE_CARD_NEVER_RECEIVED = 'card_never_received'; + const FRAUD_TYPE_FRAUDULENT_CARD_APPLICATION = 'fraudulent_card_application'; + const FRAUD_TYPE_MADE_WITH_COUNTERFEIT_CARD = 'made_with_counterfeit_card'; + const FRAUD_TYPE_MADE_WITH_LOST_CARD = 'made_with_lost_card'; + const FRAUD_TYPE_MADE_WITH_STOLEN_CARD = 'made_with_stolen_card'; + const FRAUD_TYPE_MISC = 'misc'; + const FRAUD_TYPE_UNAUTHORIZED_USE_OF_CARD = 'unauthorized_use_of_card'; +} diff --git a/plugins/stripe/lib/Radar/ValueList.php b/plugins/stripe/lib/Radar/ValueList.php new file mode 100644 index 0000000000..bcbef74cd4 --- /dev/null +++ b/plugins/stripe/lib/Radar/ValueList.php @@ -0,0 +1,35 @@ +Default Stripe + * Lists. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string $alias The name of the value list for use in rules. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $created_by The name or email address of the user who created this value list. + * @property string $item_type The type of items in the value list. One of card_fingerprint, card_bin, email, ip_address, country, string, or case_sensitive_string. + * @property \Stripe\Collection $list_items List of items contained within this value list. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $name The name of the value list. + */ +class ValueList extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'radar.value_list'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Delete; + use \Stripe\ApiOperations\Retrieve; + use \Stripe\ApiOperations\Update; +} diff --git a/plugins/stripe/lib/Radar/ValueListItem.php b/plugins/stripe/lib/Radar/ValueListItem.php new file mode 100644 index 0000000000..c4ab28194b --- /dev/null +++ b/plugins/stripe/lib/Radar/ValueListItem.php @@ -0,0 +1,31 @@ +Managing List + * Items. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $created_by The name or email address of the user who added this item to the value list. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property string $value The value of the item. + * @property string $value_list The identifier of the value list this item belongs to. + */ +class ValueListItem extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'radar.value_list_item'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Delete; + use \Stripe\ApiOperations\Retrieve; +} diff --git a/plugins/stripe/lib/Recipient.php b/plugins/stripe/lib/Recipient.php index 2d5eda5cf7..8d5ad4c0a7 100644 --- a/plugins/stripe/lib/Recipient.php +++ b/plugins/stripe/lib/Recipient.php @@ -1,48 +1,44 @@ Recipient objects, you can transfer money from your Stripe + * account to a third-party bank account or debit card. The API allows you to + * create, delete, and update your recipients. You can retrieve individual + * recipients as well as a list of all your recipients. * - * @package Stripe + * Recipient objects have been deprecated in favor of Connect, specifically Connect's much + * more powerful Account objects. + * Stripe accounts that don't already use recipients can no longer begin doing so. + * Please use Account objects instead. * - * @property string $id - * @property string $object - * @property mixed $active_account - * @property Collection $cards - * @property int $created - * @property string $default_card - * @property string $description - * @property string $email - * @property bool $livemode - * @property StripeObject $metadata - * @property string $migrated_to - * @property string $name - * @property string $rolled_back_from - * @property string $type + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|\Stripe\BankAccount $active_account Hash describing the current account on the recipient, if there is one. + * @property null|\Stripe\Collection $cards + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string|\Stripe\Card $default_card The default card to use for creating transfers to this recipient. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|string $email + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string|\Stripe\Account $migrated_to The ID of the Custom account this recipient was migrated to. If set, the recipient can no longer be updated, nor can transfers be made to it: use the Custom account instead. + * @property null|string $name Full, legal name of the recipient. + * @property string|\Stripe\Account $rolled_back_from + * @property string $type Type of the recipient, one of individual or corporation. + * @property bool $verified Whether the recipient has been verified. This field is non-standard, and maybe removed in the future */ class Recipient extends ApiResource { - - const OBJECT_NAME = "recipient"; + const OBJECT_NAME = 'recipient'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; - - /** - * @param array|null $params - * - * @return Collection of the Recipient's Transfers - */ - public function transfers($params = null) - { - $params = $params ?: []; - $params['recipient'] = $this->id; - $transfers = Transfer::all($params, $this->_opts); - return $transfers; - } } diff --git a/plugins/stripe/lib/RecipientTransfer.php b/plugins/stripe/lib/RecipientTransfer.php index 17de5a52e5..5e2d4365da 100644 --- a/plugins/stripe/lib/RecipientTransfer.php +++ b/plugins/stripe/lib/RecipientTransfer.php @@ -3,7 +3,7 @@ namespace Stripe; /** - * Class RecipientTransfer + * Class RecipientTransfer. * * @property string $id * @property string $object @@ -20,20 +20,17 @@ * @property string $failure_code * @property string $failure_message * @property bool $livemode - * @property StripeObject $metadata + * @property \Stripe\StripeObject $metadata * @property string $method * @property string $recipient - * @property mixed $reversals + * @property \Stripe\Collection $reversals * @property bool $reversed * @property string $source_type * @property string $statement_descriptor * @property string $status * @property string $type - * - * @package Stripe */ class RecipientTransfer extends ApiResource { - - const OBJECT_NAME = "recipient_transfer"; + const OBJECT_NAME = 'recipient_transfer'; } diff --git a/plugins/stripe/lib/Refund.php b/plugins/stripe/lib/Refund.php index e7dab26988..f5e975fd83 100644 --- a/plugins/stripe/lib/Refund.php +++ b/plugins/stripe/lib/Refund.php @@ -1,33 +1,58 @@ Refund objects allow you to refund a charge that has previously + * been created but not yet refunded. Funds will be refunded to the credit or debit + * card that was originally charged. * - * @property string $id - * @property string $object - * @property int $amount - * @property string $balance_transaction - * @property string $charge - * @property int $created - * @property string $currency - * @property string $failure_balance_transaction - * @property string failure_reason - * @property StripeObject $metadata - * @property mixed $reason - * @property mixed $receipt_number - * @property string $status + * Related guide: Refunds. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount, in %s. + * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance. + * @property null|string|\Stripe\Charge $charge ID of the charge that was refunded. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only) + * @property string|\Stripe\BalanceTransaction $failure_balance_transaction If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. + * @property string $failure_reason If the refund failed, the reason for refund failure if known. Possible values are lost_or_stolen_card, expired_or_canceled_card, or unknown. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string|\Stripe\PaymentIntent $payment_intent ID of the PaymentIntent that was refunded. + * @property null|string $reason Reason for the refund, either user-provided (duplicate, fraudulent, or requested_by_customer) or generated by Stripe internally (expired_uncaptured_charge). + * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this refund. + * @property null|string|\Stripe\TransferReversal $source_transfer_reversal The transfer reversal that is associated with the refund. Only present if the charge came from another Stripe account. See the Connect documentation for details. + * @property null|string $status Status of the refund. For credit card refunds, this can be pending, succeeded, or failed. For other types of refunds, it can be pending, succeeded, failed, or canceled. Refer to our refunds documentation for more details. + * @property null|string|\Stripe\TransferReversal $transfer_reversal If the accompanying transfer was reversed, the transfer reversal object. Only applicable if the charge was created using the destination parameter. */ class Refund extends ApiResource { - - const OBJECT_NAME = "refund"; + const OBJECT_NAME = 'refund'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; + + const FAILURE_REASON_EXPIRED_OR_CANCELED_CARD = 'expired_or_canceled_card'; + const FAILURE_REASON_LOST_OR_STOLEN_CARD = 'lost_or_stolen_card'; + const FAILURE_REASON_UNKNOWN = 'unknown'; + + const REASON_DUPLICATE = 'duplicate'; + const REASON_FRAUDULENT = 'fraudulent'; + const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; + + const STATUS_CANCELED = 'canceled'; + const STATUS_FAILED = 'failed'; + const STATUS_PENDING = 'pending'; + const STATUS_SUCCEEDED = 'succeeded'; + + /** + * @deprecated use FAILURE_REASON_EXPIRED_OR_CANCELED_CARD instead + */ + const FAILURE_REASON = 'expired_or_canceled_card'; } diff --git a/plugins/stripe/lib/Reporting/ReportRun.php b/plugins/stripe/lib/Reporting/ReportRun.php new file mode 100644 index 0000000000..458cbed6cd --- /dev/null +++ b/plugins/stripe/lib/Reporting/ReportRun.php @@ -0,0 +1,37 @@ +API Access to + * Reports. + * + * Note that reports can only be run based on your live-mode data (not test-mode + * data), and thus related requests must be made with a live-mode API key. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $error If something should go wrong during the run, a message about the failure (populated when status=failed). + * @property bool $livemode Always true: reports can only be run on live-mode data. + * @property \Stripe\StripeObject $parameters + * @property string $report_type The ID of the report type to run, such as "balance.summary.1". + * @property null|\Stripe\File $result The file object representing the result of the report run (populated when status=succeeded). + * @property string $status Status of this report run. This will be pending when the run is initially created. When the run finishes, this will be set to succeeded and the result field will be populated. Rarely, we may encounter an error, at which point this will be set to failed and the error field will be populated. + * @property null|int $succeeded_at Timestamp at which this run successfully finished (populated when status=succeeded). Measured in seconds since the Unix epoch. + */ +class ReportRun extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'reporting.report_run'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Retrieve; +} diff --git a/plugins/stripe/lib/Reporting/ReportType.php b/plugins/stripe/lib/Reporting/ReportType.php new file mode 100644 index 0000000000..cf753012a4 --- /dev/null +++ b/plugins/stripe/lib/Reporting/ReportType.php @@ -0,0 +1,34 @@ +API Access to Reports + * documentation for those Report Type IDs, along with required and optional + * parameters. + * + * Note that reports can only be run based on your live-mode data (not test-mode + * data), and thus related requests must be made with a live-mode API key. + * + * @property string $id The ID of the Report Type, such as balance.summary.1. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $data_available_end Most recent time for which this Report Type is available. Measured in seconds since the Unix epoch. + * @property int $data_available_start Earliest time for which this Report Type is available. Measured in seconds since the Unix epoch. + * @property null|string[] $default_columns List of column names that are included by default when this Report Type gets run. (If the Report Type doesn't support the columns parameter, this will be null.) + * @property string $name Human-readable name of the Report Type + * @property int $updated When this Report Type was latest updated. Measured in seconds since the Unix epoch. + * @property int $version Version of the Report Type. Different versions report with the same ID will have the same purpose, but may take different run parameters or have different result schemas. + */ +class ReportType extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'reporting.report_type'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Retrieve; +} diff --git a/plugins/stripe/lib/RequestTelemetry.php b/plugins/stripe/lib/RequestTelemetry.php new file mode 100644 index 0000000000..bf9074acb2 --- /dev/null +++ b/plugins/stripe/lib/RequestTelemetry.php @@ -0,0 +1,26 @@ +requestId = $requestId; + $this->requestDuration = $requestDuration; + } +} diff --git a/plugins/stripe/lib/Review.php b/plugins/stripe/lib/Review.php new file mode 100644 index 0000000000..606b41054d --- /dev/null +++ b/plugins/stripe/lib/Review.php @@ -0,0 +1,66 @@ +Radar and reviewing payments here. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string $billing_zip The ZIP or postal code of the card used, if applicable. + * @property null|string|\Stripe\Charge $charge The charge associated with this review. + * @property null|string $closed_reason The reason the review was closed, or null if it has not yet been closed. One of approved, refunded, refunded_as_fraud, or disputed. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $ip_address The IP address where the payment originated. + * @property null|\Stripe\StripeObject $ip_address_location Information related to the location of the payment. Note that this information is an approximation and attempts to locate the nearest population center - it should not be used to determine a specific address. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property bool $open If true, the review needs action. + * @property string $opened_reason The reason the review was opened. One of rule or manual. + * @property string|\Stripe\PaymentIntent $payment_intent The PaymentIntent ID associated with this review, if one exists. + * @property string $reason The reason the review is currently open or closed. One of rule, manual, approved, refunded, refunded_as_fraud, or disputed. + * @property null|\Stripe\StripeObject $session Information related to the browsing session of the user who initiated the payment. + */ +class Review extends ApiResource +{ + const OBJECT_NAME = 'review'; + + use ApiOperations\All; + use ApiOperations\Retrieve; + + /** + * Possible string representations of the current, the opening or the closure reason of the review. + * Not all of these enumeration apply to all of the ´reason´ fields. Please consult the Review object to + * determine where these are apply. + * + * @see https://stripe.com/docs/api/radar/reviews/object + */ + const REASON_APPROVED = 'approved'; + const REASON_DISPUTED = 'disputed'; + const REASON_MANUAL = 'manual'; + const REASON_REFUNDED = 'refunded'; + const REASON_REFUNDED_AS_FRAUD = 'refunded_as_fraud'; + const REASON_RULE = 'rule'; + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Review the approved review + */ + public function approve($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/approve'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } +} diff --git a/plugins/stripe/lib/SKU.php b/plugins/stripe/lib/SKU.php index 5b50df8a84..b418c6c5df 100644 --- a/plugins/stripe/lib/SKU.php +++ b/plugins/stripe/lib/SKU.php @@ -1,31 +1,40 @@ stock keeping units. + * SKUs describe specific product variations, taking into account any combination + * of: attributes, currency, and cost. For example, a product may be a T-shirt, + * whereas a specific SKU represents the size: large, color: + * red version of that shirt. + * + * Can also be used to manage inventory. * - * @property string $id - * @property string $object - * @property bool $active - * @property mixed $attributes - * @property int $created - * @property string $currency - * @property string $image - * @property mixed $inventory - * @property bool $livemode - * @property StripeObject $metadata - * @property mixed $package_dimensions - * @property int $price - * @property string $product - * @property int $updated + * Related guide: Tax, Shipping, and + * Inventory. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property bool $active Whether the SKU is available for purchase. + * @property \Stripe\StripeObject $attributes A dictionary of attributes and values for the attributes defined by the product. If, for example, a product's attributes are ["size", "gender"], a valid SKU has the following dictionary of attributes: {"size": "Medium", "gender": "Unisex"}. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string $image The URL of an image for this SKU, meant to be displayable to the customer. + * @property \Stripe\StripeObject $inventory + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this SKU for shipping purposes. + * @property int $price The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 100 to charge ¥100, Japanese Yen being a zero-decimal currency). + * @property string|\Stripe\Product $product The ID of the product this SKU is associated with. The product must be currently active. + * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. */ class SKU extends ApiResource { - - const OBJECT_NAME = "sku"; + const OBJECT_NAME = 'sku'; use ApiOperations\All; use ApiOperations\Create; diff --git a/plugins/stripe/lib/Service/AbstractService.php b/plugins/stripe/lib/Service/AbstractService.php new file mode 100644 index 0000000000..ed092c8b84 --- /dev/null +++ b/plugins/stripe/lib/Service/AbstractService.php @@ -0,0 +1,79 @@ +client = $client; + } + + /** + * Gets the client used by this service to send requests. + * + * @return \Stripe\StripeClientInterface + */ + public function getClient() + { + return $this->client; + } + + /** + * Translate null values to empty strings. For service methods, + * we interpret null as a request to unset the field, which + * corresponds to sending an empty string for the field to the + * API. + * + * @param null|array $params + */ + private static function formatParams($params) + { + if (null === $params) { + return null; + } + \array_walk_recursive($params, function (&$value, $key) { + if (null === $value) { + $value = ''; + } + }); + + return $params; + } + + protected function request($method, $path, $params, $opts) + { + return $this->getClient()->request($method, $path, static::formatParams($params), $opts); + } + + protected function requestCollection($method, $path, $params, $opts) + { + return $this->getClient()->requestCollection($method, $path, static::formatParams($params), $opts); + } + + protected function buildPath($basePath, ...$ids) + { + foreach ($ids as $id) { + if (null === $id || '' === \trim($id)) { + $msg = 'The resource ID cannot be null or whitespace.'; + + throw new \Stripe\Exception\InvalidArgumentException($msg); + } + } + + return \sprintf($basePath, ...\array_map('\urlencode', $ids)); + } +} diff --git a/plugins/stripe/lib/Service/AbstractServiceFactory.php b/plugins/stripe/lib/Service/AbstractServiceFactory.php new file mode 100644 index 0000000000..4aca686869 --- /dev/null +++ b/plugins/stripe/lib/Service/AbstractServiceFactory.php @@ -0,0 +1,59 @@ + */ + private $services; + + /** + * @param \Stripe\StripeClientInterface $client + */ + public function __construct($client) + { + $this->client = $client; + $this->services = []; + } + + /** + * @param string $name + * + * @return null|string + */ + abstract protected function getServiceClass($name); + + /** + * @param string $name + * + * @return null|AbstractService|AbstractServiceFactory + */ + public function __get($name) + { + $serviceClass = $this->getServiceClass($name); + if (null !== $serviceClass) { + if (!\array_key_exists($name, $this->services)) { + $this->services[$name] = new $serviceClass($this->client); + } + + return $this->services[$name]; + } + + \trigger_error('Undefined property: ' . static::class . '::$' . $name); + + return null; + } +} diff --git a/plugins/stripe/lib/Service/AccountLinkService.php b/plugins/stripe/lib/Service/AccountLinkService.php new file mode 100644 index 0000000000..2e90492397 --- /dev/null +++ b/plugins/stripe/lib/Service/AccountLinkService.php @@ -0,0 +1,25 @@ +request('post', '/v1/account_links', $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/AccountService.php b/plugins/stripe/lib/Service/AccountService.php new file mode 100644 index 0000000000..c731e475e0 --- /dev/null +++ b/plugins/stripe/lib/Service/AccountService.php @@ -0,0 +1,381 @@ +Connect. If you’re not a platform, the list is empty. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/accounts', $params, $opts); + } + + /** + * Returns a list of capabilities associated with the account. The capabilities are + * returned sorted by creation date, with the most recent capability appearing + * first. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allCapabilities($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/capabilities', $parentId), $params, $opts); + } + + /** + * List external accounts for an account. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allExternalAccounts($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts); + } + + /** + * Returns a list of people associated with the account’s legal entity. The people + * are returned sorted by creation date, with the most recent people appearing + * first. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allPersons($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts); + } + + /** + * With Connect, you can create Stripe accounts for + * your users. To do this, you’ll first need to register your + * platform. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Account + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/accounts', $params, $opts); + } + + /** + * Create an external account for a given account. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BankAccount|\Stripe\Card + */ + public function createExternalAccount($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts); + } + + /** + * Creates a single-use login link for an Express account to access their Stripe + * dashboard. + * + * You may only create login links for Express accounts connected to your + * platform. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\LoginLink + */ + public function createLoginLink($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/accounts/%s/login_links', $parentId), $params, $opts); + } + + /** + * Creates a new person. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Person + */ + public function createPerson($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts); + } + + /** + * With Connect, you can delete Custom or Express + * accounts you manage. + * + * Accounts created using test-mode keys can be deleted at any time. Accounts + * created using live-mode keys can only be deleted once all balances are zero. + * + * If you want to delete your own account, use the account information tab in your + * account settings 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\Account + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/accounts/%s', $id), $params, $opts); + } + + /** + * Delete a specified external account for a given account. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BankAccount|\Stripe\Card + */ + public function deleteExternalAccount($parentId, $id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts); + } + + /** + * Deletes an existing person’s relationship to the account’s legal entity. Any + * person with a relationship for an account can be deleted through the API, except + * if the person is the account_opener. If your integration is using + * the executive parameter, you cannot delete the only verified + * executive on file. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Person + */ + public function deletePerson($parentId, $id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts); + } + + /** + * With Connect, you may flag accounts as suspicious. + * + * Test-mode Custom and Express accounts can be rejected at any time. Accounts + * created using live-mode keys may only be rejected once all balances are zero. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Account + */ + public function reject($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/accounts/%s/reject', $id), $params, $opts); + } + + /** + * Retrieves information about the specified Account Capability. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Capability + */ + public function retrieveCapability($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts); + } + + /** + * Retrieve a specified external account for a given account. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BankAccount|\Stripe\Card + */ + public function retrieveExternalAccount($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts); + } + + /** + * Retrieves an existing person. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Person + */ + public function retrievePerson($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts); + } + + /** + * Updates a connected Express or Custom + * account by setting the values of the parameters passed. Any parameters not + * provided are left unchanged. Most parameters can be changed only for Custom + * accounts. (These are marked Custom Only below.) Parameters + * marked Custom and Express are supported by both account types. + * + * To update your own account, use the Dashboard. Refer to our Connect documentation to learn more + * about updating accounts. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Account + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/accounts/%s', $id), $params, $opts); + } + + /** + * Updates an existing Account Capability. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Capability + */ + public function updateCapability($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts); + } + + /** + * Updates the metadata, account holder name, and account holder type of a bank + * account belonging to a Custom + * account, and optionally sets it as the default for its currency. Other bank + * account details are not editable by design. + * + * You can re-enable a disabled bank account by performing an update call without + * providing any arguments or changes. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BankAccount|\Stripe\Card + */ + public function updateExternalAccount($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts); + } + + /** + * Updates an existing person. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Person + */ + public function updatePerson($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts); + } + + /** + * Retrieves the details of an account. + * + * @param null|string $id + * @param null|array $params + * @param null|array|StripeUtilRequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Account + */ + public function retrieve($id = null, $params = null, $opts = null) + { + if (null === $id) { + return $this->request('get', '/v1/account', $params, $opts); + } + + return $this->request('get', $this->buildPath('/v1/accounts/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/ApplePayDomainService.php b/plugins/stripe/lib/Service/ApplePayDomainService.php new file mode 100644 index 0000000000..6577b6b62a --- /dev/null +++ b/plugins/stripe/lib/Service/ApplePayDomainService.php @@ -0,0 +1,70 @@ +requestCollection('get', '/v1/apple_pay/domains', $params, $opts); + } + + /** + * Create an apple pay domain. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ApplePayDomain + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/apple_pay/domains', $params, $opts); + } + + /** + * Delete an apple pay domain. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ApplePayDomain + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts); + } + + /** + * Retrieve an apple pay domain. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ApplePayDomain + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/apple_pay/domains/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/ApplicationFeeService.php b/plugins/stripe/lib/Service/ApplicationFeeService.php new file mode 100644 index 0000000000..c05c3cd597 --- /dev/null +++ b/plugins/stripe/lib/Service/ApplicationFeeService.php @@ -0,0 +1,125 @@ +requestCollection('get', '/v1/application_fees', $params, $opts); + } + + /** + * You can see a list of the refunds belonging to a specific application fee. Note + * that the 10 most recent refunds are always available by default on the + * application fee object. If you need more than those 10, you can use this API + * method and the limit and starting_after parameters to + * page through additional refunds. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allRefunds($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts); + } + + /** + * Refunds an application fee that has previously been collected but not yet + * refunded. Funds will be refunded to the Stripe account from which the fee was + * originally collected. + * + * You can optionally refund only part of an application fee. You can do so + * multiple times, until the entire fee has been refunded. + * + * Once entirely refunded, an application fee can’t be refunded again. This method + * will raise an error when called on an already-refunded application fee, or when + * trying to refund more money than is left on an application fee. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ApplicationFeeRefund + */ + public function createRefund($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts); + } + + /** + * Retrieves the details of an application fee that your account has collected. The + * same information is returned when refunding the application fee. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ApplicationFee + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/application_fees/%s', $id), $params, $opts); + } + + /** + * By default, you can see the 10 most recent refunds stored directly on the + * application fee object, but you can also retrieve details about a specific + * refund stored on the application fee. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ApplicationFeeRefund + */ + public function retrieveRefund($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts); + } + + /** + * Updates the specified application fee refund by setting the values of the + * parameters passed. Any parameters not provided will be left unchanged. + * + * This request only accepts metadata as an argument. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ApplicationFeeRefund + */ + public function updateRefund($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/BalanceService.php b/plugins/stripe/lib/Service/BalanceService.php new file mode 100644 index 0000000000..0f55385f13 --- /dev/null +++ b/plugins/stripe/lib/Service/BalanceService.php @@ -0,0 +1,26 @@ +Accounting + * for negative balances. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Balance + */ + public function retrieve($params = null, $opts = null) + { + return $this->request('get', '/v1/balance', $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/BalanceTransactionService.php b/plugins/stripe/lib/Service/BalanceTransactionService.php new file mode 100644 index 0000000000..fb1da50182 --- /dev/null +++ b/plugins/stripe/lib/Service/BalanceTransactionService.php @@ -0,0 +1,47 @@ +/v1/balance/history. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/balance_transactions', $params, $opts); + } + + /** + * Retrieves the balance transaction with the given ID. + * + * Note that this endpoint previously used the path + * /v1/balance/history/:id. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BalanceTransaction + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/balance_transactions/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/BillingPortal/BillingPortalServiceFactory.php b/plugins/stripe/lib/Service/BillingPortal/BillingPortalServiceFactory.php new file mode 100644 index 0000000000..756ae17690 --- /dev/null +++ b/plugins/stripe/lib/Service/BillingPortal/BillingPortalServiceFactory.php @@ -0,0 +1,25 @@ + + */ + private static $classMap = [ + 'sessions' => SessionService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/plugins/stripe/lib/Service/BillingPortal/SessionService.php b/plugins/stripe/lib/Service/BillingPortal/SessionService.php new file mode 100644 index 0000000000..6b3e602639 --- /dev/null +++ b/plugins/stripe/lib/Service/BillingPortal/SessionService.php @@ -0,0 +1,23 @@ +request('post', '/v1/billing_portal/sessions', $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/ChargeService.php b/plugins/stripe/lib/Service/ChargeService.php new file mode 100644 index 0000000000..f5321b8ac9 --- /dev/null +++ b/plugins/stripe/lib/Service/ChargeService.php @@ -0,0 +1,101 @@ +requestCollection('get', '/v1/charges', $params, $opts); + } + + /** + * Capture the payment of an existing, uncaptured, charge. This is the second half + * of the two-step payment flow, where first you created a + * charge with the capture option set to false. + * + * Uncaptured payments expire exactly seven days after they are created. If they + * are not captured by that point in time, they will be marked as refunded and will + * no longer be capturable. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Charge + */ + public function capture($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/charges/%s/capture', $id), $params, $opts); + } + + /** + * To charge a credit card or other payment source, you create a + * Charge object. If your API key is in test mode, the supplied + * payment source (e.g., card) won’t actually be charged, although everything else + * will occur as if in live mode. (Stripe assumes that the charge would have + * completed successfully). + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Charge + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/charges', $params, $opts); + } + + /** + * Retrieves the details of a charge that has previously been created. Supply the + * unique charge ID that was returned from your previous request, and Stripe will + * return the corresponding charge information. The same information is returned + * when creating or refunding the charge. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Charge + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/charges/%s', $id), $params, $opts); + } + + /** + * Updates the specified charge by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Charge + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/charges/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Checkout/CheckoutServiceFactory.php b/plugins/stripe/lib/Service/Checkout/CheckoutServiceFactory.php new file mode 100644 index 0000000000..bb26a837f6 --- /dev/null +++ b/plugins/stripe/lib/Service/Checkout/CheckoutServiceFactory.php @@ -0,0 +1,25 @@ + + */ + private static $classMap = [ + 'sessions' => SessionService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/plugins/stripe/lib/Service/Checkout/SessionService.php b/plugins/stripe/lib/Service/Checkout/SessionService.php new file mode 100644 index 0000000000..9da3788784 --- /dev/null +++ b/plugins/stripe/lib/Service/Checkout/SessionService.php @@ -0,0 +1,73 @@ +requestCollection('get', '/v1/checkout/sessions', $params, $opts); + } + + /** + * When retrieving a Checkout Session, there is an includable + * line_items property containing the first handful of those + * items. There is also a URL where you can retrieve the full (paginated) list of + * line items. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allLineItems($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/checkout/sessions/%s/line_items', $parentId), $params, $opts); + } + + /** + * Creates a Session object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Checkout\Session + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/checkout/sessions', $params, $opts); + } + + /** + * Retrieves a Session 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\Checkout\Session + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/checkout/sessions/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/CoreServiceFactory.php b/plugins/stripe/lib/Service/CoreServiceFactory.php new file mode 100644 index 0000000000..e0109591d3 --- /dev/null +++ b/plugins/stripe/lib/Service/CoreServiceFactory.php @@ -0,0 +1,125 @@ + + */ + private static $classMap = [ + 'accountLinks' => AccountLinkService::class, + 'accounts' => AccountService::class, + 'applePayDomains' => ApplePayDomainService::class, + 'applicationFees' => ApplicationFeeService::class, + 'balance' => BalanceService::class, + 'balanceTransactions' => BalanceTransactionService::class, + 'billingPortal' => BillingPortal\BillingPortalServiceFactory::class, + 'charges' => ChargeService::class, + 'checkout' => Checkout\CheckoutServiceFactory::class, + 'countrySpecs' => CountrySpecService::class, + 'coupons' => CouponService::class, + 'creditNotes' => CreditNoteService::class, + 'customers' => CustomerService::class, + 'disputes' => DisputeService::class, + 'ephemeralKeys' => EphemeralKeyService::class, + 'events' => EventService::class, + 'exchangeRates' => ExchangeRateService::class, + 'fileLinks' => FileLinkService::class, + 'files' => FileService::class, + 'invoiceItems' => InvoiceItemService::class, + 'invoices' => InvoiceService::class, + 'issuing' => Issuing\IssuingServiceFactory::class, + 'mandates' => MandateService::class, + 'oauth' => OAuthService::class, + 'orderReturns' => OrderReturnService::class, + 'orders' => OrderService::class, + 'paymentIntents' => PaymentIntentService::class, + 'paymentMethods' => PaymentMethodService::class, + 'payouts' => PayoutService::class, + 'plans' => PlanService::class, + 'prices' => PriceService::class, + 'products' => ProductService::class, + 'promotionCodes' => PromotionCodeService::class, + 'radar' => Radar\RadarServiceFactory::class, + 'refunds' => RefundService::class, + 'reporting' => Reporting\ReportingServiceFactory::class, + 'reviews' => ReviewService::class, + 'setupAttempts' => SetupAttemptService::class, + 'setupIntents' => SetupIntentService::class, + 'sigma' => Sigma\SigmaServiceFactory::class, + 'skus' => SkuService::class, + 'sources' => SourceService::class, + 'subscriptionItems' => SubscriptionItemService::class, + 'subscriptions' => SubscriptionService::class, + 'subscriptionSchedules' => SubscriptionScheduleService::class, + 'taxRates' => TaxRateService::class, + 'terminal' => Terminal\TerminalServiceFactory::class, + 'tokens' => TokenService::class, + 'topups' => TopupService::class, + 'transfers' => TransferService::class, + 'webhookEndpoints' => WebhookEndpointService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/plugins/stripe/lib/Service/CountrySpecService.php b/plugins/stripe/lib/Service/CountrySpecService.php new file mode 100644 index 0000000000..573444fd3f --- /dev/null +++ b/plugins/stripe/lib/Service/CountrySpecService.php @@ -0,0 +1,39 @@ +requestCollection('get', '/v1/country_specs', $params, $opts); + } + + /** + * Returns a Country Spec for a given Country code. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CountrySpec + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/country_specs/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/CouponService.php b/plugins/stripe/lib/Service/CouponService.php new file mode 100644 index 0000000000..82a880f536 --- /dev/null +++ b/plugins/stripe/lib/Service/CouponService.php @@ -0,0 +1,104 @@ +requestCollection('get', '/v1/coupons', $params, $opts); + } + + /** + * You can create coupons easily via the coupon management page of the + * Stripe dashboard. Coupon creation is also accessible via the API if you need to + * create coupons on the fly. + * + * A coupon has either a percent_off or an amount_off and + * currency. If you set an amount_off, that amount will + * be subtracted from any invoice’s subtotal. For example, an invoice with a + * subtotal of 100 will have a final total of + * 0 if a coupon with an amount_off of + * 200 is applied to it and an invoice with a subtotal of + * 300 will have a final total of 100 if + * a coupon with an amount_off of 200 is applied to + * it. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Coupon + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/coupons', $params, $opts); + } + + /** + * You can delete coupons via the coupon management page of the + * Stripe dashboard. However, deleting a coupon does not affect any customers who + * have already applied the coupon; it means that new customers can’t redeem the + * coupon. You can also delete coupons via the API. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Coupon + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); + } + + /** + * Retrieves the coupon with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Coupon + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); + } + + /** + * Updates the metadata of a coupon. Other coupon details (currency, duration, + * amount_off) are, by design, not editable. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Coupon + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/coupons/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/CreditNoteService.php b/plugins/stripe/lib/Service/CreditNoteService.php new file mode 100644 index 0000000000..39807dc11a --- /dev/null +++ b/plugins/stripe/lib/Service/CreditNoteService.php @@ -0,0 +1,156 @@ +requestCollection('get', '/v1/credit_notes', $params, $opts); + } + + /** + * When retrieving a credit note, you’ll get a lines property + * containing the the first handful of those items. There is also a URL where you + * can retrieve the full (paginated) list of line items. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allLines($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/credit_notes/%s/lines', $parentId), $params, $opts); + } + + /** + * Issue a credit note to adjust the amount of a finalized invoice. For a + * status=open invoice, a credit note reduces its + * amount_due. For a status=paid invoice, a credit note + * does not affect its amount_due. Instead, it can result in any + * combination of the following:. + * + *
  • Refund: create a new refund (using refund_amount) or link + * an existing refund (using refund).
  • Customer balance + * credit: credit the customer’s balance (using credit_amount) which + * will be automatically applied to their next invoice when it’s finalized.
  • + *
  • Outside of Stripe credit: record the amount that is or will be credited + * outside of Stripe (using out_of_band_amount).
+ * + * For post-payment credit notes the sum of the refund, credit and outside of + * Stripe amounts must equal the credit note total. + * + * You may issue multiple credit notes for an invoice. Each credit note will + * increment the invoice’s pre_payment_credit_notes_amount or + * post_payment_credit_notes_amount depending on its + * status at the time of credit note creation. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CreditNote + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/credit_notes', $params, $opts); + } + + /** + * Get a preview of a credit note without creating it. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CreditNote + */ + public function preview($params = null, $opts = null) + { + return $this->request('get', '/v1/credit_notes/preview', $params, $opts); + } + + /** + * When retrieving a credit note preview, you’ll get a lines + * property containing the first handful of those items. This URL you can retrieve + * the full (paginated) list of line items. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CreditNote + */ + public function previewLines($params = null, $opts = null) + { + return $this->request('get', '/v1/credit_notes/preview/lines', $params, $opts); + } + + /** + * Retrieves the credit note object with the given identifier. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CreditNote + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/credit_notes/%s', $id), $params, $opts); + } + + /** + * Updates an existing credit note. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CreditNote + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/credit_notes/%s', $id), $params, $opts); + } + + /** + * Marks a credit note as void. Learn more about voiding credit notes. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CreditNote + */ + public function voidCreditNote($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/credit_notes/%s/void', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/CustomerService.php b/plugins/stripe/lib/Service/CustomerService.php new file mode 100644 index 0000000000..fdc6a59606 --- /dev/null +++ b/plugins/stripe/lib/Service/CustomerService.php @@ -0,0 +1,353 @@ +requestCollection('get', '/v1/customers', $params, $opts); + } + + /** + * Returns a list of transactions that updated the customer’s balances. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allBalanceTransactions($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); + } + + /** + * List sources for a specified customer. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allSources($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts); + } + + /** + * Returns a list of tax IDs for a customer. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allTaxIds($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts); + } + + /** + * Creates a new customer object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Customer + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/customers', $params, $opts); + } + + /** + * Creates an immutable transaction that updates the customer’s credit balance. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CustomerBalanceTransaction + */ + public function createBalanceTransaction($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions', $parentId), $params, $opts); + } + + /** + * When you create a new credit card, you must specify a customer or recipient on + * which to create it. + * + * If the card’s owner has no default card, then the new card will become the + * default. However, if the owner already has a default, then it will not change. + * To change the default, you should update the + * customer to have a new default_source. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source + */ + public function createSource($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/customers/%s/sources', $parentId), $params, $opts); + } + + /** + * Creates a new TaxID object for a customer. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxId + */ + public function createTaxId($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/customers/%s/tax_ids', $parentId), $params, $opts); + } + + /** + * Permanently deletes a customer. It cannot be undone. Also immediately cancels + * any active subscriptions on the customer. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Customer + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/customers/%s', $id), $params, $opts); + } + + /** + * Removes the currently applied discount on a customer. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Customer + */ + public function deleteDiscount($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/customers/%s/discount', $id), $params, $opts); + } + + /** + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source + */ + public function deleteSource($parentId, $id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); + } + + /** + * Deletes an existing TaxID object. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxId + */ + public function deleteTaxId($parentId, $id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts); + } + + /** + * Retrieves the details of an existing customer. You need only supply the unique + * customer identifier that was returned upon customer creation. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Customer + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/customers/%s', $id), $params, $opts); + } + + /** + * Retrieves a specific customer balance transaction that updated the customer’s balances. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CustomerBalanceTransaction + */ + public function retrieveBalanceTransaction($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts); + } + + /** + * Retrieve a specified source for a given customer. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source + */ + public function retrieveSource($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); + } + + /** + * Retrieves the TaxID object with the given identifier. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxId + */ + public function retrieveTaxId($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/customers/%s/tax_ids/%s', $parentId, $id), $params, $opts); + } + + /** + * Updates the specified customer by setting the values of the parameters passed. + * Any parameters not provided will be left unchanged. For example, if you pass the + * source parameter, that becomes the customer’s active source + * (e.g., a card) to be used for all charges in the future. When you update a + * customer to a new valid card source by passing the source + * parameter: for each of the customer’s current subscriptions, if the subscription + * bills automatically and is in the past_due state, then the latest + * open invoice for the subscription with automatic collection enabled will be + * retried. This retry will not count as an automatic retry, and will not affect + * the next regularly scheduled payment for the invoice. Changing the + * default_source for a customer will not trigger this behavior. + * + * This request accepts mostly the same arguments as the customer creation call. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Customer + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/customers/%s', $id), $params, $opts); + } + + /** + * Most credit balance transaction fields are immutable, but you may update its + * description and metadata. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\CustomerBalanceTransaction + */ + public function updateBalanceTransaction($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/customers/%s/balance_transactions/%s', $parentId, $id), $params, $opts); + } + + /** + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source + */ + public function updateSource($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); + } + + /** + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source + */ + public function verifySource($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/customers/%s/sources/%s/verify', $parentId, $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/DisputeService.php b/plugins/stripe/lib/Service/DisputeService.php new file mode 100644 index 0000000000..4eb1542bf4 --- /dev/null +++ b/plugins/stripe/lib/Service/DisputeService.php @@ -0,0 +1,83 @@ +requestCollection('get', '/v1/disputes', $params, $opts); + } + + /** + * Closing the dispute for a charge indicates that you do not have any evidence to + * submit and are essentially dismissing the dispute, acknowledging it as lost. + * + * The status of the dispute will change from needs_response to + * lost. Closing a dispute is irreversible. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Dispute + */ + public function close($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/disputes/%s/close', $id), $params, $opts); + } + + /** + * Retrieves the dispute with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Dispute + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/disputes/%s', $id), $params, $opts); + } + + /** + * When you get a dispute, contacting your customer is always the best first step. + * If that doesn’t work, you can submit evidence to help us resolve the dispute in + * your favor. You can do this in your dashboard, but if you prefer, + * you can use the API to submit evidence programmatically. + * + * Depending on your dispute type, different evidence fields will give you a better + * chance of winning your dispute. To figure out which evidence fields to provide, + * see our guide to dispute types. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Dispute + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/disputes/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/EphemeralKeyService.php b/plugins/stripe/lib/Service/EphemeralKeyService.php new file mode 100644 index 0000000000..3ca14c9047 --- /dev/null +++ b/plugins/stripe/lib/Service/EphemeralKeyService.php @@ -0,0 +1,43 @@ +request('delete', $this->buildPath('/v1/ephemeral_keys/%s', $id), $params, $opts); + } + + /** + * Creates a short-lived API key for a given resource. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\EphemeralKey + */ + public function create($params = null, $opts = null) + { + if (!$opts || !isset($opts['stripe_version'])) { + throw new \Stripe\Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key'); + } + + return $this->request('post', '/v1/ephemeral_keys', $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/EventService.php b/plugins/stripe/lib/Service/EventService.php new file mode 100644 index 0000000000..430b35abf7 --- /dev/null +++ b/plugins/stripe/lib/Service/EventService.php @@ -0,0 +1,44 @@ +event object api_version + * attribute (not according to your current Stripe API version or + * Stripe-Version header). + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/events', $params, $opts); + } + + /** + * Retrieves the details of an event. Supply the unique identifier of the event, + * which you might have received in a webhook. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Event + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/events/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/ExchangeRateService.php b/plugins/stripe/lib/Service/ExchangeRateService.php new file mode 100644 index 0000000000..fc78410c78 --- /dev/null +++ b/plugins/stripe/lib/Service/ExchangeRateService.php @@ -0,0 +1,41 @@ +requestCollection('get', '/v1/exchange_rates', $params, $opts); + } + + /** + * Retrieves the exchange rates from the given currency to every supported + * currency. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\ExchangeRate + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/exchange_rates/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/FileLinkService.php b/plugins/stripe/lib/Service/FileLinkService.php new file mode 100644 index 0000000000..7a3a435dd2 --- /dev/null +++ b/plugins/stripe/lib/Service/FileLinkService.php @@ -0,0 +1,70 @@ +requestCollection('get', '/v1/file_links', $params, $opts); + } + + /** + * Creates a new file link object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FileLink + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/file_links', $params, $opts); + } + + /** + * Retrieves the file link with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FileLink + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/file_links/%s', $id), $params, $opts); + } + + /** + * Updates an existing file link object. Expired links can no longer be updated. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\FileLink + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/file_links/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/FileService.php b/plugins/stripe/lib/Service/FileService.php new file mode 100644 index 0000000000..1484288496 --- /dev/null +++ b/plugins/stripe/lib/Service/FileService.php @@ -0,0 +1,66 @@ +requestCollection('get', '/v1/files', $params, $opts); + } + + /** + * Retrieves the details of an existing file object. Supply the unique file ID from + * a file, and Stripe will return the corresponding file object. To access file + * contents, see the File Upload + * Guide. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\File + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/files/%s', $id), $params, $opts); + } + + /** + * Create a file. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @return \Stripe\File + */ + public function create($params = null, $opts = null) + { + $opts = \Stripe\Util\RequestOptions::parse($opts); + if (!isset($opts->apiBase)) { + $opts->apiBase = $this->getClient()->getFilesBase(); + } + + // Manually flatten params, otherwise curl's multipart encoder will + // choke on nested null|arrays. + $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0); + + return $this->request('post', '/v1/files', $flatParams, $opts); + } +} diff --git a/plugins/stripe/lib/Service/InvoiceItemService.php b/plugins/stripe/lib/Service/InvoiceItemService.php new file mode 100644 index 0000000000..0f0b9e91f0 --- /dev/null +++ b/plugins/stripe/lib/Service/InvoiceItemService.php @@ -0,0 +1,93 @@ +requestCollection('get', '/v1/invoiceitems', $params, $opts); + } + + /** + * Creates an item to be added to a draft invoice (up to 250 items per invoice). If + * no invoice is specified, the item will be on the next invoice created for the + * customer specified. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceItem + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/invoiceitems', $params, $opts); + } + + /** + * Deletes an invoice item, removing it from an invoice. Deleting invoice items is + * only possible when they’re not attached to invoices, or if it’s attached to a + * draft invoice. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceItem + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts); + } + + /** + * Retrieves the invoice item with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceItem + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts); + } + + /** + * Updates the amount or description of an invoice item on an upcoming invoice. + * Updating an invoice item is only possible before the invoice it’s attached to is + * closed. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\InvoiceItem + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoiceitems/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/InvoiceService.php b/plugins/stripe/lib/Service/InvoiceService.php new file mode 100644 index 0000000000..f647b28f6c --- /dev/null +++ b/plugins/stripe/lib/Service/InvoiceService.php @@ -0,0 +1,272 @@ +requestCollection('get', '/v1/invoices', $params, $opts); + } + + /** + * When retrieving an invoice, you’ll get a lines property + * containing the total count of line items and the first handful of those items. + * There is also a URL where you can retrieve the full (paginated) list of line + * items. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allLines($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/invoices/%s/lines', $parentId), $params, $opts); + } + + /** + * This endpoint creates a draft invoice for a given customer. The draft invoice + * created pulls in all pending invoice items on that customer, including + * prorations. The invoice remains a draft until you finalize the invoice, which allows you to pay or send the invoice to + * your customers. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/invoices', $params, $opts); + } + + /** + * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to + * delete invoices that are no longer in a draft state will fail; once an invoice + * has been finalized or if an invoice is for a subscription, it must be voided. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/invoices/%s', $id), $params, $opts); + } + + /** + * Stripe automatically finalizes drafts before sending and attempting payment on + * invoices. However, if you’d like to finalize a draft invoice manually, you can + * do so using this method. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function finalizeInvoice($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoices/%s/finalize', $id), $params, $opts); + } + + /** + * Marking an invoice as uncollectible is useful for keeping track of bad debts + * that can be written off for accounting purposes. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function markUncollectible($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoices/%s/mark_uncollectible', $id), $params, $opts); + } + + /** + * Stripe automatically creates and then attempts to collect payment on invoices + * for customers on subscriptions according to your subscriptions + * settings. However, if you’d like to attempt payment on an invoice out of the + * normal collection schedule or for some other reason, you can do so. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function pay($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoices/%s/pay', $id), $params, $opts); + } + + /** + * Retrieves the invoice with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/invoices/%s', $id), $params, $opts); + } + + /** + * Stripe will automatically send invoices to customers according to your subscriptions + * settings. However, if you’d like to manually send an invoice to your + * customer out of the normal schedule, you can do so. When sending invoices that + * have already been paid, there will be no reference to the payment in the email. + * + * Requests made in test-mode result in no emails being sent, despite sending an + * invoice.sent event. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function sendInvoice($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoices/%s/send', $id), $params, $opts); + } + + /** + * At any time, you can preview the upcoming invoice for a customer. This will show + * you all the charges that are pending, including subscription renewal charges, + * invoice item charges, etc. It will also show you any discounts that are + * applicable to the invoice. + * + * Note that when you are viewing an upcoming invoice, you are simply viewing a + * preview – the invoice has not yet been created. As such, the upcoming invoice + * will not show up in invoice listing calls, and you cannot use the API to pay or + * edit the invoice. If you want to change the amount that your customer will be + * billed, you can add, remove, or update pending invoice items, or update the + * customer’s discount. + * + * You can preview the effects of updating a subscription, including a preview of + * what proration will take place. To ensure that the actual proration is + * calculated exactly the same as the previewed proration, you should pass a + * proration_date parameter when doing the actual subscription update. + * The value passed in should be the same as the + * subscription_proration_date returned on the upcoming invoice + * resource. The recommended way to get only the prorations being previewed is to + * consider only proration line items where period[start] is equal to + * the subscription_proration_date on the upcoming invoice resource. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function upcoming($params = null, $opts = null) + { + return $this->request('get', '/v1/invoices/upcoming', $params, $opts); + } + + /** + * When retrieving an upcoming invoice, you’ll get a lines + * property containing the total count of line items and the first handful of those + * items. There is also a URL where you can retrieve the full (paginated) list of + * line items. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function upcomingLines($params = null, $opts = null) + { + return $this->request('get', '/v1/invoices/upcoming/lines', $params, $opts); + } + + /** + * Draft invoices are fully editable. Once an invoice is finalized, monetary values, + * as well as collection_method, become uneditable. + * + * If you would like to stop the Stripe Billing engine from automatically + * finalizing, reattempting payments on, sending reminders for, or automatically reconciling + * invoices, pass auto_advance=false. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoices/%s', $id), $params, $opts); + } + + /** + * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is + * similar to deletion, however it only applies to + * finalized invoices and maintains a papertrail where the invoice can still be + * found. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Invoice + */ + public function voidInvoice($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/invoices/%s/void', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Issuing/AuthorizationService.php b/plugins/stripe/lib/Service/Issuing/AuthorizationService.php new file mode 100644 index 0000000000..6fff70e7e9 --- /dev/null +++ b/plugins/stripe/lib/Service/Issuing/AuthorizationService.php @@ -0,0 +1,97 @@ +Authorization objects. The objects are + * sorted in descending order by creation date, with the most recently created + * object appearing first. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/issuing/authorizations', $params, $opts); + } + + /** + * Approves a pending Issuing Authorization object. This request + * should be made within the timeout window of the real-time + * authorization flow. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Authorization + */ + public function approve($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s/approve', $id), $params, $opts); + } + + /** + * Declines a pending Issuing Authorization object. This request + * should be made within the timeout window of the real time + * authorization flow. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Authorization + */ + public function decline($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s/decline', $id), $params, $opts); + } + + /** + * Retrieves an Issuing Authorization 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\Issuing\Authorization + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/issuing/authorizations/%s', $id), $params, $opts); + } + + /** + * Updates the specified Issuing Authorization object by setting the + * values of the parameters passed. Any parameters not provided will be left + * unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Authorization + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/issuing/authorizations/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Issuing/CardService.php b/plugins/stripe/lib/Service/Issuing/CardService.php new file mode 100644 index 0000000000..346d54afae --- /dev/null +++ b/plugins/stripe/lib/Service/Issuing/CardService.php @@ -0,0 +1,73 @@ +Card objects. The objects are sorted in + * descending order by creation date, with the most recently created object + * appearing first. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/issuing/cards', $params, $opts); + } + + /** + * Creates an Issuing Card object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Card + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/issuing/cards', $params, $opts); + } + + /** + * Retrieves an Issuing Card 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\Issuing\Card + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts); + } + + /** + * Updates the specified Issuing Card object by setting the values of + * the parameters passed. Any parameters not provided will be left unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Card + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/issuing/cards/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Issuing/CardholderService.php b/plugins/stripe/lib/Service/Issuing/CardholderService.php new file mode 100644 index 0000000000..5731b1bf14 --- /dev/null +++ b/plugins/stripe/lib/Service/Issuing/CardholderService.php @@ -0,0 +1,74 @@ +Cardholder objects. The objects are + * sorted in descending order by creation date, with the most recently created + * object appearing first. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/issuing/cardholders', $params, $opts); + } + + /** + * Creates a new Issuing Cardholder object that can be issued cards. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Cardholder + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/issuing/cardholders', $params, $opts); + } + + /** + * Retrieves an Issuing Cardholder 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\Issuing\Cardholder + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts); + } + + /** + * Updates the specified Issuing Cardholder object by setting the + * values of the parameters passed. Any parameters not provided will be left + * unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Cardholder + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/issuing/cardholders/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Issuing/DisputeService.php b/plugins/stripe/lib/Service/Issuing/DisputeService.php new file mode 100644 index 0000000000..ab5df5f3e7 --- /dev/null +++ b/plugins/stripe/lib/Service/Issuing/DisputeService.php @@ -0,0 +1,99 @@ +Dispute objects. The objects are sorted + * in descending order by creation date, with the most recently created object + * appearing first. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/issuing/disputes', $params, $opts); + } + + /** + * Creates an Issuing Dispute object. Individual pieces of evidence + * within the evidence object are optional at this point. Stripe only + * validates that required evidence is present during submission. Refer to Dispute + * reasons and evidence for more details about evidence requirements. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Dispute + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/issuing/disputes', $params, $opts); + } + + /** + * Retrieves an Issuing Dispute 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\Issuing\Dispute + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts); + } + + /** + * Submits an Issuing Dispute to the card network. Stripe validates + * that all evidence fields required for the dispute’s reason are present. For more + * details, see Dispute + * reasons and evidence. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Dispute + */ + public function submit($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/issuing/disputes/%s/submit', $id), $params, $opts); + } + + /** + * Updates the specified Issuing Dispute object by setting the values + * of the parameters passed. Any parameters not provided will be left unchanged. + * Properties on the evidence object can be unset by passing in an + * empty string. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Dispute + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/issuing/disputes/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Issuing/IssuingServiceFactory.php b/plugins/stripe/lib/Service/Issuing/IssuingServiceFactory.php new file mode 100644 index 0000000000..a8d5d0f816 --- /dev/null +++ b/plugins/stripe/lib/Service/Issuing/IssuingServiceFactory.php @@ -0,0 +1,33 @@ + + */ + private static $classMap = [ + 'authorizations' => AuthorizationService::class, + 'cardholders' => CardholderService::class, + 'cards' => CardService::class, + 'disputes' => DisputeService::class, + 'transactions' => TransactionService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/plugins/stripe/lib/Service/Issuing/TransactionService.php b/plugins/stripe/lib/Service/Issuing/TransactionService.php new file mode 100644 index 0000000000..8fb0ee2ac6 --- /dev/null +++ b/plugins/stripe/lib/Service/Issuing/TransactionService.php @@ -0,0 +1,59 @@ +Transaction objects. The objects are + * sorted in descending order by creation date, with the most recently created + * object appearing first. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/issuing/transactions', $params, $opts); + } + + /** + * Retrieves an Issuing Transaction 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\Issuing\Transaction + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts); + } + + /** + * Updates the specified Issuing Transaction object by setting the + * values of the parameters passed. Any parameters not provided will be left + * unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Issuing\Transaction + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/issuing/transactions/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/MandateService.php b/plugins/stripe/lib/Service/MandateService.php new file mode 100644 index 0000000000..156bff0a02 --- /dev/null +++ b/plugins/stripe/lib/Service/MandateService.php @@ -0,0 +1,24 @@ +request('get', $this->buildPath('/v1/mandates/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/OAuthService.php b/plugins/stripe/lib/Service/OAuthService.php new file mode 100644 index 0000000000..b745ad9876 --- /dev/null +++ b/plugins/stripe/lib/Service/OAuthService.php @@ -0,0 +1,150 @@ +_parseOpts($opts); + $opts->apiBase = $this->_getBase($opts); + + return $this->request($method, $path, $params, $opts); + } + + /** + * Generates a URL to Stripe's OAuth form. + * + * @param null|array $params + * @param null|array $opts + * + * @return string the URL to Stripe's OAuth form + */ + public function authorizeUrl($params = null, $opts = null) + { + $params = $params ?: []; + + $opts = $this->_parseOpts($opts); + $base = $this->_getBase($opts); + + $params['client_id'] = $this->_getClientId($params); + if (!\array_key_exists('response_type', $params)) { + $params['response_type'] = 'code'; + } + $query = \Stripe\Util\Util::encodeParameters($params); + + return $base . '/oauth/authorize?' . $query; + } + + /** + * Use an authoriztion code to connect an account to your platform and + * fetch the user's credentials. + * + * @param null|array $params + * @param null|array $opts + * + * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails + * + * @return \Stripe\StripeObject object containing the response from the API + */ + public function token($params = null, $opts = null) + { + $params = $params ?: []; + $params['client_secret'] = $this->_getClientSecret($params); + + return $this->requestConnect('post', '/oauth/token', $params, $opts); + } + + /** + * Disconnects an account from your platform. + * + * @param null|array $params + * @param null|array $opts + * + * @throws \Stripe\Exception\OAuth\OAuthErrorException if the request fails + * + * @return \Stripe\StripeObject object containing the response from the API + */ + public function deauthorize($params = null, $opts = null) + { + $params = $params ?: []; + $params['client_id'] = $this->_getClientId($params); + + return $this->requestConnect('post', '/oauth/deauthorize', $params, $opts); + } + + private function _getClientId($params = null) + { + $clientId = ($params && \array_key_exists('client_id', $params)) ? $params['client_id'] : null; + + if (null === $clientId) { + $clientId = $this->client->getClientId(); + } + if (null === $clientId) { + $msg = 'No client_id provided. (HINT: set your client_id using ' + . '`new \Stripe\StripeClient([clientId => + ])`)". You can find your client_ids ' + . 'in your Stripe dashboard at ' + . 'https://dashboard.stripe.com/account/applications/settings, ' + . 'after registering your account as a platform. See ' + . 'https://stripe.com/docs/connect/standard-accounts for details, ' + . 'or email support@stripe.com if you have any questions.'; + + throw new \Stripe\Exception\AuthenticationException($msg); + } + + return $clientId; + } + + private function _getClientSecret($params = null) + { + if (\array_key_exists('client_secret', $params)) { + return $params['client_secret']; + } + + return $this->client->getApiKey(); + } + + /** + * @param array|\Stripe\Util\RequestOptions $opts the special modifiers of the request + * + * @throws \Stripe\Exception\InvalidArgumentException + * + * @return \Stripe\Util\RequestOptions + */ + private function _parseOpts($opts) + { + if (\is_array($opts)) { + if (\array_key_exists('connect_base', $opts)) { + // Throw an exception for the convenience of anybody migrating to + // \Stripe\Service\OAuthService from \Stripe\OAuth, where `connect_base` + // was the name of the parameter that behaves as `api_base` does here. + throw new \Stripe\Exception\InvalidArgumentException('Use `api_base`, not `connect_base`'); + } + } + + return \Stripe\Util\RequestOptions::parse($opts); + } + + /** + * @param \Stripe\Util\RequestOptions $opts + * + * @return string + */ + private function _getBase($opts) + { + return isset($opts->apiBase) ? + $opts->apiBase : + $this->client->getConnectBase(); + } +} diff --git a/plugins/stripe/lib/Service/OrderReturnService.php b/plugins/stripe/lib/Service/OrderReturnService.php new file mode 100644 index 0000000000..6183166c52 --- /dev/null +++ b/plugins/stripe/lib/Service/OrderReturnService.php @@ -0,0 +1,42 @@ +requestCollection('get', '/v1/order_returns', $params, $opts); + } + + /** + * Retrieves the details of an existing order return. Supply the unique order ID + * from either an order return creation request or the order return list, and + * Stripe will return the corresponding order information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\OrderReturn + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/order_returns/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/OrderService.php b/plugins/stripe/lib/Service/OrderService.php new file mode 100644 index 0000000000..fa658fa7ba --- /dev/null +++ b/plugins/stripe/lib/Service/OrderService.php @@ -0,0 +1,109 @@ +requestCollection('get', '/v1/orders', $params, $opts); + } + + /** + * Creates a new order object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Order + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/orders', $params, $opts); + } + + /** + * Pay an order by providing a source to create a payment. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Order + */ + public function pay($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/orders/%s/pay', $id), $params, $opts); + } + + /** + * Retrieves the details of an existing order. Supply the unique order ID from + * either an order creation request or the order list, and Stripe will return the + * corresponding order information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Order + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/orders/%s', $id), $params, $opts); + } + + /** + * Return all or part of an order. The order must have a status of + * paid or fulfilled before it can be returned. Once all + * items have been returned, the order will become canceled or + * returned depending on which status the order started in. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Order + */ + public function returnOrder($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/orders/%s/returns', $id), $params, $opts); + } + + /** + * Updates the specific order by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Order + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/orders/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/PaymentIntentService.php b/plugins/stripe/lib/Service/PaymentIntentService.php new file mode 100644 index 0000000000..43aba46d85 --- /dev/null +++ b/plugins/stripe/lib/Service/PaymentIntentService.php @@ -0,0 +1,181 @@ +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); + } +} diff --git a/plugins/stripe/lib/Service/PaymentMethodService.php b/plugins/stripe/lib/Service/PaymentMethodService.php new file mode 100644 index 0000000000..7111b9ebc4 --- /dev/null +++ b/plugins/stripe/lib/Service/PaymentMethodService.php @@ -0,0 +1,121 @@ +requestCollection('get', '/v1/payment_methods', $params, $opts); + } + + /** + * Attaches a PaymentMethod object to a Customer. + * + * To attach a new PaymentMethod to a customer for future payments, we recommend + * you use a SetupIntent or a PaymentIntent + * with setup_future_usage. + * These approaches will perform any necessary steps to ensure that the + * PaymentMethod can be used in a future payment. Using the + * /v1/payment_methods/:id/attach endpoint does not ensure that future + * payments can be made with the attached PaymentMethod. See Optimizing cards for future + * payments for more information about setting up future payments. + * + * To use this PaymentMethod as the default for invoice or subscription payments, + * set invoice_settings.default_payment_method, + * on the Customer to the PaymentMethod’s ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PaymentMethod + */ + public function attach($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_methods/%s/attach', $id), $params, $opts); + } + + /** + * Creates a PaymentMethod object. Read the Stripe.js + * reference to learn how to create PaymentMethods via Stripe.js. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PaymentMethod + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/payment_methods', $params, $opts); + } + + /** + * Detaches a PaymentMethod object from a Customer. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PaymentMethod + */ + public function detach($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_methods/%s/detach', $id), $params, $opts); + } + + /** + * Retrieves a PaymentMethod 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\PaymentMethod + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/payment_methods/%s', $id), $params, $opts); + } + + /** + * Updates a PaymentMethod object. A PaymentMethod must be attached a customer to + * be updated. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PaymentMethod + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payment_methods/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/PayoutService.php b/plugins/stripe/lib/Service/PayoutService.php new file mode 100644 index 0000000000..547e22da6a --- /dev/null +++ b/plugins/stripe/lib/Service/PayoutService.php @@ -0,0 +1,127 @@ +requestCollection('get', '/v1/payouts', $params, $opts); + } + + /** + * A previously created payout can be canceled if it has not yet been paid out. + * Funds will be refunded to your available balance. You may not cancel automatic + * Stripe payouts. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Payout + */ + public function cancel($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payouts/%s/cancel', $id), $params, $opts); + } + + /** + * To send funds to your own bank account, you create a new payout object. Your Stripe balance must be able to cover the payout amount, or + * you’ll receive an “Insufficient Funds” error. + * + * If your API key is in test mode, money won’t actually be sent, though everything + * else will occur as if in live mode. + * + * If you are creating a manual payout on a Stripe account that uses multiple + * payment source types, you’ll need to specify the source type balance that the + * payout should draw from. The balance object + * details available and pending amounts by source type. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Payout + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/payouts', $params, $opts); + } + + /** + * Retrieves the details of an existing payout. Supply the unique payout ID from + * either a payout creation request or the payout list, and Stripe will return the + * corresponding payout information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Payout + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/payouts/%s', $id), $params, $opts); + } + + /** + * Reverses a payout by debiting the destination bank account. Only payouts for + * connected accounts to US bank accounts may be reversed at this time. If the + * payout is in the pending status, + * /v1/payouts/:id/cancel should be used instead. + * + * By requesting a reversal via /v1/payouts/:id/reverse, you confirm + * that the authorized signatory of the selected bank account has authorized the + * debit on the bank account and that no other authorization is required. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Payout + */ + public function reverse($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payouts/%s/reverse', $id), $params, $opts); + } + + /** + * Updates the specified payout by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. This request accepts only the + * metadata as arguments. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Payout + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/payouts/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/PlanService.php b/plugins/stripe/lib/Service/PlanService.php new file mode 100644 index 0000000000..16625d27a9 --- /dev/null +++ b/plugins/stripe/lib/Service/PlanService.php @@ -0,0 +1,91 @@ +requestCollection('get', '/v1/plans', $params, $opts); + } + + /** + * You can now model subscriptions more flexibly using the Prices + * API. It replaces the Plans API and is backwards compatible to simplify your + * migration. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Plan + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/plans', $params, $opts); + } + + /** + * Deleting plans means new subscribers can’t be added. Existing subscribers aren’t + * affected. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Plan + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/plans/%s', $id), $params, $opts); + } + + /** + * Retrieves the plan with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Plan + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/plans/%s', $id), $params, $opts); + } + + /** + * Updates the specified plan by setting the values of the parameters passed. Any + * parameters not provided are left unchanged. By design, you cannot change a + * plan’s ID, amount, currency, or billing cycle. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Plan + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/plans/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/PriceService.php b/plugins/stripe/lib/Service/PriceService.php new file mode 100644 index 0000000000..cc44f69c94 --- /dev/null +++ b/plugins/stripe/lib/Service/PriceService.php @@ -0,0 +1,72 @@ +requestCollection('get', '/v1/prices', $params, $opts); + } + + /** + * Creates a new price for an existing product. The price can be recurring or + * one-time. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Price + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/prices', $params, $opts); + } + + /** + * Retrieves the price with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Price + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/prices/%s', $id), $params, $opts); + } + + /** + * Updates the specified price by setting the values of the parameters passed. Any + * parameters not provided are left unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Price + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/prices/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/ProductService.php b/plugins/stripe/lib/Service/ProductService.php new file mode 100644 index 0000000000..850cea56f7 --- /dev/null +++ b/plugins/stripe/lib/Service/ProductService.php @@ -0,0 +1,92 @@ +requestCollection('get', '/v1/products', $params, $opts); + } + + /** + * Creates a new product object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Product + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/products', $params, $opts); + } + + /** + * Delete a product. Deleting a product is only possible if it has no prices + * associated with it. Additionally, deleting a product with type=good + * is only possible if it has no SKUs associated with it. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Product + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/products/%s', $id), $params, $opts); + } + + /** + * Retrieves the details of an existing product. Supply the unique product ID from + * either a product creation request or the product list, and Stripe will return + * the corresponding product information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Product + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/products/%s', $id), $params, $opts); + } + + /** + * Updates the specific product by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Product + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/products/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/PromotionCodeService.php b/plugins/stripe/lib/Service/PromotionCodeService.php new file mode 100644 index 0000000000..1de5696da4 --- /dev/null +++ b/plugins/stripe/lib/Service/PromotionCodeService.php @@ -0,0 +1,72 @@ +requestCollection('get', '/v1/promotion_codes', $params, $opts); + } + + /** + * A promotion code points to a coupon. You can optionally restrict the code to a + * specific customer, redemption limit, and expiration date. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PromotionCode + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/promotion_codes', $params, $opts); + } + + /** + * Retrieves the promotion code with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PromotionCode + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts); + } + + /** + * Updates the specified promotion code by setting the values of the parameters + * passed. Most fields are, by design, not editable. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\PromotionCode + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/promotion_codes/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Radar/EarlyFraudWarningService.php b/plugins/stripe/lib/Service/Radar/EarlyFraudWarningService.php new file mode 100644 index 0000000000..7b09734838 --- /dev/null +++ b/plugins/stripe/lib/Service/Radar/EarlyFraudWarningService.php @@ -0,0 +1,43 @@ +requestCollection('get', '/v1/radar/early_fraud_warnings', $params, $opts); + } + + /** + * Retrieves the details of an early fraud warning that has previously been + * created. + * + * Please refer to the early fraud + * warning 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\Radar\EarlyFraudWarning + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/radar/early_fraud_warnings/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Radar/RadarServiceFactory.php b/plugins/stripe/lib/Service/Radar/RadarServiceFactory.php new file mode 100644 index 0000000000..b093c67174 --- /dev/null +++ b/plugins/stripe/lib/Service/Radar/RadarServiceFactory.php @@ -0,0 +1,29 @@ + + */ + private static $classMap = [ + 'earlyFraudWarnings' => EarlyFraudWarningService::class, + 'valueListItems' => ValueListItemService::class, + 'valueLists' => ValueListService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/plugins/stripe/lib/Service/Radar/ValueListItemService.php b/plugins/stripe/lib/Service/Radar/ValueListItemService.php new file mode 100644 index 0000000000..89eba2a7a8 --- /dev/null +++ b/plugins/stripe/lib/Service/Radar/ValueListItemService.php @@ -0,0 +1,74 @@ +ValueListItem objects. The objects are sorted in + * descending order by creation date, with the most recently created object + * appearing first. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/radar/value_list_items', $params, $opts); + } + + /** + * Creates a new ValueListItem object, which is added to the specified + * parent value list. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Radar\ValueListItem + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/radar/value_list_items', $params, $opts); + } + + /** + * Deletes a ValueListItem object, removing it from its parent value + * list. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Radar\ValueListItem + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts); + } + + /** + * Retrieves a ValueListItem 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\Radar\ValueListItem + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/radar/value_list_items/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Radar/ValueListService.php b/plugins/stripe/lib/Service/Radar/ValueListService.php new file mode 100644 index 0000000000..64ac2ee790 --- /dev/null +++ b/plugins/stripe/lib/Service/Radar/ValueListService.php @@ -0,0 +1,93 @@ +ValueList objects. The objects are sorted in + * descending order by creation date, with the most recently created object + * appearing first. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/radar/value_lists', $params, $opts); + } + + /** + * Creates a new ValueList object, which can then be referenced in + * rules. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Radar\ValueList + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/radar/value_lists', $params, $opts); + } + + /** + * Deletes a ValueList object, also deleting any items contained + * within the value list. To be deleted, a value list must not be referenced in any + * rules. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Radar\ValueList + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts); + } + + /** + * Retrieves a ValueList 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\Radar\ValueList + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts); + } + + /** + * Updates a ValueList object by setting the values of the parameters + * passed. Any parameters not provided will be left unchanged. Note that + * item_type is immutable. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Radar\ValueList + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/radar/value_lists/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/RefundService.php b/plugins/stripe/lib/Service/RefundService.php new file mode 100644 index 0000000000..49b4267e40 --- /dev/null +++ b/plugins/stripe/lib/Service/RefundService.php @@ -0,0 +1,76 @@ +requestCollection('get', '/v1/refunds', $params, $opts); + } + + /** + * Create a refund. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Refund + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/refunds', $params, $opts); + } + + /** + * Retrieves the details of an existing refund. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Refund + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/refunds/%s', $id), $params, $opts); + } + + /** + * Updates the specified refund by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + * + * This request only accepts metadata as an argument. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Refund + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/refunds/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Reporting/ReportRunService.php b/plugins/stripe/lib/Service/Reporting/ReportRunService.php new file mode 100644 index 0000000000..46e2139a2b --- /dev/null +++ b/plugins/stripe/lib/Service/Reporting/ReportRunService.php @@ -0,0 +1,57 @@ +live-mode API key.). + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/reporting/report_runs', $params, $opts); + } + + /** + * Creates a new object and begin running the report. (Requires a live-mode API key.). + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Reporting\ReportRun + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/reporting/report_runs', $params, $opts); + } + + /** + * Retrieves the details of an existing Report Run. (Requires a live-mode API key.). + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Reporting\ReportRun + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/reporting/report_runs/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Reporting/ReportTypeService.php b/plugins/stripe/lib/Service/Reporting/ReportTypeService.php new file mode 100644 index 0000000000..46f6bf83e1 --- /dev/null +++ b/plugins/stripe/lib/Service/Reporting/ReportTypeService.php @@ -0,0 +1,41 @@ +live-mode API key.). + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/reporting/report_types', $params, $opts); + } + + /** + * Retrieves the details of a Report Type. (Requires a live-mode API key.). + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Reporting\ReportType + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/reporting/report_types/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Reporting/ReportingServiceFactory.php b/plugins/stripe/lib/Service/Reporting/ReportingServiceFactory.php new file mode 100644 index 0000000000..7832e91752 --- /dev/null +++ b/plugins/stripe/lib/Service/Reporting/ReportingServiceFactory.php @@ -0,0 +1,27 @@ + + */ + private static $classMap = [ + 'reportRuns' => ReportRunService::class, + 'reportTypes' => ReportTypeService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/plugins/stripe/lib/Service/ReviewService.php b/plugins/stripe/lib/Service/ReviewService.php new file mode 100644 index 0000000000..ea152f23e8 --- /dev/null +++ b/plugins/stripe/lib/Service/ReviewService.php @@ -0,0 +1,58 @@ +Review objects that have open set to + * true. The objects are sorted in descending order by creation date, + * with the most recently created object appearing first. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/reviews', $params, $opts); + } + + /** + * Approves a Review object, closing it and removing it from the list + * of reviews. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Review + */ + public function approve($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/reviews/%s/approve', $id), $params, $opts); + } + + /** + * Retrieves a Review 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\Review + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/reviews/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/SetupAttemptService.php b/plugins/stripe/lib/Service/SetupAttemptService.php new file mode 100644 index 0000000000..7376ea13e7 --- /dev/null +++ b/plugins/stripe/lib/Service/SetupAttemptService.php @@ -0,0 +1,23 @@ +requestCollection('get', '/v1/setup_attempts', $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/SetupIntentService.php b/plugins/stripe/lib/Service/SetupIntentService.php new file mode 100644 index 0000000000..3cbec506f6 --- /dev/null +++ b/plugins/stripe/lib/Service/SetupIntentService.php @@ -0,0 +1,127 @@ +requestCollection('get', '/v1/setup_intents', $params, $opts); + } + + /** + * A SetupIntent object can be canceled when it is in one of these statuses: + * requires_payment_method, requires_confirmation, or + * requires_action. + * + * Once canceled, setup is abandoned and any operations on the SetupIntent will + * fail with an error. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SetupIntent + */ + public function cancel($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/setup_intents/%s/cancel', $id), $params, $opts); + } + + /** + * Confirm that your customer intends to set up the current or provided payment + * method. For example, you would confirm a SetupIntent when a customer hits the + * “Save” button on a payment method management page on your website. + * + * If the selected payment method does not require any additional steps from the + * customer, the SetupIntent will transition to the succeeded status. + * + * Otherwise, it will transition to the requires_action status and + * suggest additional actions via next_action. If setup fails, the + * SetupIntent will transition to the requires_payment_method status. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SetupIntent + */ + public function confirm($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/setup_intents/%s/confirm', $id), $params, $opts); + } + + /** + * Creates a SetupIntent object. + * + * After the SetupIntent is created, attach a payment method and confirm to collect any required + * permissions to charge the payment method later. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SetupIntent + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/setup_intents', $params, $opts); + } + + /** + * Retrieves the details of a SetupIntent 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 SetupIntent + * 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\SetupIntent + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/setup_intents/%s', $id), $params, $opts); + } + + /** + * Updates a SetupIntent 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\SetupIntent + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/setup_intents/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Sigma/ScheduledQueryRunService.php b/plugins/stripe/lib/Service/Sigma/ScheduledQueryRunService.php new file mode 100644 index 0000000000..92641751bc --- /dev/null +++ b/plugins/stripe/lib/Service/Sigma/ScheduledQueryRunService.php @@ -0,0 +1,39 @@ +requestCollection('get', '/v1/sigma/scheduled_query_runs', $params, $opts); + } + + /** + * Retrieves the details of an scheduled query run. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Sigma\ScheduledQueryRun + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/sigma/scheduled_query_runs/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Sigma/SigmaServiceFactory.php b/plugins/stripe/lib/Service/Sigma/SigmaServiceFactory.php new file mode 100644 index 0000000000..356750f477 --- /dev/null +++ b/plugins/stripe/lib/Service/Sigma/SigmaServiceFactory.php @@ -0,0 +1,25 @@ + + */ + private static $classMap = [ + 'scheduledQueryRuns' => ScheduledQueryRunService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/plugins/stripe/lib/Service/SkuService.php b/plugins/stripe/lib/Service/SkuService.php new file mode 100644 index 0000000000..8934f20644 --- /dev/null +++ b/plugins/stripe/lib/Service/SkuService.php @@ -0,0 +1,95 @@ +requestCollection('get', '/v1/skus', $params, $opts); + } + + /** + * Creates a new SKU associated with a product. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SKU + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/skus', $params, $opts); + } + + /** + * Delete a SKU. Deleting a SKU is only possible until it has been used in an + * order. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SKU + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/skus/%s', $id), $params, $opts); + } + + /** + * Retrieves the details of an existing SKU. Supply the unique SKU identifier from + * either a SKU creation request or from the product, and Stripe will return the + * corresponding SKU information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SKU + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/skus/%s', $id), $params, $opts); + } + + /** + * Updates the specific SKU by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + * + * Note that a SKU’s attributes are not editable. Instead, you would + * need to deactivate the existing SKU and create a new one with the new attribute + * values. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SKU + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/skus/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/SourceService.php b/plugins/stripe/lib/Service/SourceService.php new file mode 100644 index 0000000000..c6cc059646 --- /dev/null +++ b/plugins/stripe/lib/Service/SourceService.php @@ -0,0 +1,110 @@ +request('get', $this->buildPath('/v1/sources/%s/source_transactions', $id), $params, $opts); + } + + /** + * Creates a new source object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Source + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/sources', $params, $opts); + } + + /** + * Delete a specified source for a given customer. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Source + */ + public function detach($parentId, $id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts); + } + + /** + * Retrieves an existing source object. Supply the unique source ID from a source + * creation request and Stripe will return the corresponding up-to-date source + * object information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Source + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/sources/%s', $id), $params, $opts); + } + + /** + * Updates the specified source by setting the values of the parameters passed. Any + * parameters not provided will be left unchanged. + * + * This request accepts the metadata and owner as + * arguments. It is also possible to update type specific information for selected + * payment methods. Please refer to our payment method + * guides for more detail. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Source + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/sources/%s', $id), $params, $opts); + } + + /** + * Verify a given source. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Source + */ + public function verify($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/sources/%s/verify', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/SubscriptionItemService.php b/plugins/stripe/lib/Service/SubscriptionItemService.php new file mode 100644 index 0000000000..3b2aa2b126 --- /dev/null +++ b/plugins/stripe/lib/Service/SubscriptionItemService.php @@ -0,0 +1,151 @@ +requestCollection('get', '/v1/subscription_items', $params, $opts); + } + + /** + * For the specified subscription item, returns a list of summary objects. Each + * object in the list provides usage information that’s been summarized from + * multiple usage records and over a subscription billing period (e.g., 15 usage + * records in the month of September). + * + * The list is sorted in reverse-chronological order (newest first). The first list + * item represents the most current usage period that hasn’t ended yet. Since new + * usage records can still be added, the returned summary information for the + * subscription item’s ID should be seen as unstable until the subscription billing + * period ends. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allUsageRecordSummaries($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/subscription_items/%s/usage_record_summaries', $parentId), $params, $opts); + } + + /** + * Adds a new item to an existing subscription. No existing items will be changed + * or replaced. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionItem + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/subscription_items', $params, $opts); + } + + /** + * Creates a usage record for a specified subscription item and date, and fills it + * with a quantity. + * + * Usage records provide quantity information that Stripe uses to + * track how much a customer is using your service. With usage information and the + * pricing model set up by the metered + * billing plan, Stripe helps you send accurate invoices to your customers. + * + * The default calculation for usage is to add up all the quantity + * values of the usage records within a billing period. You can change this default + * behavior with the billing plan’s aggregate_usage parameter. When + * there is more than one usage record with the same timestamp, Stripe adds the + * quantity values together. In most cases, this is the desired + * resolution, however, you can change this behavior with the action + * parameter. + * + * The default pricing model for metered billing is per-unit pricing. + * For finer granularity, you can configure metered billing to have a tiered pricing + * model. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\UsageRecord + */ + public function createUsageRecord($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/subscription_items/%s/usage_records', $parentId), $params, $opts); + } + + /** + * Deletes an item from the subscription. Removing a subscription item from a + * subscription will not cancel the subscription. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionItem + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts); + } + + /** + * Retrieves the subscription item with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionItem + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts); + } + + /** + * Updates the plan or quantity of an item on a current subscription. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionItem + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/subscription_items/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/SubscriptionScheduleService.php b/plugins/stripe/lib/Service/SubscriptionScheduleService.php new file mode 100644 index 0000000000..9eed460604 --- /dev/null +++ b/plugins/stripe/lib/Service/SubscriptionScheduleService.php @@ -0,0 +1,113 @@ +requestCollection('get', '/v1/subscription_schedules', $params, $opts); + } + + /** + * Cancels a subscription schedule and its associated subscription immediately (if + * the subscription schedule has an active subscription). A subscription schedule + * can only be canceled if its status is not_started or + * active. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionSchedule + */ + public function cancel($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/cancel', $id), $params, $opts); + } + + /** + * Creates a new subscription schedule object. Each customer can have up to 500 + * active or scheduled subscriptions. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionSchedule + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/subscription_schedules', $params, $opts); + } + + /** + * Releases the subscription schedule immediately, which will stop scheduling of + * its phases, but leave any existing subscription in place. A schedule can only be + * released if its status is not_started or active. If + * the subscription schedule is currently associated with a subscription, releasing + * it will remove its subscription property and set the subscription’s + * ID to the released_subscription property. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionSchedule + */ + public function release($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/release', $id), $params, $opts); + } + + /** + * Retrieves the details of an existing subscription schedule. You only need to + * supply the unique subscription schedule identifier that was returned upon + * subscription schedule creation. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionSchedule + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts); + } + + /** + * Updates an existing subscription schedule. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\SubscriptionSchedule + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/SubscriptionService.php b/plugins/stripe/lib/Service/SubscriptionService.php new file mode 100644 index 0000000000..f3ac768c89 --- /dev/null +++ b/plugins/stripe/lib/Service/SubscriptionService.php @@ -0,0 +1,124 @@ +status=canceled. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/subscriptions', $params, $opts); + } + + /** + * Cancels a customer’s subscription immediately. The customer will not be charged + * again for the subscription. + * + * Note, however, that any pending invoice items that you’ve created will still be + * charged for at the end of the period, unless manually deleted. If you’ve set the subscription to cancel + * at the end of the period, any pending prorations will also be left in place and + * collected at the end of the period. But if the subscription is set to cancel + * immediately, pending prorations will be removed. + * + * By default, upon subscription cancellation, Stripe will stop automatic + * collection of all finalized invoices for the customer. This is intended to + * prevent unexpected payment attempts after the customer has canceled a + * subscription. However, you can resume automatic collection of the invoices + * manually after subscription cancellation to have us proceed. Or, you could check + * for unpaid invoices before allowing the customer to cancel the subscription at + * all. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Subscription + */ + public function cancel($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts); + } + + /** + * Creates a new subscription on an existing customer. Each customer can have up to + * 500 active or scheduled subscriptions. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Subscription + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/subscriptions', $params, $opts); + } + + /** + * Removes the currently applied discount on a subscription. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Subscription + */ + public function deleteDiscount($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/subscriptions/%s/discount', $id), $params, $opts); + } + + /** + * Retrieves the subscription with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Subscription + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts); + } + + /** + * Updates an existing subscription on a customer to match the specified + * parameters. When changing plans or quantities, we will optionally prorate the + * price we charge next month to make up for any price changes. To preview how the + * proration will be calculated, use the upcoming + * invoice endpoint. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Subscription + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/subscriptions/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/TaxRateService.php b/plugins/stripe/lib/Service/TaxRateService.php new file mode 100644 index 0000000000..7cee1fead7 --- /dev/null +++ b/plugins/stripe/lib/Service/TaxRateService.php @@ -0,0 +1,71 @@ +requestCollection('get', '/v1/tax_rates', $params, $opts); + } + + /** + * Creates a new tax rate. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxRate + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/tax_rates', $params, $opts); + } + + /** + * Retrieves a tax rate with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxRate + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts); + } + + /** + * Updates an existing tax rate. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TaxRate + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/tax_rates/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Terminal/ConnectionTokenService.php b/plugins/stripe/lib/Service/Terminal/ConnectionTokenService.php new file mode 100644 index 0000000000..7b25b2315a --- /dev/null +++ b/plugins/stripe/lib/Service/Terminal/ConnectionTokenService.php @@ -0,0 +1,25 @@ +request('post', '/v1/terminal/connection_tokens', $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Terminal/LocationService.php b/plugins/stripe/lib/Service/Terminal/LocationService.php new file mode 100644 index 0000000000..8adc7a520d --- /dev/null +++ b/plugins/stripe/lib/Service/Terminal/LocationService.php @@ -0,0 +1,87 @@ +Location objects. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/terminal/locations', $params, $opts); + } + + /** + * Creates a new Location object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Terminal\Location + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/terminal/locations', $params, $opts); + } + + /** + * Deletes a Location 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\Terminal\Location + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts); + } + + /** + * Retrieves a Location 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\Terminal\Location + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts); + } + + /** + * Updates a Location object by setting the values of the parameters + * passed. Any parameters not provided will be left unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Terminal\Location + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/terminal/locations/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Terminal/ReaderService.php b/plugins/stripe/lib/Service/Terminal/ReaderService.php new file mode 100644 index 0000000000..765015c835 --- /dev/null +++ b/plugins/stripe/lib/Service/Terminal/ReaderService.php @@ -0,0 +1,87 @@ +Reader objects. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/terminal/readers', $params, $opts); + } + + /** + * Creates a new Reader object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Terminal\Reader + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/terminal/readers', $params, $opts); + } + + /** + * Deletes a Reader 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\Terminal\Reader + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts); + } + + /** + * Retrieves a Reader 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\Terminal\Reader + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts); + } + + /** + * Updates a Reader object by setting the values of the parameters + * passed. Any parameters not provided will be left unchanged. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Terminal\Reader + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/terminal/readers/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/Terminal/TerminalServiceFactory.php b/plugins/stripe/lib/Service/Terminal/TerminalServiceFactory.php new file mode 100644 index 0000000000..c70ac873bc --- /dev/null +++ b/plugins/stripe/lib/Service/Terminal/TerminalServiceFactory.php @@ -0,0 +1,29 @@ + + */ + private static $classMap = [ + 'connectionTokens' => ConnectionTokenService::class, + 'locations' => LocationService::class, + 'readers' => ReaderService::class, + ]; + + protected function getServiceClass($name) + { + return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; + } +} diff --git a/plugins/stripe/lib/Service/TokenService.php b/plugins/stripe/lib/Service/TokenService.php new file mode 100644 index 0000000000..1c72759f64 --- /dev/null +++ b/plugins/stripe/lib/Service/TokenService.php @@ -0,0 +1,42 @@ +Custom + * account. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Token + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/tokens', $params, $opts); + } + + /** + * Retrieves the token with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Token + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/tokens/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/TopupService.php b/plugins/stripe/lib/Service/TopupService.php new file mode 100644 index 0000000000..059dc20906 --- /dev/null +++ b/plugins/stripe/lib/Service/TopupService.php @@ -0,0 +1,89 @@ +requestCollection('get', '/v1/topups', $params, $opts); + } + + /** + * Cancels a top-up. Only pending top-ups can be canceled. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Topup + */ + public function cancel($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/topups/%s/cancel', $id), $params, $opts); + } + + /** + * Top up the balance of an account. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Topup + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/topups', $params, $opts); + } + + /** + * Retrieves the details of a top-up that has previously been created. Supply the + * unique top-up ID that was returned from your previous request, and Stripe will + * return the corresponding top-up information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Topup + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/topups/%s', $id), $params, $opts); + } + + /** + * Updates the metadata of a top-up. Other top-up details are not editable by + * design. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Topup + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/topups/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/TransferService.php b/plugins/stripe/lib/Service/TransferService.php new file mode 100644 index 0000000000..150bbf7313 --- /dev/null +++ b/plugins/stripe/lib/Service/TransferService.php @@ -0,0 +1,175 @@ +requestCollection('get', '/v1/transfers', $params, $opts); + } + + /** + * You can see a list of the reversals belonging to a specific transfer. Note that + * the 10 most recent reversals are always available by default on the transfer + * object. If you need more than those 10, you can use this API method and the + * limit and starting_after parameters to page through + * additional reversals. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection + */ + public function allReversals($parentId, $params = null, $opts = null) + { + return $this->requestCollection('get', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts); + } + + /** + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Transfer + */ + public function cancel($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/transfers/%s/cancel', $id), $params, $opts); + } + + /** + * To send funds from your Stripe account to a connected account, you create a new + * transfer object. Your Stripe balance must be able to + * cover the transfer amount, or you’ll receive an “Insufficient Funds” error. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Transfer + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/transfers', $params, $opts); + } + + /** + * When you create a new reversal, you must specify a transfer to create it on. + * + * When reversing transfers, you can optionally reverse part of the transfer. You + * can do so as many times as you wish until the entire transfer has been reversed. + * + * Once entirely reversed, a transfer can’t be reversed again. This method will + * return an error when called on an already-reversed transfer, or when trying to + * reverse more money than is left on a transfer. + * + * @param string $parentId + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TransferReversal + */ + public function createReversal($parentId, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts); + } + + /** + * Retrieves the details of an existing transfer. Supply the unique transfer ID + * from either a transfer creation request or the transfer list, and Stripe will + * return the corresponding transfer information. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Transfer + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/transfers/%s', $id), $params, $opts); + } + + /** + * By default, you can see the 10 most recent reversals stored directly on the + * transfer object, but you can also retrieve details about a specific reversal + * stored on the transfer. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TransferReversal + */ + public function retrieveReversal($parentId, $id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/transfers/%s/reversals/%s', $parentId, $id), $params, $opts); + } + + /** + * Updates the specified transfer by setting the values of the parameters passed. + * Any parameters not provided will be left unchanged. + * + * This request accepts only metadata as an argument. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Transfer + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/transfers/%s', $id), $params, $opts); + } + + /** + * Updates the specified reversal by setting the values of the parameters passed. + * Any parameters not provided will be left unchanged. + * + * This request only accepts metadata and description as arguments. + * + * @param string $parentId + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TransferReversal + */ + public function updateReversal($parentId, $id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/transfers/%s/reversals/%s', $parentId, $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/Service/WebhookEndpointService.php b/plugins/stripe/lib/Service/WebhookEndpointService.php new file mode 100644 index 0000000000..01e642249b --- /dev/null +++ b/plugins/stripe/lib/Service/WebhookEndpointService.php @@ -0,0 +1,97 @@ +requestCollection('get', '/v1/webhook_endpoints', $params, $opts); + } + + /** + * A webhook endpoint must have a url and a list of + * enabled_events. You may optionally specify the Boolean + * connect parameter. If set to true, then a Connect webhook endpoint + * that notifies the specified url about events from all connected + * accounts is created; otherwise an account webhook endpoint that notifies the + * specified url only about events from your account is created. You + * can also create webhook endpoints in the webhooks settings + * section of the Dashboard. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\WebhookEndpoint + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/webhook_endpoints', $params, $opts); + } + + /** + * You can also delete webhook endpoints via the webhook endpoint + * management page of the Stripe dashboard. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\WebhookEndpoint + */ + public function delete($id, $params = null, $opts = null) + { + return $this->request('delete', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts); + } + + /** + * Retrieves the webhook endpoint with the given ID. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\WebhookEndpoint + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts); + } + + /** + * Updates the webhook endpoint. You may edit the url, the list of + * enabled_events, and the status of your endpoint. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\WebhookEndpoint + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts); + } +} diff --git a/plugins/stripe/lib/SetupAttempt.php b/plugins/stripe/lib/SetupAttempt.php new file mode 100644 index 0000000000..6c83b686c6 --- /dev/null +++ b/plugins/stripe/lib/SetupAttempt.php @@ -0,0 +1,32 @@ +application on the SetupIntent at the time of this confirmation. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string|\Stripe\Customer $customer The value of customer on the SetupIntent at the time of this confirmation. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string|\Stripe\Account $on_behalf_of The value of on_behalf_of on the SetupIntent at the time of this confirmation. + * @property string|\Stripe\PaymentMethod $payment_method ID of the payment method used with this SetupAttempt. + * @property \Stripe\StripeObject $payment_method_details + * @property null|\Stripe\ErrorObject $setup_error The error encountered during this attempt to confirm the SetupIntent, if any. + * @property string|\Stripe\SetupIntent $setup_intent ID of the SetupIntent that this attempt belongs to. + * @property string $status Status of this SetupAttempt, one of requires_confirmation, requires_action, processing, succeeded, failed, or abandoned. + * @property string $usage The value of usage on the SetupIntent at the time of this confirmation, one of off_session or on_session. + */ +class SetupAttempt extends ApiResource +{ + const OBJECT_NAME = 'setup_attempt'; + + use ApiOperations\All; +} diff --git a/plugins/stripe/lib/SetupIntent.php b/plugins/stripe/lib/SetupIntent.php new file mode 100644 index 0000000000..bf8da19cf6 --- /dev/null +++ b/plugins/stripe/lib/SetupIntent.php @@ -0,0 +1,114 @@ +PaymentIntents to drive + * the payment flow. + * + * Create a SetupIntent as soon as you're ready to collect your customer's payment + * credentials. Do not maintain long-lived, unconfirmed SetupIntents as they may no + * longer be valid. The SetupIntent then transitions through multiple statuses as + * it guides you through the setup process. + * + * Successful SetupIntents result in payment credentials that are optimized for + * future payments. For example, cardholders in certain regions may need to be + * run through Strong Customer + * Authentication at the time of payment method collection in order to + * streamline later off-session payments. + * If the SetupIntent is used with a Customer, + * upon success, it will automatically attach the resulting payment method to that + * Customer. We recommend using SetupIntents or setup_future_usage + * on PaymentIntents to save payment methods in order to prevent saving invalid or + * unoptimized payment methods. + * + * By using SetupIntents, you ensure that your customers experience the minimum set + * of required friction, even as regulations change over time. + * + * Related guide: Setup + * Intents API. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the SetupIntent. + * @property null|string $cancellation_reason Reason for cancellation of this SetupIntent, one of abandoned, requested_by_customer, or duplicate. + * @property null|string $client_secret

The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.

The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string|\Stripe\Customer $customer

ID of the Customer this SetupIntent belongs to, if one exists.

If present, the SetupIntent's payment method will be attached to the Customer on successful setup. Payment methods attached to other Customers cannot be used with this SetupIntent.

+ * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|\Stripe\ErrorObject $last_setup_error The error encountered in the previous SetupIntent confirmation. + * @property null|string|\Stripe\SetupAttempt $latest_attempt The most recent SetupAttempt for this SetupIntent. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string|\Stripe\Mandate $mandate ID of the multi use Mandate generated by the SetupIntent. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|\Stripe\StripeObject $next_action If present, this property tells you what actions you need to take in order for your customer to continue payment setup. + * @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the setup is intended. + * @property null|string|\Stripe\PaymentMethod $payment_method ID of the payment method used with this SetupIntent. + * @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for this SetupIntent. + * @property string[] $payment_method_types The list of payment method types (e.g. card) that this SetupIntent is allowed to set up. + * @property null|string|\Stripe\Mandate $single_use_mandate ID of the single_use Mandate generated by the SetupIntent. + * @property string $status Status of this SetupIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, canceled, or succeeded. + * @property string $usage

Indicates how the payment method is intended to be used in the future.

Use on_session if you intend to only reuse the payment method when the customer is in your checkout flow. Use off_session if your customer may or may not be in your checkout flow. If not provided, this value defaults to off_session.

+ */ +class SetupIntent extends ApiResource +{ + const OBJECT_NAME = 'setup_intent'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Retrieve; + use ApiOperations\Update; + + const STATUS_CANCELED = 'canceled'; + const STATUS_PROCESSING = 'processing'; + const STATUS_REQUIRES_ACTION = 'requires_action'; + const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation'; + 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 SetupIntent the canceled setup intent + */ + public function cancel($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/cancel'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return SetupIntent the confirmed setup intent + */ + public function confirm($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/confirm'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } +} diff --git a/plugins/stripe/lib/Sigma/ScheduledQueryRun.php b/plugins/stripe/lib/Sigma/ScheduledQueryRun.php index 4d97bf7ce2..b109dde70b 100644 --- a/plugins/stripe/lib/Sigma/ScheduledQueryRun.php +++ b/plugins/stripe/lib/Sigma/ScheduledQueryRun.php @@ -1,33 +1,37 @@ scheduled + * a Sigma query, you'll receive a + * sigma.scheduled_query_run.created webhook each time the query runs. + * The webhook contains a ScheduledQueryRun object, which you can use + * to retrieve the query results. * - * @package Stripe\Sigma + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property int $data_load_time When the query was run, Sigma contained a snapshot of your Stripe data at this time. + * @property \Stripe\StripeObject $error + * @property null|\Stripe\File $file The file object representing the results of the query. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property int $result_available_until Time at which the result expires and is no longer available for download. + * @property string $sql SQL for the query. + * @property string $status The query's execution status, which will be completed for successful runs, and canceled, failed, or timed_out otherwise. + * @property string $title Title of the query. */ class ScheduledQueryRun extends \Stripe\ApiResource { - const OBJECT_NAME = "scheduled_query_run"; + const OBJECT_NAME = 'scheduled_query_run'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Retrieve; public static function classUrl() { - return "/v1/sigma/scheduled_query_runs"; + return '/v1/sigma/scheduled_query_runs'; } } diff --git a/plugins/stripe/lib/SingletonApiResource.php b/plugins/stripe/lib/SingletonApiResource.php index 26a78bf3e2..704cff874b 100644 --- a/plugins/stripe/lib/SingletonApiResource.php +++ b/plugins/stripe/lib/SingletonApiResource.php @@ -3,9 +3,7 @@ namespace Stripe; /** - * Class SingletonApiResource - * - * @package Stripe + * Class SingletonApiResource. */ abstract class SingletonApiResource extends ApiResource { @@ -14,22 +12,24 @@ protected static function _singletonRetrieve($options = null) $opts = Util\RequestOptions::parse($options); $instance = new static(null, $opts); $instance->refresh(); + return $instance; } /** - * @return string The endpoint associated with this singleton class. + * @return string the endpoint associated with this singleton class */ public static function classUrl() { // Replace dots with slashes for namespaced resources, e.g. if the object's name is // "foo.bar", then its URL will be "/v1/foo/bar". - $base = str_replace('.', '/', static::OBJECT_NAME); - return "/v1/${base}"; + $base = \str_replace('.', '/', static::OBJECT_NAME); + + return "/v1/{$base}"; } /** - * @return string The endpoint associated with this singleton API resource. + * @return string the endpoint associated with this singleton API resource */ public function instanceUrl() { diff --git a/plugins/stripe/lib/Source.php b/plugins/stripe/lib/Source.php index 5a9669d7a4..2262e71d42 100644 --- a/plugins/stripe/lib/Source.php +++ b/plugins/stripe/lib/Source.php @@ -1,112 +1,168 @@ Source objects allow you to accept a variety of payment methods. + * They represent a customer's payment instrument, and can be used with the Stripe + * API just like a Card object: once chargeable, they can be charged, + * or can be attached to customers. * - * @property string $id - * @property string $object - * @property int $amount - * @property string $client_secret - * @property mixed $code_verification - * @property int $created - * @property string $currency - * @property string $flow - * @property bool $livemode - * @property StripeObject $metadata - * @property mixed $owner - * @property mixed $receiver - * @property mixed $redirect - * @property string $statement_descriptor - * @property string $status - * @property string $type - * @property string $usage + * Related guides: Sources API and Sources & Customers. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\StripeObject $ach_credit_transfer + * @property \Stripe\StripeObject $ach_debit + * @property \Stripe\StripeObject $acss_debit + * @property \Stripe\StripeObject $alipay + * @property null|int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for single_use sources. + * @property \Stripe\StripeObject $au_becs_debit + * @property \Stripe\StripeObject $bancontact + * @property \Stripe\StripeObject $card + * @property \Stripe\StripeObject $card_present + * @property string $client_secret The client secret of the source. Used for client-side retrieval using a publishable key. + * @property \Stripe\StripeObject $code_verification + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $currency Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready. Required for single_use sources. + * @property string $customer The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer. + * @property \Stripe\StripeObject $eps + * @property string $flow The authentication flow of the source. flow is one of redirect, receiver, code_verification, none. + * @property \Stripe\StripeObject $giropay + * @property \Stripe\StripeObject $ideal + * @property \Stripe\StripeObject $klarna + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property \Stripe\StripeObject $multibanco + * @property null|\Stripe\StripeObject $owner Information about the owner of the payment instrument that may be used or required by particular source types. + * @property \Stripe\StripeObject $p24 + * @property \Stripe\StripeObject $receiver + * @property \Stripe\StripeObject $redirect + * @property \Stripe\StripeObject $sepa_credit_transfer + * @property \Stripe\StripeObject $sepa_debit + * @property \Stripe\StripeObject $sofort + * @property \Stripe\StripeObject $source_order + * @property null|string $statement_descriptor Extra information about a source. This will appear on your customer's statement every time you charge the source. + * @property string $status The status of the source, one of canceled, chargeable, consumed, failed, or pending. Only chargeable sources can be used to create a charge. + * @property \Stripe\StripeObject $three_d_secure + * @property string $type The type of the source. The type is a payment method, one of ach_credit_transfer, ach_debit, alipay, bancontact, card, card_present, eps, giropay, ideal, multibanco, klarna, p24, sepa_debit, sofort, three_d_secure, or wechat. An additional hash is included on the source with a name matching this value. It contains additional information specific to the payment method used. + * @property null|string $usage Either reusable or single_use. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned. + * @property \Stripe\StripeObject $wechat */ class Source extends ApiResource { - - const OBJECT_NAME = "source"; + const OBJECT_NAME = 'source'; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; + const FLOW_CODE_VERIFICATION = 'code_verification'; + const FLOW_NONE = 'none'; + const FLOW_RECEIVER = 'receiver'; + const FLOW_REDIRECT = 'redirect'; + + const STATUS_CANCELED = 'canceled'; + const STATUS_CHARGEABLE = 'chargeable'; + const STATUS_CONSUMED = 'consumed'; + const STATUS_FAILED = 'failed'; + const STATUS_PENDING = 'pending'; + + const USAGE_REUSABLE = 'reusable'; + const USAGE_SINGLE_USE = 'single_use'; + + use ApiOperations\NestedResource; + /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts * - * @return Source The detached source. + * @throws \Stripe\Exception\UnexpectedValueException if the source is not attached to a customer + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Source the detached source */ - public function detach($params = null, $options = null) + public function detach($params = null, $opts = null) { self::_validateParams($params); $id = $this['id']; if (!$id) { - $class = get_class($this); - $msg = "Could not determine which URL to request: $class instance " - . "has invalid ID: $id"; - throw new Error\InvalidRequest($msg, null); + $class = static::class; + $msg = "Could not determine which URL to request: {$class} instance " + . "has invalid ID: {$id}"; + + throw new Exception\UnexpectedValueException($msg, null); } if ($this['customer']) { $base = Customer::classUrl(); - $parentExtn = urlencode(Util\Util::utf8($this['customer'])); - $extn = urlencode(Util\Util::utf8($id)); - $url = "$base/$parentExtn/sources/$extn"; + $parentExtn = \urlencode(Util\Util::utf8($this['customer'])); + $extn = \urlencode(Util\Util::utf8($id)); + $url = "{$base}/{$parentExtn}/sources/{$extn}"; - list($response, $opts) = $this->_request('delete', $url, $params, $options); + list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; - } else { - $message = "This source object does not appear to be currently attached " - . "to a customer object."; - throw new Error\Api($message); } + $message = 'This source object does not appear to be currently attached ' + . 'to a customer object.'; + + throw new Exception\UnexpectedValueException($message); } /** - * @param array|null $params - * @param array|string|null $options + * @deprecated sourceTransactions is deprecated. Please use Source::allSourceTransactions instead. + * + * @param null|array $params + * @param null|array|string $opts * - * @return Source The detached source. + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @deprecated Use the `detach` method instead. + * @return \Stripe\Collection the list of source transactions */ - public function delete($params = null, $options = null) + public function sourceTransactions($params = null, $opts = null) { - $this->detach($params, $options); + $url = $this->instanceUrl() . '/source_transactions'; + list($response, $opts) = $this->_request('get', $url, $params, $opts); + $obj = \Stripe\Util\Util::convertToStripeObject($response, $opts); + $obj->setLastResponse($response); + + return $obj; } /** - * @param array|null $params - * @param array|string|null $options + * @param string $id + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Collection The list of source transactions. + * @return \Stripe\Collection the list of source transactions */ - public function sourceTransactions($params = null, $options = null) + public static function allSourceTransactions($id, $params = null, $opts = null) { - $url = $this->instanceUrl() . '/source_transactions'; - list($response, $opts) = $this->_request('get', $url, $params, $options); - $obj = Util\Util::convertToStripeObject($response, $opts); - $obj->setLastResponse($response); - return $obj; + return self::_allNestedResources($id, '/source_transactions', $params, $opts); } /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts * - * @return Source The verified source. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Source the verified source */ - public function verify($params = null, $options = null) + public function verify($params = null, $opts = null) { $url = $this->instanceUrl() . '/verify'; - list($response, $opts) = $this->_request('post', $url, $params, $options); + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/SourceTransaction.php b/plugins/stripe/lib/SourceTransaction.php index 018a896240..281f2a710b 100644 --- a/plugins/stripe/lib/SourceTransaction.php +++ b/plugins/stripe/lib/SourceTransaction.php @@ -3,21 +3,18 @@ namespace Stripe; /** - * Class SourceTransaction + * Class SourceTransaction. * * @property string $id * @property string $object + * @property \Stripe\StripeObject $ach_credit_transfer * @property int $amount * @property int $created * @property string $customer_data * @property string $currency * @property string $type - * @property mixed $ach_credit_transfer - * - * @package Stripe */ class SourceTransaction extends ApiResource { - - const OBJECT_NAME = "source_transaction"; + const OBJECT_NAME = 'source_transaction'; } diff --git a/plugins/stripe/lib/Stripe.php b/plugins/stripe/lib/Stripe.php index 70d150679a..7012f96557 100644 --- a/plugins/stripe/lib/Stripe.php +++ b/plugins/stripe/lib/Stripe.php @@ -3,59 +3,65 @@ namespace Stripe; /** - * Class Stripe - * - * @package Stripe + * Class Stripe. */ class Stripe { - // @var string The Stripe API key to be used for requests. + /** @var string The Stripe API key to be used for requests. */ public static $apiKey; - // @var string The Stripe client_id to be used for Connect requests. + /** @var string The Stripe client_id to be used for Connect requests. */ public static $clientId; - // @var string The base URL for the Stripe API. + /** @var string The base URL for the Stripe API. */ public static $apiBase = 'https://api.stripe.com'; - // @var string The base URL for the OAuth API. + /** @var string The base URL for the OAuth API. */ public static $connectBase = 'https://connect.stripe.com'; - // @var string The base URL for the Stripe API uploads endpoint. - public static $apiUploadBase = 'https://uploads.stripe.com'; + /** @var string The base URL for the Stripe API uploads endpoint. */ + public static $apiUploadBase = 'https://files.stripe.com'; - // @var string|null The version of the Stripe API to use for requests. + /** @var null|string The version of the Stripe API to use for requests. */ public static $apiVersion = null; - // @var string|null The account ID for connected accounts requests. + /** @var null|string The account ID for connected accounts requests. */ public static $accountId = null; - // @var string Path to the CA bundle used to verify SSL certificates + /** @var string Path to the CA bundle used to verify SSL certificates */ public static $caBundlePath = null; - // @var boolean Defaults to true. + /** @var bool Defaults to true. */ public static $verifySslCerts = true; - // @var array The application's information (name, version, URL) + /** @var array The application's information (name, version, URL) */ public static $appInfo = null; - // @var Util\LoggerInterface|null The logger to which the library will - // produce messages. + /** + * @var null|Util\LoggerInterface the logger to which the library will + * produce messages + */ public static $logger = null; - // @var int Maximum number of request retries + /** @var int Maximum number of request retries */ public static $maxNetworkRetries = 0; - // @var float Maximum delay between retries, in seconds + /** @var bool Whether client telemetry is enabled. Defaults to true. */ + public static $enableTelemetry = true; + + /** @var float Maximum delay between retries, in seconds */ private static $maxNetworkRetryDelay = 2.0; - // @var float Initial delay between retries, in seconds + /** @var float Maximum delay between retries, in seconds, that will be respected from the Stripe API */ + private static $maxRetryAfter = 60.0; + + /** @var float Initial delay between retries, in seconds */ private static $initialNetworkRetryDelay = 0.5; - const VERSION = '6.15.0'; + const VERSION = '7.66.1'; /** - * @return string The API key used for requests. + * @return string the API key used for requests */ public static function getApiKey() { @@ -63,7 +69,7 @@ public static function getApiKey() } /** - * @return string The client_id used for Connect requests. + * @return string the client_id used for Connect requests */ public static function getClientId() { @@ -71,20 +77,21 @@ public static function getClientId() } /** - * @return Util\LoggerInterface The logger to which the library will - * produce messages. + * @return Util\LoggerInterface the logger to which the library will + * produce messages */ public static function getLogger() { - if (self::$logger == null) { + if (null === self::$logger) { return new Util\DefaultLogger(); } + return self::$logger; } /** - * @param Util\LoggerInterface $logger The logger to which the library - * will produce messages. + * @param Util\LoggerInterface $logger the logger to which the library + * will produce messages */ public static function setLogger($logger) { @@ -121,7 +128,7 @@ public static function getApiVersion() } /** - * @param string $apiVersion The API version to use for requests. + * @param string $apiVersion the API version to use for requests */ public static function setApiVersion($apiVersion) { @@ -133,7 +140,7 @@ public static function setApiVersion($apiVersion) */ private static function getDefaultCABundlePath() { - return realpath(dirname(__FILE__) . '/../data/ca-certificates.crt'); + return \realpath(__DIR__ . '/../data/ca-certificates.crt'); } /** @@ -153,7 +160,7 @@ public static function setCABundlePath($caBundlePath) } /** - * @return boolean + * @return bool */ public static function getVerifySslCerts() { @@ -161,7 +168,7 @@ public static function getVerifySslCerts() } /** - * @param boolean $verify + * @param bool $verify */ public static function setVerifySslCerts($verify) { @@ -170,7 +177,7 @@ public static function setVerifySslCerts($verify) /** * @return string | null The Stripe account ID for connected account - * requests. + * requests */ public static function getAccountId() { @@ -178,8 +185,8 @@ public static function getAccountId() } /** - * @param string $accountId The Stripe account ID to set for connected - * account requests. + * @param string $accountId the Stripe account ID to set for connected + * account requests */ public static function setAccountId($accountId) { @@ -196,8 +203,9 @@ public static function getAppInfo() /** * @param string $appName The application's name - * @param string $appVersion The application's version - * @param string $appUrl The application's URL + * @param null|string $appVersion The application's version + * @param null|string $appUrl The application's URL + * @param null|string $appPartnerId The application's partner ID */ public static function setAppInfo($appName, $appVersion = null, $appUrl = null, $appPartnerId = null) { @@ -232,6 +240,14 @@ public static function getMaxNetworkRetryDelay() return self::$maxNetworkRetryDelay; } + /** + * @return float Maximum delay between retries, in seconds, that will be respected from the Stripe API + */ + public static function getMaxRetryAfter() + { + return self::$maxRetryAfter; + } + /** * @return float Initial delay between retries, in seconds */ @@ -239,4 +255,24 @@ public static function getInitialNetworkRetryDelay() { return self::$initialNetworkRetryDelay; } + + /** + * @return bool Whether client telemetry is enabled + */ + public static function getEnableTelemetry() + { + return self::$enableTelemetry; + } + + /** + * @param bool $enableTelemetry Enables client telemetry. + * + * Client telemetry enables timing and request metrics to be sent back to Stripe as an HTTP Header + * with the current request. This enables Stripe to do latency and metrics analysis without adding extra + * overhead (such as extra network calls) on the client. + */ + public static function setEnableTelemetry($enableTelemetry) + { + self::$enableTelemetry = $enableTelemetry; + } } diff --git a/plugins/stripe/lib/StripeClient.php b/plugins/stripe/lib/StripeClient.php new file mode 100644 index 0000000000..661483c5b9 --- /dev/null +++ b/plugins/stripe/lib/StripeClient.php @@ -0,0 +1,77 @@ +coreServiceFactory) { + $this->coreServiceFactory = new \Stripe\Service\CoreServiceFactory($this); + } + + return $this->coreServiceFactory->__get($name); + } +} diff --git a/plugins/stripe/lib/StripeClientInterface.php b/plugins/stripe/lib/StripeClientInterface.php new file mode 100644 index 0000000000..adcef3f9aa --- /dev/null +++ b/plugins/stripe/lib/StripeClientInterface.php @@ -0,0 +1,56 @@ +_values = []; $this->_unsavedValues = new Util\Set(); $this->_transientValues = new Util\Set(); - if ($id !== null) { + if (null !== $id) { $this->_values['id'] = $id; } } @@ -116,17 +130,17 @@ public function __construct($id = null, $opts = null) public function __set($k, $v) { if (static::getPermanentAttributes()->includes($k)) { - throw new \InvalidArgumentException( - "Cannot set $k on this object. HINT: you can't set: " . - join(', ', static::getPermanentAttributes()->toArray()) + throw new Exception\InvalidArgumentException( + "Cannot set {$k} on this object. HINT: you can't set: " . + \implode(', ', static::getPermanentAttributes()->toArray()) ); } - if ($v === "") { - throw new \InvalidArgumentException( - 'You cannot set \''.$k.'\'to an empty string. ' - .'We interpret empty strings as NULL in requests. ' - .'You may set obj->'.$k.' = NULL to delete the property' + if ('' === $v) { + throw new Exception\InvalidArgumentException( + 'You cannot set \'' . $k . '\'to an empty string. ' + . 'We interpret empty strings as NULL in requests. ' + . 'You may set obj->' . $k . ' = NULL to delete the property' ); } @@ -151,24 +165,26 @@ public function &__get($k) { // function should return a reference, using $nullval to return a reference to null $nullval = null; - if (!empty($this->_values) && array_key_exists($k, $this->_values)) { + if (!empty($this->_values) && \array_key_exists($k, $this->_values)) { return $this->_values[$k]; - } else if (!empty($this->_transientValues) && $this->_transientValues->includes($k)) { - $class = get_class($this); - $attrs = join(', ', array_keys($this->_values)); - $message = "Stripe Notice: Undefined property of $class instance: $k. " - . "HINT: The $k attribute was set in the past, however. " - . "It was then wiped when refreshing the object " + } + if (!empty($this->_transientValues) && $this->_transientValues->includes($k)) { + $class = static::class; + $attrs = \implode(', ', \array_keys($this->_values)); + $message = "Stripe Notice: Undefined property of {$class} instance: {$k}. " + . "HINT: The {$k} attribute was set in the past, however. " + . 'It was then wiped when refreshing the object ' . "with the result returned by Stripe's API, " - . "probably as a result of a save(). The attributes currently " - . "available on this object are: $attrs"; + . 'probably as a result of a save(). The attributes currently ' + . "available on this object are: {$attrs}"; Stripe::getLogger()->error($message); - return $nullval; - } else { - $class = get_class($this); - Stripe::getLogger()->error("Stripe Notice: Undefined property of $class instance: $k"); + return $nullval; } + $class = static::class; + Stripe::getLogger()->error("Stripe Notice: Undefined property of {$class} instance: {$k}"); + + return $nullval; } // Magic method for var_dump output. Only works with PHP >= 5.6 @@ -180,52 +196,53 @@ public function __debugInfo() // ArrayAccess methods public function offsetSet($k, $v) { - $this->$k = $v; + $this->{$k} = $v; } public function offsetExists($k) { - return array_key_exists($k, $this->_values); + return \array_key_exists($k, $this->_values); } public function offsetUnset($k) { - unset($this->$k); + unset($this->{$k}); } public function offsetGet($k) { - return array_key_exists($k, $this->_values) ? $this->_values[$k] : null; + return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null; } // Countable method public function count() { - return count($this->_values); + return \count($this->_values); } public function keys() { - return array_keys($this->_values); + return \array_keys($this->_values); } public function values() { - return array_values($this->_values); + return \array_values($this->_values); } /** - * This unfortunately needs to be public to be used in Util\Util + * This unfortunately needs to be public to be used in Util\Util. * * @param array $values - * @param null|string|array|Util\RequestOptions $opts + * @param null|array|string|Util\RequestOptions $opts * - * @return StripeObject The object constructed from the given values. + * @return static the object constructed from the given values */ public static function constructFrom($values, $opts = null) { $obj = new static(isset($values['id']) ? $values['id'] : null); $obj->refreshFrom($values, $opts); + return $obj; } @@ -233,8 +250,8 @@ public static function constructFrom($values, $opts = null) * Refreshes this object using the provided values. * * @param array $values - * @param null|string|array|Util\RequestOptions $opts - * @param boolean $partial Defaults to false. + * @param null|array|string|Util\RequestOptions $opts + * @param bool $partial defaults to false */ public function refreshFrom($values, $opts, $partial = false) { @@ -243,7 +260,7 @@ public function refreshFrom($values, $opts, $partial = false) $this->_originalValues = self::deepCopy($values); if ($values instanceof StripeObject) { - $values = $values->__toArray(true); + $values = $values->toArray(); } // Wipe old state before setting new. This is useful for e.g. updating a @@ -252,11 +269,11 @@ public function refreshFrom($values, $opts, $partial = false) if ($partial) { $removed = new Util\Set(); } else { - $removed = new Util\Set(array_diff(array_keys($this->_values), array_keys($values))); + $removed = new Util\Set(\array_diff(\array_keys($this->_values), \array_keys($values))); } foreach ($removed->toArray() as $k) { - unset($this->$k); + unset($this->{$k}); } $this->updateAttributes($values, $opts, false); @@ -270,8 +287,8 @@ public function refreshFrom($values, $opts, $partial = false) * Mass assigns attributes on the model. * * @param array $values - * @param null|string|array|Util\RequestOptions $opts - * @param boolean $dirty Defaults to true. + * @param null|array|string|Util\RequestOptions $opts + * @param bool $dirty defaults to true */ public function updateAttributes($values, $opts = null, $dirty = true) { @@ -280,7 +297,7 @@ public function updateAttributes($values, $opts = null, $dirty = true) // This is necessary in case metadata is empty, as PHP arrays do // not differentiate between lists and hashes, and we consider // empty arrays to be lists. - if ($k === "metadata") { + if (('metadata' === $k) && (\is_array($v))) { $this->_values[$k] = StripeObject::constructFrom($v, $opts); } else { $this->_values[$k] = Util\Util::convertToStripeObject($v, $opts); @@ -293,8 +310,10 @@ public function updateAttributes($values, $opts = null, $dirty = true) } /** - * @return array A recursive mapping of attributes to values for this object, - * including the proper value for deleted attributes. + * @param bool $force defaults to false + * + * @return array a recursive mapping of attributes to values for this object, + * including the proper value for deleted attributes */ public function serializeParameters($force = false) { @@ -309,7 +328,7 @@ public function serializeParameters($force = false) // 3. Its value is a StripeObject. A StripeObject may contain modified // values within in that its parent StripeObject doesn't know about. // - $original = array_key_exists($k, $this->_originalValues) ? $this->_originalValues[$k] : null; + $original = \array_key_exists($k, $this->_originalValues) ? $this->_originalValues[$k] : null; $unsaved = $this->_unsavedValues->includes($k); if ($force || $unsaved || $v instanceof StripeObject) { $updateParams[$k] = $this->serializeParamsValue( @@ -324,17 +343,14 @@ public function serializeParameters($force = false) // a `null` that makes it out of `serializeParamsValue` signals an empty // value that we shouldn't appear in the serialized form of the object - $updateParams = array_filter( + return \array_filter( $updateParams, function ($v) { - return $v !== null; + return null !== $v; } ); - - return $updateParams; } - public function serializeParamsValue($value, $original, $unsaved, $force, $key = null) { // The logic here is that essentially any object embedded in another @@ -359,26 +375,29 @@ public function serializeParamsValue($value, $original, $unsaved, $force, $key = // We throw an error if a property was set explicitly but we can't do // anything with it because the integration is probably not working as the // user intended it to. - if ($value === null) { - return ""; - } elseif (($value instanceof APIResource) && (!$value->saveWithParent)) { + if (null === $value) { + return ''; + } + if (($value instanceof ApiResource) && (!$value->saveWithParent)) { if (!$unsaved) { return null; - } elseif (isset($value->id)) { + } + if (isset($value->id)) { return $value; - } else { - throw new \InvalidArgumentException( - "Cannot save property `$key` containing an API resource of type " . - get_class($value) . ". It doesn't appear to be persisted and is " . - "not marked as `saveWithParent`." - ); } - } elseif (is_array($value)) { + + throw new Exception\InvalidArgumentException( + "Cannot save property `{$key}` containing an API resource of type " . + \get_class($value) . ". It doesn't appear to be persisted and is " . + 'not marked as `saveWithParent`.' + ); + } + if (\is_array($value)) { if (Util\Util::isList($value)) { // Sequential array, i.e. a list $update = []; foreach ($value as $v) { - array_push($update, $this->serializeParamsValue($v, null, true, $force)); + \array_push($update, $this->serializeParamsValue($v, null, true, $force)); } // This prevents an array that's unchanged from being resent. if ($update !== $this->serializeParamsValue($original, null, true, $force, $key)) { @@ -391,8 +410,9 @@ public function serializeParamsValue($value, $original, $unsaved, $force, $key = } elseif ($value instanceof StripeObject) { $update = $value->serializeParameters($force); if ($original && $unsaved && $key && static::getAdditiveParams()->includes($key)) { - $update = array_merge(self::emptyValues($original), $update); + $update = \array_merge(self::emptyValues($original), $update); } + return $update; } else { return $value; @@ -401,27 +421,55 @@ public function serializeParamsValue($value, $original, $unsaved, $force, $key = public function jsonSerialize() { - return $this->__toArray(true); + return $this->toArray(); } - public function __toJSON() + /** + * Returns an associative array with the key and values composing the + * Stripe object. + * + * @return array the associative array + */ + public function toArray() { - return json_encode($this->__toArray(true), JSON_PRETTY_PRINT); + $maybeToArray = function ($value) { + if (null === $value) { + return null; + } + + return \is_object($value) && \method_exists($value, 'toArray') ? $value->toArray() : $value; + }; + + return \array_reduce(\array_keys($this->_values), function ($acc, $k) use ($maybeToArray) { + if ('_' === \substr((string) $k, 0, 1)) { + return $acc; + } + $v = $this->_values[$k]; + if (Util\Util::isList($v)) { + $acc[$k] = \array_map($maybeToArray, $v); + } else { + $acc[$k] = $maybeToArray($v); + } + + return $acc; + }, []); } - public function __toString() + /** + * Returns a pretty JSON representation of the Stripe object. + * + * @return string the JSON representation of the Stripe object + */ + public function toJSON() { - $class = get_class($this); - return $class . ' JSON: ' . $this->__toJSON(); + return \json_encode($this->toArray(), \JSON_PRETTY_PRINT); } - public function __toArray($recursive = false) + public function __toString() { - if ($recursive) { - return Util\Util::convertStripeObjectToArray($this->_values); - } else { - return $this->_values; - } + $class = static::class; + + return $class . ' JSON: ' . $this->toJSON(); } /** @@ -432,7 +480,7 @@ public function __toArray($recursive = false) */ public function dirty() { - $this->_unsavedValues = new Util\Set(array_keys($this->_values)); + $this->_unsavedValues = new Util\Set(\array_keys($this->_values)); foreach ($this->_values as $k => $v) { $this->dirtyValue($v); } @@ -440,7 +488,7 @@ public function dirty() protected function dirtyValue($value) { - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $v) { $this->dirtyValue($v); } @@ -452,46 +500,52 @@ protected function dirtyValue($value) /** * Produces a deep copy of the given object including support for arrays * and StripeObjects. + * + * @param mixed $obj */ protected static function deepCopy($obj) { - if (is_array($obj)) { + if (\is_array($obj)) { $copy = []; foreach ($obj as $k => $v) { $copy[$k] = self::deepCopy($v); } + return $copy; - } elseif ($obj instanceof StripeObject) { + } + if ($obj instanceof StripeObject) { return $obj::constructFrom( self::deepCopy($obj->_values), clone $obj->_opts ); - } else { - return $obj; } + + return $obj; } /** * Returns a hash of empty values for all the values that are in the given * StripeObject. + * + * @param mixed $obj */ public static function emptyValues($obj) { - if (is_array($obj)) { + if (\is_array($obj)) { $values = $obj; } elseif ($obj instanceof StripeObject) { $values = $obj->_values; } else { - throw new \InvalidArgumentException( - "empty_values got got unexpected object type: " . get_class($obj) + throw new Exception\InvalidArgumentException( + 'empty_values got unexpected object type: ' . \get_class($obj) ); } - $update = array_fill_keys(array_keys($values), ""); - return $update; + + return \array_fill_keys(\array_keys($values), ''); } /** - * @return object The last response from the Stripe API + * @return null|ApiResponse The last response from the Stripe API */ public function getLastResponse() { @@ -499,9 +553,9 @@ public function getLastResponse() } /** - * @param ApiResponse + * Sets the last response from the Stripe API. * - * @return void Set the last response from the Stripe API + * @param ApiResponse $resp */ public function setLastResponse($resp) { @@ -513,7 +567,7 @@ public function setLastResponse($resp) * Note that some, but not all, resources can indicate whether they have * been deleted. * - * @return bool Whether the resource is deleted. + * @return bool whether the resource is deleted */ public function isDeleted() { diff --git a/plugins/stripe/lib/Subscription.php b/plugins/stripe/lib/Subscription.php index 5cdebb87a4..fcb55a31de 100644 --- a/plugins/stripe/lib/Subscription.php +++ b/plugins/stripe/lib/Subscription.php @@ -1,76 +1,98 @@ Creating + * Subscriptions. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. + * @property int $billing_cycle_anchor Determines the date of the first full invoice, and, for plans with month or year intervals, the day of the month for subsequent invoices. + * @property null|\Stripe\StripeObject $billing_thresholds Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period + * @property null|int $cancel_at A date in the future at which the subscription will automatically get canceled + * @property bool $cancel_at_period_end If the subscription has been canceled with the at_period_end flag set to true, cancel_at_period_end on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period. + * @property null|int $canceled_at If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with cancel_at_period_end, canceled_at will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state. + * @property null|string $collection_method Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property int $current_period_end End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created. + * @property int $current_period_start Start of the current period that the subscription has been invoiced for. + * @property string|\Stripe\Customer $customer ID of the customer who owns the subscription. + * @property null|int $days_until_due Number of days a customer has to pay invoices generated by this subscription. This value will be null for subscriptions where collection_method=charge_automatically. + * @property null|string|\Stripe\PaymentMethod $default_payment_method ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over default_source. If neither are set, invoices will use the customer's invoice_settings.default_payment_method or default_source. + * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source ID of the default payment source for the subscription. It must belong to the customer associated with the subscription and be in a chargeable state. If default_payment_method is also set, default_payment_method will take precedence. If neither are set, invoices will use the customer's invoice_settings.default_payment_method or default_source. + * @property null|\Stripe\TaxRate[] $default_tax_rates The tax rates that will apply to any subscription item that does not have tax_rates set. Invoices created will have their default_tax_rates populated from the subscription. + * @property null|\Stripe\Discount $discount Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a subscription overrides a discount applied on a customer-wide basis. + * @property null|int $ended_at If the subscription has ended, the date the subscription ended. + * @property \Stripe\Collection $items List of subscription items, each with an attached price. + * @property null|string|\Stripe\Invoice $latest_invoice The most recent invoice this subscription has generated. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|int $next_pending_invoice_item_invoice Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at pending_invoice_item_interval. + * @property null|\Stripe\StripeObject $pause_collection If specified, payment collection for this subscription will be paused. + * @property null|\Stripe\StripeObject $pending_invoice_item_interval Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling Create an invoice for the given subscription at the specified interval. + * @property null|string|\Stripe\SetupIntent $pending_setup_intent You can use this SetupIntent to collect user authentication when creating a subscription without immediate payment or updating a subscription's payment method, allowing you to optimize for off-session payments. Learn more in the SCA Migration Guide. + * @property null|\Stripe\StripeObject $pending_update If specified, pending updates that will be applied to the subscription once the latest_invoice has been paid. + * @property null|string|\Stripe\SubscriptionSchedule $schedule The schedule attached to the subscription + * @property int $start_date Date when the subscription was first created. The date might differ from the created date due to backdating. + * @property string $status

Possible values are incomplete, incomplete_expired, trialing, active, past_due, canceled, or unpaid.

For collection_method=charge_automatically a subscription moves into incomplete if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an active state. If the first invoice is not paid within 23 hours, the subscription transitions to incomplete_expired. This is a terminal state, the open invoice will be voided and no further invoices will be generated.

A subscription that is currently in a trial period is trialing and moves to active when the trial period is over.

If subscription collection_method=charge_automatically it becomes past_due when payment to renew it fails and canceled or unpaid (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.

If subscription collection_method=send_invoice it becomes past_due when its invoice is not paid by the due date, and canceled or unpaid if it is still not paid by an additional deadline after that. Note that when a subscription has a status of unpaid, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.

+ * @property null|int $trial_end If the subscription has a trial, the end of that trial. + * @property null|int $trial_start If the subscription has a trial, the beginning of that trial. */ class Subscription extends ApiResource { - - const OBJECT_NAME = "subscription"; + const OBJECT_NAME = 'subscription'; use ApiOperations\All; use ApiOperations\Create; - use ApiOperations\Delete { - delete as protected _delete; - } use ApiOperations\Retrieve; use ApiOperations\Update; - /** - * These constants are possible representations of the status field. - * - * @link https://stripe.com/docs/api#subscription_object-status - */ - const STATUS_ACTIVE = 'active'; + const PAYMENT_BEHAVIOR_ALLOW_INCOMPLETE = 'allow_incomplete'; + const PAYMENT_BEHAVIOR_ERROR_IF_INCOMPLETE = 'error_if_incomplete'; + const PAYMENT_BEHAVIOR_PENDING_IF_INCOMPLETE = 'pending_if_incomplete'; + + const PRORATION_BEHAVIOR_ALWAYS_INVOICE = 'always_invoice'; + const PRORATION_BEHAVIOR_CREATE_PRORATIONS = 'create_prorations'; + const PRORATION_BEHAVIOR_NONE = 'none'; + + const STATUS_ACTIVE = 'active'; const STATUS_CANCELED = 'canceled'; + const STATUS_INCOMPLETE = 'incomplete'; + const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired'; const STATUS_PAST_DUE = 'past_due'; const STATUS_TRIALING = 'trialing'; - const STATUS_UNPAID = 'unpaid'; + const STATUS_UNPAID = 'unpaid'; + + use ApiOperations\Delete { + delete as protected _delete; + } public static function getSavedNestedResources() { static $savedNestedResources = null; - if ($savedNestedResources === null) { + if (null === $savedNestedResources) { $savedNestedResources = new Util\Set([ 'source', ]); } + return $savedNestedResources; } /** - * @param array|null $params + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return Subscription The deleted subscription. + * @return \Stripe\Subscription the deleted subscription */ public function cancel($params = null, $opts = null) { @@ -78,12 +100,17 @@ public function cancel($params = null, $opts = null) } /** - * @return Subscription The updated subscription. + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Subscription the updated subscription */ - public function deleteDiscount() + public function deleteDiscount($params = null, $opts = null) { $url = $this->instanceUrl() . '/discount'; - list($response, $opts) = $this->_request('delete', $url); + list($response, $opts) = $this->_request('delete', $url, $params, $opts); $this->refreshFrom(['discount' => null], $opts, true); } } diff --git a/plugins/stripe/lib/SubscriptionItem.php b/plugins/stripe/lib/SubscriptionItem.php index e19effbe38..5bd25b2520 100644 --- a/plugins/stripe/lib/SubscriptionItem.php +++ b/plugins/stripe/lib/SubscriptionItem.php @@ -1,28 +1,84 @@ key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property \Stripe\Plan $plan

You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.

Plans define the base price, currency, and billing cycle for recurring purchases of products. Products help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.

For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.

Related guides: Set up a subscription and more about products and prices.

+ * @property \Stripe\Price $price

Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.

For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.

Related guides: Set up a subscription, create an invoice, and more about products and prices.

+ * @property int $quantity The quantity of the plan to which the customer should be subscribed. + * @property string $subscription The subscription this subscription_item belongs to. + * @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to this subscription_item. When set, the default_tax_rates on the subscription do not apply to this subscription_item. */ class SubscriptionItem extends ApiResource { - - const OBJECT_NAME = "subscription_item"; + const OBJECT_NAME = 'subscription_item'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; + use ApiOperations\NestedResource; use ApiOperations\Retrieve; use ApiOperations\Update; + + const PATH_USAGE_RECORDS = '/usage_records'; + + /** + * @param null|string $id the ID of the subscription item on which to create the usage record + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\UsageRecord + */ + public static function createUsageRecord($id, $params = null, $opts = null) + { + return self::_createNestedResource($id, static::PATH_USAGE_RECORDS, $params, $opts); + } + + /** + * @deprecated usageRecordSummaries is deprecated. Please use SubscriptionItem::allUsageRecordSummaries instead. + * + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of usage record summaries + */ + public function usageRecordSummaries($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/usage_record_summaries'; + list($response, $opts) = $this->_request('get', $url, $params, $opts); + $obj = \Stripe\Util\Util::convertToStripeObject($response, $opts); + $obj->setLastResponse($response); + + return $obj; + } + + const PATH_USAGE_RECORD_SUMMARIES = '/usage_record_summaries'; + + /** + * @param string $id the ID of the subscription item on which to retrieve the usage record summaries + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of usage record summaries + */ + public static function allUsageRecordSummaries($id, $params = null, $opts = null) + { + return self::_allNestedResources($id, static::PATH_USAGE_RECORD_SUMMARIES, $params, $opts); + } } diff --git a/plugins/stripe/lib/SubscriptionSchedule.php b/plugins/stripe/lib/SubscriptionSchedule.php new file mode 100644 index 0000000000..0f1b156302 --- /dev/null +++ b/plugins/stripe/lib/SubscriptionSchedule.php @@ -0,0 +1,74 @@ +Subscription + * Schedules. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|int $canceled_at Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. + * @property null|int $completed_at Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|\Stripe\StripeObject $current_phase Object representing the start and end dates for the current phase of the subscription schedule, if it is active. + * @property string|\Stripe\Customer $customer ID of the customer who owns the subscription schedule. + * @property \Stripe\StripeObject $default_settings + * @property string $end_behavior Behavior of the subscription schedule and underlying subscription when it ends. Possible values are release and cancel. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property \Stripe\StripeObject[] $phases Configuration for the subscription schedule's phases. + * @property null|int $released_at Time at which the subscription schedule was released. Measured in seconds since the Unix epoch. + * @property null|string $released_subscription ID of the subscription once managed by the subscription schedule (if it is released). + * @property string $status The present status of the subscription schedule. Possible values are not_started, active, completed, released, and canceled. You can read more about the different states in our behavior guide. + * @property null|string|\Stripe\Subscription $subscription ID of the subscription managed by the subscription schedule. + */ +class SubscriptionSchedule extends ApiResource +{ + const OBJECT_NAME = 'subscription_schedule'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Retrieve; + use ApiOperations\Update; + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return SubscriptionSchedule the canceled subscription schedule + */ + public function cancel($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/cancel'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } + + /** + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return SubscriptionSchedule the released subscription schedule + */ + public function release($params = null, $opts = null) + { + $url = $this->instanceUrl() . '/release'; + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + + return $this; + } +} diff --git a/plugins/stripe/lib/TaxId.php b/plugins/stripe/lib/TaxId.php new file mode 100644 index 0000000000..d4188fe404 --- /dev/null +++ b/plugins/stripe/lib/TaxId.php @@ -0,0 +1,106 @@ +customer. A customer's tax IDs + * are displayed on invoices and credit notes issued for the customer. + * + * Related guide: Customer + * Tax Identification Numbers. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string $country Two-letter ISO code representing the country of the tax ID. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string|\Stripe\Customer $customer ID of the customer. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property string $type Type of the tax ID, one of ae_trn, au_abn, br_cnpj, br_cpf, ca_bn, ca_qst, ch_vat, cl_tin, es_cif, eu_vat, hk_br, id_npwp, in_gst, jp_cn, jp_rn, kr_brn, li_uid, mx_rfc, my_frp, my_itn, my_sst, no_vat, nz_gst, ru_inn, ru_kpp, sa_vat, sg_gst, sg_uen, th_vat, tw_vat, us_ein, or za_vat. Note that some legacy tax IDs have type unknown + * @property string $value Value of the tax ID. + * @property null|\Stripe\StripeObject $verification Tax ID verification information. + */ +class TaxId extends ApiResource +{ + const OBJECT_NAME = 'tax_id'; + + use ApiOperations\Delete; + + const TYPE_AE_TRN = 'ae_trn'; + const TYPE_AU_ABN = 'au_abn'; + const TYPE_BR_CNPJ = 'br_cnpj'; + const TYPE_BR_CPF = 'br_cpf'; + const TYPE_CA_BN = 'ca_bn'; + const TYPE_CA_QST = 'ca_qst'; + const TYPE_CH_VAT = 'ch_vat'; + const TYPE_CL_TIN = 'cl_tin'; + const TYPE_ES_CIF = 'es_cif'; + const TYPE_EU_VAT = 'eu_vat'; + const TYPE_HK_BR = 'hk_br'; + const TYPE_ID_NPWP = 'id_npwp'; + const TYPE_IN_GST = 'in_gst'; + const TYPE_JP_CN = 'jp_cn'; + const TYPE_JP_RN = 'jp_rn'; + const TYPE_KR_BRN = 'kr_brn'; + const TYPE_LI_UID = 'li_uid'; + const TYPE_MX_RFC = 'mx_rfc'; + const TYPE_MY_FRP = 'my_frp'; + const TYPE_MY_ITN = 'my_itn'; + const TYPE_MY_SST = 'my_sst'; + const TYPE_NO_VAT = 'no_vat'; + const TYPE_NZ_GST = 'nz_gst'; + const TYPE_RU_INN = 'ru_inn'; + const TYPE_RU_KPP = 'ru_kpp'; + const TYPE_SA_VAT = 'sa_vat'; + const TYPE_SG_GST = 'sg_gst'; + const TYPE_SG_UEN = 'sg_uen'; + const TYPE_TH_VAT = 'th_vat'; + const TYPE_TW_VAT = 'tw_vat'; + const TYPE_UNKNOWN = 'unknown'; + const TYPE_US_EIN = 'us_ein'; + const TYPE_ZA_VAT = 'za_vat'; + + const VERIFICATION_STATUS_PENDING = 'pending'; + const VERIFICATION_STATUS_UNAVAILABLE = 'unavailable'; + const VERIFICATION_STATUS_UNVERIFIED = 'unverified'; + const VERIFICATION_STATUS_VERIFIED = 'verified'; + + /** + * @return string the API URL for this tax id + */ + public function instanceUrl() + { + $id = $this['id']; + $customer = $this['customer']; + if (!$id) { + throw new Exception\UnexpectedValueException( + "Could not determine which URL to request: class instance has invalid ID: {$id}" + ); + } + $id = Util\Util::utf8($id); + $customer = Util\Util::utf8($customer); + + $base = Customer::classUrl(); + $customerExtn = \urlencode($customer); + $extn = \urlencode($id); + + return "{$base}/{$customerExtn}/tax_ids/{$extn}"; + } + + /** + * @param array|string $_id + * @param null|array|string $_opts + * + * @throws \Stripe\Exception\BadMethodCallException + */ + public static function retrieve($_id, $_opts = null) + { + $msg = 'Tax IDs cannot be retrieved without a customer ID. Retrieve ' . + "a tax ID using `Customer::retrieveTaxId('customer_id', " . + "'tax_id_id')`."; + + throw new Exception\BadMethodCallException($msg); + } +} diff --git a/plugins/stripe/lib/TaxRate.php b/plugins/stripe/lib/TaxRate.php new file mode 100644 index 0000000000..2974f8383f --- /dev/null +++ b/plugins/stripe/lib/TaxRate.php @@ -0,0 +1,38 @@ +invoices, subscriptions and + * Checkout + * Sessions to collect tax. + * + * Related guide: Tax + * Rates. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property bool $active Defaults to true. When set to false, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $description An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. + * @property string $display_name The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page. + * @property bool $inclusive This specifies if the tax rate is inclusive or exclusive. + * @property null|string $jurisdiction The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property float $percentage This represents the tax rate percent out of 100. + */ +class TaxRate extends ApiResource +{ + const OBJECT_NAME = 'tax_rate'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Retrieve; + use ApiOperations\Update; +} diff --git a/plugins/stripe/lib/Terminal/ConnectionToken.php b/plugins/stripe/lib/Terminal/ConnectionToken.php new file mode 100644 index 0000000000..e688857b04 --- /dev/null +++ b/plugins/stripe/lib/Terminal/ConnectionToken.php @@ -0,0 +1,23 @@ +Fleet + * Management. + * + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string $location The id of the location that this connection token is scoped to. + * @property string $secret Your application should pass this token to the Stripe Terminal SDK. + */ +class ConnectionToken extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'terminal.connection_token'; + + use \Stripe\ApiOperations\Create; +} diff --git a/plugins/stripe/lib/Terminal/Location.php b/plugins/stripe/lib/Terminal/Location.php new file mode 100644 index 0000000000..5769ef358e --- /dev/null +++ b/plugins/stripe/lib/Terminal/Location.php @@ -0,0 +1,30 @@ +Fleet + * Management. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\StripeObject $address + * @property string $display_name The display name of the location. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ +class Location extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'terminal.location'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Delete; + use \Stripe\ApiOperations\Retrieve; + use \Stripe\ApiOperations\Update; +} diff --git a/plugins/stripe/lib/Terminal/Reader.php b/plugins/stripe/lib/Terminal/Reader.php new file mode 100644 index 0000000000..513b130af6 --- /dev/null +++ b/plugins/stripe/lib/Terminal/Reader.php @@ -0,0 +1,35 @@ +Connecting to a + * Reader. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string $device_sw_version The current software version of the reader. + * @property string $device_type Type of reader, one of bbpos_chipper2x or verifone_P400. + * @property null|string $ip_address The local IP address of the reader. + * @property string $label Custom label given to the reader for easier identification. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string $location The location identifier of the reader. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $serial_number Serial number of the reader. + * @property null|string $status The networking status of the reader. + */ +class Reader extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'terminal.reader'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Delete; + use \Stripe\ApiOperations\Retrieve; + use \Stripe\ApiOperations\Update; +} diff --git a/plugins/stripe/lib/ThreeDSecure.php b/plugins/stripe/lib/ThreeDSecure.php index 5e67e351ba..51b5691d4e 100644 --- a/plugins/stripe/lib/ThreeDSecure.php +++ b/plugins/stripe/lib/ThreeDSecure.php @@ -1,20 +1,37 @@ 3D + * Secure object. Once the object has been created, you can use it to + * authenticate the cardholder and create a charge. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount of the charge that you will create when authentication completes. + * @property bool $authenticated True if the cardholder went through the authentication flow and their bank indicated that authentication succeeded. + * @property \Stripe\Card $card

You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.

Related guide: Card Payments with Sources.

+ * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string $redirect_url If present, this is the URL that you should send the cardholder to for authentication. If you are going to use Stripe.js to display the authentication page in an iframe, you should use the value "_callback". + * @property string $status Possible values are redirect_pending, succeeded, or failed. When the cardholder can be authenticated, the object starts with status redirect_pending. When liability will be shifted to the cardholder's bank (either because the cardholder was successfully authenticated, or because the bank has not implemented 3D Secure, the object wlil be in status succeeded. failed indicates that authentication was attempted unsuccessfully. + */ class ThreeDSecure extends ApiResource { - - const OBJECT_NAME = "three_d_secure"; + const OBJECT_NAME = 'three_d_secure'; use ApiOperations\Create; use ApiOperations\Retrieve; /** - * @return string The endpoint URL for the given class. + * @return string the endpoint URL for the given class */ public static function classUrl() { - return "/v1/3d_secure"; + return '/v1/3d_secure'; } } diff --git a/plugins/stripe/lib/Token.php b/plugins/stripe/lib/Token.php index 91abf7abc4..de7988cfb5 100644 --- a/plugins/stripe/lib/Token.php +++ b/plugins/stripe/lib/Token.php @@ -1,27 +1,57 @@ recommended payments integrations to + * perform this process client-side. This ensures that no sensitive card data + * touches your server, and allows your integration to operate in a PCI-compliant + * way. + * + * If you cannot use client-side tokenization, you can also create tokens using the + * API with either your publishable or secret API key. Keep in mind that if your + * integration uses this method, you are responsible for any PCI compliance that + * may be required, and you must keep your secret API key safe. Unlike with + * client-side tokenization, your customer's information is not sent directly to + * Stripe, so we cannot determine how it is handled or stored. + * + * Tokens cannot be stored or used more than once. To store card or bank account + * information for later use, you can create Customer objects or Custom accounts. Note + * that Radar, our integrated solution + * for automatic fraud protection, supports only integrations that use client-side + * tokenization. * - * @property string $id - * @property string $object - * @property BankAccount $bank_account - * @property Card $card - * @property string $client_ip - * @property int $created - * @property bool $livemode - * @property string $type - * @property bool $used + * Related guide: Accept + * a payment * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\BankAccount $bank_account

These bank accounts are payment methods on Customer objects.

On the other hand External Accounts are transfer destinations on Account objects for Custom accounts. They can be bank accounts or debit cards as well, and are documented in the links above.

Related guide: Bank Debits and Transfers.

+ * @property \Stripe\Card $card

You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.

Related guide: Card Payments with Sources.

+ * @property null|string $client_ip IP address of the client that generated the token. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property string $type Type of the token: account, bank_account, card, or pii. + * @property bool $used Whether this token has already been used (tokens can be used only once). */ class Token extends ApiResource { - - const OBJECT_NAME = "token"; + const OBJECT_NAME = 'token'; use ApiOperations\Create; use ApiOperations\Retrieve; + + const TYPE_ACCOUNT = 'account'; + const TYPE_BANK_ACCOUNT = 'bank_account'; + const TYPE_CARD = 'card'; + const TYPE_PII = 'pii'; } diff --git a/plugins/stripe/lib/Topup.php b/plugins/stripe/lib/Topup.php index ad277c4c11..4a4c818b21 100644 --- a/plugins/stripe/lib/Topup.php +++ b/plugins/stripe/lib/Topup.php @@ -1,49 +1,63 @@ Topping Up your + * Platform Account. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount transferred. + * @property null|string|\Stripe\BalanceTransaction $balance_transaction ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|int $expected_availability_date Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up. + * @property null|string $failure_code Error code explaining reason for top-up failure if available (see the errors section for a list of codes). + * @property null|string $failure_message Message to user further explaining reason for top-up failure if available. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property \Stripe\Source $source

Source objects allow you to accept a variety of payment methods. They represent a customer's payment instrument, and can be used with the Stripe API just like a Card object: once chargeable, they can be charged, or can be attached to customers.

Related guides: Sources API and Sources & Customers.

+ * @property null|string $statement_descriptor Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter. + * @property string $status The status of the top-up is either canceled, failed, pending, reversed, or succeeded. + * @property null|string $transfer_group A string that identifies this top-up as part of a group. */ class Topup extends ApiResource { - - const OBJECT_NAME = "topup"; + const OBJECT_NAME = 'topup'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; + const STATUS_CANCELED = 'canceled'; + const STATUS_FAILED = 'failed'; + const STATUS_PENDING = 'pending'; + const STATUS_REVERSED = 'reversed'; + const STATUS_SUCCEEDED = 'succeeded'; + /** - * @param array|null $params - * @param array|string|null $options + * @param null|array $params + * @param null|array|string $opts * - * @return Topup The canceled topup. + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Topup the canceled topup */ - public function cancel($params = null, $options = null) + public function cancel($params = null, $opts = null) { $url = $this->instanceUrl() . '/cancel'; - list($response, $opts) = $this->_request('post', $url, $params, $options); + list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } } diff --git a/plugins/stripe/lib/Transfer.php b/plugins/stripe/lib/Transfer.php index fb84c874a9..6b8e4ac6af 100644 --- a/plugins/stripe/lib/Transfer.php +++ b/plugins/stripe/lib/Transfer.php @@ -1,34 +1,44 @@ Transfer object is created when you move funds between Stripe + * accounts as part of Connect. + * + * Before April 6, 2017, transfers also represented movement of funds from a Stripe + * account to a card or bank account. This behavior has since been split out into a + * Payout object, with + * corresponding payout endpoints. For more information, read about the transfer/payout split. * - * @property string $id - * @property string $object - * @property int $amount - * @property int $amount_reversed - * @property string $balance_transaction - * @property int $created - * @property string $currency - * @property string $description - * @property string $destination - * @property string $destination_payment - * @property bool $livemode - * @property StripeObject $metadata - * @property Collection $reversals - * @property bool $reversed - * @property string $source_transaction - * @property string $source_type - * @property string $transfer_group + * Related guide: Creating Separate + * Charges and Transfers. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount in %s to be transferred. + * @property int $amount_reversed Amount in %s reversed (can be less than the amount attribute on the transfer if a partial reversal was issued). + * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact of this transfer on your account balance. + * @property int $created Time that this record of the transfer was first created. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. + * @property null|string|\Stripe\Account $destination ID of the Stripe account the transfer was sent to. + * @property string|\Stripe\Charge $destination_payment If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property \Stripe\Collection $reversals A list of reversals that have been applied to the transfer. + * @property bool $reversed Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false. + * @property null|string|\Stripe\Charge $source_transaction ID of the charge or payment that was used to fund the transfer. If null, the transfer was funded from the available balance. + * @property null|string $source_type The source balance this transfer came from. One of card, fpx, or bank_account. + * @property null|string $transfer_group A string that identifies this transaction as part of a group. See the Connect documentation for details. */ class Transfer extends ApiResource { - - const OBJECT_NAME = "transfer"; + const OBJECT_NAME = 'transfer'; use ApiOperations\All; use ApiOperations\Create; @@ -36,36 +46,52 @@ class Transfer extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; - const PATH_REVERSALS = '/reversals'; + const SOURCE_TYPE_ALIPAY_ACCOUNT = 'alipay_account'; + const SOURCE_TYPE_BANK_ACCOUNT = 'bank_account'; + const SOURCE_TYPE_CARD = 'card'; + const SOURCE_TYPE_FINANCING = 'financing'; /** - * @return TransferReversal The created transfer reversal. + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return Transfer the canceled transfer */ - public function reverse($params = null, $opts = null) + public function cancel($params = null, $opts = null) { - $url = $this->instanceUrl() . '/reversals'; + $url = $this->instanceUrl() . '/cancel'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); + return $this; } + const PATH_REVERSALS = '/reversals'; + /** - * @return Transfer The canceled transfer. + * @param string $id the ID of the transfer on which to retrieve the transfer reversals + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection the list of transfer reversals */ - public function cancel() + public static function allReversals($id, $params = null, $opts = null) { - $url = $this->instanceUrl() . '/cancel'; - list($response, $opts) = $this->_request('post', $url); - $this->refreshFrom($response, $opts); - return $this; + return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts); } /** - * @param array|null $id The ID of the transfer on which to create the reversal. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the transfer on which to create the transfer reversal + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return TransferReversal + * @return \Stripe\TransferReversal */ public static function createReversal($id, $params = null, $opts = null) { @@ -73,12 +99,14 @@ public static function createReversal($id, $params = null, $opts = null) } /** - * @param array|null $id The ID of the transfer to which the reversal belongs. - * @param array|null $reversalId The ID of the reversal to retrieve. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the transfer to which the transfer reversal belongs + * @param string $reversalId the ID of the transfer reversal to retrieve + * @param null|array $params + * @param null|array|string $opts * - * @return TransferReversal + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\TransferReversal */ public static function retrieveReversal($id, $reversalId, $params = null, $opts = null) { @@ -86,27 +114,17 @@ public static function retrieveReversal($id, $reversalId, $params = null, $opts } /** - * @param array|null $id The ID of the transfer to which the reversal belongs. - * @param array|null $reversalId The ID of the reversal to update. - * @param array|null $params - * @param array|string|null $opts + * @param string $id the ID of the transfer to which the transfer reversal belongs + * @param string $reversalId the ID of the transfer reversal to update + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return TransferReversal + * @return \Stripe\TransferReversal */ public static function updateReversal($id, $reversalId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_REVERSALS, $reversalId, $params, $opts); } - - /** - * @param array|null $id The ID of the transfer on which to retrieve the reversals. - * @param array|null $params - * @param array|string|null $opts - * - * @return TransferReversal - */ - public static function allReversals($id, $params = null, $opts = null) - { - return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts); - } } diff --git a/plugins/stripe/lib/TransferReversal.php b/plugins/stripe/lib/TransferReversal.php index 3c8a7e2e52..b6167dbb30 100644 --- a/plugins/stripe/lib/TransferReversal.php +++ b/plugins/stripe/lib/TransferReversal.php @@ -1,41 +1,57 @@ Stripe Connect platforms can + * reverse transfers made to a connected account, either entirely or partially, and + * can also specify whether to refund any related application fees. Transfer + * reversals add to the platform's balance and subtract from the destination + * account's balance. + * + * Reversing a transfer that was made for a destination charge is allowed only + * up to the amount of the charge. It is possible to reverse a transfer_group + * transfer only if the destination account has enough balance to cover the + * reversal. * - * @property string $id - * @property string $object - * @property int $amount - * @property string $balance_transaction - * @property int $created - * @property string $currency - * @property StripeObject $metadata - * @property string $transfer + * Related guide: Reversing + * Transfers. * - * @package Stripe + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property int $amount Amount, in %s. + * @property null|string|\Stripe\BalanceTransaction $balance_transaction Balance transaction that describes the impact on your account balance. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. + * @property null|string|\Stripe\Refund $destination_payment_refund Linked payment refund for the transfer reversal. + * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string|\Stripe\Refund $source_refund ID of the refund responsible for the transfer reversal. + * @property string|\Stripe\Transfer $transfer ID of the transfer that was reversed. */ class TransferReversal extends ApiResource { - - const OBJECT_NAME = "transfer_reversal"; + const OBJECT_NAME = 'transfer_reversal'; use ApiOperations\Update { save as protected _save; } /** - * @return string The API URL for this Stripe transfer reversal. + * @return string the API URL for this Stripe transfer reversal */ public function instanceUrl() { $id = $this['id']; $transfer = $this['transfer']; if (!$id) { - throw new Error\InvalidRequest( - "Could not determine which URL to request: " . - "class instance has invalid ID: $id", + throw new Exception\UnexpectedValueException( + 'Could not determine which URL to request: ' . + "class instance has invalid ID: {$id}", null ); } @@ -43,15 +59,18 @@ public function instanceUrl() $transfer = Util\Util::utf8($transfer); $base = Transfer::classUrl(); - $transferExtn = urlencode($transfer); - $extn = urlencode($id); - return "$base/$transferExtn/reversals/$extn"; + $transferExtn = \urlencode($transfer); + $extn = \urlencode($id); + + return "{$base}/{$transferExtn}/reversals/{$extn}"; } /** - * @param array|string|null $opts + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return TransferReversal The saved reversal. + * @return TransferReversal the saved reversal */ public function save($opts = null) { diff --git a/plugins/stripe/lib/UsageRecord.php b/plugins/stripe/lib/UsageRecord.php index a9e3a25e3e..5522982769 100644 --- a/plugins/stripe/lib/UsageRecord.php +++ b/plugins/stripe/lib/UsageRecord.php @@ -1,44 +1,25 @@ Metered + * Billing. * - * @property string $id - * @property string $object - * @property bool $livemode - * @property int $quantity - * @property string $subscription_item - * @property int $timestamp + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property int $quantity The usage quantity for the specified date. + * @property string $subscription_item The ID of the subscription item this usage record contains data for. + * @property int $timestamp The timestamp when this usage occurred. */ class UsageRecord extends ApiResource { - - const OBJECT_NAME = "usage_record"; - - /** - * @param array|null $params - * @param array|string|null $options - * - * @return \Stripe\ApiResource The created resource. - */ - public static function create($params = null, $options = null) - { - self::_validateParams($params); - if (!array_key_exists('subscription_item', $params)) { - throw new Error\InvalidRequest("Missing subscription_item param in request", null); - } - $subscription_item = $params['subscription_item']; - $url = "/v1/subscription_items/$subscription_item/usage_records"; - $request_params = $params; - unset($request_params['subscription_item']); - - list($response, $opts) = static::_staticRequest('post', $url, $request_params, $options); - $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); - $obj->setLastResponse($response); - return $obj; - } + const OBJECT_NAME = 'usage_record'; } diff --git a/plugins/stripe/lib/UsageRecordSummary.php b/plugins/stripe/lib/UsageRecordSummary.php new file mode 100644 index 0000000000..174e14e035 --- /dev/null +++ b/plugins/stripe/lib/UsageRecordSummary.php @@ -0,0 +1,19 @@ +true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $period + * @property string $subscription_item The ID of the subscription item this summary is describing. + * @property int $total_usage The total usage within this usage period. + */ +class UsageRecordSummary extends ApiResource +{ + const OBJECT_NAME = 'usage_record_summary'; +} diff --git a/plugins/stripe/lib/Util/AutoPagingIterator.php b/plugins/stripe/lib/Util/AutoPagingIterator.php deleted file mode 100644 index 167d1258a2..0000000000 --- a/plugins/stripe/lib/Util/AutoPagingIterator.php +++ /dev/null @@ -1,61 +0,0 @@ -page = $collection; - $this->params = $params; - } - - public function rewind() - { - // Actually rewinding would require making a copy of the original page. - } - - public function current() - { - $item = current($this->page->data); - $this->lastId = $item !== false ? $item['id'] : null; - - return $item; - } - - public function key() - { - return key($this->page->data) + $this->pageOffset; - } - - public function next() - { - $item = next($this->page->data); - if ($item === false) { - // If we've run out of data on the current page, try to fetch another one - // and increase the offset the new page would start at - $this->pageOffset += count($this->page->data); - if ($this->page['has_more']) { - $this->params = array_merge( - $this->params ?: [], - ['starting_after' => $this->lastId] - ); - $this->page = $this->page->all($this->params); - } else { - return false; - } - } - } - - public function valid() - { - $key = key($this->page->data); - $valid = ($key !== null && $key !== false); - return $valid; - } -} diff --git a/plugins/stripe/lib/Util/CaseInsensitiveArray.php b/plugins/stripe/lib/Util/CaseInsensitiveArray.php new file mode 100644 index 0000000000..670ab0b6a7 --- /dev/null +++ b/plugins/stripe/lib/Util/CaseInsensitiveArray.php @@ -0,0 +1,72 @@ +container = \array_change_key_case($initial_array, \CASE_LOWER); + } + + public function count() + { + return \count($this->container); + } + + public function getIterator() + { + return new \ArrayIterator($this->container); + } + + public function offsetSet($offset, $value) + { + $offset = static::maybeLowercase($offset); + if (null === $offset) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + public function offsetExists($offset) + { + $offset = static::maybeLowercase($offset); + + return isset($this->container[$offset]); + } + + public function offsetUnset($offset) + { + $offset = static::maybeLowercase($offset); + unset($this->container[$offset]); + } + + public function offsetGet($offset) + { + $offset = static::maybeLowercase($offset); + + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + private static function maybeLowercase($v) + { + if (\is_string($v)) { + return \strtolower($v); + } + + return $v; + } +} diff --git a/plugins/stripe/lib/Util/DefaultLogger.php b/plugins/stripe/lib/Util/DefaultLogger.php index 1a8663699f..016cbe85fb 100644 --- a/plugins/stripe/lib/Util/DefaultLogger.php +++ b/plugins/stripe/lib/Util/DefaultLogger.php @@ -8,11 +8,22 @@ */ class DefaultLogger implements LoggerInterface { + /** @var int */ + public $messageType = 0; + + /** @var null|string */ + public $destination; + public function error($message, array $context = []) { - if (count($context) > 0) { - throw new \Exception('DefaultLogger does not currently implement context. Please implement if you need it.'); + if (\count($context) > 0) { + throw new \Stripe\Exception\BadMethodCallException('DefaultLogger does not currently implement context. Please implement if you need it.'); + } + + if (null === $this->destination) { + \error_log($message, $this->messageType); + } else { + \error_log($message, $this->messageType, $this->destination); } - error_log($message); } } diff --git a/plugins/stripe/lib/Util/LoggerInterface.php b/plugins/stripe/lib/Util/LoggerInterface.php index bbdfc92998..5603c81b8f 100644 --- a/plugins/stripe/lib/Util/LoggerInterface.php +++ b/plugins/stripe/lib/Util/LoggerInterface.php @@ -29,8 +29,6 @@ interface LoggerInterface * be logged and monitored. * * @param string $message - * @param array $context - * @return null */ public function error($message, array $context = []); } diff --git a/plugins/stripe/lib/Util/ObjectTypes.php b/plugins/stripe/lib/Util/ObjectTypes.php new file mode 100644 index 0000000000..5aad2bb407 --- /dev/null +++ b/plugins/stripe/lib/Util/ObjectTypes.php @@ -0,0 +1,99 @@ + \Stripe\Account::class, + \Stripe\AccountLink::OBJECT_NAME => \Stripe\AccountLink::class, + \Stripe\AlipayAccount::OBJECT_NAME => \Stripe\AlipayAccount::class, + \Stripe\ApplePayDomain::OBJECT_NAME => \Stripe\ApplePayDomain::class, + \Stripe\ApplicationFee::OBJECT_NAME => \Stripe\ApplicationFee::class, + \Stripe\ApplicationFeeRefund::OBJECT_NAME => \Stripe\ApplicationFeeRefund::class, + \Stripe\Balance::OBJECT_NAME => \Stripe\Balance::class, + \Stripe\BalanceTransaction::OBJECT_NAME => \Stripe\BalanceTransaction::class, + \Stripe\BankAccount::OBJECT_NAME => \Stripe\BankAccount::class, + \Stripe\BillingPortal\Session::OBJECT_NAME => \Stripe\BillingPortal\Session::class, + \Stripe\BitcoinReceiver::OBJECT_NAME => \Stripe\BitcoinReceiver::class, + \Stripe\BitcoinTransaction::OBJECT_NAME => \Stripe\BitcoinTransaction::class, + \Stripe\Capability::OBJECT_NAME => \Stripe\Capability::class, + \Stripe\Card::OBJECT_NAME => \Stripe\Card::class, + \Stripe\Charge::OBJECT_NAME => \Stripe\Charge::class, + \Stripe\Checkout\Session::OBJECT_NAME => \Stripe\Checkout\Session::class, + \Stripe\Collection::OBJECT_NAME => \Stripe\Collection::class, + \Stripe\CountrySpec::OBJECT_NAME => \Stripe\CountrySpec::class, + \Stripe\Coupon::OBJECT_NAME => \Stripe\Coupon::class, + \Stripe\CreditNote::OBJECT_NAME => \Stripe\CreditNote::class, + \Stripe\CreditNoteLineItem::OBJECT_NAME => \Stripe\CreditNoteLineItem::class, + \Stripe\Customer::OBJECT_NAME => \Stripe\Customer::class, + \Stripe\CustomerBalanceTransaction::OBJECT_NAME => \Stripe\CustomerBalanceTransaction::class, + \Stripe\Discount::OBJECT_NAME => \Stripe\Discount::class, + \Stripe\Dispute::OBJECT_NAME => \Stripe\Dispute::class, + \Stripe\EphemeralKey::OBJECT_NAME => \Stripe\EphemeralKey::class, + \Stripe\Event::OBJECT_NAME => \Stripe\Event::class, + \Stripe\ExchangeRate::OBJECT_NAME => \Stripe\ExchangeRate::class, + \Stripe\File::OBJECT_NAME => \Stripe\File::class, + \Stripe\File::OBJECT_NAME_ALT => \Stripe\File::class, + \Stripe\FileLink::OBJECT_NAME => \Stripe\FileLink::class, + \Stripe\Invoice::OBJECT_NAME => \Stripe\Invoice::class, + \Stripe\InvoiceItem::OBJECT_NAME => \Stripe\InvoiceItem::class, + \Stripe\InvoiceLineItem::OBJECT_NAME => \Stripe\InvoiceLineItem::class, + \Stripe\Issuing\Authorization::OBJECT_NAME => \Stripe\Issuing\Authorization::class, + \Stripe\Issuing\Card::OBJECT_NAME => \Stripe\Issuing\Card::class, + \Stripe\Issuing\CardDetails::OBJECT_NAME => \Stripe\Issuing\CardDetails::class, + \Stripe\Issuing\Cardholder::OBJECT_NAME => \Stripe\Issuing\Cardholder::class, + \Stripe\Issuing\Dispute::OBJECT_NAME => \Stripe\Issuing\Dispute::class, + \Stripe\Issuing\Transaction::OBJECT_NAME => \Stripe\Issuing\Transaction::class, + \Stripe\LineItem::OBJECT_NAME => \Stripe\LineItem::class, + \Stripe\LoginLink::OBJECT_NAME => \Stripe\LoginLink::class, + \Stripe\Mandate::OBJECT_NAME => \Stripe\Mandate::class, + \Stripe\Order::OBJECT_NAME => \Stripe\Order::class, + \Stripe\OrderItem::OBJECT_NAME => \Stripe\OrderItem::class, + \Stripe\OrderReturn::OBJECT_NAME => \Stripe\OrderReturn::class, + \Stripe\PaymentIntent::OBJECT_NAME => \Stripe\PaymentIntent::class, + \Stripe\PaymentMethod::OBJECT_NAME => \Stripe\PaymentMethod::class, + \Stripe\Payout::OBJECT_NAME => \Stripe\Payout::class, + \Stripe\Person::OBJECT_NAME => \Stripe\Person::class, + \Stripe\Plan::OBJECT_NAME => \Stripe\Plan::class, + \Stripe\Price::OBJECT_NAME => \Stripe\Price::class, + \Stripe\Product::OBJECT_NAME => \Stripe\Product::class, + \Stripe\PromotionCode::OBJECT_NAME => \Stripe\PromotionCode::class, + \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \Stripe\Radar\EarlyFraudWarning::class, + \Stripe\Radar\ValueList::OBJECT_NAME => \Stripe\Radar\ValueList::class, + \Stripe\Radar\ValueListItem::OBJECT_NAME => \Stripe\Radar\ValueListItem::class, + \Stripe\Recipient::OBJECT_NAME => \Stripe\Recipient::class, + \Stripe\RecipientTransfer::OBJECT_NAME => \Stripe\RecipientTransfer::class, + \Stripe\Refund::OBJECT_NAME => \Stripe\Refund::class, + \Stripe\Reporting\ReportRun::OBJECT_NAME => \Stripe\Reporting\ReportRun::class, + \Stripe\Reporting\ReportType::OBJECT_NAME => \Stripe\Reporting\ReportType::class, + \Stripe\Review::OBJECT_NAME => \Stripe\Review::class, + \Stripe\SetupAttempt::OBJECT_NAME => \Stripe\SetupAttempt::class, + \Stripe\SetupIntent::OBJECT_NAME => \Stripe\SetupIntent::class, + \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \Stripe\Sigma\ScheduledQueryRun::class, + \Stripe\SKU::OBJECT_NAME => \Stripe\SKU::class, + \Stripe\Source::OBJECT_NAME => \Stripe\Source::class, + \Stripe\SourceTransaction::OBJECT_NAME => \Stripe\SourceTransaction::class, + \Stripe\Subscription::OBJECT_NAME => \Stripe\Subscription::class, + \Stripe\SubscriptionItem::OBJECT_NAME => \Stripe\SubscriptionItem::class, + \Stripe\SubscriptionSchedule::OBJECT_NAME => \Stripe\SubscriptionSchedule::class, + \Stripe\TaxId::OBJECT_NAME => \Stripe\TaxId::class, + \Stripe\TaxRate::OBJECT_NAME => \Stripe\TaxRate::class, + \Stripe\Terminal\ConnectionToken::OBJECT_NAME => \Stripe\Terminal\ConnectionToken::class, + \Stripe\Terminal\Location::OBJECT_NAME => \Stripe\Terminal\Location::class, + \Stripe\Terminal\Reader::OBJECT_NAME => \Stripe\Terminal\Reader::class, + \Stripe\ThreeDSecure::OBJECT_NAME => \Stripe\ThreeDSecure::class, + \Stripe\Token::OBJECT_NAME => \Stripe\Token::class, + \Stripe\Topup::OBJECT_NAME => \Stripe\Topup::class, + \Stripe\Transfer::OBJECT_NAME => \Stripe\Transfer::class, + \Stripe\TransferReversal::OBJECT_NAME => \Stripe\TransferReversal::class, + \Stripe\UsageRecord::OBJECT_NAME => \Stripe\UsageRecord::class, + \Stripe\UsageRecordSummary::OBJECT_NAME => \Stripe\UsageRecordSummary::class, + \Stripe\WebhookEndpoint::OBJECT_NAME => \Stripe\WebhookEndpoint::class, + ]; +} diff --git a/plugins/stripe/lib/Util/RandomGenerator.php b/plugins/stripe/lib/Util/RandomGenerator.php index 470f2bce8b..b11e445d26 100644 --- a/plugins/stripe/lib/Util/RandomGenerator.php +++ b/plugins/stripe/lib/Util/RandomGenerator.php @@ -12,11 +12,12 @@ class RandomGenerator * Returns a random value between 0 and $max. * * @param float $max (optional) + * * @return float */ public function randFloat($max = 1.0) { - return mt_rand() / mt_getrandmax() * $max; + return \mt_rand() / \mt_getrandmax() * $max; } /** @@ -26,9 +27,10 @@ public function randFloat($max = 1.0) */ public function uuid() { - $arr = array_values(unpack('N1a/n4b/N1c', openssl_random_pseudo_bytes(16))); + $arr = \array_values(\unpack('N1a/n4b/N1c', \openssl_random_pseudo_bytes(16))); $arr[2] = ($arr[2] & 0x0fff) | 0x4000; $arr[3] = ($arr[3] & 0x3fff) | 0x8000; - return vsprintf('%08x-%04x-%04x-%04x-%04x%08x', $arr); + + return \vsprintf('%08x-%04x-%04x-%04x-%04x%08x', $arr); } } diff --git a/plugins/stripe/lib/Util/RequestOptions.php b/plugins/stripe/lib/Util/RequestOptions.php index a31f4d322d..1effb9ab53 100644 --- a/plugins/stripe/lib/Util/RequestOptions.php +++ b/plugins/stripe/lib/Util/RequestOptions.php @@ -2,41 +2,69 @@ namespace Stripe\Util; -use Stripe\Error; - class RequestOptions { /** - * @var array A list of headers that should be persisted across requests. + * @var array a list of headers that should be persisted across requests */ public static $HEADERS_TO_PERSIST = [ 'Stripe-Account', 'Stripe-Version', ]; + /** @var array */ public $headers; + + /** @var null|string */ public $apiKey; - public function __construct($key = null, $headers = []) + /** @var null|string */ + public $apiBase; + + /** + * @param null|string $key + * @param array $headers + * @param null|string $base + */ + public function __construct($key = null, $headers = [], $base = null) { $this->apiKey = $key; $this->headers = $headers; + $this->apiBase = $base; + } + + /** + * @return array + */ + public function __debugInfo() + { + return [ + 'apiKey' => $this->redactedApiKey(), + 'headers' => $this->headers, + 'apiBase' => $this->apiBase, + ]; } /** * Unpacks an options array and merges it into the existing RequestOptions * object. - * @param array|string|null $options a key => value array + * + * @param null|array|RequestOptions|string $options a key => value array + * @param bool $strict when true, forbid string form and arbitrary keys in array form * * @return RequestOptions */ - public function merge($options) + public function merge($options, $strict = false) { - $other_options = self::parse($options); - if ($other_options->apiKey === null) { + $other_options = self::parse($options, $strict); + if (null === $other_options->apiKey) { $other_options->apiKey = $this->apiKey; } - $other_options->headers = array_merge($this->headers, $other_options->headers); + if (null === $other_options->apiBase) { + $other_options->apiBase = $this->apiBase; + } + $other_options->headers = \array_merge($this->headers, $other_options->headers); + return $other_options; } @@ -46,54 +74,95 @@ public function merge($options) public function discardNonPersistentHeaders() { foreach ($this->headers as $k => $v) { - if (!in_array($k, self::$HEADERS_TO_PERSIST)) { + if (!\in_array($k, self::$HEADERS_TO_PERSIST, true)) { unset($this->headers[$k]); } } } /** - * Unpacks an options array into an RequestOptions object - * @param array|string|null $options a key => value array + * Unpacks an options array into an RequestOptions object. + * + * @param null|array|RequestOptions|string $options a key => value array + * @param bool $strict when true, forbid string form and arbitrary keys in array form + * + * @throws \Stripe\Exception\InvalidArgumentException * * @return RequestOptions */ - public static function parse($options) + public static function parse($options, $strict = false) { if ($options instanceof self) { return $options; } - if (is_null($options)) { - return new RequestOptions(null, []); + if (null === $options) { + return new RequestOptions(null, [], null); } - if (is_string($options)) { - return new RequestOptions($options, []); + if (\is_string($options)) { + if ($strict) { + $message = 'Do not pass a string for request options. If you want to set the ' + . 'API key, pass an array like ["api_key" => ] instead.'; + + throw new \Stripe\Exception\InvalidArgumentException($message); + } + + return new RequestOptions($options, [], null); } - if (is_array($options)) { + if (\is_array($options)) { $headers = []; $key = null; - if (array_key_exists('api_key', $options)) { + $base = null; + + if (\array_key_exists('api_key', $options)) { $key = $options['api_key']; + unset($options['api_key']); } - if (array_key_exists('idempotency_key', $options)) { + if (\array_key_exists('idempotency_key', $options)) { $headers['Idempotency-Key'] = $options['idempotency_key']; + unset($options['idempotency_key']); } - if (array_key_exists('stripe_account', $options)) { + if (\array_key_exists('stripe_account', $options)) { $headers['Stripe-Account'] = $options['stripe_account']; + unset($options['stripe_account']); } - if (array_key_exists('stripe_version', $options)) { + if (\array_key_exists('stripe_version', $options)) { $headers['Stripe-Version'] = $options['stripe_version']; + unset($options['stripe_version']); + } + if (\array_key_exists('api_base', $options)) { + $base = $options['api_base']; + unset($options['api_base']); + } + + if ($strict && !empty($options)) { + $message = 'Got unexpected keys in options array: ' . \implode(', ', \array_keys($options)); + + throw new \Stripe\Exception\InvalidArgumentException($message); } - return new RequestOptions($key, $headers); + + return new RequestOptions($key, $headers, $base); } $message = 'The second argument to Stripe API method calls is an ' . 'optional per-request apiKey, which must be a string, or ' . 'per-request options, which must be an array. (HINT: you can set ' . 'a global apiKey by "Stripe::setApiKey()")'; - throw new Error\Api($message); + + throw new \Stripe\Exception\InvalidArgumentException($message); + } + + private function redactedApiKey() + { + $pieces = \explode('_', $this->apiKey, 3); + $last = \array_pop($pieces); + $redactedLast = \strlen($last) > 4 + ? (\str_repeat('*', \strlen($last) - 4) . \substr($last, -4)) + : $last; + \array_push($pieces, $redactedLast); + + return \implode('_', $pieces); } } diff --git a/plugins/stripe/lib/Util/Set.php b/plugins/stripe/lib/Util/Set.php index d8beb8b1a3..017f929785 100644 --- a/plugins/stripe/lib/Util/Set.php +++ b/plugins/stripe/lib/Util/Set.php @@ -2,8 +2,8 @@ namespace Stripe\Util; -use IteratorAggregate; use ArrayIterator; +use IteratorAggregate; class Set implements IteratorAggregate { @@ -34,7 +34,7 @@ public function discard($elt) public function toArray() { - return array_keys($this->_elts); + return \array_keys($this->_elts); } public function getIterator() diff --git a/plugins/stripe/lib/Util/Util.php b/plugins/stripe/lib/Util/Util.php index 5f6f23b30b..595a7d61dd 100644 --- a/plugins/stripe/lib/Util/Util.php +++ b/plugins/stripe/lib/Util/Util.php @@ -15,238 +15,251 @@ abstract class Util * integers starting at 0. Empty arrays are considered to be lists. * * @param array|mixed $array - * @return boolean true if the given object is a list. + * + * @return bool true if the given object is a list */ public static function isList($array) { - if (!is_array($array)) { + if (!\is_array($array)) { return false; } - if ($array === []) { + if ([] === $array) { return true; } - if (array_keys($array) !== range(0, count($array) - 1)) { + if (\array_keys($array) !== \range(0, \count($array) - 1)) { return false; } - return true; - } - /** - * Recursively converts the PHP Stripe object to an array. - * - * @param array $values The PHP Stripe object to convert. - * @return array - */ - public static function convertStripeObjectToArray($values) - { - $results = []; - foreach ($values as $k => $v) { - // FIXME: this is an encapsulation violation - if ($k[0] == '_') { - continue; - } - if ($v instanceof StripeObject) { - $results[$k] = $v->__toArray(true); - } elseif (is_array($v)) { - $results[$k] = self::convertStripeObjectToArray($v); - } else { - $results[$k] = $v; - } - } - return $results; + return true; } /** * Converts a response from the Stripe API to the corresponding PHP object. * - * @param array $resp The response from the Stripe API. + * @param array $resp the response from the Stripe API * @param array $opts - * @return StripeObject|array + * + * @return array|StripeObject */ public static function convertToStripeObject($resp, $opts) { - $types = [ - // data structures - \Stripe\Collection::OBJECT_NAME => 'Stripe\\Collection', - - // business objects - \Stripe\Account::OBJECT_NAME => 'Stripe\\Account', - \Stripe\AlipayAccount::OBJECT_NAME => 'Stripe\\AlipayAccount', - \Stripe\ApplePayDomain::OBJECT_NAME => 'Stripe\\ApplePayDomain', - \Stripe\ApplicationFee::OBJECT_NAME => 'Stripe\\ApplicationFee', - \Stripe\Balance::OBJECT_NAME => 'Stripe\\Balance', - \Stripe\BalanceTransaction::OBJECT_NAME => 'Stripe\\BalanceTransaction', - \Stripe\BankAccount::OBJECT_NAME => 'Stripe\\BankAccount', - \Stripe\BitcoinReceiver::OBJECT_NAME => 'Stripe\\BitcoinReceiver', - \Stripe\BitcoinTransaction::OBJECT_NAME => 'Stripe\\BitcoinTransaction', - \Stripe\Card::OBJECT_NAME => 'Stripe\\Card', - \Stripe\Charge::OBJECT_NAME => 'Stripe\\Charge', - \Stripe\CountrySpec::OBJECT_NAME => 'Stripe\\CountrySpec', - \Stripe\Coupon::OBJECT_NAME => 'Stripe\\Coupon', - \Stripe\Customer::OBJECT_NAME => 'Stripe\\Customer', - \Stripe\Discount::OBJECT_NAME => 'Stripe\\Discount', - \Stripe\Dispute::OBJECT_NAME => 'Stripe\\Dispute', - \Stripe\EphemeralKey::OBJECT_NAME => 'Stripe\\EphemeralKey', - \Stripe\Event::OBJECT_NAME => 'Stripe\\Event', - \Stripe\ExchangeRate::OBJECT_NAME => 'Stripe\\ExchangeRate', - \Stripe\ApplicationFeeRefund::OBJECT_NAME => 'Stripe\\ApplicationFeeRefund', - \Stripe\FileLink::OBJECT_NAME => 'Stripe\\FileLink', - \Stripe\FileUpload::OBJECT_NAME => 'Stripe\\FileUpload', - \Stripe\Invoice::OBJECT_NAME => 'Stripe\\Invoice', - \Stripe\InvoiceItem::OBJECT_NAME => 'Stripe\\InvoiceItem', - \Stripe\InvoiceLineItem::OBJECT_NAME => 'Stripe\\InvoiceLineItem', - \Stripe\IssuerFraudRecord::OBJECT_NAME => 'Stripe\\IssuerFraudRecord', - \Stripe\Issuing\Authorization::OBJECT_NAME => 'Stripe\\Issuing\\Authorization', - \Stripe\Issuing\Card::OBJECT_NAME => 'Stripe\\Issuing\\Card', - \Stripe\Issuing\CardDetails::OBJECT_NAME => 'Stripe\\Issuing\\CardDetails', - \Stripe\Issuing\Cardholder::OBJECT_NAME => 'Stripe\\Issuing\\Cardholder', - \Stripe\Issuing\Dispute::OBJECT_NAME => 'Stripe\\Issuing\\Dispute', - \Stripe\Issuing\Transaction::OBJECT_NAME => 'Stripe\\Issuing\\Transaction', - \Stripe\LoginLink::OBJECT_NAME => 'Stripe\\LoginLink', - \Stripe\Order::OBJECT_NAME => 'Stripe\\Order', - \Stripe\OrderItem::OBJECT_NAME => 'Stripe\\OrderItem', - \Stripe\OrderReturn::OBJECT_NAME => 'Stripe\\OrderReturn', - \Stripe\PaymentIntent::OBJECT_NAME => 'Stripe\\PaymentIntent', - \Stripe\Payout::OBJECT_NAME => 'Stripe\\Payout', - \Stripe\Plan::OBJECT_NAME => 'Stripe\\Plan', - \Stripe\Product::OBJECT_NAME => 'Stripe\\Product', - \Stripe\Recipient::OBJECT_NAME => 'Stripe\\Recipient', - \Stripe\RecipientTransfer::OBJECT_NAME => 'Stripe\\RecipientTransfer', - \Stripe\Refund::OBJECT_NAME => 'Stripe\\Refund', - \Stripe\SKU::OBJECT_NAME => 'Stripe\\SKU', - \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => 'Stripe\\Sigma\\ScheduledQueryRun', - \Stripe\Source::OBJECT_NAME => 'Stripe\\Source', - \Stripe\SourceTransaction::OBJECT_NAME => 'Stripe\\SourceTransaction', - \Stripe\Subscription::OBJECT_NAME => 'Stripe\\Subscription', - \Stripe\SubscriptionItem::OBJECT_NAME => 'Stripe\\SubscriptionItem', - \Stripe\ThreeDSecure::OBJECT_NAME => 'Stripe\\ThreeDSecure', - \Stripe\Token::OBJECT_NAME => 'Stripe\\Token', - \Stripe\Topup::OBJECT_NAME => 'Stripe\\Topup', - \Stripe\Transfer::OBJECT_NAME => 'Stripe\\Transfer', - \Stripe\TransferReversal::OBJECT_NAME => 'Stripe\\TransferReversal', - \Stripe\UsageRecord::OBJECT_NAME => 'Stripe\\UsageRecord', - ]; + $types = \Stripe\Util\ObjectTypes::mapping; if (self::isList($resp)) { $mapped = []; foreach ($resp as $i) { - array_push($mapped, self::convertToStripeObject($i, $opts)); + \array_push($mapped, self::convertToStripeObject($i, $opts)); } + return $mapped; - } elseif (is_array($resp)) { - if (isset($resp['object']) && is_string($resp['object']) && isset($types[$resp['object']])) { + } + if (\is_array($resp)) { + if (isset($resp['object']) && \is_string($resp['object']) && isset($types[$resp['object']])) { $class = $types[$resp['object']]; } else { - $class = 'Stripe\\StripeObject'; + $class = \Stripe\StripeObject::class; } + return $class::constructFrom($resp, $opts); - } else { - return $resp; } + + return $resp; } /** - * @param string|mixed $value A string to UTF8-encode. + * @param mixed|string $value a string to UTF8-encode * - * @return string|mixed The UTF8-encoded string, or the object passed in if - * it wasn't a string. + * @return mixed|string the UTF8-encoded string, or the object passed in if + * it wasn't a string */ public static function utf8($value) { - if (self::$isMbstringAvailable === null) { - self::$isMbstringAvailable = function_exists('mb_detect_encoding'); + if (null === self::$isMbstringAvailable) { + self::$isMbstringAvailable = \function_exists('mb_detect_encoding'); if (!self::$isMbstringAvailable) { - trigger_error("It looks like the mbstring extension is not enabled. " . - "UTF-8 strings will not properly be encoded. Ask your system " . - "administrator to enable the mbstring extension, or write to " . - "support@stripe.com if you have any questions.", E_USER_WARNING); + \trigger_error('It looks like the mbstring extension is not enabled. ' . + 'UTF-8 strings will not properly be encoded. Ask your system ' . + 'administrator to enable the mbstring extension, or write to ' . + 'support@stripe.com if you have any questions.', \E_USER_WARNING); } } - if (is_string($value) && self::$isMbstringAvailable && mb_detect_encoding($value, "UTF-8", true) != "UTF-8") { - return utf8_encode($value); - } else { - return $value; + if (\is_string($value) && self::$isMbstringAvailable && 'UTF-8' !== \mb_detect_encoding($value, 'UTF-8', true)) { + return \utf8_encode($value); } + + return $value; } /** * Compares two strings for equality. The time taken is independent of the * number of characters that match. * - * @param string $a one of the strings to compare. - * @param string $b the other string to compare. - * @return bool true if the strings are equal, false otherwise. + * @param string $a one of the strings to compare + * @param string $b the other string to compare + * + * @return bool true if the strings are equal, false otherwise */ public static function secureCompare($a, $b) { - if (self::$isHashEqualsAvailable === null) { - self::$isHashEqualsAvailable = function_exists('hash_equals'); + if (null === self::$isHashEqualsAvailable) { + self::$isHashEqualsAvailable = \function_exists('hash_equals'); } if (self::$isHashEqualsAvailable) { - return hash_equals($a, $b); - } else { - if (strlen($a) != strlen($b)) { - return false; + return \hash_equals($a, $b); + } + if (\strlen($a) !== \strlen($b)) { + return false; + } + + $result = 0; + for ($i = 0; $i < \strlen($a); ++$i) { + $result |= \ord($a[$i]) ^ \ord($b[$i]); + } + + return 0 === $result; + } + + /** + * Recursively goes through an array of parameters. If a parameter is an instance of + * ApiResource, then it is replaced by the resource's ID. + * Also clears out null values. + * + * @param mixed $h + * + * @return mixed + */ + public static function objectsToIds($h) + { + if ($h instanceof \Stripe\ApiResource) { + return $h->id; + } + if (static::isList($h)) { + $results = []; + foreach ($h as $v) { + \array_push($results, static::objectsToIds($v)); } - $result = 0; - for ($i = 0; $i < strlen($a); $i++) { - $result |= ord($a[$i]) ^ ord($b[$i]); + return $results; + } + if (\is_array($h)) { + $results = []; + foreach ($h as $k => $v) { + if (null === $v) { + continue; + } + $results[$k] = static::objectsToIds($v); } - return ($result == 0); + + return $results; } + + return $h; } /** - * @param array $arr A map of param keys to values. - * @param string|null $prefix + * @param array $params * - * @return string A querystring, essentially. + * @return string */ - public static function urlEncode($arr, $prefix = null) + public static function encodeParameters($params) { - if (!is_array($arr)) { - return $arr; + $flattenedParams = self::flattenParams($params); + $pieces = []; + foreach ($flattenedParams as $param) { + list($k, $v) = $param; + \array_push($pieces, self::urlEncode($k) . '=' . self::urlEncode($v)); } - $r = []; - foreach ($arr as $k => $v) { - if (is_null($v)) { - continue; - } + return \implode('&', $pieces); + } - if ($prefix) { - if ($k !== null && (!is_int($k) || is_array($v))) { - $k = $prefix."[".$k."]"; - } else { - $k = $prefix."[]"; - } + /** + * @param array $params + * @param null|string $parentKey + * + * @return array + */ + public static function flattenParams($params, $parentKey = null) + { + $result = []; + + foreach ($params as $key => $value) { + $calculatedKey = $parentKey ? "{$parentKey}[{$key}]" : $key; + + if (self::isList($value)) { + $result = \array_merge($result, self::flattenParamsList($value, $calculatedKey)); + } elseif (\is_array($value)) { + $result = \array_merge($result, self::flattenParams($value, $calculatedKey)); + } else { + \array_push($result, [$calculatedKey, $value]); } + } - if (is_array($v)) { - $enc = self::urlEncode($v, $k); - if ($enc) { - $r[] = $enc; - } + return $result; + } + + /** + * @param array $value + * @param string $calculatedKey + * + * @return array + */ + public static function flattenParamsList($value, $calculatedKey) + { + $result = []; + + foreach ($value as $i => $elem) { + if (self::isList($elem)) { + $result = \array_merge($result, self::flattenParamsList($elem, $calculatedKey)); + } elseif (\is_array($elem)) { + $result = \array_merge($result, self::flattenParams($elem, "{$calculatedKey}[{$i}]")); } else { - $r[] = urlencode($k)."=".urlencode($v); + \array_push($result, ["{$calculatedKey}[{$i}]", $elem]); } } - return implode("&", $r); + return $result; + } + + /** + * @param string $key a string to URL-encode + * + * @return string the URL-encoded string + */ + public static function urlEncode($key) + { + $s = \urlencode((string) $key); + + // Don't use strict form encoding by changing the square bracket control + // characters back to their literals. This is fine by the server, and + // makes these parameter strings easier to read. + $s = \str_replace('%5B', '[', $s); + + return \str_replace('%5D', ']', $s); } public static function normalizeId($id) { - if (is_array($id)) { + if (\is_array($id)) { $params = $id; $id = $params['id']; unset($params['id']); } else { $params = []; } + return [$id, $params]; } + + /** + * Returns UNIX timestamp in milliseconds. + * + * @return int current time in millis + */ + public static function currentTimeMillis() + { + return (int) \round(\microtime(true) * 1000); + } } diff --git a/plugins/stripe/lib/Webhook.php b/plugins/stripe/lib/Webhook.php index e0ab3021a8..b9db2d6c05 100644 --- a/plugins/stripe/lib/Webhook.php +++ b/plugins/stripe/lib/Webhook.php @@ -7,34 +7,36 @@ abstract class Webhook const DEFAULT_TOLERANCE = 300; /** - * Returns an Event instance using the provided JSON payload. Throws a - * \UnexpectedValueException if the payload is not valid JSON, and a - * \Stripe\SignatureVerificationException if the signature verification - * fails for any reason. + * Returns an Event instance using the provided JSON payload. Throws an + * Exception\UnexpectedValueException if the payload is not valid JSON, and + * an Exception\SignatureVerificationException if the signature + * verification fails for any reason. * - * @param string $payload the payload sent by Stripe. + * @param string $payload the payload sent by Stripe * @param string $sigHeader the contents of the signature header sent by - * Stripe. - * @param string $secret secret used to generate the signature. + * Stripe + * @param string $secret secret used to generate the signature * @param int $tolerance maximum difference allowed between the header's * timestamp and the current time - * @return \Stripe\Event the Event instance - * @throws \UnexpectedValueException if the payload is not valid JSON, - * @throws \Stripe\Error\SignatureVerification if the verification fails. + * + * @throws Exception\UnexpectedValueException if the payload is not valid JSON, + * @throws Exception\SignatureVerificationException if the verification fails + * + * @return Event the Event instance */ public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE) { - $data = json_decode($payload, true); - $jsonError = json_last_error(); - if ($data === null && $jsonError !== JSON_ERROR_NONE) { - $msg = "Invalid payload: $payload " - . "(json_last_error() was $jsonError)"; - throw new \UnexpectedValueException($msg); - } - $event = Event::constructFrom($data); - WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance); - return $event; + $data = \json_decode($payload, true); + $jsonError = \json_last_error(); + if (null === $data && \JSON_ERROR_NONE !== $jsonError) { + $msg = "Invalid payload: {$payload} " + . "(json_last_error() was {$jsonError})"; + + throw new Exception\UnexpectedValueException($msg); + } + + return Event::constructFrom($data); } } diff --git a/plugins/stripe/lib/WebhookEndpoint.php b/plugins/stripe/lib/WebhookEndpoint.php new file mode 100644 index 0000000000..96333d1324 --- /dev/null +++ b/plugins/stripe/lib/WebhookEndpoint.php @@ -0,0 +1,41 @@ +webhook + * endpoints via the API to be notified about events that happen in your Stripe + * account or connected accounts. + * + * Most users configure webhooks from the dashboard, which provides a + * user interface for registering and testing your webhook endpoints. + * + * Related guide: Setting up + * Webhooks. + * + * @property string $id Unique identifier for the object. + * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property null|string $api_version The API version events are rendered as for this webhook endpoint. + * @property null|string $application The ID of the associated Connect application. + * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. + * @property null|string $description An optional description of what the webhook is used for. + * @property string[] $enabled_events The list of events to enable for this endpoint. ['*'] indicates that all events are enabled, except those that require explicit selection. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property string $secret The endpoint's secret, used to generate webhook signatures. Only returned at creation. + * @property string $status The status of the webhook. It can be enabled or disabled. + * @property string $url The URL of the webhook endpoint. + */ +class WebhookEndpoint extends ApiResource +{ + const OBJECT_NAME = 'webhook_endpoint'; + + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Delete; + use ApiOperations\Retrieve; + use ApiOperations\Update; +} diff --git a/plugins/stripe/lib/WebhookSignature.php b/plugins/stripe/lib/WebhookSignature.php index 73e70dbd7d..1bb22db8fe 100644 --- a/plugins/stripe/lib/WebhookSignature.php +++ b/plugins/stripe/lib/WebhookSignature.php @@ -4,20 +4,22 @@ abstract class WebhookSignature { - const EXPECTED_SCHEME = "v1"; + const EXPECTED_SCHEME = 'v1'; /** - * Verifies the signature header sent by Stripe. Throws a - * SignatureVerification exception if the verification fails for any - * reason. + * Verifies the signature header sent by Stripe. Throws an + * Exception\SignatureVerificationException exception if the verification fails for + * any reason. * - * @param string $payload the payload sent by Stripe. + * @param string $payload the payload sent by Stripe * @param string $header the contents of the signature header sent by - * Stripe. - * @param string $secret secret used to generate the signature. + * Stripe + * @param string $secret secret used to generate the signature * @param int $tolerance maximum difference allowed between the header's * timestamp and the current time - * @throws \Stripe\Error\SignatureVerification if the verification fails. + * + * @throws Exception\SignatureVerificationException if the verification fails + * * @return bool */ public static function verifyHeader($payload, $header, $secret, $tolerance = null) @@ -25,46 +27,47 @@ public static function verifyHeader($payload, $header, $secret, $tolerance = nul // Extract timestamp and signatures from header $timestamp = self::getTimestamp($header); $signatures = self::getSignatures($header, self::EXPECTED_SCHEME); - if ($timestamp == -1) { - throw new Error\SignatureVerification( - "Unable to extract timestamp and signatures from header", - $header, - $payload + if (-1 === $timestamp) { + throw Exception\SignatureVerificationException::factory( + 'Unable to extract timestamp and signatures from header', + $payload, + $header ); } if (empty($signatures)) { - throw new Error\SignatureVerification( - "No signatures found with expected scheme", - $header, - $payload + throw Exception\SignatureVerificationException::factory( + 'No signatures found with expected scheme', + $payload, + $header ); } // Check if expected signature is found in list of signatures from // header - $signedPayload = "$timestamp.$payload"; + $signedPayload = "{$timestamp}.{$payload}"; $expectedSignature = self::computeSignature($signedPayload, $secret); $signatureFound = false; foreach ($signatures as $signature) { if (Util\Util::secureCompare($expectedSignature, $signature)) { $signatureFound = true; + break; } } if (!$signatureFound) { - throw new Error\SignatureVerification( - "No signatures found matching the expected signature for payload", - $header, - $payload + throw Exception\SignatureVerificationException::factory( + 'No signatures found matching the expected signature for payload', + $payload, + $header ); } // Check if timestamp is within tolerance - if (($tolerance > 0) && ((time() - $timestamp) > $tolerance)) { - throw new Error\SignatureVerification( - "Timestamp outside the tolerance zone", - $header, - $payload + if (($tolerance > 0) && (\abs(\time() - $timestamp) > $tolerance)) { + throw Exception\SignatureVerificationException::factory( + 'Timestamp outside the tolerance zone', + $payload, + $header ); } @@ -75,20 +78,22 @@ public static function verifyHeader($payload, $header, $secret, $tolerance = nul * Extracts the timestamp in a signature header. * * @param string $header the signature header + * * @return int the timestamp contained in the header, or -1 if no valid * timestamp is found */ private static function getTimestamp($header) { - $items = explode(",", $header); + $items = \explode(',', $header); foreach ($items as $item) { - $itemParts = explode("=", $item, 2); - if ($itemParts[0] == "t") { - if (!is_numeric($itemParts[1])) { + $itemParts = \explode('=', $item, 2); + if ('t' === $itemParts[0]) { + if (!\is_numeric($itemParts[1])) { return -1; } - return intval($itemParts[1]); + + return (int) ($itemParts[1]); } } @@ -99,18 +104,19 @@ private static function getTimestamp($header) * Extracts the signatures matching a given scheme in a signature header. * * @param string $header the signature header - * @param string $scheme the signature scheme to look for. - * @return array the list of signatures matching the provided scheme. + * @param string $scheme the signature scheme to look for + * + * @return array the list of signatures matching the provided scheme */ private static function getSignatures($header, $scheme) { $signatures = []; - $items = explode(",", $header); + $items = \explode(',', $header); foreach ($items as $item) { - $itemParts = explode("=", $item, 2); - if ($itemParts[0] == $scheme) { - array_push($signatures, $itemParts[1]); + $itemParts = \explode('=', $item, 2); + if (\trim($itemParts[0]) === $scheme) { + \array_push($signatures, $itemParts[1]); } } @@ -122,12 +128,13 @@ private static function getSignatures($header, $scheme) * * The current scheme used by Stripe ("v1") is HMAC/SHA-256. * - * @param string $payload the payload to sign. - * @param string $secret the secret used to generate the signature. - * @return string the signature as a string. + * @param string $payload the payload to sign + * @param string $secret the secret used to generate the signature + * + * @return string the signature as a string */ private static function computeSignature($payload, $secret) { - return hash_hmac("sha256", $payload, $secret); + return \hash_hmac('sha256', $payload, $secret); } } diff --git a/plugins/stripe/phpdoc.dist.xml b/plugins/stripe/phpdoc.dist.xml new file mode 100644 index 0000000000..b1ea92fadc --- /dev/null +++ b/plugins/stripe/phpdoc.dist.xml @@ -0,0 +1,31 @@ + + + + build/phpdoc + + + latest + + + lib + + api + + + php + + stripe-php + + +