Skip to content

Commit

Permalink
Merge pull request #612 from nickdnk/new_constants
Browse files Browse the repository at this point in the history
Implemented more constants
  • Loading branch information
ob-stripe authored Mar 22, 2019
2 parents 0af11ae + 52299f9 commit 6ce0343
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 8 deletions.
25 changes: 25 additions & 0 deletions lib/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions lib/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
31 changes: 30 additions & 1 deletion lib/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
32 changes: 28 additions & 4 deletions lib/Payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions lib/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
25 changes: 25 additions & 0 deletions lib/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
19 changes: 16 additions & 3 deletions lib/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions lib/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
10 changes: 10 additions & 0 deletions lib/Topup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions lib/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 6ce0343

Please sign in to comment.