From 52299f97b88b977150e11d934330651b32d99a1d Mon Sep 17 00:00:00 2001 From: Nicolai Cornelis Date: Fri, 22 Mar 2019 02:06:08 +0100 Subject: [PATCH] Constants --- lib/Card.php | 25 +++++++++++++++++++++++++ lib/Charge.php | 8 ++++++++ lib/Dispute.php | 1 + lib/Invoice.php | 31 ++++++++++++++++++++++++++++++- lib/Payout.php | 32 ++++++++++++++++++++++++++++---- lib/Product.php | 7 +++++++ lib/Refund.php | 25 +++++++++++++++++++++++++ lib/Review.php | 19 ++++++++++++++++--- lib/Token.php | 9 +++++++++ lib/Topup.php | 10 ++++++++++ lib/Transfer.php | 9 +++++++++ 11 files changed, 168 insertions(+), 8 deletions(-) diff --git a/lib/Card.php b/lib/Card.php index 1a18fc5af..40de733e7 100644 --- a/lib/Card.php +++ b/lib/Card.php @@ -44,6 +44,31 @@ class Card extends ApiResource use ApiOperations\Delete; use ApiOperations\Update; + /** + * Possible string representations of the CVC check status. + * @link 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. + * @link 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. + * @link 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 diff --git a/lib/Charge.php b/lib/Charge.php index 00288d6a5..832a07c7c 100644 --- a/lib/Charge.php +++ b/lib/Charge.php @@ -105,6 +105,14 @@ class Charge extends ApiResource const DECLINED_TRY_AGAIN_LATER = 'try_again_later'; const DECLINED_WITHDRAWAL_COUNT_LIMIT_EXCEEDED = 'withdrawal_count_limit_exceeded'; + /** + * Possible string representations of the status of the charge. + * @link https://stripe.com/docs/api/charges/object#charge_object-status + */ + const STATUS_FAILED = 'failed'; + const STATUS_PENDING = 'pending'; + const STATUS_SUCCEEDED = 'succeeded'; + /** * @param array|null $params * @param array|string|null $options diff --git a/lib/Dispute.php b/lib/Dispute.php index c4a956676..2d58daa38 100644 --- a/lib/Dispute.php +++ b/lib/Dispute.php @@ -36,6 +36,7 @@ class Dispute extends ApiResource * @link https://stripe.com/docs/api#dispute_object */ 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'; diff --git a/lib/Invoice.php b/lib/Invoice.php index e5b16f37a..2740959cd 100644 --- a/lib/Invoice.php +++ b/lib/Invoice.php @@ -10,7 +10,7 @@ * @property int $amount_due * @property int $amount_paid * @property int $amount_remaining - * @property int $application_fee + * @property int $application_fee_amount * @property int $attempt_count * @property bool $attempted * @property bool $auto_advance @@ -64,6 +64,35 @@ class Invoice extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; + /** + * Possible string representations of the invoice status. + * @link https://stripe.com/docs/api/invoices/object#invoice_object-status + */ + const STATUS_DRAFT = 'draft'; + const STATUS_OPEN = 'open'; + const STATUS_PAID = 'paid'; + const STATUS_UNCOLLECTIBLE = 'uncollectible'; + const STATUS_VOID = 'void'; + + /** + * Possible string representations of the billing. + * @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'; + /** * @param array|null $params * @param array|string|null $opts diff --git a/lib/Payout.php b/lib/Payout.php index daef97ff9..365d7e47e 100644 --- a/lib/Payout.php +++ b/lib/Payout.php @@ -33,6 +33,11 @@ class Payout extends ApiResource const OBJECT_NAME = "payout"; + use ApiOperations\All; + use ApiOperations\Create; + use ApiOperations\Retrieve; + use ApiOperations\Update; + /** * Types of payout failure codes. * @link https://stripe.com/docs/api#payout_failures @@ -51,10 +56,29 @@ class Payout extends ApiResource const FAILURE_NO_ACCOUNT = 'no_account'; const FAILURE_UNSUPPORTED_CARD = 'unsupported_card'; - use ApiOperations\All; - use ApiOperations\Create; - use ApiOperations\Retrieve; - use ApiOperations\Update; + /** + * Possible string representations of the payout methods. + * @link https://stripe.com/docs/api/payouts/object#payout_object-method + */ + const METHOD_STANDARD = 'standard'; + const METHOD_INSTANT = 'instant'; + + /** + * Possible string representations of the status of the payout. + * @link https://stripe.com/docs/api/payouts/object#payout_object-status + */ + const STATUS_CANCELED = 'canceled'; + const STATUS_IN_TRANSIT = 'in_transit'; + const STATUS_FAILED = 'failed'; + const STATUS_PAID = 'paid'; + const STATUS_PENDING = 'pending'; + + /** + * Possible string representations of the type of payout. + * @link https://stripe.com/docs/api/payouts/object#payout_object-type + */ + const TYPE_BANK_ACCOUNT = 'bank_account'; + const TYPE_CARD = 'card'; /** * @return Payout The canceled payout. diff --git a/lib/Product.php b/lib/Product.php index 1d718d503..cb27ef42d 100644 --- a/lib/Product.php +++ b/lib/Product.php @@ -37,4 +37,11 @@ class Product extends ApiResource use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; + + /** + * Possible string representations of the type of product. + * @link https://stripe.com/docs/api/service_products/object#service_product_object-type + */ + const TYPE_GOOD = 'good'; + const TYPE_SERVICE = 'service'; } diff --git a/lib/Refund.php b/lib/Refund.php index 396f06fc7..6f3fdfaf4 100644 --- a/lib/Refund.php +++ b/lib/Refund.php @@ -33,4 +33,29 @@ class Refund extends ApiResource use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; + + /** + * Possible string representations of the failure reason. + * @link https://stripe.com/docs/api/refunds/object#refund_object-failure_reason + */ + const FAILURE_REASON = 'expired_or_canceled_card'; + const FAILURE_REASON_LOST_OR_STOLEN_CARD = 'lost_or_stolen_card'; + const FAILURE_REASON_UNKNOWN = 'unknown'; + + /** + * Possible string representations of the refund reason. + * @link https://stripe.com/docs/api/refunds/object#refund_object-reason + */ + const REASON_DUPLICATE = 'duplicate'; + const REASON_FRAUDULENT = 'fraudulent'; + const REASON_REQUESTED_BY_CUSTOMER = 'requested_by_customer'; + + /** + * Possible string representations of the refund status. + * @link https://stripe.com/docs/api/refunds/object#refund_object-status + */ + const STATUS_CANCELED = 'canceled'; + const STATUS_FAILED = 'failed'; + const STATUS_PENDING = 'pending'; + const STATUS_SUCCEEDED = 'succeeded'; } diff --git a/lib/Review.php b/lib/Review.php index 2698b37fc..a2fd5d06d 100644 --- a/lib/Review.php +++ b/lib/Review.php @@ -22,12 +22,25 @@ * * @package Stripe */ -class Review extends \Stripe\ApiResource +class Review extends ApiResource { const OBJECT_NAME = "review"; - use \Stripe\ApiOperations\All; - use \Stripe\ApiOperations\Retrieve; + 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. + * @link 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 array|string|null $options diff --git a/lib/Token.php b/lib/Token.php index 91abf7abc..989219fc7 100644 --- a/lib/Token.php +++ b/lib/Token.php @@ -24,4 +24,13 @@ class Token extends ApiResource use ApiOperations\Create; use ApiOperations\Retrieve; + + /** + * Possible string representations of the token type. + * @link https://stripe.com/docs/api/tokens/object#token_object-type + */ + const TYPE_ACCOUNT = 'account'; + const TYPE_BANK_ACCOUNT = 'bank_account'; + const TYPE_CARD = 'card'; + const TYPE_PII = 'pii'; } diff --git a/lib/Topup.php b/lib/Topup.php index 29914665a..9ad96670a 100644 --- a/lib/Topup.php +++ b/lib/Topup.php @@ -34,6 +34,16 @@ class Topup extends ApiResource use ApiOperations\Retrieve; use ApiOperations\Update; + /** + * Possible string representations of the status of the top-up. + * @link https://stripe.com/docs/api/topups/object#topup_object-status + */ + 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 diff --git a/lib/Transfer.php b/lib/Transfer.php index 5a173fad2..7fcca2255 100644 --- a/lib/Transfer.php +++ b/lib/Transfer.php @@ -38,6 +38,15 @@ class Transfer extends ApiResource const PATH_REVERSALS = '/reversals'; + /** + * Possible string representations of the source type of the transfer. + * @link https://stripe.com/docs/api/transfers/object#transfer_object-source_type + */ + 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. */