Skip to content

Commit

Permalink
Codegen for openapi v226
Browse files Browse the repository at this point in the history
  • Loading branch information
anniel-stripe committed Feb 16, 2023
1 parent 0f2217d commit 97deb3e
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 55 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v224
v226
16 changes: 15 additions & 1 deletion test/resources/generated_examples_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

'use strict';

const stripe = require('../../testUtils').getStripeMockClient();
const testUtils = require('../../testUtils');
const stripe = testUtils.getStripeMockClient();
const expect = require('chai').expect;

describe('Accounts', function() {
Expand Down Expand Up @@ -192,6 +193,19 @@ describe('Accounts', function() {
);
expect(person).not.to.be.null;
});

it('retrieve method', async function() {
const stripe = testUtils.createMockClient([
{
method: 'GET',
path: '/v1/accounts/acc_123',
response:
'{"business_profile":{"mcc":"mcc","name":"name","product_description":"product_description","support_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"support_email":"support_email","support_phone":"support_phone","support_url":"support_url","url":"url"},"business_type":"government_entity","capabilities":{"acss_debit_payments":"inactive","affirm_payments":"pending","afterpay_clearpay_payments":"inactive","au_becs_debit_payments":"active","bacs_debit_payments":"active","bancontact_payments":"inactive","bank_transfer_payments":"pending","blik_payments":"inactive","boleto_payments":"inactive","card_issuing":"active","card_payments":"active","cartes_bancaires_payments":"active","cashapp_payments":"active","eps_payments":"inactive","fpx_payments":"active","giropay_payments":"active","grabpay_payments":"pending","ideal_payments":"inactive","india_international_payments":"inactive","jcb_payments":"inactive","klarna_payments":"active","konbini_payments":"active","legacy_payments":"active","link_payments":"inactive","oxxo_payments":"pending","p24_payments":"inactive","paynow_payments":"active","promptpay_payments":"active","sepa_debit_payments":"inactive","sofort_payments":"active","tax_reporting_us_1099_k":"inactive","tax_reporting_us_1099_misc":"pending","transfers":"inactive","treasury":"pending","us_bank_account_ach_payments":"pending","zip_payments":"pending"},"charges_enabled":true,"company":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"address_kana":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"address_kanji":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"directors_provided":true,"executives_provided":true,"name":"name","name_kana":"name_kana","name_kanji":"name_kanji","owners_provided":true,"ownership_declaration":{"date":"3076014","ip":"ip","user_agent":"user_agent"},"phone":"phone","structure":"sole_establishment","tax_id_provided":true,"tax_id_registrar":"tax_id_registrar","vat_id_provided":true,"verification":{"document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}}}},"controller":{"application":{"loss_liable":true,"onboarding_owner":true,"pricing_controls":true},"dashboard":{"type":"express"},"is_controller":true,"type":"account"},"country":"country","created":"1028554472","default_currency":"default_currency","details_submitted":true,"email":"email","external_accounts":null,"future_requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"current_deadline":"270965154","currently_due":["currently_due"],"disabled_reason":"disabled_reason","errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"id":"obj_123","individual":{"account":"account","address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"address_kana":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"address_kanji":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"created":"1028554472","dob":{"day":99228,"month":104080000,"year":3704893},"email":"email","first_name":"first_name","first_name_kana":"first_name_kana","first_name_kanji":"first_name_kanji","full_name_aliases":["full_name_aliases"],"future_requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"currently_due":["currently_due"],"errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"gender":"gender","id":"obj_123","id_number_provided":true,"id_number_secondary_provided":true,"last_name":"last_name","last_name_kana":"last_name_kana","last_name_kanji":"last_name_kanji","maiden_name":"maiden_name","metadata":{"undefined":"metadata"},"nationality":"nationality","object":"person","phone":"phone","political_exposure":"none","registered_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"relationship":{"director":true,"executive":true,"owner":true,"percent_ownership":760989685,"representative":true,"title":"title"},"requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"currently_due":["currently_due"],"errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"ssn_last_4_provided":true,"verification":{"additional_document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}},"details":"details","details_code":"details_code","document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}},"status":"status"}},"metadata":{"undefined":"metadata"},"object":"account","payouts_enabled":true,"requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"current_deadline":"270965154","currently_due":["currently_due"],"disabled_reason":"disabled_reason","errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"settings":{"bacs_debit_payments":{"display_name":"display_name"},"branding":{"icon":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"logo":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"primary_color":"primary_color","secondary_color":"secondary_color"},"card_issuing":{"tos_acceptance":{"date":3076014,"ip":"ip","user_agent":"user_agent"}},"card_payments":{"decline_on":{"avs_failure":true,"cvc_failure":true},"statement_descriptor_prefix":"statement_descriptor_prefix","statement_descriptor_prefix_kana":"statement_descriptor_prefix_kana","statement_descriptor_prefix_kanji":"statement_descriptor_prefix_kanji"},"dashboard":{"display_name":"display_name","timezone":"timezone"},"payments":{"statement_descriptor":"statement_descriptor","statement_descriptor_kana":"statement_descriptor_kana","statement_descriptor_kanji":"statement_descriptor_kanji","statement_descriptor_prefix_kana":"statement_descriptor_prefix_kana","statement_descriptor_prefix_kanji":"statement_descriptor_prefix_kanji"},"payouts":{"debit_negative_balances":true,"schedule":{"delay_days":1647351405,"interval":"interval","monthly_anchor":1920305369,"weekly_anchor":"weekly_anchor"},"statement_descriptor":"statement_descriptor"},"sepa_debit_payments":{"creditor_id":"creditor_id"},"treasury":{"tos_acceptance":{"date":3076014,"ip":"ip","user_agent":"user_agent"}}},"tos_acceptance":{"date":"3076014","ip":"ip","service_agreement":"service_agreement","user_agent":"user_agent"},"type":"custom"}',
},
]);
const account = await stripe.accounts.retrieve('acc_123');
expect(account).not.to.be.null;
});
});

