Skip to content

Commit

Permalink
feat: add flag to line item on subscription update (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
StashBank authored Sep 26, 2023
1 parent a6501a2 commit 4f9b01d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libs/stripe/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@valor/nestjs-stripe",
"version": "0.0.11",
"version": "0.0.12",
"type": "commonjs",
"private": false,
"author": "opavlovskyi-valor-software",
Expand Down
9 changes: 9 additions & 0 deletions libs/stripe/src/lib/dto/update-subscription.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ export class SubscriptionUpdateItemDto {
@IsOptional()
@IsPositive()
quantity?: number;

@ApiPropertyOptional()
@IsOptional()
deleted?: boolean;

@ApiPropertyOptional()
@IsOptional()
@IsString()
metadata?: Stripe.MetadataParam;
}

export class SubscriptionUpdateBillingThresholdsDto {
Expand Down
8 changes: 5 additions & 3 deletions libs/stripe/src/lib/stripe.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,10 @@ export class StripeService {
id: i.id,
price: i.priceId,
plan: i.planId,
quantity: i.quantity
})),
quantity: i.quantity,
deleted: i.deleted,
metadata: i.metadata,
} as Stripe.SubscriptionUpdateParams.Item)),
add_invoice_items: dto.addInvoiceItems?.map(i => ({
price: i.priceId,
quantity:i.quantity,
Expand Down Expand Up @@ -1356,7 +1358,7 @@ export class StripeService {
//#endregion

//#region Test Clocks
async createTestClock(frozenTime: number = Date.now(), name = ''): Promise<BaseDataResponse<TestClockDto>> {
async createTestClock(frozenTime: number, name = ''): Promise<BaseDataResponse<TestClockDto>> {
try {
const testClock = await this.stripe.testHelpers.testClocks.create({
name,
Expand Down

0 comments on commit 4f9b01d

Please sign in to comment.