mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { Inject } from 'typedi';
|
|
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 createInvoiceCheckoutSessionService: CreateInvoiceCheckoutSession;
|
|
|
|
/**
|
|
* Creates a new Stripe account for Bigcapital.
|
|
* @param {number} tenantId
|
|
* @param {number} createStripeAccountDTO
|
|
*/
|
|
public createStripeAccount(
|
|
tenantId: number,
|
|
createStripeAccountDTO: CreateStripeAccountDTO = {}
|
|
) {
|
|
return this.createStripeAccountService.createStripeAccount(
|
|
tenantId,
|
|
createStripeAccountDTO
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Creates the Stripe checkout session from the given sale invoice.
|
|
* @param {number} tenantId
|
|
* @param {string} paymentLinkId
|
|
* @returns {Promise<StripeInvoiceCheckoutSessionPOJO>}
|
|
*/
|
|
public createSaleInvoiceCheckoutSession(
|
|
tenantId: number,
|
|
paymentLinkId: number
|
|
): Promise<StripeInvoiceCheckoutSessionPOJO> {
|
|
return this.createInvoiceCheckoutSessionService.createInvoiceCheckoutSession(
|
|
tenantId,
|
|
paymentLinkId
|
|
);
|
|
}
|
|
}
|