Skip to content

Commit

Permalink
More accurate handling of deleted resources and required/optional fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rattrayalex-stripe committed Dec 20, 2019
1 parent 89f905b commit b56f772
Show file tree
Hide file tree
Showing 39 changed files with 225 additions and 121 deletions.
23 changes: 13 additions & 10 deletions types/2019-12-03/Accounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ declare namespace Stripe {
*/
business_type: string | null;

capabilities: Account.Capabilities;
capabilities?: Account.Capabilities;

/**
* Whether the account can create live charges.
*/
charges_enabled: boolean;

company: Account.Company;
company?: Account.Company;

/**
* The account's country.
Expand All @@ -40,7 +40,7 @@ declare namespace Stripe {
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created: number;
created?: number;

/**
* Three-letter ISO currency code representing the default currency for the account. This must be a currency that [Stripe supports in the account's country](https://stripe.com/docs/payouts).
Expand All @@ -62,14 +62,14 @@ declare namespace Stripe {
/**
* External accounts (bank accounts and debit cards) currently attached to this account
*/
external_accounts: ApiList<BankAccount | Card>;
external_accounts?: ApiList<BankAccount | Card>;

individual: Person;
individual?: Person;

/**
* 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.
*/
metadata: {
metadata?: {
[key: string]: string;
};

Expand All @@ -78,14 +78,14 @@ declare namespace Stripe {
*/
payouts_enabled: boolean;

requirements: Account.Requirements;
requirements?: Account.Requirements;

/**
* Options for customizing how the account functions within Stripe.
*/
settings: Account.Settings | null;

tos_acceptance: Account.TosAcceptance;
tos_acceptance?: Account.TosAcceptance;

/**
* The Stripe account type. Can be `standard`, `express`, or `custom`.
Expand Down Expand Up @@ -509,6 +509,9 @@ declare namespace Stripe {
type Type = 'custom' | 'express' | 'standard'
}

/**
* The DeletedAccount object.
*/
interface DeletedAccount {
/**
* Unique identifier for the object.
Expand Down Expand Up @@ -2228,12 +2231,12 @@ declare namespace Stripe {
id: string,
params?: ExternalAccountDeleteParams,
options?: RequestOptions
): Promise<BankAccount | Card>;
): Promise<DeletedBankAccount | DeletedCard>;
deleteExternalAccount(
accountId: string,
id: string,
options?: RequestOptions
): Promise<BankAccount | Card>;
): Promise<DeletedBankAccount | DeletedCard>;

/**
* Creates a single-use login link for an Express account to access their Stripe dashboard.
Expand Down
7 changes: 5 additions & 2 deletions types/2019-12-03/AlipayAccounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare namespace Stripe {
*/
created: number;

customer: string | Customer | DeletedCustomer | null;
customer?: string | Customer | DeletedCustomer | null;

deleted?: void;

Expand All @@ -35,7 +35,7 @@ declare namespace Stripe {
/**
* 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.
*/
metadata: {
metadata?: {
[key: string]: string;
};

Expand Down Expand Up @@ -65,6 +65,9 @@ declare namespace Stripe {
username: string;
}

/**
* The DeletedAlipayAccount object.
*/
interface DeletedAlipayAccount {
/**
* Unique identifier for the object.
Expand Down
3 changes: 3 additions & 0 deletions types/2019-12-03/ApplePayDomains.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ declare namespace Stripe {
livemode: boolean;
}

/**
* The DeletedApplePayDomain object.
*/
interface DeletedApplePayDomain {
/**
* Unique identifier for the object.
Expand Down
2 changes: 1 addition & 1 deletion types/2019-12-03/ApplicationFees.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare namespace Stripe {
/**
* ID of the Stripe account this fee was taken from.
*/
account: string | Account | DeletedAccount;
account: string | Account;

/**
* Amount earned, in %s.
Expand Down
21 changes: 12 additions & 9 deletions types/2019-12-03/BankAccounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare namespace Stripe {
*/
object: 'bank_account';

account: string | Account | DeletedAccount | null;
account?: string | Account | null;

/**
* The name of the person or business that owns the bank account.
Expand All @@ -38,14 +38,14 @@ declare namespace Stripe {
/**
* Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
*/
currency: string | null;
currency: string;

customer: string | Customer | DeletedCustomer | null;
customer?: string | Customer | DeletedCustomer | null;

/**
* Whether this bank account is the default external account for its currency.
*/
default_for_currency: boolean | null;
default_for_currency?: boolean | null;

deleted?: void;

Expand All @@ -59,7 +59,7 @@ declare namespace Stripe {
/**
* 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.
*/
metadata:
metadata?:
| {
[key: string]: string;
}
Expand All @@ -78,6 +78,9 @@ declare namespace Stripe {
status: string;
}

/**
* The DeletedBankAccount object.
*/
interface DeletedBankAccount {
/**
* Unique identifier for the object.
Expand All @@ -90,13 +93,13 @@ declare namespace Stripe {
object: 'bank_account';

/**
* Always true for a deleted object
* Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
*/
deleted: true;
currency: string | null;

/**
* Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
* Always true for a deleted object
*/
currency?: string | null;
deleted: true;
}
}
9 changes: 6 additions & 3 deletions types/2019-12-03/BitcoinReceivers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ declare namespace Stripe {
*/
currency: string;

customer: string | null;
customer?: string | null;

deleted?: void;

Expand Down Expand Up @@ -92,14 +92,14 @@ declare namespace Stripe {
/**
* The ID of the payment created from the receiver, if any. Hidden when viewing the receiver with a publishable key.
*/
payment: string | null;
payment?: string | null;

refund_address: string | null;

/**
* A list with one entry for each time that the customer sent bitcoin to the receiver. Hidden when viewing the receiver with a publishable key.
*/
transactions: ApiList<BitcoinTransaction>;
transactions?: ApiList<BitcoinTransaction>;

/**
* This receiver contains uncaptured funds that can be used for a payment or refunded.
Expand All @@ -109,6 +109,9 @@ declare namespace Stripe {
used_for_payment: boolean | null;
}

/**
* The DeletedBitcoinReceiver object.
*/
interface DeletedBitcoinReceiver {
/**
* Unique identifier for the object.
Expand Down
2 changes: 1 addition & 1 deletion types/2019-12-03/Capabilities.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare namespace Stripe {
/**
* The account for which the capability enables functionality.
*/
account: string | Account | DeletedAccount;
account: string | Account;

/**
* Whether the capability has been requested.
Expand Down
34 changes: 17 additions & 17 deletions types/2019-12-03/Cards.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare namespace Stripe {
/**
* The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead.
*/
account: string | Account | DeletedAccount | null;
account?: string | Account | null;

/**
* City/District/Suburb/Town/Village.
Expand Down Expand Up @@ -61,7 +61,7 @@ declare namespace Stripe {
/**
* A set of available payout methods for this card. Will be either `["standard"]` or `["standard", "instant"]`. Only values from this set should be passed as the `method` when creating a transfer.
*/
available_payout_methods: Array<Card.AvailablePayoutMethod> | null;
available_payout_methods?: Array<Card.AvailablePayoutMethod> | null;

/**
* Card brand. Can be `American Express`, `Diners Club`, `Discover`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
Expand All @@ -73,15 +73,12 @@ declare namespace Stripe {
*/
country: string | null;

/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
currency: string | null;
currency?: string | null;

/**
* The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
*/
customer: string | Customer | DeletedCustomer | null;
customer?: string | Customer | DeletedCustomer | null;

/**
* If a CVC was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
Expand All @@ -91,14 +88,14 @@ declare namespace Stripe {
/**
* Whether this card is the default external account for its currency.
*/
default_for_currency: boolean | null;
default_for_currency?: boolean | null;

deleted?: void;

/**
* Card description. (Only for internal use only and not typically available in standard API requests.)
*/
description: string;
description?: string;

/**
* (For tokenized numbers only.) The last four digits of the device account number.
Expand All @@ -118,7 +115,7 @@ declare namespace Stripe {
/**
* 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.
*/
fingerprint: string | null;
fingerprint?: string | null;

/**
* Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`.
Expand All @@ -128,12 +125,12 @@ declare namespace Stripe {
/**
* Issuer identification number of the card. (Only for internal use only and not typically available in standard API requests.)
*/
iin: string;
iin?: string;

/**
* Issuer bank name of the card. (Only for internal use only and not typically available in standard API requests.)
*/
issuer: string;
issuer?: string;

/**
* The last four digits of the card.
Expand All @@ -155,7 +152,7 @@ declare namespace Stripe {
/**
* The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead.
*/
recipient: string | Recipient | DeletedRecipient | null;
recipient?: string | Recipient | null;

/**
* If the card number is tokenized, this is the method that was used. Can be `apple_pay` or `google_pay`.
Expand All @@ -167,6 +164,9 @@ declare namespace Stripe {
type AvailablePayoutMethod = 'instant' | 'standard'
}

/**
* The DeletedCard object.
*/
interface DeletedCard {
/**
* Unique identifier for the object.
Expand All @@ -179,13 +179,13 @@ declare namespace Stripe {
object: 'card';

/**
* Always true for a deleted object
* Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
*/
deleted: true;
currency: string | null;

/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
* Always true for a deleted object
*/
currency?: string | null;
deleted: true;
}
}
8 changes: 4 additions & 4 deletions types/2019-12-03/Charges.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ declare namespace Stripe {
/**
* ID of an existing, connected Stripe account to transfer funds to if `transfer_data` was specified in the charge request.
*/
destination: string | Account | DeletedAccount | null;
destination: string | Account | null;

/**
* Details about the dispute if the charge has been disputed.
Expand Down Expand Up @@ -110,7 +110,7 @@ declare namespace Stripe {
/**
* ID of the invoice this charge is for if one exists.
*/
invoice: string | Invoice | DeletedInvoice | null;
invoice: string | Invoice | null;

level3?: Charge.Level3;

Expand All @@ -129,7 +129,7 @@ declare namespace Stripe {
/**
* The account (if any) the charge was made on behalf of without triggering an automatic transfer. See the [Connect documentation](https://stripe.com/docs/connect/charges-transfers) for details.
*/
on_behalf_of: string | Account | DeletedAccount | null;
on_behalf_of: string | Account | null;

/**
* ID of the order this charge is for if one exists.
Expand Down Expand Up @@ -1158,7 +1158,7 @@ declare namespace Stripe {
/**
* ID of an existing, connected Stripe account to transfer funds to if `transfer_data` was specified in the charge request.
*/
destination: string | Account | DeletedAccount;
destination: string | Account;
}
}

Expand Down
Loading

0 comments on commit b56f772

Please sign in to comment.