Skip to content

Commit

Permalink
feat: added urls.customer_portal_update_subscription parameter to …
Browse files Browse the repository at this point in the history
…Subscription objects (#65)

* feat(orders): add setup_fee, setup_fee_usd, tax_inclusive and setup_fee_formatted

* feat(subscriptionInvoices): add tax_inclusive

* feat(subscriptions): added `urls.customer_portal_update_subscription` response field, type and test

* docs: update changeset
  • Loading branch information
keyding authored Feb 28, 2024
1 parent f4e941d commit 27cbaf4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-monkeys-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lemonsqueezy/lemonsqueezy.js": minor
---

Added `urls.customer_portal_update_subscription` parameter to Subscription objects.
1 change: 1 addition & 0 deletions src/subscriptions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ type Attributes = {
urls: {
update_payment_method: string;
customer_portal: string;
customer_portal_update_subscription: string;
};
/**
* An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) formatted date-time string indicating the end of the current billing cycle, and when the next invoice will be issued. This also applies to `past_due` subscriptions; `renews_at` will reflect the next renewal charge attempt.
Expand Down
30 changes: 26 additions & 4 deletions test/subscriptions/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,19 @@ describe("Retrieve a subscription", () => {
for (const item of firstItems) expect(item).toBeDefined();
} else expect(first_subscription_item).toBeNull();

expect(urls.update_payment_method).toBeString();
expect(urls.customer_portal).toBeString();
// urls
const {
update_payment_method,
customer_portal,
customer_portal_update_subscription,
} = urls;
const urlItems = [
update_payment_method,
customer_portal,
customer_portal_update_subscription,
];
expect(Object.keys(urls).length).toEqual(urlItems.length);
for (const item of urlItems) expect(item).toBeString();

const {
store,
Expand Down Expand Up @@ -466,8 +477,19 @@ describe("Retrieve a subscription", () => {
for (const item of firstItems) expect(item).toBeDefined();
} else expect(first_subscription_item).toBeNull();

expect(urls.update_payment_method).toBeString();
expect(urls.customer_portal).toBeString();
// urls
const {
update_payment_method,
customer_portal,
customer_portal_update_subscription,
} = urls;
const urlItems = [
update_payment_method,
customer_portal,
customer_portal_update_subscription,
];
expect(Object.keys(urls).length).toEqual(urlItems.length);
for (const item of urlItems) expect(item).toBeString();

const {
store,
Expand Down

0 comments on commit 27cbaf4

Please sign in to comment.