Skip to content
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 10.15.0 - 2022-10-20
* [#1588](https://github.com/stripe/stripe-node/pull/1588) API Updates
* Add support for new values `jp_trn` and `ke_pin` on enums `Checkout.Session.customer_details.tax_ids[].type`, `Invoice.customer_tax_ids[].type`, `Order.tax_details.tax_ids[].type`, and `TaxId.type`
* Add support for new values `jp_trn` and `ke_pin` on enums `CustomerCreateParams.tax_id_data[].type`, `InvoiceUpcomingLinesParams.customer_details.tax_ids[].type`, `InvoiceUpcomingParams.customer_details.tax_ids[].type`, `OrderCreateParams.tax_details.tax_ids[].type`, `OrderUpdateParams.tax_details.tax_ids[].type`, and `TaxIdCreateParams.type`
* Add support for `tipping` on `Terminal.Reader.action.process_payment_intent.process_config` and `TerminalReaderProcessPaymentIntentParams.process_config`
* [#1585](https://github.com/stripe/stripe-node/pull/1585) use native UUID method if available

## 10.15.0-beta.1 - 2022-10-14
* Add support for `schedule_settings` on `SubscriptionScheduleAmendParams`
* Add support for new value `upcoming_invoice` on enum `SubscriptionScheduleAmendParams.amendments[].amendment_end.type`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v202
v203
5 changes: 5 additions & 0 deletions lib/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,12 @@ const utils = {
* https://stackoverflow.com/a/2117523
*/
uuid4: () => {
// available in: v14.17.x+
if (crypto.randomUUID) {
return crypto.randomUUID();
}

// legacy behavior if native UUIDs aren't available
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0;
const v = c === 'x' ? r : (r & 0x3) | 0x8;
Expand Down
39 changes: 39 additions & 0 deletions test/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,45 @@ describe('utils', () => {
}).to.throw();
});
});

describe('uuid', () => {
describe('crypto.randomUUID', () => {
const crypto = require('crypto');
let randomUUID$;
let called;
beforeEach(() => {
// if it's available, mock it and ensure it's called
// otherwise, skip this whole operation
if (crypto.randomUUID) {
called = false;
randomUUID$ = crypto.randomUUID;
crypto.randomUUID = () => {
called = true;
return 'no, YOU you id';
};
}
});
afterEach(() => {
if (randomUUID$) {
crypto.randomUUID = randomUUID$;
}
});
it('is called if available', () => {
if (randomUUID$) {
expect(utils.uuid4()).to.equal('no, YOU you id');
expect(called).to.equal(true);
}
});
});
it('should return a well-formatted v4 UUID', () => {
expect(utils.uuid4()).to.match(
// regex from https://createuuid.com/validator/, specifically for v4
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i
);
// further test: could spy on crypto.randomUUID to ensure it's being used, if available
// whether that's useful is a race between using jest/sinon for these tests and dropping support for node < 14
});
});
});

