Upgrade Stripe lib to 6.41 to support SetupIntent
This commit is contained in:
parent
8f2e781df6
commit
ac715b5147
@ -32,7 +32,7 @@ PSR/simple-cache ? Library for cache (used by PHPSp
|
||||
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
Sabre 3.2.2 BSD Yes DAV support
|
||||
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
||||
Stripe 6.35 MIT licence Yes Library for Stripe module
|
||||
Stripe 6.41 MIT licence Yes Library for Stripe module
|
||||
TCPDF 6.2.25 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
|
||||
@ -1,5 +1,45 @@
|
||||
# Changelog
|
||||
|
||||
## 6.41.0 - 2019-07-31
|
||||
* [#683](https://github.com/stripe/stripe-php/pull/683) Move the List Balance History API to `/v1/balance_transactions`
|
||||
|
||||
## 6.40.0 - 2019-06-27
|
||||
* [#675](https://github.com/stripe/stripe-php/pull/675) Add support for `SetupIntent` resource and APIs
|
||||
|
||||
## 6.39.2 - 2019-06-26
|
||||
* [#676](https://github.com/stripe/stripe-php/pull/676) Fix exception message in `CustomerBalanceTransaction::update()`
|
||||
|
||||
## 6.39.1 - 2019-06-25
|
||||
* [#674](https://github.com/stripe/stripe-php/pull/674) Add new constants for `collection_method` on `Invoice`
|
||||
|
||||
## 6.39.0 - 2019-06-24
|
||||
* [#673](https://github.com/stripe/stripe-php/pull/673) Enable request latency telemetry by default
|
||||
|
||||
## 6.38.0 - 2019-06-17
|
||||
* [#649](https://github.com/stripe/stripe-php/pull/649) Add support for `CustomerBalanceTransaction` resource and APIs
|
||||
|
||||
## 6.37.2 - 2019-06-17
|
||||
* [#671](https://github.com/stripe/stripe-php/pull/671) Add new PHPDoc
|
||||
* [#672](https://github.com/stripe/stripe-php/pull/672) Add constants for `submit_type` on Checkout `Session`
|
||||
|
||||
## 6.37.1 - 2019-06-14
|
||||
* [#670](https://github.com/stripe/stripe-php/pull/670) Add new PHPDoc
|
||||
|
||||
## 6.37.0 - 2019-05-23
|
||||
* [#663](https://github.com/stripe/stripe-php/pull/663) Add support for `radar.early_fraud_warning` resource
|
||||
|
||||
## 6.36.0 - 2019-05-22
|
||||
* [#661](https://github.com/stripe/stripe-php/pull/661) Add constants for new TaxId types
|
||||
* [#662](https://github.com/stripe/stripe-php/pull/662) Add constants for BalanceTransaction types
|
||||
|
||||
## 6.35.2 - 2019-05-20
|
||||
* [#655](https://github.com/stripe/stripe-php/pull/655) Add constants for payment intent statuses
|
||||
* [#659](https://github.com/stripe/stripe-php/pull/659) Fix PHPDoc for various nested Account actions
|
||||
* [#660](https://github.com/stripe/stripe-php/pull/660) Fix various PHPDoc
|
||||
|
||||
## 6.35.1 - 2019-05-20
|
||||
* [#658](https://github.com/stripe/stripe-php/pull/658) Use absolute value when checking timestamp tolerance
|
||||
|
||||
## 6.35.0 - 2019-05-14
|
||||
* [#651](https://github.com/stripe/stripe-php/pull/651) Add support for the Capability resource and APIs
|
||||
|
||||
|
||||
@ -6,7 +6,11 @@
|
||||
[](https://packagist.org/packages/stripe/stripe-php)
|
||||
[](https://coveralls.io/r/stripe/stripe-php?branch=master)
|
||||
|
||||
You can sign up for a Stripe account at https://stripe.com.
|
||||
The Stripe PHP library provides convenient access to the Stripe API from
|
||||
applications written in the PHP language. It includes a pre-defined set of
|
||||
classes for API resources that initialize themselves dynamically from API
|
||||
responses which makes it compatible with a wide range of versions of the Stripe
|
||||
API.
|
||||
|
||||
## Requirements
|
||||
|
||||
@ -56,7 +60,7 @@ echo $charge;
|
||||
|
||||
## Documentation
|
||||
|
||||
Please see https://stripe.com/docs/api for up-to-date documentation.
|
||||
See the [PHP API docs](https://stripe.com/docs/api/php#intro).
|
||||
|
||||
## Legacy Version Support
|
||||
|
||||
@ -179,6 +183,17 @@ an intermittent network problem:
|
||||
[Idempotency keys][idempotency-keys] are added to requests to guarantee that
|
||||
retries are safe.
|
||||
|
||||
### Request latency telemetry
|
||||
|
||||
By default, the library sends request latency telemetry to Stripe. These
|
||||
numbers help Stripe improve the overall latency of its API for all users.
|
||||
|
||||
You can disable this behavior if you prefer:
|
||||
|
||||
```php
|
||||
\Stripe\Stripe::setEnableTelemetry(false);
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Get [Composer][composer]. For example, on Mac OS:
|
||||
|
||||
@ -1 +1 @@
|
||||
6.35.0
|
||||
6.41.0
|
||||
|
||||
@ -76,6 +76,7 @@ require(dirname(__FILE__) . '/lib/CountrySpec.php');
|
||||
require(dirname(__FILE__) . '/lib/Coupon.php');
|
||||
require(dirname(__FILE__) . '/lib/CreditNote.php');
|
||||
require(dirname(__FILE__) . '/lib/Customer.php');
|
||||
require(dirname(__FILE__) . '/lib/CustomerBalanceTransaction.php');
|
||||
require(dirname(__FILE__) . '/lib/Discount.php');
|
||||
require(dirname(__FILE__) . '/lib/Dispute.php');
|
||||
require(dirname(__FILE__) . '/lib/EphemeralKey.php');
|
||||
@ -104,6 +105,7 @@ require(dirname(__FILE__) . '/lib/Payout.php');
|
||||
require(dirname(__FILE__) . '/lib/Person.php');
|
||||
require(dirname(__FILE__) . '/lib/Plan.php');
|
||||
require(dirname(__FILE__) . '/lib/Product.php');
|
||||
require(dirname(__FILE__) . '/lib/Radar/EarlyFraudWarning.php');
|
||||
require(dirname(__FILE__) . '/lib/Radar/ValueList.php');
|
||||
require(dirname(__FILE__) . '/lib/Radar/ValueListItem.php');
|
||||
require(dirname(__FILE__) . '/lib/Recipient.php');
|
||||
@ -112,6 +114,7 @@ require(dirname(__FILE__) . '/lib/Refund.php');
|
||||
require(dirname(__FILE__) . '/lib/Reporting/ReportRun.php');
|
||||
require(dirname(__FILE__) . '/lib/Reporting/ReportType.php');
|
||||
require(dirname(__FILE__) . '/lib/Review.php');
|
||||
require(dirname(__FILE__) . '/lib/SetupIntent.php');
|
||||
require(dirname(__FILE__) . '/lib/SKU.php');
|
||||
require(dirname(__FILE__) . '/lib/Sigma/ScheduledQueryRun.php');
|
||||
require(dirname(__FILE__) . '/lib/Source.php');
|
||||
|
||||
@ -152,8 +152,8 @@ class Account extends ApiResource
|
||||
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the capability belongs.
|
||||
* @param string|null $capabilityId The ID of the capability to retrieve.
|
||||
* @param string $id The ID of the account to which the capability belongs.
|
||||
* @param string $capabilityId The ID of the capability to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -165,8 +165,8 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the capability belongs.
|
||||
* @param string|null $capabilityId The ID of the capability to update.
|
||||
* @param string $id The ID of the account to which the capability belongs.
|
||||
* @param string $capabilityId The ID of the capability to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -178,7 +178,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to retrieve the capabilities.
|
||||
* @param string $id The ID of the account on which to retrieve the capabilities.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -190,7 +190,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to create the external account.
|
||||
* @param string $id The ID of the account on which to create the external account.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -202,8 +202,8 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to retrieve.
|
||||
* @param string $id The ID of the account to which the external account belongs.
|
||||
* @param string $externalAccountId The ID of the external account to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -215,8 +215,8 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to update.
|
||||
* @param string $id The ID of the account to which the external account belongs.
|
||||
* @param string $externalAccountId The ID of the external account to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -228,8 +228,8 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the external account belongs.
|
||||
* @param array|null $externalAccountId The ID of the external account to delete.
|
||||
* @param string $id The ID of the account to which the external account belongs.
|
||||
* @param string $externalAccountId The ID of the external account to delete.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -241,7 +241,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to retrieve the external accounts.
|
||||
* @param string $id The ID of the account on which to retrieve the external accounts.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -253,7 +253,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to create the login link.
|
||||
* @param string $id The ID of the account on which to create the login link.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -280,7 +280,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to create the person.
|
||||
* @param string $id The ID of the account on which to create the person.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -292,8 +292,8 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to retrieve.
|
||||
* @param string $id The ID of the account to which the person belongs.
|
||||
* @param string $personId The ID of the person to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -305,8 +305,8 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to update.
|
||||
* @param string $id The ID of the account to which the person belongs.
|
||||
* @param string $personId The ID of the person to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -318,8 +318,8 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account to which the person belongs.
|
||||
* @param string|null $personId The ID of the person to delete.
|
||||
* @param string $id The ID of the account to which the person belongs.
|
||||
* @param string $personId The ID of the person to delete.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
@ -331,7 +331,7 @@ class Account extends ApiResource
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the account on which to retrieve the persons.
|
||||
* @param string $id The ID of the account on which to retrieve the persons.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
|
||||
@ -31,11 +31,36 @@ class BalanceTransaction extends ApiResource
|
||||
use ApiOperations\Retrieve;
|
||||
|
||||
/**
|
||||
* @return string The class URL for this resource. It needs to be special
|
||||
* cased because it doesn't fit into the standard resource pattern.
|
||||
* Possible string representations of the type of balance transaction.
|
||||
* @link https://stripe.com/docs/api/balance/balance_transaction#balance_transaction_object-type
|
||||
*/
|
||||
public static function classUrl()
|
||||
{
|
||||
return "/v1/balance/history";
|
||||
}
|
||||
const TYPE_ADJUSTMENT = 'adjustment';
|
||||
const TYPE_ADVANCE = 'advance';
|
||||
const TYPE_ADVANCE_FUNDING = 'advance_funding';
|
||||
const TYPE_APPLICATION_FEE = 'application_fee';
|
||||
const TYPE_APPLICATION_FEE_REFUND = 'application_fee_refund';
|
||||
const TYPE_CHARGE = 'charge';
|
||||
const TYPE_CONNECT_COLLECTION_TRANSFER = 'connect_collection_transfer';
|
||||
const TYPE_ISSUING_AUTHORIZATION_HOLD = 'issuing_authorization_hold';
|
||||
const TYPE_ISSUING_AUTHORIZATION_RELEASE = 'issuing_authorization_release';
|
||||
const TYPE_ISSUING_TRANSACTION = 'issuing_transaction';
|
||||
const TYPE_PAYMENT = 'payment';
|
||||
const TYPE_PAYMENT_FAILURE_REFUND = 'payment_failure_refund';
|
||||
const TYPE_PAYMENT_REFUND = 'payment_refund';
|
||||
const TYPE_PAYOUT = 'payout';
|
||||
const TYPE_PAYOUT_CANCEL = 'payout_cancel';
|
||||
const TYPE_PAYOUT_FAILURE = 'payout_failure';
|
||||
const TYPE_REFUND = 'refund';
|
||||
const TYPE_REFUND_FAILURE = 'refund_failure';
|
||||
const TYPE_RESERVE_TRANSACTION = 'reserve_transaction';
|
||||
const TYPE_RESERVED_FUNDS = 'reserved_funds';
|
||||
const TYPE_STRIPE_FEE = 'stripe_fee';
|
||||
const TYPE_STRIPE_FX_FEE = 'stripe_fx_fee';
|
||||
const TYPE_TAX_FEE = 'tax_fee';
|
||||
const TYPE_TOPUP = 'topup';
|
||||
const TYPE_TOPUP_REVERSAL = 'topup_reversal';
|
||||
const TYPE_TRANSFER = 'transfer';
|
||||
const TYPE_TRANSFER_CANCEL = 'transfer_cancel';
|
||||
const TYPE_TRANSFER_FAILURE = 'transfer_failure';
|
||||
const TYPE_TRANSFER_REFUND = 'transfer_refund';
|
||||
}
|
||||
|
||||
@ -31,6 +31,16 @@ class BankAccount extends ApiResource
|
||||
use ApiOperations\Delete;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of the bank verification status.
|
||||
* @link https://stripe.com/docs/api/external_account_bank_accounts/object#account_bank_account_object-status
|
||||
*/
|
||||
const STATUS_NEW = 'new';
|
||||
const STATUS_VALIDATED = 'validated';
|
||||
const STATUS_VERIFIED = 'verified';
|
||||
const STATUS_VERIFICATION_FAILED = 'verification_failed';
|
||||
const STATUS_ERRORED = 'errored';
|
||||
|
||||
/**
|
||||
* @return string The instance URL for this resource. It needs to be special
|
||||
* cased because it doesn't fit into the standard resource pattern.
|
||||
|
||||
@ -11,7 +11,9 @@ namespace Stripe;
|
||||
* @property int $amount_refunded
|
||||
* @property string $application
|
||||
* @property string $application_fee
|
||||
* @property int $application_fee_amount
|
||||
* @property string $balance_transaction
|
||||
* @property mixed $billing_details
|
||||
* @property bool $captured
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
@ -30,6 +32,8 @@ namespace Stripe;
|
||||
* @property mixed $outcome
|
||||
* @property bool $paid
|
||||
* @property string $payment_intent
|
||||
* @property string $payment_method
|
||||
* @property mixed $payment_method_details
|
||||
* @property string $receipt_email
|
||||
* @property string $receipt_number
|
||||
* @property string $receipt_url
|
||||
@ -86,6 +90,7 @@ class Charge extends ApiResource
|
||||
const DECLINED_INVALID_PIN = 'invalid_pin';
|
||||
const DECLINED_ISSUER_NOT_AVAILABLE = 'issuer_not_available';
|
||||
const DECLINED_LOST_CARD = 'lost_card';
|
||||
const DECLINED_MERCHANT_BLACKLIST = 'merchant_blacklist';
|
||||
const DECLINED_NEW_ACCOUNT_INFORMATION_AVAILABLE = 'new_account_information_available';
|
||||
const DECLINED_NO_ACTION_TAKEN = 'no_action_taken';
|
||||
const DECLINED_NOT_PERMITTED = 'not_permitted';
|
||||
|
||||
@ -15,6 +15,7 @@ namespace Stripe\Checkout;
|
||||
* @property bool $livemode
|
||||
* @property string $payment_intent
|
||||
* @property string[] $payment_method_types
|
||||
* @property string $submit_type
|
||||
* @property string $subscription
|
||||
* @property string $success_url
|
||||
*
|
||||
@ -27,4 +28,13 @@ class Session extends \Stripe\ApiResource
|
||||
|
||||
use \Stripe\ApiOperations\Create;
|
||||
use \Stripe\ApiOperations\Retrieve;
|
||||
|
||||
/**
|
||||
* Possible string representations of submit type.
|
||||
* @link https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-submit_type
|
||||
*/
|
||||
const SUBMIT_TYPE_AUTO = 'auto';
|
||||
const SUBMIT_TYPE_BOOK = 'book';
|
||||
const SUBMIT_TYPE_DONATE = 'donate';
|
||||
const SUBMIT_TYPE_PAY = 'pay';
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ namespace Stripe;
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $amount
|
||||
* @property string $customer_balance_transaction
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property string $customer
|
||||
|
||||
@ -7,8 +7,8 @@ namespace Stripe;
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $account_balance
|
||||
* @property mixed $address
|
||||
* @property int $balance
|
||||
* @property string $created
|
||||
* @property string $currency
|
||||
* @property string $default_source
|
||||
@ -26,6 +26,7 @@ namespace Stripe;
|
||||
* @property mixed $shipping
|
||||
* @property Collection $sources
|
||||
* @property Collection $subscriptions
|
||||
* @property string $tax_exempt
|
||||
* @property Collection $tax_ids
|
||||
*
|
||||
* @package Stripe
|
||||
@ -61,6 +62,7 @@ class Customer extends ApiResource
|
||||
return $savedNestedResources;
|
||||
}
|
||||
|
||||
const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
|
||||
const PATH_SOURCES = '/sources';
|
||||
const PATH_TAX_IDS = '/tax_ids';
|
||||
|
||||
@ -264,4 +266,55 @@ class Customer extends ApiResource
|
||||
{
|
||||
return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the customer on which to create the balance transaction.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return ApiResource
|
||||
*/
|
||||
public static function createBalanceTransaction($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the customer to which the balance transaction belongs.
|
||||
* @param string|null $balanceTransactionId The ID of the balance transaction to retrieve.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return ApiResource
|
||||
*/
|
||||
public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the customer on which to update the balance transaction.
|
||||
* @param string|null $balanceTransactionId The ID of the balance transaction to update.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
*
|
||||
* @return ApiResource
|
||||
*/
|
||||
public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
|
||||
{
|
||||
return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $id The ID of the customer on which to retrieve the customer balance transactions.
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Collection The list of customer balance transactions.
|
||||
*/
|
||||
public static function allBalanceTransactions($id, $params = null, $opts = null)
|
||||
{
|
||||
return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
|
||||
}
|
||||
}
|
||||
|
||||
88
htdocs/includes/stripe/lib/CustomerBalanceTransaction.php
Normal file
88
htdocs/includes/stripe/lib/CustomerBalanceTransaction.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class CustomerBalanceTransaction
|
||||
*
|
||||
* @package Stripe
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property int $amount
|
||||
* @property string $credit_note
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property string $customer
|
||||
* @property string $description
|
||||
* @property int $ending_balance
|
||||
* @property string $invoice
|
||||
* @property bool $livemode
|
||||
* @property StripeObject $metadata
|
||||
* @property string $type
|
||||
*/
|
||||
class CustomerBalanceTransaction extends ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "customer_balance_transaction";
|
||||
|
||||
/**
|
||||
* Possible string representations of a balance transaction's type.
|
||||
* @link https://stripe.com/docs/api/customers/customer_balance_transaction_object#customer_balance_transaction_object-type
|
||||
*/
|
||||
const TYPE_ADJUSTEMENT = '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';
|
||||
|
||||
/**
|
||||
* @return string The API URL for this balance transaction.
|
||||
*/
|
||||
public function instanceUrl()
|
||||
{
|
||||
$id = $this['id'];
|
||||
$customer = $this['customer'];
|
||||
if (!$id) {
|
||||
throw new Error\InvalidRequest(
|
||||
"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 array|string|null $_opts
|
||||
*
|
||||
* @throws \Stripe\Error\InvalidRequest
|
||||
*/
|
||||
public static function retrieve($_id, $_opts = null)
|
||||
{
|
||||
$msg = "Customer Balance Transactions cannot be accessed without a customer ID. " .
|
||||
"Retrieve a balance transaction using Customer::retrieveBalanceTransaction('cus_123', 'cbtxn_123') instead.";
|
||||
throw new Error\InvalidRequest($msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $_id
|
||||
* @param array|null $_params
|
||||
* @param array|string|null $_options
|
||||
*
|
||||
* @throws \Stripe\Error\InvalidRequest
|
||||
*/
|
||||
public static function update($_id, $_params = null, $_options = null)
|
||||
{
|
||||
$msg = "Customer Balance Transactions cannot be accessed without a customer ID. " .
|
||||
"Update a balance transaction using Customer::updateBalanceTransaction('cus_123', 'cbtxn_123', \$params) instead.";
|
||||
throw new Error\InvalidRequest($msg, null);
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,7 @@ namespace Stripe;
|
||||
* @property string $billing
|
||||
* @property string $billing_reason
|
||||
* @property string $charge
|
||||
* @property string $collection_method
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property array $custom_fields
|
||||
@ -28,6 +29,7 @@ namespace Stripe;
|
||||
* @property string $customer_name
|
||||
* @property string $customer_phone
|
||||
* @property mixed $customer_shipping
|
||||
* @property string $customer_tax_exempt
|
||||
* @property array $customer_tax_ids
|
||||
* @property string $default_payment_method
|
||||
* @property string $default_source
|
||||
@ -77,6 +79,25 @@ class Invoice extends ApiResource
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* Possible string representations of the billing reason.
|
||||
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
|
||||
*/
|
||||
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';
|
||||
|
||||
/**
|
||||
* Possible string representations of the `collection_method` property.
|
||||
* @link https://stripe.com/docs/api/invoices/object#invoice_object-collection_method
|
||||
*/
|
||||
const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
|
||||
const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
|
||||
|
||||
/**
|
||||
* Possible string representations of the invoice status.
|
||||
* @link https://stripe.com/docs/api/invoices/object#invoice_object-status
|
||||
@ -88,23 +109,12 @@ class Invoice extends ApiResource
|
||||
const STATUS_VOID = 'void';
|
||||
|
||||
/**
|
||||
* Possible string representations of the billing.
|
||||
* Possible string representations of the `billing` property.
|
||||
* @deprecated Use `collection_method` instead.
|
||||
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing
|
||||
*/
|
||||
const BILLING_SEND_INVOICE = 'send_invoice';
|
||||
const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically';
|
||||
|
||||
/**
|
||||
* Possible string representations of the billing reason.
|
||||
* @link https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
|
||||
*/
|
||||
const BILLING_REASON_SUBSCRIPTION = 'subscription';
|
||||
const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create';
|
||||
const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle';
|
||||
const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update';
|
||||
const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold';
|
||||
const BILLING_REASON_MANUAL = 'manual';
|
||||
const BILLING_REASON_UPCOMING = 'upcoming';
|
||||
const BILLING_SEND_INVOICE = 'send_invoice';
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
|
||||
@ -17,6 +17,8 @@ namespace Stripe\Issuing;
|
||||
* @property string $dispute
|
||||
* @property bool $livemode
|
||||
* @property mixed $merchant_data
|
||||
* @property int $merchant_amount
|
||||
* @property string $merchant_currency
|
||||
* @property \Stripe\StripeObject $metadata
|
||||
* @property string $type
|
||||
*
|
||||
|
||||
@ -23,7 +23,7 @@ namespace Stripe;
|
||||
* @property Collection $returns
|
||||
* @property string $selected_shipping_method
|
||||
* @property mixed $shipping
|
||||
* @property mixed $shipping_methods
|
||||
* @property array $shipping_methods
|
||||
* @property string $status
|
||||
* @property mixed $status_transitions
|
||||
* @property int $updated
|
||||
|
||||
@ -50,6 +50,19 @@ class PaymentIntent extends ApiResource
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* These constants are possible representations of the status field.
|
||||
*
|
||||
* @link https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status
|
||||
*/
|
||||
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
|
||||
|
||||
@ -45,7 +45,7 @@ class Person extends ApiResource
|
||||
* Possible string representations of a person's gender.
|
||||
* @link https://stripe.com/docs/api/persons/object#person_object-gender
|
||||
*/
|
||||
const GENDER_MALE = 'male';
|
||||
const GENDER_MALE = 'male';
|
||||
const GENDER_FEMALE = 'female';
|
||||
|
||||
/**
|
||||
|
||||
36
htdocs/includes/stripe/lib/Radar/EarlyFraudWarning.php
Normal file
36
htdocs/includes/stripe/lib/Radar/EarlyFraudWarning.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe\Radar;
|
||||
|
||||
/**
|
||||
* Class EarlyFraudWarning
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property bool $actionable
|
||||
* @property string $charge
|
||||
* @property int $created
|
||||
* @property string $fraud_type
|
||||
* @property bool $livemode
|
||||
*
|
||||
* @package Stripe\Radar
|
||||
*/
|
||||
class EarlyFraudWarning extends \Stripe\ApiResource
|
||||
{
|
||||
const OBJECT_NAME = "radar.early_fraud_warning";
|
||||
|
||||
use \Stripe\ApiOperations\All;
|
||||
use \Stripe\ApiOperations\Retrieve;
|
||||
|
||||
/**
|
||||
* Possible string representations of an early fraud warning's fraud type.
|
||||
* @link https://stripe.com/docs/api/early_fraud_warnings/object#early_fraud_warning_object-fraud_type
|
||||
*/
|
||||
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';
|
||||
}
|
||||
75
htdocs/includes/stripe/lib/SetupIntent.php
Normal file
75
htdocs/includes/stripe/lib/SetupIntent.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class SetupIntent
|
||||
*
|
||||
* @property string $id
|
||||
* @property string $object
|
||||
* @property string $application
|
||||
* @property string $client_secret
|
||||
* @property int $created
|
||||
* @property string $customer
|
||||
* @property string $description
|
||||
* @property mixed $last_setup_error
|
||||
* @property bool $livemode
|
||||
* @property StripeObject $metadata
|
||||
* @property mixed $next_action
|
||||
* @property string $on_behalf_of
|
||||
* @property string $payment_method
|
||||
* @property string[] $payment_method_types
|
||||
* @property string $status
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class SetupIntent extends ApiResource
|
||||
{
|
||||
|
||||
const OBJECT_NAME = "setup_intent";
|
||||
|
||||
use ApiOperations\All;
|
||||
use ApiOperations\Create;
|
||||
use ApiOperations\Retrieve;
|
||||
use ApiOperations\Update;
|
||||
|
||||
/**
|
||||
* These constants are possible representations of the status field.
|
||||
*
|
||||
* @link https://stripe.com/docs/api/setup_intents/object#setup_intent_object-status
|
||||
*/
|
||||
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 array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return SetupIntent The canceled setup intent.
|
||||
*/
|
||||
public function cancel($params = null, $options = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/cancel';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $options);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return SetupIntent The confirmed setup intent.
|
||||
*/
|
||||
public function confirm($params = null, $options = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/confirm';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $options);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@ -18,6 +18,7 @@ namespace Stripe;
|
||||
* @property mixed $code_verification
|
||||
* @property int $created
|
||||
* @property string $currency
|
||||
* @property string $customer
|
||||
* @property mixed $eps
|
||||
* @property string $flow
|
||||
* @property mixed $giropay
|
||||
|
||||
@ -47,7 +47,7 @@ class Stripe
|
||||
public static $maxNetworkRetries = 0;
|
||||
|
||||
// @var boolean Whether client telemetry is enabled. Defaults to false.
|
||||
public static $enableTelemetry = false;
|
||||
public static $enableTelemetry = true;
|
||||
|
||||
// @var float Maximum delay between retries, in seconds
|
||||
private static $maxNetworkRetryDelay = 2.0;
|
||||
@ -55,7 +55,7 @@ class Stripe
|
||||
// @var float Initial delay between retries, in seconds
|
||||
private static $initialNetworkRetryDelay = 0.5;
|
||||
|
||||
const VERSION = '6.35.0';
|
||||
const VERSION = '6.41.0';
|
||||
|
||||
/**
|
||||
* @return string The API key used for requests.
|
||||
|
||||
@ -13,6 +13,7 @@ namespace Stripe;
|
||||
* @property mixed $billing_thresholds
|
||||
* @property bool $cancel_at_period_end
|
||||
* @property int $canceled_at
|
||||
* @property string $collection_method
|
||||
* @property int $created
|
||||
* @property int $current_period_end
|
||||
* @property int $current_period_start
|
||||
@ -31,6 +32,7 @@ namespace Stripe;
|
||||
* @property int $quantity
|
||||
* @property SubscriptionSchedule $schedule
|
||||
* @property int $start
|
||||
* @property int $start_date
|
||||
* @property string $status
|
||||
* @property float $tax_percent
|
||||
* @property int $trial_end
|
||||
|
||||
@ -12,7 +12,6 @@ namespace Stripe;
|
||||
* @property string $country
|
||||
* @property int $created
|
||||
* @property string $customer
|
||||
* @property bool $deleted
|
||||
* @property bool $livemode
|
||||
* @property string $type
|
||||
* @property string $value
|
||||
@ -27,10 +26,12 @@ class TaxId extends ApiResource
|
||||
|
||||
/**
|
||||
* Possible string representations of a tax id's type.
|
||||
* @link https://stripe.com/docs/api/customers/tax_id_object#tax_id_object-type
|
||||
* @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-type
|
||||
*/
|
||||
const TYPE_AU_ABN = 'au_abn';
|
||||
const TYPE_EU_VAT = 'eu_vat';
|
||||
const TYPE_IN_GST = 'in_gst';
|
||||
const TYPE_NO_VAT = 'no_vat';
|
||||
const TYPE_NZ_GST = 'nz_gst';
|
||||
const TYPE_UNKNOWN = 'unknown';
|
||||
|
||||
|
||||
@ -88,6 +88,7 @@ abstract class Util
|
||||
\Stripe\Coupon::OBJECT_NAME => 'Stripe\\Coupon',
|
||||
\Stripe\CreditNote::OBJECT_NAME => 'Stripe\\CreditNote',
|
||||
\Stripe\Customer::OBJECT_NAME => 'Stripe\\Customer',
|
||||
\Stripe\CustomerBalanceTransaction::OBJECT_NAME => 'Stripe\\CustomerBalanceTransaction',
|
||||
\Stripe\Discount::OBJECT_NAME => 'Stripe\\Discount',
|
||||
\Stripe\Dispute::OBJECT_NAME => 'Stripe\\Dispute',
|
||||
\Stripe\EphemeralKey::OBJECT_NAME => 'Stripe\\EphemeralKey',
|
||||
@ -117,6 +118,7 @@ abstract class Util
|
||||
\Stripe\Person::OBJECT_NAME => 'Stripe\\Person',
|
||||
\Stripe\Plan::OBJECT_NAME => 'Stripe\\Plan',
|
||||
\Stripe\Product::OBJECT_NAME => 'Stripe\\Product',
|
||||
\Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => 'Stripe\\Radar\\EarlyFraudWarning',
|
||||
\Stripe\Radar\ValueList::OBJECT_NAME => 'Stripe\\Radar\\ValueList',
|
||||
\Stripe\Radar\ValueListItem::OBJECT_NAME => 'Stripe\\Radar\\ValueListItem',
|
||||
\Stripe\Recipient::OBJECT_NAME => 'Stripe\\Recipient',
|
||||
@ -125,6 +127,7 @@ abstract class Util
|
||||
\Stripe\Reporting\ReportRun::OBJECT_NAME => 'Stripe\\Reporting\\ReportRun',
|
||||
\Stripe\Reporting\ReportType::OBJECT_NAME => 'Stripe\\Reporting\\ReportType',
|
||||
\Stripe\Review::OBJECT_NAME => 'Stripe\\Review',
|
||||
\Stripe\SetupIntent::OBJECT_NAME => 'Stripe\\SetupIntent',
|
||||
\Stripe\SKU::OBJECT_NAME => 'Stripe\\SKU',
|
||||
\Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => 'Stripe\\Sigma\\ScheduledQueryRun',
|
||||
\Stripe\Source::OBJECT_NAME => 'Stripe\\Source',
|
||||
|
||||
@ -24,6 +24,8 @@ abstract class Webhook
|
||||
*/
|
||||
public static function constructEvent($payload, $sigHeader, $secret, $tolerance = self::DEFAULT_TOLERANCE)
|
||||
{
|
||||
WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance);
|
||||
|
||||
$data = json_decode($payload, true);
|
||||
$jsonError = json_last_error();
|
||||
if ($data === null && $jsonError !== JSON_ERROR_NONE) {
|
||||
@ -33,8 +35,6 @@ abstract class Webhook
|
||||
}
|
||||
$event = Event::constructFrom($data);
|
||||
|
||||
WebhookSignature::verifyHeader($payload, $sigHeader, $secret, $tolerance);
|
||||
|
||||
return $event;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ abstract class WebhookSignature
|
||||
}
|
||||
|
||||
// Check if timestamp is within tolerance
|
||||
if (($tolerance > 0) && ((time() - $timestamp) > $tolerance)) {
|
||||
if (($tolerance > 0) && (abs(time() - $timestamp) > $tolerance)) {
|
||||
throw new Error\SignatureVerification(
|
||||
"Timestamp outside the tolerance zone",
|
||||
$header,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user