From e038ff7e441c8137888d6b5081317ddf6489a862 Mon Sep 17 00:00:00 2001 From: Nicolai Cornelis Date: Thu, 31 May 2018 01:37:15 +0200 Subject: [PATCH] Added Discount and OrderItem objects Added charge decline code constants to Charge Added payout failure code constants to Payout Indented subscription constants like elsewhere Corrected alphabetical order of constants in Payout Updated phpdocs across the board --- init.php | 2 ++ lib/Card.php | 5 ++++ lib/Charge.php | 48 +++++++++++++++++++++++++++++++++++++++ lib/Customer.php | 2 +- lib/Discount.php | 21 +++++++++++++++++ lib/Dispute.php | 2 +- lib/FileUpload.php | 2 ++ lib/Invoice.php | 5 +++- lib/InvoiceItem.php | 1 + lib/Order.php | 2 +- lib/OrderItem.php | 22 ++++++++++++++++++ lib/OrderReturn.php | 10 ++++++++ lib/Payout.php | 18 +++++++++++++++ lib/Plan.php | 1 + lib/SourceTransaction.php | 9 ++++++++ lib/Subscription.php | 7 +++--- lib/Token.php | 2 +- lib/Transfer.php | 1 + lib/Util/Util.php | 2 ++ 19 files changed, 154 insertions(+), 8 deletions(-) create mode 100644 lib/Discount.php create mode 100644 lib/OrderItem.php diff --git a/init.php b/init.php index ef52ee94b..1aa08b402 100644 --- a/init.php +++ b/init.php @@ -70,6 +70,7 @@ require(dirname(__FILE__) . '/lib/CountrySpec.php'); require(dirname(__FILE__) . '/lib/Coupon.php'); require(dirname(__FILE__) . '/lib/Customer.php'); +require(dirname(__FILE__) . '/lib/Discount.php'); require(dirname(__FILE__) . '/lib/Dispute.php'); require(dirname(__FILE__) . '/lib/EphemeralKey.php'); require(dirname(__FILE__) . '/lib/Event.php'); @@ -81,6 +82,7 @@ require(dirname(__FILE__) . '/lib/IssuerFraudRecord.php'); require(dirname(__FILE__) . '/lib/LoginLink.php'); require(dirname(__FILE__) . '/lib/Order.php'); +require(dirname(__FILE__) . '/lib/OrderItem.php'); require(dirname(__FILE__) . '/lib/OrderReturn.php'); require(dirname(__FILE__) . '/lib/Payout.php'); require(dirname(__FILE__) . '/lib/Plan.php'); diff --git a/lib/Card.php b/lib/Card.php index 09f5511aa..686080ee8 100644 --- a/lib/Card.php +++ b/lib/Card.php @@ -7,6 +7,7 @@ * * @property string $id * @property string $object + * @property string $account * @property string $address_city * @property string $address_country * @property string $address_line1 @@ -15,10 +16,13 @@ * @property string $address_state * @property string $address_zip * @property string $address_zip_check + * @property array $available_payout_methods * @property string $brand * @property string $country + * @property string $currency * @property string $customer * @property string $cvc_check + * @property bool $default_for_currency * @property string $dynamic_last4 * @property int $exp_month * @property int $exp_year @@ -27,6 +31,7 @@ * @property string $last4 * @property StripeObject $metadata * @property string $name + * @property string $recipient * @property string $tokenization_method * * @package Stripe diff --git a/lib/Charge.php b/lib/Charge.php index cd925eeb6..96988f61a 100644 --- a/lib/Charge.php +++ b/lib/Charge.php @@ -54,6 +54,54 @@ class Charge extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; + /** + * 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 + */ + 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_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'; + /** * @param array|null $params * @param array|string|null $options diff --git a/lib/Customer.php b/lib/Customer.php index fd73fe895..f44872c4f 100644 --- a/lib/Customer.php +++ b/lib/Customer.php @@ -14,7 +14,7 @@ * @property string $default_source * @property bool $delinquent * @property string $description - * @property mixed $discount + * @property Discount $discount * @property string $email * @property string $invoice_prefix * @property bool $livemode diff --git a/lib/Discount.php b/lib/Discount.php new file mode 100644 index 000000000..a72d12bc6 --- /dev/null +++ b/lib/Discount.php @@ -0,0 +1,21 @@ + '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', @@ -96,6 +97,7 @@ public static function convertToStripeObject($resp, $opts) \Stripe\IssuerFraudRecord::OBJECT_NAME => 'Stripe\\IssuerFraudRecord', \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\Payout::OBJECT_NAME => 'Stripe\\Payout', \Stripe\Plan::OBJECT_NAME => 'Stripe\\Plan',