Skip to content

Commit 0ea27ae

Browse files
Merge pull request #20272 from mozilla/PAY-3586-upgrading-subscription-set-to-cancel-does-not-unset-cancelled-for-customer-at
fix(payments-next): Upgrading subscription set to cancel does not unset cancelled_for_customer_at
2 parents efad249 + 5add7f5 commit 0ea27ae

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

libs/payments/cart/src/lib/checkout.service.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,16 @@ describe('CheckoutService', () => {
22342234
mockAttributionData
22352235
);
22362236
expect(subscriptionManager.update).toHaveBeenCalledTimes(2);
2237+
expect(subscriptionManager.update).toHaveBeenNthCalledWith(
2238+
1,
2239+
subscription.id,
2240+
expect.objectContaining({
2241+
cancel_at_period_end: false,
2242+
metadata: expect.objectContaining({
2243+
cancelled_for_customer_at: '',
2244+
}),
2245+
})
2246+
);
22372247
expect(subscriptionManager.update).toHaveBeenNthCalledWith(
22382248
2,
22392249
redundantSubscription.id,

libs/payments/cart/src/lib/checkout.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ export class CheckoutService {
812812
proration_behavior: 'always_invoice',
813813
payment_behavior: 'default_incomplete',
814814
metadata: {
815+
[STRIPE_SUBSCRIPTION_METADATA.CancelledForCustomerAt]: '',
815816
// Note: These fields are due to missing Fivetran support on Stripe multi-currency plans
816817
[STRIPE_SUBSCRIPTION_METADATA.Amount]: unitAmountForCurrency,
817818
[STRIPE_SUBSCRIPTION_METADATA.Currency]: cart.currency,

0 commit comments

Comments
 (0)