Skip to content

Commit 970eaff

Browse files
Pull in V2 FinancialAccount changes for June release (#2367)
Update for June release
1 parent c12c148 commit 970eaff

File tree

11 files changed

+1368
-34
lines changed

11 files changed

+1368
-34
lines changed

src/Error.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ export const generateV2Error = (
3535
// switchCases: The beginning of the section generated from our OpenAPI spec
3636
case 'temporary_session_expired':
3737
return new TemporarySessionExpiredError(rawStripeError);
38-
case 'financial_account_not_open':
39-
return new FinancialAccountNotOpenError(rawStripeError);
38+
case 'non_zero_balance':
39+
return new NonZeroBalanceError(rawStripeError);
40+
case 'already_exists':
41+
return new AlreadyExistsError(rawStripeError);
4042
case 'feature_not_enabled':
4143
return new FeatureNotEnabledError(rawStripeError);
44+
case 'financial_account_not_open':
45+
return new FinancialAccountNotOpenError(rawStripeError);
4246
case 'blocked_by_stripe':
4347
return new BlockedByStripeError(rawStripeError);
4448
case 'already_canceled':
@@ -259,16 +263,26 @@ export class TemporarySessionExpiredError extends StripeError {
259263
super(rawStripeError, 'TemporarySessionExpiredError');
260264
}
261265
}
262-
export class FinancialAccountNotOpenError extends StripeError {
266+
export class NonZeroBalanceError extends StripeError {
263267
constructor(rawStripeError: StripeRawError = {}) {
264-
super(rawStripeError, 'FinancialAccountNotOpenError');
268+
super(rawStripeError, 'NonZeroBalanceError');
269+
}
270+
}
271+
export class AlreadyExistsError extends StripeError {
272+
constructor(rawStripeError: StripeRawError = {}) {
273+
super(rawStripeError, 'AlreadyExistsError');
265274
}
266275
}
267276
export class FeatureNotEnabledError extends StripeError {
268277
constructor(rawStripeError: StripeRawError = {}) {
269278
super(rawStripeError, 'FeatureNotEnabledError');
270279
}
271280
}
281+
export class FinancialAccountNotOpenError extends StripeError {
282+
constructor(rawStripeError: StripeRawError = {}) {
283+
super(rawStripeError, 'FinancialAccountNotOpenError');
284+
}
285+
}
272286
export class BlockedByStripeError extends StripeError {
273287
constructor(rawStripeError: StripeRawError = {}) {
274288
super(rawStripeError, 'BlockedByStripeError');

src/Types.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ export type RawErrorType =
3939
| 'authentication_error'
4040
| 'invalid_grant'
4141
| 'temporary_session_expired'
42-
| 'financial_account_not_open'
42+
| 'non_zero_balance'
43+
| 'already_exists'
4344
| 'feature_not_enabled'
45+
| 'financial_account_not_open'
4446
| 'blocked_by_stripe'
4547
| 'already_canceled'
4648
| 'not_cancelable'

src/resources/V2/MoneyManagement/FinancialAccounts.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import {StripeResource} from '../../../StripeResource.js';
44
const stripeMethod = StripeResource.method;
55
export const FinancialAccounts = StripeResource.extend({
6+
create: stripeMethod({
7+
method: 'POST',
8+
fullPath: '/v2/money_management/financial_accounts',
9+
}),
610
retrieve: stripeMethod({
711
method: 'GET',
812
fullPath: '/v2/money_management/financial_accounts/{id}',
@@ -12,4 +16,8 @@ export const FinancialAccounts = StripeResource.extend({
1216
fullPath: '/v2/money_management/financial_accounts',
1317
methodType: 'list',
1418
}),
19+
close: stripeMethod({
20+
method: 'POST',
21+
fullPath: '/v2/money_management/financial_accounts/{id}/close',
22+
}),
1523
});

test/resources/generated_examples_test.spec.js

Lines changed: 94 additions & 19 deletions
Large diffs are not rendered by default.

types/Errors.d.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ declare module 'stripe' {
1010
| 'authentication_error'
1111
| 'invalid_grant'
1212
| 'temporary_session_expired'
13-
| 'financial_account_not_open'
13+
| 'non_zero_balance'
14+
| 'already_exists'
1415
| 'feature_not_enabled'
16+
| 'financial_account_not_open'
1517
| 'blocked_by_stripe'
1618
| 'already_canceled'
1719
| 'not_cancelable'
@@ -136,8 +138,10 @@ declare module 'stripe' {
136138
| 'StripeIdempotencyError'
137139
| 'StripeInvalidGrantError'
138140
| 'TemporarySessionExpiredError'
139-
| 'FinancialAccountNotOpenError'
141+
| 'NonZeroBalanceError'
142+
| 'AlreadyExistsError'
140143
| 'FeatureNotEnabledError'
144+
| 'FinancialAccountNotOpenError'
141145
| 'BlockedByStripeError'
142146
| 'AlreadyCanceledError'
143147
| 'NotCancelableError'
@@ -296,14 +300,22 @@ declare module 'stripe' {
296300
readonly type: 'TemporarySessionExpiredError';
297301
readonly rawType: 'temporary_session_expired';
298302
}
299-
export class FinancialAccountNotOpenError extends StripeError {
300-
readonly type: 'FinancialAccountNotOpenError';
301-
readonly rawType: 'financial_account_not_open';
303+
export class NonZeroBalanceError extends StripeError {
304+
readonly type: 'NonZeroBalanceError';
305+
readonly rawType: 'non_zero_balance';
306+
}
307+
export class AlreadyExistsError extends StripeError {
308+
readonly type: 'AlreadyExistsError';
309+
readonly rawType: 'already_exists';
302310
}
303311
export class FeatureNotEnabledError extends StripeError {
304312
readonly type: 'FeatureNotEnabledError';
305313
readonly rawType: 'feature_not_enabled';
306314
}
315+
export class FinancialAccountNotOpenError extends StripeError {
316+
readonly type: 'FinancialAccountNotOpenError';
317+
readonly rawType: 'financial_account_not_open';
318+
}
307319
export class BlockedByStripeError extends StripeError {
308320
readonly type: 'BlockedByStripeError';
309321
readonly rawType: 'blocked_by_stripe';

types/QuotesResource.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ declare module 'stripe' {
10521052
description?: string;
10531053

10541054
/**
1055-
* When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. The `effective_date` is ignored if it is in the past when the quote is accepted.
1055+
* When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. When updating a subscription, the date of which the subscription will be updated using a subscription schedule. The special value `current_period_end` can be provided to update a subscription at the end of its current period. The `effective_date` is ignored if it is in the past when the quote is accepted.
10561056
*/
10571057
effective_date?: Stripe.Emptyable<'current_period_end' | number>;
10581058

@@ -2481,7 +2481,7 @@ declare module 'stripe' {
24812481
description?: Stripe.Emptyable<string>;
24822482

24832483
/**
2484-
* When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. The `effective_date` is ignored if it is in the past when the quote is accepted.
2484+
* When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. When updating a subscription, the date of which the subscription will be updated using a subscription schedule. The special value `current_period_end` can be provided to update a subscription at the end of its current period. The `effective_date` is ignored if it is in the past when the quote is accepted.
24852485
*/
24862486
effective_date?: Stripe.Emptyable<'current_period_end' | number>;
24872487

0 commit comments

Comments
 (0)