Skip to content

Commit

Permalink
Merge pull request #911 from stripe/richardm-autogen-nested
Browse files Browse the repository at this point in the history
Codegen nested resources
  • Loading branch information
richardm-stripe authored Apr 3, 2020
2 parents 0d9692f + d423413 commit 151c6b7
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 89 deletions.
36 changes: 18 additions & 18 deletions lib/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@ public function deauthorize($clientId = null, $opts = null)
return OAuth::deauthorize($params, $opts);
}

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of persons
*/
public function persons($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/persons';
list($response, $opts) = $this->_request('get', $url, $params, $opts);
$obj = Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);

return $obj;
}

/**
* @param null|array $params
* @param null|array|string $opts
Expand Down Expand Up @@ -336,24 +354,6 @@ public static function createLoginLink($id, $params = null, $opts = null)

const PATH_PERSONS = '/persons';

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection the list of persons
*/
public function persons($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/persons';
list($response, $opts) = $this->_request('get', $url, $params, $opts);
$obj = Util\Util::convertToStripeObject($response, $opts);
$obj->setLastResponse($response);

return $obj;
}

/**
* @param string $id the ID of the account on which to retrieve the persons
* @param null|array $params
Expand Down
5 changes: 0 additions & 5 deletions lib/Capability.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ class Capability extends ApiResource

use ApiOperations\Update;

/**
* Possible string representations of a capability's status.
*
* @see https://stripe.com/docs/api/capabilities/object#capability_object-status
*/
const STATUS_ACTIVE = 'active';
const STATUS_INACTIVE = 'inactive';
const STATUS_PENDING = 'pending';
Expand Down
2 changes: 1 addition & 1 deletion lib/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @property null|string $dynamic_last4 (For tokenized numbers only.) The last four digits of the device account number.
* @property int $exp_month Two-digit number representing the card's expiration month.
* @property int $exp_year Four-digit number representing the card's expiration year.
* @property null|string $fingerprint Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example.
* @property null|string $fingerprint Uniquely identifies this particular card number. You can use this attribute to check whether two customers whove signed up with you are using the same card number,for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
* @property string $funding Card funding type. Can be <code>credit</code>, <code>debit</code>, <code>prepaid</code>, or <code>unknown</code>.
* @property string $last4 The last four digits of the card.
* @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.
Expand Down
2 changes: 1 addition & 1 deletion lib/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
* @property int $amount Amount intended to be collected by this payment. A positive integer representing how much to charge in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a> (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or <a href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">equivalent in charge currency</a>. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
* @property int $amount_refunded Amount in %s refunded (can be less than the amount attribute on the charge if a partial refund was issued).
* @property null|string|\Stripe\StripeObject $application ID of the Connect application that created the charge.
* @property null|string|\Stripe\ApplicationFee $application_fee The application fee (if any) for the charge. <a href="https://stripe.com/docs/connect/direct-charges#collecting-fees">See the Connect documentation</a> for details.
Expand Down
28 changes: 13 additions & 15 deletions lib/CreditNoteLineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
namespace Stripe;

/**
* Class InvoiceLineItem.
*
* @property string $id
* @property string $object
* @property int $amount
* @property string $description
* @property int $discount_amount
* @property string $invoice_line_item
* @property bool $livemode
* @property int $quantity
* @property array $tax_amounts
* @property array $tax_rates
* @property string $type
* @property null|int $unit_amount
* @property null|string $unit_amount_decimal
* @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 The integer amount in <strong>%s</strong> representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
* @property null|string $description Description of the item being credited.
* @property int $discount_amount The integer amount in <strong>%s</strong> representing the discount being credited for this line item.
* @property string $invoice_line_item ID of the invoice line item being credited
* @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 null|int $quantity The number of units of product being credited.
* @property \Stripe\StripeObject[] $tax_amounts The amount of tax calculated per tax rate for this line item
* @property \Stripe\TaxRate[] $tax_rates The tax rates which apply to the line item.
* @property string $type The type of the credit note line item, one of <code>invoice_line_item</code> or <code>custom_line_item</code>. When the type is <code>invoice_line_item</code> there is an additional <code>invoice_line_item</code> property on the resource the value of which is the id of the credited line item on the invoice.
* @property null|int $unit_amount The cost of each unit of product being credited.
* @property null|string $unit_amount_decimal Same as <code>unit_amount</code>, but contains a decimal value with at most 12 decimal places.
*/
class CreditNoteLineItem extends ApiResource
{
Expand Down
7 changes: 1 addition & 6 deletions lib/CustomerBalanceTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ class CustomerBalanceTransaction extends ApiResource
{
const OBJECT_NAME = 'customer_balance_transaction';

/**
* Possible string representations of a balance transaction's type.
*
* @see https://stripe.com/docs/api/customers/customer_balance_transaction_object#customer_balance_transaction_object-type
*/
const TYPE_ADJUSTEMENT = 'adjustment';
const TYPE_ADJUSTMENT = 'adjustment';
const TYPE_APPLIED_TO_INVOICE = 'applied_to_invoice';
const TYPE_CREDIT_NOTE = 'credit_note';
const TYPE_INITIAL = 'initial';
Expand Down
16 changes: 11 additions & 5 deletions lib/Issuing/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
/**
* When an <a href="https://stripe.com/docs/issuing">issued card</a> is used to
* make a purchase, an Issuing <code>Authorization</code> object is created. <a
* href="https://stripe.com/docs/issuing/authorizations">Authorizations</a> must be
* approved for the purchase to be completed successfully.
* href="https://stripe.com/docs/issuing/purchases/authorizations">Authorizations</a>
* must be approved for the purchase to be completed successfully.
*
* Related guide: <a href="https://stripe.com/docs/issuing/authorizations">Issued
* Card Authorizations</a>.
* Related guide: <a
* href="https://stripe.com/docs/issuing/purchases/authorizations">Issued Card
* Authorizations</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 $amount The total amount in the card's currency that was authorized or rejected.
* @property bool $approved Whether the authorization has been approved.
* @property string $authorization_method How the card details were provided.
* @property int $authorized_amount The amount that has been authorized. This will be <code>0</code> when the object is created, and increase after it has been approved.
Expand All @@ -21,15 +23,19 @@
* @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 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 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 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 in the local merchant_currency.
* @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 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 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 \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/authorizations/special_scenarios#incremental-authorizations">incremental authorization or partial capture</a>, you can look at request_history to see the previous states of the authorization.
* @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 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
Expand Down
1 change: 1 addition & 0 deletions lib/Issuing/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @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 name of the cardholder, printed on the card.
* @property null|\Stripe\StripeObject $pin Metadata about the PIN on the card.
* @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.
* @property null|\Stripe\StripeObject $shipping Where and how the card will be shipped.
Expand Down
6 changes: 3 additions & 3 deletions lib/Issuing/Cardholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*
* @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 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/authorizations">authorizations</a> documentation for more details.
* @property null|\Stripe\StripeObject $authorization_controls 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>business_entity</code> cardholder.
* @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.
Expand All @@ -25,7 +25,7 @@
* @property null|string $phone_number The cardholder's phone number.
* @property \Stripe\StripeObject $requirements
* @property string $status Specifies whether to permit authorizations on this cardholder's cards.
* @property string $type One of <code>individual</code> or <code>business_entity</code>.
* @property string $type One of <code>individual</code> or <code>company</code>.
*/
class Cardholder extends \Stripe\ApiResource
{
Expand Down
8 changes: 5 additions & 3 deletions lib/Issuing/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

/**
* As a <a href="https://stripe.com/docs/issuing">card issuer</a>, you can <a
* href="https://stripe.com/docs/issuing/disputes">dispute</a> transactions that
* you do not recognize, suspect to be fraudulent, or have some other issue.
* href="https://stripe.com/docs/issuing/purchases/disputes">dispute</a>
* transactions that you do not recognize, suspect to be fraudulent, or have some
* other issue.
*
* Related guide: <a href="https://stripe.com/docs/issuing/disputes">Disputing
* Related guide: <a
* href="https://stripe.com/docs/issuing/purchases/disputes">Disputing
* Transactions</a>
*
* @property string $id Unique identifier for the object.
Expand Down
5 changes: 3 additions & 2 deletions lib/Issuing/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
* purchase or refund, is represented by an Issuing <code>Transaction</code>
* object.
*
* Related guide: <a href="https://stripe.com/docs/issuing/transactions">Issued
* Card Transactions</a>.
* Related guide: <a
* href="https://stripe.com/docs/issuing/purchases/transactions">Issued Card
* Transactions</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.
Expand Down
Loading

0 comments on commit 151c6b7

Please sign in to comment.