Skip to content

Commit 4a87148

Browse files
Merge pull request #2567 from stripe/latest-codegen-private-preview
Update generated code for private-preview
2 parents d5c279e + 77b02bc commit 4a87148

38 files changed

+1774
-66
lines changed

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,33 @@ This release changes the pinned API version to `2026-01-28.preview`.
1919
* Add support for `subtotal` on `InvoiceLineItem`
2020
* Add support for `billing_cadence` on `SubscriptionListParams`
2121

22+
## 20.3.0 - 2026-01-28
23+
This release changes the pinned API version to `2026-01-28.clover`.
24+
25+
* [#2564](https://github.com/stripe/stripe-node/pull/2564) Update generated code
26+
* Add support for new resource `Radar.PaymentEvaluation`
27+
* Add support for `create` method on resource `Radar.PaymentEvaluation`
28+
* Add support for `adjustable_quantity` on `LineItem`
29+
* Add support for new value `risk_reserved` on enum `BalanceTransaction.balance_type`
30+
* Add support for new values `reserve_hold` and `reserve_release` on enum `BalanceTransaction.type`
31+
* Add support for new values `2.3.0` and `2.3.1` on enums `Charge.payment_method_details.card.three_d_secure.version`, `PaymentIntentConfirmParams.payment_method_options.card.three_d_secure.version`, `PaymentIntentCreateParams.payment_method_options.card.three_d_secure.version`, `PaymentIntentUpdateParams.payment_method_options.card.three_d_secure.version`, `SetupAttempt.payment_method_details.card.three_d_secure.version`, `SetupIntentConfirmParams.payment_method_options.card.three_d_secure.version`, `SetupIntentCreateParams.payment_method_options.card.three_d_secure.version`, and `SetupIntentUpdateParams.payment_method_options.card.three_d_secure.version`
32+
* Add support for new value `adyen` on enums `Charge.payment_method_details.ideal.bank`, `ConfirmationToken.payment_method_preview.ideal.bank`, `ConfirmationTokenCreateParams.testHelpers.payment_method_data.ideal.bank`, `PaymentAttemptRecord.payment_method_details.ideal.bank`, `PaymentIntentConfirmParams.payment_method_data.ideal.bank`, `PaymentIntentCreateParams.payment_method_data.ideal.bank`, `PaymentIntentUpdateParams.payment_method_data.ideal.bank`, `PaymentMethod.ideal.bank`, `PaymentMethodCreateParams.ideal.bank`, `PaymentRecord.payment_method_details.ideal.bank`, `SetupAttempt.payment_method_details.ideal.bank`, `SetupIntentConfirmParams.payment_method_data.ideal.bank`, `SetupIntentCreateParams.payment_method_data.ideal.bank`, and `SetupIntentUpdateParams.payment_method_data.ideal.bank`
33+
* Add support for new value `ADYBNL2A` on enums `Charge.payment_method_details.ideal.bic`, `ConfirmationToken.payment_method_preview.ideal.bic`, `PaymentAttemptRecord.payment_method_details.ideal.bic`, `PaymentMethod.ideal.bic`, `PaymentRecord.payment_method_details.ideal.bic`, and `SetupAttempt.payment_method_details.ideal.bic`
34+
* Add support for new value `pl_nip` on enums `Checkout.Session.customer_details.tax_ids[].type`, `Invoice.customer_tax_ids[].type`, `Tax.Calculation.customer_details.tax_ids[].type`, `Tax.Transaction.customer_details.tax_ids[].type`, and `TaxId.type`
35+
* Add support for new value `pl_nip` on enums `CustomerCreateParams.tax_id_data[].type`, `CustomerCreateTaxIdParams.type`, `InvoiceCreatePreviewParams.customer_details.tax_ids[].type`, `Tax.CalculationCreateParams.customer_details.tax_ids[].type`, and `TaxIdCreateParams.type`
36+
* Change `Invoice.payment_settings.payment_method_options.payto` and `Subscription.payment_settings.payment_method_options.payto` to be required
37+
* Add support for `enforce_arithmetic_validation` on `PaymentIntentCaptureParams.amount_details`, `PaymentIntentConfirmParams.amount_details`, `PaymentIntentCreateParams.amount_details`, `PaymentIntentIncrementAuthorizationParams.amount_details`, and `PaymentIntentUpdateParams.amount_details`
38+
* Add support for `error` on `PaymentIntent.amount_details`
39+
* Remove support for `bgn` on `Terminal.Configuration.tipping`, `Terminal.ConfigurationCreateParams.tipping`, and `Terminal.ConfigurationUpdateParams.tipping`
40+
* Add support for `topup` on `Treasury.ReceivedDebit.linked_flows`
41+
* Add support for `contact_phone` on `V2.Core.AccountCreateParams`, `V2.Core.AccountTokenCreateParams`, `V2.Core.AccountUpdateParams`, and `V2.Core.Account`
42+
* Add support for `registration_date` on `V2.Core.Account.identity.business_details`, `V2.Core.AccountCreateParams.identity.business_details`, `V2.Core.AccountTokenCreateParams.identity.business_details`, and `V2.Core.AccountUpdateParams.identity.business_details`
43+
* Add support for new value `gb_vat` on enums `V2.Core.Account.identity.business_details.id_numbers[].type`, `V2.Core.AccountCreateParams.identity.business_details.id_numbers[].type`, `V2.Core.AccountTokenCreateParams.identity.business_details.id_numbers[].type`, and `V2.Core.AccountUpdateParams.identity.business_details.id_numbers[].type`
44+
* Add support for error code `request_blocked` on `Invoice.last_finalization_error`, `PaymentIntent.last_payment_error`, `SetupAttempt.setup_error`, `SetupIntent.last_setup_error`, and `StripeError`
45+
* [#2558](https://github.com/stripe/stripe-node/pull/2558) Remove `qs` dependency
46+
- Remove the `qs` dependency, addressing [Issue #2117](https://github.com/stripe/stripe-node/issues/2117).
47+
* [#2562](https://github.com/stripe/stripe-node/pull/2562) Document usage of undocumented API parameters
48+
2249
## 20.3.0-alpha.1 - 2026-01-21
2350
* [#2559](https://github.com/stripe/stripe-node/pull/2559) Update generated code for private-preview
2451
* Remove support for `pause` method on resource `Subscription`

CODEGEN_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
529796460735eb8ef64a29787291f1b4d4b29f1c
1+
74913070eb5bc81c058d07ad167346b6d68d8b0b

OPENAPI_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2160
1+
v2164

src/autoPagination.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ class V1SearchIterator<T> extends V1Iterator<T> {
146146
}
147147

148148
class V2ListIterator<T> implements AsyncIterator<T> {
149-
private currentPageIterator: Promise<Iterator<T>>;
150-
private nextPageUrl: Promise<string | null>;
149+
private firstPagePromise: Promise<PageResult<T>> | null;
150+
private currentPageIterator: Iterator<T> | null;
151+
private nextPageUrl: string | null;
151152
private requestArgs: RequestArgs;
152153
private spec: MethodSpec;
153154
private stripeResource: StripeResourceObject;
@@ -157,32 +158,33 @@ class V2ListIterator<T> implements AsyncIterator<T> {
157158
spec: MethodSpec,
158159
stripeResource: StripeResourceObject
159160
) {
160-
this.currentPageIterator = (async (): Promise<Iterator<T>> => {
161-
const page = await firstPagePromise;
162-
return page.data[Symbol.iterator]();
163-
})();
164-
165-
this.nextPageUrl = (async (): Promise<string | null> => {
166-
const page = await firstPagePromise;
167-
return page.next_page_url || null;
168-
})();
169-
161+
this.firstPagePromise = firstPagePromise;
162+
this.currentPageIterator = null;
163+
this.nextPageUrl = null;
170164
this.requestArgs = requestArgs;
171165
this.spec = spec;
172166
this.stripeResource = stripeResource;
173167
}
168+
private async initFirstPage(): Promise<void> {
169+
if (this.firstPagePromise) {
170+
const page = await this.firstPagePromise;
171+
this.firstPagePromise = null;
172+
this.currentPageIterator = page.data[Symbol.iterator]();
173+
this.nextPageUrl = page.next_page_url || null;
174+
}
175+
}
174176
private async turnPage(): Promise<Iterator<T> | null> {
175-
const nextPageUrl = await this.nextPageUrl;
176-
if (!nextPageUrl) return null;
177-
this.spec.fullPath = nextPageUrl;
177+
if (!this.nextPageUrl) return null;
178+
this.spec.fullPath = this.nextPageUrl;
178179
const page = await this.stripeResource._makeRequest([], this.spec, {});
179-
this.nextPageUrl = Promise.resolve(page.next_page_url);
180-
this.currentPageIterator = Promise.resolve(page.data[Symbol.iterator]());
180+
this.nextPageUrl = page.next_page_url || null;
181+
this.currentPageIterator = page.data[Symbol.iterator]();
181182
return this.currentPageIterator;
182183
}
183184
async next(): Promise<IteratorResult<T>> {
184-
{
185-
const result = (await this.currentPageIterator).next();
185+
await this.initFirstPage();
186+
if (this.currentPageIterator) {
187+
const result = this.currentPageIterator.next();
186188
if (!result.done) return {done: false, value: result.value};
187189
}
188190
const nextPageIterator = await this.turnPage();

src/resources.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {CollectionSettings as V2BillingCollectionSettings} from './resources/V2/
2626
import {Configurations as BillingPortalConfigurations} from './resources/BillingPortal/Configurations.js';
2727
import {Configurations as TerminalConfigurations} from './resources/Terminal/Configurations.js';
2828
import {ConfirmationTokens as TestHelpersConfirmationTokens} from './resources/TestHelpers/ConfirmationTokens.js';
29+
import {ConnectionSessions as V2CoreConnectionSessions} from './resources/V2/Core/ConnectionSessions.js';
2930
import {ConnectionTokens as TerminalConnectionTokens} from './resources/Terminal/ConnectionTokens.js';
3031
import {CreditBalanceSummary as BillingCreditBalanceSummary} from './resources/Billing/CreditBalanceSummary.js';
3132
import {CreditBalanceTransactions as BillingCreditBalanceTransactions} from './resources/Billing/CreditBalanceTransactions.js';
@@ -389,6 +390,7 @@ export const V2 = resourceNamespace('v2', {
389390
AccountTokens: V2CoreAccountTokens,
390391
Accounts: V2CoreAccounts,
391392
ClaimableSandboxes: V2CoreClaimableSandboxes,
393+
ConnectionSessions: V2CoreConnectionSessions,
392394
EventDestinations: V2CoreEventDestinations,
393395
Events: V2CoreEvents,
394396
Vault: resourceNamespace('vault', {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// File generated from our OpenAPI spec
2+
3+
import {StripeResource} from '../../../StripeResource.js';
4+
const stripeMethod = StripeResource.method;
5+
export const ConnectionSessions = StripeResource.extend({
6+
create: stripeMethod({
7+
method: 'POST',
8+
fullPath: '/v2/core/connection_sessions',
9+
}),
10+
retrieve: stripeMethod({
11+
method: 'GET',
12+
fullPath: '/v2/core/connection_sessions/{id}',
13+
}),
14+
});

src/resources/V2/Payments/SettlementAllocationIntents.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export const SettlementAllocationIntents = StripeResource.extend({
2020
method: 'POST',
2121
fullPath: '/v2/payments/settlement_allocation_intents/{id}',
2222
}),
23+
list: stripeMethod({
24+
method: 'GET',
25+
fullPath: '/v2/payments/settlement_allocation_intents',
26+
methodType: 'list',
27+
}),
2328
cancel: stripeMethod({
2429
method: 'POST',
2530
fullPath: '/v2/payments/settlement_allocation_intents/{id}/cancel',

src/resources/V2/Payments/SettlementAllocationIntents/Splits.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ export const Splits = StripeResource.extend({
1313
fullPath:
1414
'/v2/payments/settlement_allocation_intents/{settlement_allocation_intent_id}/splits/{id}',
1515
}),
16+
list: stripeMethod({
17+
method: 'GET',
18+
fullPath:
19+
'/v2/payments/settlement_allocation_intents/{settlement_allocation_intent_id}/splits',
20+
methodType: 'list',
21+
}),
1622
cancel: stripeMethod({
1723
method: 'POST',
1824
fullPath:

test/autoPagination.spec.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {makeAutoPaginationMethods} from '../src/autoPagination.js';
66
import {StripeResource} from '../src/StripeResource.js';
77
import {getMockStripe} from './testUtils.js';
88
import {MethodSpec} from '../src/Types.js';
9+
import {StripeAPIError} from '../src/Error.js';
910

1011
describe('auto pagination', () => {
1112
const testCase = (mockPaginationFn) => ({
@@ -841,6 +842,52 @@ describe('auto pagination', () => {
841842
],
842843
});
843844
});
845+
846+
it('handles firstPagePromise rejection without unhandled promise rejection', async () => {
847+
const spec = {
848+
method: 'GET',
849+
fullPath: '/v2/items',
850+
methodType: 'list',
851+
};
852+
853+
const mockStripe = getMockStripe({}, () => {});
854+
const resource = new StripeResource(mockStripe);
855+
856+
// Track unhandled rejections
857+
const unhandledRejections: Error[] = [];
858+
const unhandledRejectionHandler = (reason: Error): void => {
859+
unhandledRejections.push(reason);
860+
};
861+
process.on('unhandledRejection', unhandledRejectionHandler);
862+
863+
const error = new StripeAPIError({message: 'Something went wrong'});
864+
const rejectingPromise = Promise.reject(error);
865+
866+
const paginator = makeAutoPaginationMethods(
867+
resource,
868+
{},
869+
spec,
870+
rejectingPromise
871+
);
872+
873+
// User code catches the error via autoPagingToArray
874+
try {
875+
await paginator.autoPagingToArray({limit: 10});
876+
expect.fail('Should have thrown an error');
877+
} catch (e) {
878+
expect(e.message).to.equal('Something went wrong');
879+
}
880+
881+
// Give the event loop a chance to process any unhandled rejections
882+
await new Promise((resolve) => setTimeout(resolve, 10));
883+
884+
process.off('unhandledRejection', unhandledRejectionHandler);
885+
886+
expect(
887+
unhandledRejections,
888+
'Should not have any unhandled promise rejections'
889+
).to.have.length(0);
890+
});
844891
});
845892
});
846893

0 commit comments

Comments
 (0)