зеркало из https://github.com/mozilla/fxa.git
chore(deps): Update Stripe dependency
This commit is contained in:
Родитель
7081e70866
Коммит
fefc48dd32
|
@ -35,5 +35,6 @@ export const StripeDiscountFactory = (
|
|||
promotion_code: null,
|
||||
start: faker.number.int(),
|
||||
subscription: null,
|
||||
subscription_item: null,
|
||||
...override,
|
||||
});
|
||||
|
|
|
@ -16,7 +16,8 @@ export const StripeInvoiceLineItemFactory = (
|
|||
description: null,
|
||||
discount_amounts: null,
|
||||
discountable: true,
|
||||
discounts: null,
|
||||
discounts: [],
|
||||
invoice: null,
|
||||
livemode: false,
|
||||
metadata: {},
|
||||
period: {
|
||||
|
|
|
@ -24,6 +24,7 @@ export const StripeInvoiceFactory = (
|
|||
attempted: true,
|
||||
automatic_tax: {
|
||||
enabled: true,
|
||||
liability: null,
|
||||
status: 'complete',
|
||||
},
|
||||
billing_reason: null,
|
||||
|
@ -44,11 +45,15 @@ export const StripeInvoiceFactory = (
|
|||
default_tax_rates: [],
|
||||
description: null,
|
||||
discount: null,
|
||||
discounts: null,
|
||||
discounts: [],
|
||||
due_date: null,
|
||||
ending_balance: null,
|
||||
effective_at: null,
|
||||
footer: null,
|
||||
from_invoice: null,
|
||||
issuer: {
|
||||
type: 'self',
|
||||
},
|
||||
last_finalization_error: null,
|
||||
latest_revision: null,
|
||||
lines: {
|
||||
|
@ -76,7 +81,7 @@ export const StripeInvoiceFactory = (
|
|||
pre_payment_credit_notes_amount: 0,
|
||||
quote: null,
|
||||
receipt_number: null,
|
||||
rendering_options: null,
|
||||
rendering: null,
|
||||
shipping_cost: null,
|
||||
shipping_details: null,
|
||||
starting_balance: faker.number.int({ max: 1000 }),
|
||||
|
@ -89,6 +94,7 @@ export const StripeInvoiceFactory = (
|
|||
voided_at: null,
|
||||
},
|
||||
subscription: `sub_${faker.string.alphanumeric({ length: 24 })}`,
|
||||
subscription_details: null,
|
||||
subtotal: faker.number.int({ max: 1000 }),
|
||||
subtotal_excluding_tax: faker.number.int({ max: 1000 }),
|
||||
tax: faker.number.int({ max: 1000 }),
|
||||
|
|
|
@ -38,6 +38,7 @@ export const StripePaymentIntentFactory = (
|
|||
next_action: null,
|
||||
on_behalf_of: null,
|
||||
payment_method: null,
|
||||
payment_method_configuration_details: null,
|
||||
payment_method_options: {
|
||||
card: {
|
||||
installments: null,
|
||||
|
|
|
@ -31,6 +31,7 @@ export const StripePaymentMethodFactory = (
|
|||
cvc_check: 'unchecked',
|
||||
},
|
||||
country: faker.location.countryCode(),
|
||||
display_brand: 'visa',
|
||||
exp_month: faker.date.future().getUTCMonth(),
|
||||
exp_year: faker.date.future().getUTCFullYear(),
|
||||
fingerprint: faker.string.uuid(),
|
||||
|
|
|
@ -11,11 +11,11 @@ export const StripeProductFactory = (
|
|||
id: `prod_${faker.string.alphanumeric({ length: 14 })}`,
|
||||
object: 'product',
|
||||
active: true,
|
||||
attributes: null,
|
||||
created: faker.number.int(),
|
||||
description: faker.string.alphanumeric(),
|
||||
images: [faker.system.commonFileName('jpg')],
|
||||
livemode: false,
|
||||
marketing_features: [],
|
||||
metadata: {},
|
||||
name: faker.string.alphanumeric(),
|
||||
package_dimensions: null,
|
||||
|
|
|
@ -18,8 +18,10 @@ export const StripeSubscriptionFactory = (
|
|||
application_fee_percent: null,
|
||||
automatic_tax: {
|
||||
enabled: true,
|
||||
liability: null,
|
||||
},
|
||||
billing_cycle_anchor: 1,
|
||||
billing_cycle_anchor_config: null,
|
||||
billing_thresholds: null,
|
||||
cancel_at: null,
|
||||
cancel_at_period_end: false,
|
||||
|
@ -36,6 +38,7 @@ export const StripeSubscriptionFactory = (
|
|||
default_source: faker.string.alphanumeric(10),
|
||||
description: null,
|
||||
discount: null,
|
||||
discounts: [],
|
||||
ended_at: null,
|
||||
items: {
|
||||
object: 'list',
|
||||
|
@ -73,6 +76,7 @@ export const StripeSubscriptionItemFactory = (
|
|||
object: 'subscription_item',
|
||||
billing_thresholds: null,
|
||||
created: faker.number.int(),
|
||||
discounts: [],
|
||||
metadata: {},
|
||||
plan: {
|
||||
id: `plan_${faker.string.alphanumeric({ length: 14 })}`,
|
||||
|
|
|
@ -19,6 +19,7 @@ export const StripeUpcomingInvoiceFactory = (
|
|||
attempted: true,
|
||||
automatic_tax: {
|
||||
enabled: true,
|
||||
liability: null,
|
||||
status: 'complete',
|
||||
},
|
||||
billing_reason: null,
|
||||
|
@ -39,11 +40,15 @@ export const StripeUpcomingInvoiceFactory = (
|
|||
default_tax_rates: [],
|
||||
description: null,
|
||||
discount: null,
|
||||
discounts: null,
|
||||
discounts: [],
|
||||
due_date: null,
|
||||
ending_balance: null,
|
||||
effective_at: null,
|
||||
footer: null,
|
||||
from_invoice: null,
|
||||
issuer: {
|
||||
type: 'self',
|
||||
},
|
||||
last_finalization_error: null,
|
||||
latest_revision: null,
|
||||
lines: {
|
||||
|
@ -71,7 +76,7 @@ export const StripeUpcomingInvoiceFactory = (
|
|||
pre_payment_credit_notes_amount: 0,
|
||||
quote: null,
|
||||
receipt_number: null,
|
||||
rendering_options: null,
|
||||
rendering: null,
|
||||
shipping_cost: null,
|
||||
shipping_details: null,
|
||||
starting_balance: faker.number.int({ max: 1000 }),
|
||||
|
@ -84,6 +89,7 @@ export const StripeUpcomingInvoiceFactory = (
|
|||
voided_at: null,
|
||||
},
|
||||
subscription: `sub_${faker.string.alphanumeric({ length: 24 })}`,
|
||||
subscription_details: null,
|
||||
subtotal: faker.number.int({ max: 1000 }),
|
||||
subtotal_excluding_tax: faker.number.int({ max: 1000 }),
|
||||
tax: faker.number.int({ max: 1000 }),
|
||||
|
|
|
@ -38,7 +38,7 @@ export class StripeClient {
|
|||
private readonly stripe: Stripe;
|
||||
constructor(private stripeConfig: StripeConfig) {
|
||||
this.stripe = new Stripe(this.stripeConfig.apiKey, {
|
||||
apiVersion: '2022-11-15',
|
||||
apiVersion: '2024-04-10',
|
||||
maxNetworkRetries: 3,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
"rxjs": "^7.8.1",
|
||||
"semver": "^7.6.0",
|
||||
"set-value": "^4.1.0",
|
||||
"stripe": "^15.4.0",
|
||||
"tslib": "^2.6.2",
|
||||
"uuid": "^9.0.0",
|
||||
"winston": "^3.13.0"
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
"knex": "^3.1.0",
|
||||
"pem-jwk": "^2.0.0",
|
||||
"rimraf": "^5.0.0",
|
||||
"stripe": "^11.12.0",
|
||||
"ts-morph": "^22.0.0",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
|
|
|
@ -34,7 +34,7 @@ export const StripeFactory: Provider<Stripe> = {
|
|||
const stripeConfig = configService.get('subscriptions');
|
||||
const env = configService.get<string>('env') || '';
|
||||
const stripe = new Stripe(stripeConfig.stripeApiKey, {
|
||||
apiVersion: '2022-11-15',
|
||||
apiVersion: '2024-04-10',
|
||||
maxNetworkRetries: 3,
|
||||
});
|
||||
stripe.customers.list({ limit: 1 }).catch((error) => {
|
||||
|
|
|
@ -201,7 +201,7 @@ export class StripeHelper extends StripeHelperBase {
|
|||
: undefined;
|
||||
|
||||
this.stripe = new Stripe(config.subscriptions.stripeApiKey, {
|
||||
apiVersion: '2022-11-15',
|
||||
apiVersion: '2024-04-10',
|
||||
maxNetworkRetries: 3,
|
||||
});
|
||||
|
||||
|
@ -588,7 +588,7 @@ export class StripeHelper extends StripeHelperBase {
|
|||
throw error.subscriptionAlreadyExists();
|
||||
} else if (sub && sub.status === 'incomplete') {
|
||||
// Sub has never been active or charged, delete it.
|
||||
this.stripe.subscriptions.del(sub.id);
|
||||
this.stripe.subscriptions.cancel(sub.id);
|
||||
}
|
||||
|
||||
this.statsd.increment('stripe_subscription', {
|
||||
|
@ -1563,7 +1563,7 @@ export class StripeHelper extends StripeHelperBase {
|
|||
async cancelSubscription(
|
||||
subscriptionId: string
|
||||
): Promise<Stripe.Subscription> {
|
||||
return this.stripe.subscriptions.del(subscriptionId);
|
||||
return this.stripe.subscriptions.cancel(subscriptionId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -130,7 +130,6 @@
|
|||
"safe-regex": "^2.1.1",
|
||||
"safe-url-assembler": "1.3.5",
|
||||
"sandboxed-regexp": "^0.3.0",
|
||||
"stripe": "^11.12.0",
|
||||
"superagent": "^8.1.2",
|
||||
"typedi": "^0.8.0",
|
||||
"uuid": "^9.0.0",
|
||||
|
|
|
@ -143,7 +143,7 @@ async function retrieveStripeCustomers(
|
|||
|
||||
const config = Container.get(AppConfig);
|
||||
const stripe = new Stripe(config.subscriptions.stripeApiKey, {
|
||||
apiVersion: '2022-11-15',
|
||||
apiVersion: '2024-04-10',
|
||||
maxNetworkRetries: 3,
|
||||
});
|
||||
const baseQuery = `created<=${endDate} AND created>=${startDate}`;
|
||||
|
|
|
@ -150,7 +150,7 @@ async function retrieveSubscriptionsByCreatedStripe(
|
|||
): Promise<SubscriptionData[]> {
|
||||
const config = Container.get(AppConfig);
|
||||
const stripe = new Stripe(config.subscriptions.stripeApiKey, {
|
||||
apiVersion: '2022-11-15',
|
||||
apiVersion: '2024-04-10',
|
||||
maxNetworkRetries: 3,
|
||||
});
|
||||
const baseQuery = `created<=${endDate} AND created>=${startDate}`;
|
||||
|
|
|
@ -147,7 +147,7 @@ const mockConfig = {
|
|||
},
|
||||
currenciesToCountries: { ZAR: ['AS', 'CA'] },
|
||||
contentful: {
|
||||
enabled: false
|
||||
enabled: false,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1294,7 +1294,7 @@ describe('#integration - StripeHelper', () => {
|
|||
sandbox
|
||||
.stub(stripeHelper, 'findCustomerSubscriptionByPlanId')
|
||||
.returns(collectionSubscription);
|
||||
sandbox.stub(stripeHelper.stripe.subscriptions, 'del').resolves({});
|
||||
sandbox.stub(stripeHelper.stripe.subscriptions, 'cancel').resolves({});
|
||||
sandbox
|
||||
.stub(stripeHelper.stripe.subscriptions, 'create')
|
||||
.resolves(subscription1);
|
||||
|
@ -1309,7 +1309,7 @@ describe('#integration - StripeHelper', () => {
|
|||
|
||||
assert.deepEqual(actual, subscription1);
|
||||
sinon.assert.calledOnceWithExactly(
|
||||
stripeHelper.stripe.subscriptions.del,
|
||||
stripeHelper.stripe.subscriptions.cancel,
|
||||
collectionSubscription.id
|
||||
);
|
||||
sinon.assert.calledWithExactly(
|
||||
|
@ -2974,10 +2974,10 @@ describe('#integration - StripeHelper', () => {
|
|||
|
||||
describe('cancelSubscription', () => {
|
||||
it('sets subscription to cancelled', async () => {
|
||||
sandbox.stub(stripeHelper.stripe.subscriptions, 'del').resolves({});
|
||||
sandbox.stub(stripeHelper.stripe.subscriptions, 'cancel').resolves({});
|
||||
await stripeHelper.cancelSubscription('subscriptionId');
|
||||
sinon.assert.calledOnceWithExactly(
|
||||
stripeHelper.stripe.subscriptions.del,
|
||||
stripeHelper.stripe.subscriptions.cancel,
|
||||
'subscriptionId'
|
||||
);
|
||||
});
|
||||
|
@ -3472,8 +3472,8 @@ describe('#integration - StripeHelper', () => {
|
|||
|
||||
// set sandbox and spies
|
||||
sandbox
|
||||
.stub(stripeHelper.stripe.plans, 'list')
|
||||
.returns(asyncIterable([plan1, plan2, plan3]));
|
||||
.stub(stripeHelper.stripe.plans, 'list')
|
||||
.returns(asyncIterable([plan1, plan2, plan3]));
|
||||
sandbox.spy(stripeHelper, 'allPlans');
|
||||
sandbox.spy(stripeHelper, 'allConfiguredPlans');
|
||||
|
||||
|
|
|
@ -324,7 +324,6 @@
|
|||
"mysql": "^2.18.1",
|
||||
"node-uap": "https://github.com/mozilla-fxa/node-uap.git#494714db3e65a4dbfae772f536c8697269174574",
|
||||
"objection": "^3.1.3",
|
||||
"stripe": "^11.12.0",
|
||||
"superagent": "^8.1.2",
|
||||
"typesafe-node-firestore": "^1.4.1"
|
||||
},
|
||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -37436,7 +37436,6 @@ fsevents@~2.1.1:
|
|||
pem-jwk: ^2.0.0
|
||||
pm2: ^5.3.0
|
||||
rimraf: ^5.0.0
|
||||
stripe: ^11.12.0
|
||||
supertest: ^7.0.0
|
||||
ts-jest: ^29.1.2
|
||||
ts-morph: ^22.0.0
|
||||
|
@ -37615,7 +37614,6 @@ fsevents@~2.1.1:
|
|||
simplesmtp: 0.3.35
|
||||
sinon: ^9.0.3
|
||||
storybook: ^7.4.6
|
||||
stripe: ^11.12.0
|
||||
superagent: ^8.1.2
|
||||
through: 2.3.8
|
||||
tsc-alias: ^1.8.8
|
||||
|
@ -38449,7 +38447,6 @@ fsevents@~2.1.1:
|
|||
prettier: ^2.3.1
|
||||
proxyquire: ^2.1.3
|
||||
sinon: ^9.0.3
|
||||
stripe: ^11.12.0
|
||||
superagent: ^8.1.2
|
||||
ts-jest: ^29.1.2
|
||||
ts-loader: ^8.4.0
|
||||
|
@ -38609,6 +38606,7 @@ fsevents@~2.1.1:
|
|||
semver: ^7.6.0
|
||||
server-only: ^0.0.1
|
||||
set-value: ^4.1.0
|
||||
stripe: ^15.4.0
|
||||
stylelint: ^16.2.1
|
||||
stylelint-config-prettier: ^9.0.3
|
||||
stylelint-config-recommended-scss: ^14.0.0
|
||||
|
@ -61011,13 +61009,13 @@ resolve@1.1.7:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"stripe@npm:^11.12.0":
|
||||
version: 11.14.0
|
||||
resolution: "stripe@npm:11.14.0"
|
||||
"stripe@npm:^15.4.0":
|
||||
version: 15.4.0
|
||||
resolution: "stripe@npm:15.4.0"
|
||||
dependencies:
|
||||
"@types/node": ">=8.1.0"
|
||||
qs: ^6.11.0
|
||||
checksum: daaee9f33e84d04d81d90ce86fd810d0b77b0700265b30e92fe86e4cf643d4281b3322be608896570a26d7231fe78d71c5e25c4122daf5c3f5eebe87dfd33952
|
||||
checksum: 0302b740ef76084b8cc0fbec14f80c864101a0b04b1d85ecd120d921f3d665a512230a905be1388f777d9677850ffcf066c8cce37935e2f8f3d0d3d5d29d7a4b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче