billing - BillingOperationResult - to provide setupIntent information
MODIFY
src/integration/billing/BillingIntegration.ts
src/integration/billing/BillingIntegration.ts
-import { BillingChargeInvoiceAction, BillingDataTransactionStart, BillingDataTransactionStop, BillingDataTransactionUpdate, BillingInvoice, BillingInvoiceDocument, BillingTax, BillingUser, BillingUserSynchronizeAction } from '../../types/Billing';
+import { BillingChargeInvoiceAction, BillingDataTransactionStart, BillingDataTransactionStop, BillingDataTransactionUpdate, BillingInvoice, BillingInvoiceDocument, BillingOperationResult, BillingTax, BillingUser, BillingUserSynchronizeAction } from '../../types/Billing';
import User, { UserStatus } from '../../types/User';
import BackendError from '../../exception/BackendError';
@@ -572,7 +572,7 @@ export default abstract class BillingIntegration<T extends BillingSetting> {
abstract finalizeInvoice(invoice: BillingInvoice): Promise<string>;
// ##CR - TO BE CLARIFIED - clarify the return type!
- abstract attachPaymentMethod(user: User, paymentMethodId: string): Promise<unknown>;
+ abstract attachPaymentMethod(user: User, paymentMethodId: string): Promise<BillingOperationResult>;
abstract chargeInvoice(invoice: BillingInvoice): Promise<unknown>;
abstract handleBillingEvent(req: Request): boolean;

MODIFY
src/server/rest/v1/service/BillingService.ts
src/server/rest/v1/service/BillingService.ts
import { Action, Entity } from '../../../../types/Authorization';
-import { BillingInvoiceStatus, BillingUserSynchronizeAction } from '../../../../types/Billing';
+import { BillingInvoiceStatus, BillingOperationResult, BillingUserSynchronizeAction } from '../../../../types/Billing';
import { HTTPAuthError, HTTPError } from '../../../../types/HTTPError';
import { NextFunction, Request, Response } from 'express';
@@ -516,7 +516,7 @@ export default class BillingService {
MODULE_NAME, 'handleAttachPaymentMethod', req.user);
// Invoke the billing implementation
const paymentMethodId: string = req.body.paymentMethodId;
- const operationResult = await billingImpl.attachPaymentMethod(user, paymentMethodId);
+ const operationResult: BillingOperationResult = await billingImpl.attachPaymentMethod(user, paymentMethodId);
if (operationResult) {
console.log(operationResult);
}

billing - BillingOperationResult - to provide setupIntent information