mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
fix: Stripe payment integration
This commit is contained in:
@@ -2,6 +2,7 @@ import { Inject, Service } from 'typedi';
|
||||
import HasTenancyService from '../Tenancy/TenancyService';
|
||||
import { GetPaymentMethodsPOJO } from './types';
|
||||
import config from '@/config';
|
||||
import { isStripePaymentConfigured } from './utils';
|
||||
|
||||
@Service()
|
||||
export class GetPaymentMethodsStateService {
|
||||
@@ -31,11 +32,13 @@ export class GetPaymentMethodsStateService {
|
||||
const stripePublishableKey = config.stripePayment.publishableKey;
|
||||
const stripeCurrencies = ['USD', 'EUR'];
|
||||
const stripeRedirectUrl = 'https://your-stripe-redirect-url.com';
|
||||
const isStripeServerConfigured = isStripePaymentConfigured();
|
||||
|
||||
const paymentMethodPOJO: GetPaymentMethodsPOJO = {
|
||||
stripe: {
|
||||
isStripeAccountCreated,
|
||||
isStripePaymentActive,
|
||||
isStripeServerConfigured,
|
||||
stripeAccountId,
|
||||
stripePaymentMethodId,
|
||||
stripePublishableKey,
|
||||
|
||||
@@ -17,6 +17,7 @@ export interface GetPaymentMethodsPOJO {
|
||||
stripe: {
|
||||
isStripeAccountCreated: boolean;
|
||||
isStripePaymentActive: boolean;
|
||||
isStripeServerConfigured: boolean;
|
||||
stripeAccountId: string | null;
|
||||
stripePaymentMethodId: number | null;
|
||||
stripePublishableKey: string | null;
|
||||
|
||||
9
packages/server/src/services/PaymentServices/utils.ts
Normal file
9
packages/server/src/services/PaymentServices/utils.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import config from '@/config';
|
||||
|
||||
export const isStripePaymentConfigured = () => {
|
||||
return (
|
||||
config.stripePayment.secretKey &&
|
||||
config.stripePayment.publishableKey &&
|
||||
config.stripePayment.webhooksSecret
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user