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

Update generated code for beta #2219

Merged
merged 17 commits into from
Nov 7, 2024
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
75 changes: 39 additions & 36 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1319
v1333
2 changes: 1 addition & 1 deletion examples/snippets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ If on step 2 you see an error `Error: unsure how to copy this: /Users/jar/stripe
run `rm /path/to/node/sdk/.git/fsmonitor--daemon.ipc && yarn`
This file is used by a file monitor built into git. Removing it temporarily does not seem to affect its operation, and this one liner will let `yarn` succeed.

Note that if you modify the stripe-node code, you must delete your snippets `node_modules` folder and rerun these steps.
Note that if you modify the stripe-node code, rerun step 1 and then run `yarn upgrade stripe` from this folder to pull in the new built package.

## Running an example

Expand Down
5 changes: 1 addition & 4 deletions scripts/updateAPIVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const read = (file) => fs.readFileSync(path.resolve(file)).toString();
const write = (file, str) => fs.writeFileSync(path.resolve(file), str);
const edit = (file, cb) => write(file, cb(read(file)));

const API_VERSION = '2[0-9][2-9][0-9]-[0-9]{2}-[0-9]{2}';
const API_VERSION = '2[0-9][2-9][0-9]-[0-9]{2}-[0-9]{2}.[a-z]+';

const main = () => {
const matches = [
Expand Down Expand Up @@ -36,9 +36,6 @@ const main = () => {
);
});

replaceAPIVersion('README.md', 'apiVersion: [\'"]API_VERSION[\'"]');
replaceAPIVersion('package.json', '"types": "types/API_VERSION/index.d.ts');

replaceAPIVersion(
'types/lib.d.ts',
'export type LatestApiVersion = [\'"]API_VERSION[\'"]'
Expand Down
23 changes: 22 additions & 1 deletion src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,25 @@ import {DebitReversals as TreasuryDebitReversals} from './resources/Treasury/Deb
import {DisputeSettlementDetails as IssuingDisputeSettlementDetails} from './resources/Issuing/DisputeSettlementDetails.js';
import {Disputes as IssuingDisputes} from './resources/Issuing/Disputes.js';
import {EarlyFraudWarnings as RadarEarlyFraudWarnings} from './resources/Radar/EarlyFraudWarnings.js';
import {EventDestinations as V2CoreEventDestinations} from './resources/V2/Core/EventDestinations.js';
import {Events as V2CoreEvents} from './resources/V2/Core/Events.js';
import {Features as EntitlementsFeatures} from './resources/Entitlements/Features.js';
import {FinancialAccounts as TreasuryFinancialAccounts} from './resources/Treasury/FinancialAccounts.js';
import {FinancingOffers as CapitalFinancingOffers} from './resources/Capital/FinancingOffers.js';
import {FinancingSummary as CapitalFinancingSummary} from './resources/Capital/FinancingSummary.js';
import {FinancingTransactions as CapitalFinancingTransactions} from './resources/Capital/FinancingTransactions.js';
import {Forms as TaxForms} from './resources/Tax/Forms.js';
import {FraudLiabilityDebits as IssuingFraudLiabilityDebits} from './resources/Issuing/FraudLiabilityDebits.js';
import {InboundTransfers as TestHelpersTreasuryInboundTransfers} from './resources/TestHelpers/Treasury/InboundTransfers.js';
import {InboundTransfers as TreasuryInboundTransfers} from './resources/Treasury/InboundTransfers.js';
import {Institutions as FinancialConnectionsInstitutions} from './resources/FinancialConnections/Institutions.js';
import {Locations as TerminalLocations} from './resources/Terminal/Locations.js';
import {MeterEventAdjustments as BillingMeterEventAdjustments} from './resources/Billing/MeterEventAdjustments.js';
import {MeterEventAdjustments as V2BillingMeterEventAdjustments} from './resources/V2/Billing/MeterEventAdjustments.js';
import {MeterEventSession as V2BillingMeterEventSession} from './resources/V2/Billing/MeterEventSession.js';
import {MeterEventStream as V2BillingMeterEventStream} from './resources/V2/Billing/MeterEventStream.js';
import {MeterEvents as BillingMeterEvents} from './resources/Billing/MeterEvents.js';
import {MeterEvents as V2BillingMeterEvents} from './resources/V2/Billing/MeterEvents.js';
import {Meters as BillingMeters} from './resources/Billing/Meters.js';
import {Orders as ClimateOrders} from './resources/Climate/Orders.js';
import {OutboundPayments as TestHelpersTreasuryOutboundPayments} from './resources/TestHelpers/Treasury/OutboundPayments.js';
Expand Down Expand Up @@ -109,11 +116,13 @@ export {Mandates} from './resources/Mandates.js';
export {Margins} from './resources/Margins.js';
export {OAuth} from './resources/OAuth.js';
export {Orders} from './resources/Orders.js';
export {PaymentAttemptRecords} from './resources/PaymentAttemptRecords.js';
export {PaymentIntents} from './resources/PaymentIntents.js';
export {PaymentLinks} from './resources/PaymentLinks.js';
export {PaymentMethodConfigurations} from './resources/PaymentMethodConfigurations.js';
export {PaymentMethodDomains} from './resources/PaymentMethodDomains.js';
export {PaymentMethods} from './resources/PaymentMethods.js';
export {PaymentRecords} from './resources/PaymentRecords.js';
export {Payouts} from './resources/Payouts.js';
export {Plans} from './resources/Plans.js';
export {Prices} from './resources/Prices.js';
Expand All @@ -135,7 +144,6 @@ export {TaxRates} from './resources/TaxRates.js';
export {Tokens} from './resources/Tokens.js';
export {Topups} from './resources/Topups.js';
export {Transfers} from './resources/Transfers.js';
export {V2} from './resources/V2.js';
export {WebhookEndpoints} from './resources/WebhookEndpoints.js';
export const Apps = resourceNamespace('apps', {Secrets: AppsSecrets});
export const Billing = resourceNamespace('billing', {
Expand Down Expand Up @@ -192,6 +200,7 @@ export const Issuing = resourceNamespace('issuing', {
CreditUnderwritingRecords: IssuingCreditUnderwritingRecords,
DisputeSettlementDetails: IssuingDisputeSettlementDetails,
Disputes: IssuingDisputes,
FraudLiabilityDebits: IssuingFraudLiabilityDebits,
PersonalizationDesigns: IssuingPersonalizationDesigns,
PhysicalBundles: IssuingPhysicalBundles,
Tokens: IssuingTokens,
Expand Down Expand Up @@ -258,3 +267,15 @@ export const Treasury = resourceNamespace('treasury', {
TransactionEntries: TreasuryTransactionEntries,
Transactions: TreasuryTransactions,
});
export const V2 = resourceNamespace('v2', {
Billing: resourceNamespace('billing', {
MeterEventAdjustments: V2BillingMeterEventAdjustments,
MeterEventSession: V2BillingMeterEventSession,
MeterEventStream: V2BillingMeterEventStream,
MeterEvents: V2BillingMeterEvents,
}),
Core: resourceNamespace('core', {
EventDestinations: V2CoreEventDestinations,
Events: V2CoreEvents,
}),
});
15 changes: 15 additions & 0 deletions src/resources/Issuing/FraudLiabilityDebits.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// File generated from our OpenAPI spec

import {StripeResource} from '../../StripeResource.js';
const stripeMethod = StripeResource.method;
export const FraudLiabilityDebits = StripeResource.extend({
retrieve: stripeMethod({
method: 'GET',
fullPath: '/v1/issuing/fraud_liability_debits/{fraud_liability_debit}',
}),
list: stripeMethod({
method: 'GET',
fullPath: '/v1/issuing/fraud_liability_debits',
methodType: 'list',
}),
});
15 changes: 15 additions & 0 deletions src/resources/PaymentAttemptRecords.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// File generated from our OpenAPI spec

import {StripeResource} from '../StripeResource.js';
const stripeMethod = StripeResource.method;
export const PaymentAttemptRecords = StripeResource.extend({
retrieve: stripeMethod({
method: 'GET',
fullPath: '/v1/payment_attempt_records/{id}',
}),
list: stripeMethod({
method: 'GET',
fullPath: '/v1/payment_attempt_records',
methodType: 'list',
}),
});
27 changes: 27 additions & 0 deletions src/resources/PaymentRecords.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// File generated from our OpenAPI spec

import {StripeResource} from '../StripeResource.js';
const stripeMethod = StripeResource.method;
export const PaymentRecords = StripeResource.extend({
retrieve: stripeMethod({method: 'GET', fullPath: '/v1/payment_records/{id}'}),
reportPayment: stripeMethod({
method: 'POST',
fullPath: '/v1/payment_records/report_payment',
}),
reportPaymentAttempt: stripeMethod({
method: 'POST',
fullPath: '/v1/payment_records/{id}/report_payment_attempt',
}),
reportPaymentAttemptCanceled: stripeMethod({
method: 'POST',
fullPath: '/v1/payment_records/{id}/report_payment_attempt_canceled',
}),
reportPaymentAttemptFailed: stripeMethod({
method: 'POST',
fullPath: '/v1/payment_records/{id}/report_payment_attempt_failed',
}),
reportPaymentAttemptGuaranteed: stripeMethod({
method: 'POST',
fullPath: '/v1/payment_records/{id}/report_payment_attempt_guaranteed',
}),
});
12 changes: 0 additions & 12 deletions src/resources/V2.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/resources/V2/Billing.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/resources/V2/Core.ts

This file was deleted.

2 changes: 1 addition & 1 deletion test/resources/generated_examples_test.spec.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions types/AccountSessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ declare module 'stripe' {
/**
* Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. The default value for this feature is `false` when `external_account_collection` is enabled and `true` otherwise.
*/
disable_stripe_user_authentication?: boolean;
disable_stripe_user_authentication: boolean;

/**
* Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
Expand All @@ -113,7 +113,7 @@ declare module 'stripe' {
/**
* Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. The default value for this feature is `false` when `external_account_collection` is enabled and `true` otherwise.
*/
disable_stripe_user_authentication?: boolean;
disable_stripe_user_authentication: boolean;

/**
* Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
Expand All @@ -136,7 +136,7 @@ declare module 'stripe' {
/**
* Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. The default value for this feature is `false` when `external_account_collection` is enabled and `true` otherwise.
*/
disable_stripe_user_authentication?: boolean;
disable_stripe_user_authentication: boolean;

/**
* Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
Expand Down Expand Up @@ -226,7 +226,7 @@ declare module 'stripe' {
/**
* Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. The default value for this feature is `false` when `external_account_collection` is enabled and `true` otherwise.
*/
disable_stripe_user_authentication?: boolean;
disable_stripe_user_authentication: boolean;

/**
* Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
Expand Down Expand Up @@ -315,7 +315,7 @@ declare module 'stripe' {
/**
* Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. The default value for this feature is `false` when `external_account_collection` is enabled and `true` otherwise.
*/
disable_stripe_user_authentication?: boolean;
disable_stripe_user_authentication: boolean;

/**
* Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
Expand Down
35 changes: 29 additions & 6 deletions types/AccountSessionsResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,6 @@ declare module 'stripe' {
*/
external_account_collection?: boolean;

/**
* Whether to allow money movement features.
*/
money_movement?: boolean;

/**
* Whether to allow sending money.
*/
Expand All @@ -405,6 +400,9 @@ declare module 'stripe' {
*/
enabled: boolean;

/**
* The list of features enabled in the embedded component.
*/
features?: FinancialAccountTransactions.Features;
}

Expand All @@ -430,7 +428,27 @@ declare module 'stripe' {
}

namespace IssuingCard {
interface Features {}
interface Features {
/**
* Whether to allow card management features.
*/
card_management?: boolean;

/**
* Whether to allow card spend dispute management features.
*/
card_spend_dispute_management?: boolean;

/**
* Whether to allow cardholder management features.
*/
cardholder_management?: boolean;

/**
* Whether to allow spend control management features.
*/
spend_control_management?: boolean;
}
}

interface IssuingCardsList {
Expand Down Expand Up @@ -462,6 +480,11 @@ declare module 'stripe' {
*/
cardholder_management?: boolean;

/**
* Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts.
*/
disable_stripe_user_authentication?: boolean;

/**
* Whether to allow spend control management features.
*/
Expand Down
42 changes: 38 additions & 4 deletions types/Accounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1028,9 +1028,9 @@ declare module 'stripe' {
currently_due: Array<string> | null;

/**
* This is typed as a string for consistency with `requirements.disabled_reason`.
* This is typed as an enum for consistency with `requirements.disabled_reason`.
*/
disabled_reason: string | null;
disabled_reason: FutureRequirements.DisabledReason | null;

/**
* Fields that are `currently_due` and need to be collected again because validation or verification failed.
Expand Down Expand Up @@ -1066,6 +1066,23 @@ declare module 'stripe' {
original_fields_due: Array<string>;
}

type DisabledReason =
| 'action_required.requested_capabilities'
| 'listed'
| 'other'
| 'platform_paused'
| 'rejected.fraud'
| 'rejected.incomplete_verification'
| 'rejected.listed'
| 'rejected.other'
| 'rejected.platform_fraud'
| 'rejected.platform_other'
| 'rejected.platform_terms_of_service'
| 'rejected.terms_of_service'
| 'requirements.past_due'
| 'requirements.pending_verification'
| 'under_review';

interface Error {
/**
* The code for the type of error.
Expand Down Expand Up @@ -1202,9 +1219,9 @@ declare module 'stripe' {
currently_due: Array<string> | null;

/**
* If the account is disabled, this string describes why. [Learn more about handling verification issues](https://stripe.com/docs/connect/handling-api-verification). Can be `action_required.requested_capabilities`, `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.incomplete_verification`, `rejected.listed`, `rejected.other`, `rejected.terms_of_service`, `under_review`, or `other`.
* If the account is disabled, this enum describes why. [Learn more about handling verification issues](https://stripe.com/docs/connect/handling-api-verification).
*/
disabled_reason: string | null;
disabled_reason: Requirements.DisabledReason | null;

/**
* Fields that are `currently_due` and need to be collected again because validation or verification failed.
Expand Down Expand Up @@ -1240,6 +1257,23 @@ declare module 'stripe' {
original_fields_due: Array<string>;
}

type DisabledReason =
| 'action_required.requested_capabilities'
| 'listed'
| 'other'
| 'platform_paused'
| 'rejected.fraud'
| 'rejected.incomplete_verification'
| 'rejected.listed'
| 'rejected.other'
| 'rejected.platform_fraud'
| 'rejected.platform_other'
| 'rejected.platform_terms_of_service'
| 'rejected.terms_of_service'
| 'requirements.past_due'
| 'requirements.pending_verification'
| 'under_review';

interface Error {
/**
* The code for the type of error.
Expand Down
2 changes: 1 addition & 1 deletion types/Billing/CreditBalanceSummaryResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ declare module 'stripe' {
namespace Filter {
interface ApplicabilityScope {
/**
* The price type to which credit grants can apply to. We currently only support `metered` price type.
* The price type for which credit grants can apply. We currently only support the `metered` price type.
*/
price_type: 'metered';
}
Expand Down
Loading
Loading