function handleWarnings(doWithShimmedConsoleWarn, onWarn) {
Expand Down
1 change: 1 addition & 0 deletions types/2022-08-01/Capital/FinancingOffers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ declare module 'stripe' {
| 'fully_repaid'
| 'paid_out'
| 'rejected'
| 'revoked'
| 'undelivered';
}

Expand Down
40 changes: 40 additions & 0 deletions types/2022-08-01/Charges.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ declare module 'stripe' {

paynow?: PaymentMethodDetails.Paynow;

paypal?: PaymentMethodDetails.Paypal;

pix?: PaymentMethodDetails.Pix;

promptpay?: PaymentMethodDetails.Promptpay;
Expand Down Expand Up @@ -1571,6 +1573,44 @@ declare module 'stripe' {
reference: string | null;
}

interface Paypal {
/**
* PayPal account PayerID. This identifier uniquely identifies the PayPal customer.
*/
payer_id: string | null;

/**
* The shipping address for the customer, as supplied by the merchant at the point of payment
* execution. This shipping address will not be updated if the merchant updates the shipping
* address on the PaymentIntent after the PaymentIntent was successfully confirmed.
*/
shipping?: Stripe.Address | null;

/**
* A unique ID generated by PayPal for this transaction.
*/
transaction_id?: string | null;

/**
* The shipping address for the customer, as supplied by the merchant at the point of payment
* execution. This shipping address will not be updated if the merchant updates the shipping
* address on the PaymentIntent after the PaymentIntent was successfully confirmed.
*/
verified_address?: Stripe.Address | null;

/**
* Owner's verified email. Values are verified or provided by PayPal directly
* (if supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
verified_email: string | null;

/**
* Owner's verified full name. Values are verified or provided by PayPal directly
* (if supported) at the time of authorization or settlement. They cannot be set or mutated.
*/
verified_name: string | null;
}

interface Pix {
/**
* Unique transaction id generated by BCB
Expand Down
4 changes: 3 additions & 1 deletion types/2022-08-01/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ declare module 'stripe' {

interface TaxId {
/**
* The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, or `unknown`
* The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, or `unknown`
*/
type: TaxId.Type;

Expand Down Expand Up @@ -418,6 +418,8 @@ declare module 'stripe' {
| 'is_vat'
| 'jp_cn'
| 'jp_rn'
| 'jp_trn'
| 'ke_pin'
| 'kr_brn'
| 'li_uid'
| 'mx_rfc'
Expand Down
2 changes: 1 addition & 1 deletion types/2022-08-01/CustomerBalanceTransactions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ declare module 'stripe' {
amount: number;

/**
* 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). If the customer's [`currency`](https://stripe.com/docs/api/customers/object#customer_object-currency) is set, this value must match it. If the customer's `currency` is not set, it will be updated to this value.
* 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). Specifies the [`invoice_credit_balance`](https://stripe.com/docs/api/customers/object#customer_object-invoice_credit_balance) that this transaction will apply to. If the customer's `currency` is not set, it will be updated to this value.
*/
currency: string;

Expand Down
4 changes: 3 additions & 1 deletion types/2022-08-01/Customers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ declare module 'stripe' {

interface TaxIdDatum {
/**
* Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat`
* Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat`
*/
type: TaxIdDatum.Type;

Expand Down Expand Up @@ -535,6 +535,8 @@ declare module 'stripe' {
| 'is_vat'
| 'jp_cn'
| 'jp_rn'
| 'jp_trn'
| 'ke_pin'
| 'kr_brn'
| 'li_uid'
| 'mx_rfc'
Expand Down
14 changes: 10 additions & 4 deletions types/2022-08-01/Invoices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ declare module 'stripe' {
*/
interface Invoice {
/**
* Unique identifier for the object.
* Unique identifier for the object. This property is always present unless the invoice is an upcoming invoice. See [Retrieve an upcoming invoice](https://stripe.com/docs/api/invoices/upcoming) for more details.
*/
id?: string;

Expand Down Expand Up @@ -474,7 +474,7 @@ declare module 'stripe' {

interface CustomerTaxId {
/**
* The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, or `unknown`
* The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, or `unknown`
*/
type: CustomerTaxId.Type;

Expand Down Expand Up @@ -513,6 +513,8 @@ declare module 'stripe' {
| 'is_vat'
| 'jp_cn'
| 'jp_rn'
| 'jp_trn'
| 'ke_pin'
| 'kr_brn'
| 'li_uid'
| 'mx_rfc'
Expand Down Expand Up @@ -2082,7 +2084,7 @@ declare module 'stripe' {

interface TaxId {
/**
* Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat`
* Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat`
*/
type: TaxId.Type;

Expand Down Expand Up @@ -2121,6 +2123,8 @@ declare module 'stripe' {
| 'is_vat'
| 'jp_cn'
| 'jp_rn'
| 'jp_trn'
| 'ke_pin'
| 'kr_brn'
| 'li_uid'
| 'mx_rfc'
Expand Down Expand Up @@ -2659,7 +2663,7 @@ declare module 'stripe' {

interface TaxId {
/**
* Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat`
* Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat`
*/
type: TaxId.Type;

Expand Down Expand Up @@ -2698,6 +2702,8 @@ declare module 'stripe' {
| 'is_vat'
| 'jp_cn'
| 'jp_rn'
| 'jp_trn'
| 'ke_pin'
| 'kr_brn'
| 'li_uid'
| 'mx_rfc'
Expand Down
16 changes: 14 additions & 2 deletions types/2022-08-01/Issuing/Transactions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ declare module 'stripe' {
*/
metadata: Stripe.Metadata;

/**
* Details about the transaction, such as processing dates, set by the card network.
*/
network_data?: Transaction.NetworkData | null;

/**
* Additional purchase information that is optionally provided by the merchant.
*/
Expand Down Expand Up @@ -159,6 +164,13 @@ declare module 'stripe' {
state: string | null;
}

interface NetworkData {
/**
* The date the transaction was processed by the card network. This can be different from the date the seller recorded the transaction depending on when the acquirer submits the transaction to the network.
*/
processing_date: string | null;
}

interface PurchaseDetails {
/**
* Information about the flight that was purchased with this transaction.
Expand Down Expand Up @@ -307,12 +319,12 @@ declare module 'stripe' {

interface Treasury {
/**
* The Treasury [ReceivedCredit](https://stripe.com/docs/api/treasury/received_debits) representing this Issuing transaction if it is a refund
* The Treasury [ReceivedCredit](https://stripe.com/docs/api/treasury/received_credits) representing this Issuing transaction if it is a refund
*/
received_credit: string | null;

/**
* The Treasury [ReceivedDebit](https://stripe.com/docs/api/treasury/received_credits) representing this Issuing transaction if it is a capture
* The Treasury [ReceivedDebit](https://stripe.com/docs/api/treasury/received_debits) representing this Issuing transaction if it is a capture
*/
received_debit: string | null;
}
Expand Down
Loading