File size: 567 Bytes
1fe7075
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { Global, Module } from '@nestjs/common';
import Stripe from 'stripe';
import { APP_CONFIG } from '../config/app-config.js';
import type { AppConfig } from '../config/app-config.interface.js';
import { STRIPE_CLIENT } from './stripe.constants.js';

@Global()
@Module({
  providers: [
    {
      provide: STRIPE_CLIENT,
      inject: [APP_CONFIG],
      useFactory: (config: AppConfig) => new Stripe(config.stripe.secretKey, { maxNetworkRetries: 2, appInfo: { name: 'prevision-api' } }),
    },
  ],
  exports: [STRIPE_CLIENT],
})
export class StripeModule {}