describe('Apps.Secrets', function() {
Expand Down
95 changes: 95 additions & 0 deletions types/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ declare module 'stripe' {
*/
currency_conversion?: Session.CurrencyConversion | null;

/**
* Collect additional information from your customer using custom fields. Up to 2 fields are supported.
*/
custom_fields: Array<Session.CustomField>;

custom_text: Session.CustomText;

/**
Expand Down Expand Up @@ -479,6 +484,96 @@ declare module 'stripe' {
}
}

interface CustomField {
/**
* Configuration for `type=dropdown` fields.
*/
dropdown: CustomField.Dropdown | null;

/**
* String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters.
*/
key: string;

label: CustomField.Label;

/**
* Configuration for `type=numeric` fields.
*/
numeric: CustomField.Numeric | null;

/**
* Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
*/
optional: boolean;

/**
* Configuration for `type=text` fields.
*/
text: CustomField.Text | null;

/**
* The type of the field.
*/
type: CustomField.Type;
}

namespace CustomField {
interface Dropdown {
/**
* The options available for the customer to select. Up to 200 options allowed.
*/
options: Array<Dropdown.Option>;

/**
* The option selected by the customer. This will be the `value` for the option.
*/
value: string | null;
}

namespace Dropdown {
interface Option {
/**
* The label for the option, displayed to the customer. Up to 100 characters.
*/
label: string;

/**
* The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters.
*/
value: string;
}
}

interface Label {
/**
* Custom text for the label, displayed to the customer. Up to 50 characters.
*/
custom: string | null;

/**
* The type of the label.
*/
type: 'custom';
}

interface Numeric {
/**
* The value entered by the customer, containing only digits.
*/
value: string | null;
}

interface Text {
/**
* The value entered by the customer.
*/
value: string | null;
}

type Type = 'dropdown' | 'numeric' | 'text';
}

interface CustomText {
/**
* Custom text that should be displayed alongside shipping address collection.
Expand Down
34 changes: 0 additions & 34 deletions types/CustomersResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -771,40 +771,6 @@ declare module 'stripe' {
expand?: Array<string>;
}

interface CustomerBalanceTransactionListParams extends PaginationParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

interface CustomerCashBalanceTransactionListParams
extends PaginationParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

interface CustomerSourceListParams extends PaginationParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;

/**
* Filter sources according to a particular object type.
*/
object?: string;
}

interface TaxIdListParams extends PaginationParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

interface CustomerRetrievePaymentMethodParams {
/**
* Specifies which fields in the response should be expanded.
Expand Down
10 changes: 2 additions & 8 deletions types/Quotes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,9 @@ declare module 'stripe' {
| 'stale';

interface StatusDetails {
/**
* Details on when and why a quote has been marked as canceled.
*/
canceled: StatusDetails.Canceled | null;
canceled?: StatusDetails.Canceled;

/**
* Details on when and why a quote has been marked as stale.
*/
stale: StatusDetails.Stale | null;
stale?: StatusDetails.Stale;
}

namespace StatusDetails {
Expand Down
2 changes: 1 addition & 1 deletion types/QuotesResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3361,7 +3361,7 @@ declare module 'stripe' {
): ApiListPromise<Stripe.LineItem>;

/**
* When retrieving a quote, there is an includable lines property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of lines.
* Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
*/
listLines(
id: string,
Expand Down
5 changes: 0 additions & 5 deletions types/Tax/Calculations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ declare module 'stripe' {
*/
livemode: boolean;

/**
* A custom unique identifier, such as 'myOrder_123'.
*/
reference: string | null;

/**
* The amount of tax to be collected on top of the line item prices.
*/
Expand Down
5 changes: 0 additions & 5 deletions types/Tax/CalculationsResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ declare module 'stripe' {
*/
preview?: boolean;

/**
* A custom order or sale identifier, such as 'myOrder_123'.
*/
reference?: string;

/**
* Timestamp of date at which the tax rules and rates in effect applies for the calculation. Measured in seconds since the Unix epoch.
*/
Expand Down
5 changes: 5 additions & 0 deletions types/Tax/TransactionsResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ declare module 'stripe' {
* Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
*/
metadata?: Stripe.MetadataParam;

/**
* A custom order or sale identifier, such as 'myOrder_123'.
*/
reference?: string;
}

interface TransactionRetrieveParams {
Expand Down

0 comments on commit 97deb3e

Please sign in to comment.