Skip to content

Commit

Permalink
feat: extract coupon code to conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
masterprog-cmd committed Aug 8, 2023
1 parent 3261945 commit 22d3807
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/drive/payments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ export class Payments {
}

public updateSubscriptionPrice(priceId: string, couponCode?: string): Promise<UserSubscription> {
return this.client.put('/subscriptions', { price_id: priceId, couponCode: couponCode }, this.headers());
const coupon = couponCode ? { couponCode: couponCode } : {};
return this.client.put('/subscriptions', { price_id: priceId, ...coupon }, this.headers());
}

public cancelSubscription(): Promise<void> {
Expand Down

0 comments on commit 22d3807

Please sign in to comment.