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

Add support for the Session resource and APIs on the BillingPortal namespace #920

Merged
merged 2 commits into from
Apr 22, 2020
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: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ matrix:

env:
global:
- STRIPE_MOCK_VERSION=0.79.0
- STRIPE_MOCK_VERSION=0.88.0
cache:
directories:
- $HOME/.composer/cache/files
Expand Down
1 change: 1 addition & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
require __DIR__ . '/lib/Balance.php';
require __DIR__ . '/lib/BalanceTransaction.php';
require __DIR__ . '/lib/BankAccount.php';
require __DIR__ . '/lib/BillingPortal/Session.php';
require __DIR__ . '/lib/BitcoinReceiver.php';
require __DIR__ . '/lib/BitcoinTransaction.php';
require __DIR__ . '/lib/Capability.php';
Expand Down
29 changes: 29 additions & 0 deletions lib/BillingPortal/Session.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Stripe\BillingPortal;

/**
* A Session describes the instantiation of the Self-serve Portal for a particular
* customer. By visiting the Self-serve Portal's URL, the customer can manage their
* subscriptions and view their invoice payment history. For security reasons,
* Sessions are short-lived and will expire if the customer does not visit the URL.
* Create Sessions on-demand.
*
* Related guide: <a
* href="https://stripe.com/docs/billing/subscriptions/integrating-self-serve">Self-serve
* Portal</a>.
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $customer The ID of the customer for this session.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $return_url The URL to which Stripe should send customers when they click on the link to return to your website.
* @property string $url The short-lived URL of the session giving customers access to the self-serve portal.
*/
class Session extends \Stripe\ApiResource
{
const OBJECT_NAME = 'billing_portal.session';

use \Stripe\ApiOperations\Create;
}
10 changes: 1 addition & 9 deletions lib/Issuing/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,22 @@
* @property int $amount The total amount that was authorized or rejected. This amount is in the card's currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property bool $approved Whether the authorization has been approved.
* @property string $authorization_method How the card details were provided.
* @property int $authorized_amount [DEPRECATED] The amount that has been authorized. This will be <code>0</code> when the object is created, and increase after it has been approved.
* @property string $authorized_currency [DEPRECATED] The currency that was presented to the cardholder for the authorization. Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this authorization.
* @property \Stripe\Issuing\Card $card You can <a href="https://stripe.com/docs/issuing/cards">create physical or virtual cards</a> that are issued to cardholders.
* @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this authorization belongs.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property int $held_amount [DEPRECATED] The amount the authorization is expected to be in <code>held_currency</code>. When Stripe holds funds from you, this is the amount reserved for the authorization. This will be <code>0</code> when the object is created, and increase after it has been approved. For multi-currency transactions, <code>held_amount</code> can be used to determine the expected exchange rate.
* @property string $held_currency [DEPRECATED] The currency of the <a href="https://stripe.com/docs/api#issuing_authorization_object-held_amount">held amount</a>. This will always be the card currency.
* @property bool $is_held_amount_controllable [DEPRECATED] If set <code>true</code>, you may provide <a href="https://stripe.com/docs/api/issuing/authorizations/approve#approve_issuing_authorization-held_amount">held_amount</a> to control how much to hold for the authorization.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property int $merchant_amount The total amount that was authorized or rejected. This amount is in the <code>merchant_currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
* @property string $merchant_currency The currency that was presented to the cardholder for the authorization. Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property \Stripe\StripeObject $merchant_data
* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property int $pending_authorized_amount [DEPRECATED] The amount the user is requesting to be authorized. This field will only be non-zero during an <code>issuing_authorization.request</code> webhook.
* @property int $pending_held_amount [DEPRECATED] The additional amount Stripe will hold if the authorization is approved. This field will only be non-zero during an <code>issuing_authorization.request</code> webhook.
* @property null|\Stripe\StripeObject $pending_request The pending authorization request. This field will only be non-null during an <code>issuing_authorization.request</code> webhook.
* @property \Stripe\StripeObject[] $request_history History of every time the authorization was approved/denied (whether approved/denied by you directly, or by Stripe based on your authorization_controls). If the merchant changes the authorization by performing an <a href="https://stripe.com/docs/issuing/purchases/authorizations">incremental authorization or partial capture</a>, you can look at request_history to see the previous states of the authorization.
* @property \Stripe\StripeObject[] $request_history History of every time the authorization was approved/denied (whether approved/denied by you directly or by Stripe based on your <code>spending_controls</code>). If the merchant changes the authorization by performing an <a href="https://stripe.com/docs/issuing/purchases/authorizations">incremental authorization or partial capture</a>, you can look at this field to see the previous states of the authorization.
* @property string $status The current status of the authorization in its lifecycle.
* @property \Stripe\Issuing\Transaction[] $transactions List of <a href="https://stripe.com/docs/api/issuing/transactions">transactions</a> associated with this authorization.
* @property \Stripe\StripeObject $verification_data
* @property null|string $wallet What, if any, digital wallet was used for this authorization. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>.
* @property null|string $wallet_provider [DEPRECATED] What, if any, digital wallet was used for this authorization. One of <code>apple_pay</code>, <code>google_pay</code>, or <code>samsung_pay</code>.
*/
class Authorization extends \Stripe\ApiResource
{
Expand Down
5 changes: 2 additions & 3 deletions lib/Issuing/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property \Stripe\StripeObject $authorization_controls
* @property string $brand The brand of the card.
* @property null|string $cancellation_reason The reason why the card was canceled.
* @property \Stripe\Issuing\Cardholder $cardholder <p>An Issuing <code>Cardholder</code> object represents an individual or business entity who is <a href="https://stripe.com/docs/issuing">issued</a> cards.</p><p>Related guide: <a href="https://stripe.com/docs/issuing/cards#create-cardholder">How to create a Cardholder</a></p>
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property string $cvc The card's CVC. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with <a href="https://stripe.com/docs/api/expanding_objects">the <code>expand</code> parameter</a>. Additionally, it's only available via the <a href="https://stripe.com/docs/api/issuing/cards/retrieve">&quot;Retrieve a card&quot; endpoint</a>, not via &quot;List all cards&quot; or any other endpoint.
* @property int $exp_month The expiration month of the card.
* @property int $exp_year The expiration year of the card.
* @property string $last4 The last 4 digits of the card number.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $name [DEPRECATED] The name of the cardholder, printed on the card. Refer to <code>cardholder.name</code> instead.
* @property null|\Stripe\StripeObject $pin Metadata about the PIN on the card.
* @property string $number The full unredacted card number. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with <a href="https://stripe.com/docs/api/expanding_objects">the <code>expand</code> parameter</a>. Additionally, it's only available via the <a href="https://stripe.com/docs/api/issuing/cards/retrieve">&quot;Retrieve a card&quot; endpoint</a>, not via &quot;List all cards&quot; or any other endpoint.
* @property null|string|\Stripe\Issuing\Card $replaced_by The latest card that replaces this card, if any.
* @property null|string|\Stripe\Issuing\Card $replacement_for The card this card replaces, if any.
* @property null|string $replacement_reason The reason why the previous card needed to be replaced.
Expand Down
2 changes: 0 additions & 2 deletions lib/Issuing/Cardholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $authorization_controls [DEPRECATED] Spending rules that give you some control over how this cardholder's cards can be used. Refer to our <a href="https://stripe.com/docs/issuing/purchases/authorizations">authorizations</a> documentation for more details.
* @property \Stripe\StripeObject $billing
* @property null|\Stripe\StripeObject $company Additional information about a <code>company</code> cardholder.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string $email The cardholder's email address.
* @property null|\Stripe\StripeObject $individual Additional information about an <code>individual</code> cardholder.
* @property bool $is_default [DEPRECATED] Whether or not this cardholder is the default cardholder.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $name The cardholder's name. This will be printed on cards issued to them.
Expand Down
8 changes: 0 additions & 8 deletions lib/Issuing/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,7 @@
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property int $amount Disputed amount. Usually the amount of the <code>disputed_transaction</code>, but can differ (usually because of currency fluctuation or because only part of the order is disputed).
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency The currency the <code>disputed_transaction</code> was made in.
* @property string|\Stripe\Issuing\Transaction $disputed_transaction The transaction being disputed.
* @property \Stripe\StripeObject $evidence
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property string $reason Reason for this dispute. One of <code>duplicate</code>, <code>product_not_received</code>, <code>fraudulent</code>, or <code>other</code>.
* @property string $status Current status of dispute. One of <code>unsubmitted</code>, <code>under_review</code>, <code>won</code>, or <code>lost</code>.
*/
class Dispute extends \Stripe\ApiResource
{
Expand Down
1 change: 0 additions & 1 deletion lib/Issuing/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this transaction belongs.
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property null|string|\Stripe\Issuing\Dispute $dispute If you've disputed the transaction, the ID of the dispute.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property int $merchant_amount The amount that the merchant will receive, denominated in <code>merchant_currency</code> and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. It will be different from <code>amount</code> if the merchant is taking payment in a different currency.
* @property string $merchant_currency The currency with which the merchant is taking payment.
Expand Down
2 changes: 1 addition & 1 deletion lib/Payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @property string $method The method used to send this payout, which can be <code>standard</code> or <code>instant</code>. <code>instant</code> is only supported for payouts to debit cards. (See <a href="https://stripe.com/blog/instant-payouts-for-marketplaces">Instant payouts for marketplaces</a> for more information.)
* @property string $source_type The source balance this payout came from. One of <code>card</code>, <code>fpx</code>, or <code>bank_account</code>.
* @property null|string $statement_descriptor Extra information about a payout to be displayed on the user's bank statement.
* @property string $status Current status of the payout (<code>paid</code>, <code>pending</code>, <code>in_transit</code>, <code>canceled</code> or <code>failed</code>). A payout will be <code>pending</code> until it is submitted to the bank, at which point it becomes <code>in_transit</code>. It will then change to <code>paid</code> if the transaction goes through. If it does not go through successfully, its status will change to <code>failed</code> or <code>canceled</code>.
* @property string $status Current status of the payout: <code>paid</code>, <code>pending</code>, <code>in_transit</code>, <code>canceled</code> or <code>failed</code>. A payout is <code>pending</code> until it is submitted to the bank, when it becomes <code>in_transit</code>. The status then changes to <code>paid</code> if the transaction goes through, or to <code>failed</code> or <code>canceled</code> (within 5 business days). Some failed payouts may initially show as <code>paid</code> but then change to <code>failed</code>.
* @property string $type Can be <code>bank_account</code> or <code>card</code>.
*/
class Payout extends ApiResource
Expand Down
7 changes: 3 additions & 4 deletions lib/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

/**
* Plans define the base price, currency, and billing cycle for subscriptions. For
* example, you might have a &lt;currency&gt;5&lt;/currency&gt;/month plan that
* provides limited access to your products, and a
* &lt;currency&gt;15&lt;/currency&gt;/month plan that allows full access.
* example, you might have a $5/month plan that provides limited access to your
* products, and a $15/month plan that allows full access.
*
* Related guides: <a
* href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up
Expand All @@ -16,7 +15,7 @@
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property bool $active Whether the plan is currently available for new subscriptions.
* @property bool $active Whether the plan can be used for new purchases.
* @property null|string $aggregate_usage Specifies a usage aggregation strategy for plans of <code>usage_type=metered</code>. Allowed values are <code>sum</code> for summing up all usage during a period, <code>last_during_period</code> for using the last usage record reported within a period, <code>last_ever</code> for using the last usage record ever (across period bounds) or <code>max</code> which uses the usage record with the maximum reported usage during a period. Defaults to <code>sum</code>.
* @property null|int $amount The amount in %s to be charged on the interval specified.
* @property null|string $amount_decimal Same as <code>amount</code>, but contains a decimal value with at most 12 decimal places.
Expand Down
2 changes: 1 addition & 1 deletion lib/SubscriptionItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @property null|\Stripe\StripeObject $billing_thresholds Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
* @property \Stripe\Plan $plan <p>Plans define the base price, currency, and billing cycle for subscriptions. For example, you might have a &lt;currency&gt;5&lt;/currency&gt;/month plan that provides limited access to your products, and a &lt;currency&gt;15&lt;/currency&gt;/month plan that allows full access.</p><p>Related guides: <a href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up a subscription</a> and more about <a href="https://stripe.com/docs/billing/subscriptions/products-and-plans">products and plans</a>.</p>
* @property \Stripe\Plan $plan <p>Plans define the base price, currency, and billing cycle for subscriptions. For example, you might have a $5/month plan that provides limited access to your products, and a $15/month plan that allows full access.</p><p>Related guides: <a href="https://stripe.com/docs/billing/subscriptions/set-up-subscription">Set up a subscription</a> and more about <a href="https://stripe.com/docs/billing/subscriptions/products-and-plans">products and plans</a>.</p>
* @property int $quantity The <a href="https://stripe.com/docs/subscriptions/quantities">quantity</a> of the plan to which the customer should be subscribed.
* @property string $subscription The <code>subscription</code> this <code>subscription_item</code> belongs to.
* @property null|\Stripe\TaxRate[] $tax_rates The tax rates which apply to this <code>subscription_item</code>. When set, the <code>default_tax_rates</code> on the subscription do not apply to this <code>subscription_item</code>.
Expand Down
Loading