Skip to content

Commit 1623e74

Browse files
committed
feat: init stripe in service
1 parent e5af726 commit 1623e74

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

libs/stripe/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": "0.0.17",
44
"type": "commonjs",
55
"private": false,
6-
"author": "opavlovskyi-valor-software",
76
"license": "ISC",
87
"description": "Stripe service with DTO's and Swagger for nestjs projects. Include Webhooks listeners and Event enums.",
98
"repository": {

libs/stripe/src/lib/stripe.service.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ import { StripeLogger } from './stripe.logger';
7171

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

7876
constructor(
7977
@Inject(STRIPE_CONFIG) protected readonly config: StripeConfig,
8078
private readonly logger: StripeLogger
81-
) {}
79+
) {
80+
this.stripe = new Stripe(this.config.apiKey, {
81+
apiVersion: '2022-11-15'
82+
});
83+
}
8284

8385
//#region Payment Intent
8486
async createPaymentIntent(dto: CreatePaymentIntentDto): Promise<PaymentIntentResponse> {
@@ -1112,7 +1114,7 @@ export class StripeService {
11121114
discountable: dto.discountable,
11131115
discounts: dto.discounts,
11141116
expand: dto.expand,
1115-
invoice: dto.invoice,
1117+
invoice: invoiceId|| dto.invoice,
11161118
period: dto.period,
11171119
price: dto.price,
11181120
price_data: dto.priceData ? {

0 commit comments

Comments
 (0)