Skip to content

Commit

Permalink
feat: init stripe in service
Browse files Browse the repository at this point in the history
  • Loading branch information
StashBank committed Dec 6, 2023
1 parent e5af726 commit 1623e74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion libs/stripe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.17",
"type": "commonjs",
"private": false,
"author": "opavlovskyi-valor-software",
"license": "ISC",
"description": "Stripe service with DTO's and Swagger for nestjs projects. Include Webhooks listeners and Event enums.",
"repository": {
Expand Down
12 changes: 7 additions & 5 deletions libs/stripe/src/lib/stripe.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,16 @@ import { StripeLogger } from './stripe.logger';

@Injectable()
export class StripeService {
protected stripe: Stripe = new Stripe(this.config.apiKey, {
apiVersion: '2022-11-15'
});
protected readonly stripe!: Stripe;

constructor(
@Inject(STRIPE_CONFIG) protected readonly config: StripeConfig,
private readonly logger: StripeLogger
) {}
) {
this.stripe = new Stripe(this.config.apiKey, {
apiVersion: '2022-11-15'
});
}

//#region Payment Intent
async createPaymentIntent(dto: CreatePaymentIntentDto): Promise<PaymentIntentResponse> {
Expand Down Expand Up @@ -1112,7 +1114,7 @@ export class StripeService {
discountable: dto.discountable,
discounts: dto.discounts,
expand: dto.expand,
invoice: dto.invoice,
invoice: invoiceId|| dto.invoice,
period: dto.period,
price: dto.price,
price_data: dto.priceData ? {
Expand Down

0 comments on commit 1623e74

Please sign in to comment.