mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
feat: clean up the stripe payment integration
This commit is contained in:
@@ -1,22 +1,13 @@
|
||||
import { Knex } from 'knex';
|
||||
import { Inject } from 'typedi';
|
||||
import { CreateStripeAccountService } from '@/api/controllers/StripeIntegration/CreateStripeAccountService';
|
||||
import { CreateStripeAccountDTO } from '@/api/controllers/StripeIntegration/types';
|
||||
import { SaleInvoiceStripePaymentLink } from './SaleInvoiceStripePaymentLink';
|
||||
import { DeleteStripePaymentLinkInvoice } from './DeleteStripePaymentLinkInvoice';
|
||||
import { CreateInvoiceCheckoutSession } from './CreateInvoiceCheckoutSession';
|
||||
import { StripeInvoiceCheckoutSessionPOJO } from '@/interfaces/StripePayment';
|
||||
import { CreateStripeAccountService } from './CreateStripeAccountService';
|
||||
import { CreateStripeAccountDTO } from './types';
|
||||
|
||||
export class StripePaymentApplication {
|
||||
@Inject()
|
||||
private createStripeAccountService: CreateStripeAccountService;
|
||||
|
||||
@Inject()
|
||||
private saleInvoiceStripePaymentLinkService: SaleInvoiceStripePaymentLink;
|
||||
|
||||
@Inject()
|
||||
private deleteStripePaymentLinkInvoice: DeleteStripePaymentLinkInvoice;
|
||||
|
||||
@Inject()
|
||||
private createSaleInvoiceCheckoutSessionService: CreateInvoiceCheckoutSession;
|
||||
|
||||
@@ -35,25 +26,6 @@ export class StripePaymentApplication {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Stripe payment link for the given sale invoice.
|
||||
* @param {number} tenantId - Tenant id.
|
||||
* @param {number} stripeIntegrationId - Stripe integration id.
|
||||
* @param {ISaleInvoice} saleInvoice - Sale invoice id.
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
public createSaleInvoicePaymentLink(
|
||||
tenantId: number,
|
||||
stripeIntegrationId: number,
|
||||
invoiceId: number
|
||||
) {
|
||||
return this.saleInvoiceStripePaymentLinkService.createPaymentLink(
|
||||
tenantId,
|
||||
stripeIntegrationId,
|
||||
invoiceId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Stripe checkout session from the given sale invoice.
|
||||
* @param {number} tenantId
|
||||
@@ -69,22 +41,4 @@ export class StripePaymentApplication {
|
||||
paymentLinkId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the Stripe payment link associated with the given sale invoice.
|
||||
* @param {number} tenantId - Tenant id.
|
||||
* @param {number} invoiceId - Sale invoice id.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
public deleteInvoicePaymentLink(
|
||||
tenantId: number,
|
||||
invoiceId: number,
|
||||
trx?: Knex.Transaction
|
||||
): Promise<void> {
|
||||
return this.deleteStripePaymentLinkInvoice.deleteInvoicePaymentLink(
|
||||
tenantId,
|
||||
invoiceId,
|
||||
trx
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user