зеркало из https://github.com/mozilla/fxa.git
feat(payments-stripe): add cancelSubscription to stripe manager
Because: * We want to be able to cancel subscriptions from non-stripe lib This commit: * Adds a stripe manager method to do so Closes FXA-9027
This commit is contained in:
Родитель
0e40f47469
Коммит
f619c142fb
|
@ -122,6 +122,18 @@ describe('StripeManager', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('cancelSubscription', () => {
|
||||
it('calls stripeclient', async () => {
|
||||
const mockSubscription = StripeSubscriptionFactory();
|
||||
|
||||
mockClient.subscriptionsCancel = jest
|
||||
.fn()
|
||||
.mockResolvedValueOnce(undefined);
|
||||
|
||||
await manager.cancelSubscription(mockSubscription.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isCustomerStripeTaxEligible', () => {
|
||||
it('should return true for a taxable customer', async () => {
|
||||
const mockCustomer = StripeCustomerFactory({
|
||||
|
|
|
@ -70,6 +70,10 @@ export class StripeManager {
|
|||
});
|
||||
}
|
||||
|
||||
async cancelSubscription(subscriptionId: string) {
|
||||
return this.client.subscriptionsCancel(subscriptionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if customer's automatic tax status indicates that they're eligible for automatic tax.
|
||||
* Creating a subscription with automatic_tax enabled requires a customer with an address
|
||||
|
|
Загрузка…
Ссылка в новой задаче