Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added more constants, fixed more docs, added missing objects #481

Merged
merged 1 commit into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down
5 changes: 5 additions & 0 deletions lib/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -27,6 +31,7 @@
* @property string $last4
* @property StripeObject $metadata
* @property string $name
* @property string $recipient
* @property string $tokenization_method
*
* @package Stripe
Expand Down
48 changes: 48 additions & 0 deletions lib/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions lib/Discount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Stripe;

/**
* Class Discount
*
* @property string $object
* @property Coupon $coupon
* @property string $customer
* @property int $end
* @property int $start
* @property string $subscription
*
* @package Stripe
*/
class Discount extends StripeObject
{

const OBJECT_NAME = "discount";
}
2 changes: 1 addition & 1 deletion lib/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @property string $id
* @property string $object
* @property int $amount
* @property mixed $balance_transactions
* @property BalanceTransaction[] $balance_transactions
* @property string $charge
* @property int $created
* @property string $currency
Expand Down
2 changes: 2 additions & 0 deletions lib/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
* @property string $id
* @property string $object
* @property int $created
* @property string $filename
* @property string $purpose
* @property int $size
* @property string $type
* @property string $url
*
* @package Stripe
*/
Expand Down
5 changes: 4 additions & 1 deletion lib/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@
* @property int $attempt_count
* @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 mixed $discount
* @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
Expand Down
1 change: 1 addition & 0 deletions lib/InvoiceItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* @property int $quantity
* @property string $subscription
* @property string $subscription_item
* @property int $unit_amount
*
* @package Stripe
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @property string $customer
* @property string $email
* @property string $external_coupon_code
* @property mixed $items
* @property OrderItem[] $items
* @property bool $livemode
* @property StripeObject $metadata
* @property Collection $returns
Expand Down
22 changes: 22 additions & 0 deletions lib/OrderItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Stripe;

/**
* Class OrderItem
*
* @property string $object
* @property int $amount
* @property string $currency
* @property string $description
* @property string $parent
* @property int $quantity
* @property string $type
*
* @package Stripe
*/
class OrderItem extends StripeObject
{

const OBJECT_NAME = "order_item";
}
10 changes: 10 additions & 0 deletions lib/OrderReturn.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
/**
* Class OrderReturn
*
* @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
*
* @package Stripe
*/
class OrderReturn extends ApiResource
Expand Down
18 changes: 18 additions & 0 deletions lib/Payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ 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';

use ApiOperations\All;
use ApiOperations\Create;
use ApiOperations\Retrieve;
Expand Down
1 change: 1 addition & 0 deletions lib/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*
* @property string $id
* @property string $object
* @property bool $active
* @property string $aggregate_usage
* @property int $amount
* @property string $billing_scheme
Expand Down
9 changes: 9 additions & 0 deletions lib/SourceTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
/**
* Class SourceTransaction
*
* @property string $id
* @property string $object
* @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
Expand Down
7 changes: 4 additions & 3 deletions lib/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
* @property string $object
* @property float $application_fee_percent
* @property string $billing
* @property int $billing_cycle_anchor
* @property bool $cancel_at_period_end
* @property int $canceled_at
* @property int $created
* @property int current_period_end
* @property int current_period_start
* @property string $customer
* @property int $days_until_due
* @property mixed $discount
* @property Discount $discount
* @property int $ended_at
* @property Collection $items
* @property boolean $livemode
Expand Down Expand Up @@ -49,11 +50,11 @@ class Subscription extends ApiResource
*
* @link https://stripe.com/docs/api#subscription_object-status
*/
const STATUS_ACTIVE = 'active';
const STATUS_ACTIVE = 'active';
const STATUS_CANCELED = 'canceled';
const STATUS_PAST_DUE = 'past_due';
const STATUS_TRIALING = 'trialing';
const STATUS_UNPAID = 'unpaid';
const STATUS_UNPAID = 'unpaid';

public static function getSavedNestedResources()
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @property string $id
* @property string $object
* @property mixed $bank_account
* @property BankAccount $bank_account
* @property Card $card
* @property string $client_ip
* @property int $created
Expand Down
1 change: 1 addition & 0 deletions lib/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @property string $balance_transaction
* @property int $created
* @property string $currency
* @property string $description
* @property string $destination
* @property string $destination_payment
* @property bool $livemode
Expand Down
2 changes: 2 additions & 0 deletions lib/Util/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public static function convertToStripeObject($resp, $opts)
\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',
Expand All @@ -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',
Expand Down