stripe - BillingError as common to all payment platforms
MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -479,7 +479,7 @@ export default class StripeBillingIntegration extends BillingIntegration<StripeB
};
} catch (error) {
return {
- succeeded: true,
+ succeeded: false,
error,
};
}

MODIFY
src/integration/billing/stripe/StripeHelpers.ts
src/integration/billing/stripe/StripeHelpers.ts
-import { BillingInvoice, BillingOperationResult } from '../../../types/Billing';
+import { BillingError, BillingInvoice, BillingOperationResult } from '../../../types/Billing';
import BillingStorage from '../../../storage/mongodb/BillingStorage';
import Stripe from 'stripe';
-export interface BillingError {
- message: string
- statusCode: number,
- context?: unknown; // e.g.: payment ==> last_payment_error
-}
-
export default class StripeHelpers {
public static async handleStripeOperationResult(tenantID: string, billingInvoice: BillingInvoice, operationResult: BillingOperationResult): Promise<void> {

MODIFY
src/storage/mongodb/BillingStorage.ts
src/storage/mongodb/BillingStorage.ts
-import { BillingInvoice, BillingInvoiceDocument, BillingInvoiceStatus } from '../../types/Billing';
+import { BillingError, BillingInvoice, BillingInvoiceStatus } from '../../types/Billing';
import global, { FilterParams } from '../../types/GlobalType';
-import { BillingError } from '../../integration/billing/stripe/StripeHelpers';
import Constants from '../../utils/Constants';
import { DataResult } from '../../types/DataResult';
import DatabaseUtils from './DatabaseUtils';

MODIFY
src/types/Billing.ts
src/types/Billing.ts
@@ -131,3 +131,10 @@ export interface BillingPaymentMethodResult {
result: BillingPaymentMethod[];
count: number;
}
+
+export interface BillingError {
+ // TODO - Billing Error should expose at least the information which is common to all payment platforms
+ message: string
+ statusCode: number,
+ context?: unknown; // The context may provide additional information that are platform-specific
+}

stripe - BillingError as common to all payment platforms