From 7b2eebfa24ef454db3e8b1528ed94f0e0f2e13ef Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlovskyi Date: Fri, 29 Dec 2023 10:48:42 +0200 Subject: [PATCH] feat: add def pm to update customer --- libs/stripe/package.json | 2 +- libs/stripe/src/lib/dto/update-customer.dto.ts | 5 +++++ libs/stripe/src/lib/stripe.service.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/stripe/package.json b/libs/stripe/package.json index e421b2d..78bfe0d 100644 --- a/libs/stripe/package.json +++ b/libs/stripe/package.json @@ -1,6 +1,6 @@ { "name": "@valor/nestjs-stripe", - "version": "0.0.18", + "version": "0.0.19", "type": "commonjs", "private": false, "author": "opavlovskyi-valor-software", diff --git a/libs/stripe/src/lib/dto/update-customer.dto.ts b/libs/stripe/src/lib/dto/update-customer.dto.ts index ce81a7b..ba12a68 100644 --- a/libs/stripe/src/lib/dto/update-customer.dto.ts +++ b/libs/stripe/src/lib/dto/update-customer.dto.ts @@ -88,4 +88,9 @@ export class UpdateCustomerDto { @IsOptional() @IsEnum(['exempt', 'none', 'reverse']) taxExempt?: 'exempt' | 'none' | 'reverse'; + + @ApiPropertyOptional() + @IsOptional() + @IsString() + defaultPaymentMethod?: string; } \ No newline at end of file diff --git a/libs/stripe/src/lib/stripe.service.ts b/libs/stripe/src/lib/stripe.service.ts index ba4f905..256131f 100644 --- a/libs/stripe/src/lib/stripe.service.ts +++ b/libs/stripe/src/lib/stripe.service.ts @@ -215,6 +215,7 @@ export class StripeService { phone: dto.phone, address: this.addressFromDto(dto.address), invoice_prefix: dto.invoicePrefix, + invoice_settings: dto.defaultPaymentMethod ? { default_payment_method: dto.defaultPaymentMethod } : undefined, metadata:dto.metadata, preferred_locales: dto.preferredLocales, promotion_code: dto.promotionCode,