зеркало из https://github.com/mozilla/fxa.git
Merge pull request #17423 from mozilla/FXA-10162
refactor(payments): Set billing agreement ID on customer metadata
This commit is contained in:
Коммит
6e0e15b6b5
|
@ -514,6 +514,7 @@ describe('CheckoutService', () => {
|
|||
promotionCode: mockPromotionCode,
|
||||
priceId: mockPriceId,
|
||||
});
|
||||
jest.spyOn(customerManager, 'update').mockResolvedValue(mockCustomer);
|
||||
jest.spyOn(invoiceManager, 'processPayPalInvoice').mockResolvedValue();
|
||||
jest.spyOn(invoiceManager, 'retrieve').mockResolvedValue(mockInvoice);
|
||||
jest.spyOn(paypalBillingAgreementManager, 'cancel').mockResolvedValue();
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
InvoiceManager,
|
||||
PaymentMethodManager,
|
||||
PromotionCodeManager,
|
||||
STRIPE_CUSTOMER_METADATA,
|
||||
StripeSubscription,
|
||||
SubplatInterval,
|
||||
SubscriptionManager,
|
||||
|
@ -280,7 +281,12 @@ export class CheckoutService {
|
|||
status: 'active',
|
||||
endedAt: null,
|
||||
});
|
||||
// TODO: set billingAgreementId on customer metadata (existing is updateCustomerPaypalAgreement)
|
||||
|
||||
await this.customerManager.update(customer.id, {
|
||||
metadata: {
|
||||
[STRIPE_CUSTOMER_METADATA.PAYPAL_AGREEMENT]: billingAgreementId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!subscription.latest_invoice) {
|
||||
throw new CheckoutError('latest_invoice does not exist on subscription');
|
||||
|
|
|
@ -17,6 +17,10 @@ export interface TaxAmount {
|
|||
amount: number;
|
||||
}
|
||||
|
||||
export enum STRIPE_CUSTOMER_METADATA {
|
||||
PAYPAL_AGREEMENT = 'paypalAgreementId',
|
||||
}
|
||||
|
||||
export enum STRIPE_PRICE_METADATA {
|
||||
APP_STORE_PRODUCT_IDS = 'appStoreProductIds',
|
||||
PLAY_SKU_IDS = 'playSkuIds',
|
||||
|
|
Загрузка…
Ссылка в новой задаче