skikrumb-api 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -16,7 +16,8 @@ export declare const skiKrumb: (options?: {
16
16
  postal_code: string;
17
17
  state?: string;
18
18
  }) => Promise<any>;
19
- createSubscription: (customerId: string, cartId: string, productId: string, registrations: Array<string>) => Promise<any>;
19
+ createSubscription: (customerId: string, priceId: string, cartId: string, productId: string, registrations: Array<string>) => Promise<any>;
20
+ updateSubscription: (subscriptionId: string, quantity: number, registrations: Array<string>) => Promise<any>;
20
21
  cancelSubscription: (subscriptionId: string) => Promise<any>;
21
22
  readApiKeys: () => Promise<apiKeys[]>;
22
23
  readDataForDevices: (query: QueryDevice) => Promise<Device[]>;
package/dist/index.js CHANGED
@@ -110,15 +110,15 @@ export const skiKrumb = (options = {
110
110
  })
111
111
  .json();
112
112
  });
113
- const createSubscription = (customerId, cartId, productId, registrations) => __awaiter(void 0, void 0, void 0, function* () {
114
- if (!customerId || !cartId || !productId || !registrations) {
115
- throw new Error('Customer ID, cart ID, product ID, and registrations are required');
113
+ const createSubscription = (customerId, priceId, cartId, productId, registrations) => __awaiter(void 0, void 0, void 0, function* () {
114
+ if (!customerId || priceId || !cartId || !productId || !registrations) {
115
+ throw new Error('Customer ID, price Id, cart ID, product ID, and registrations are required');
116
116
  }
117
117
  return api
118
118
  .post(`${options.url}/payments/create-subscription`, {
119
119
  json: {
120
120
  customerId,
121
- priceId: 'price_1Qr1zjBxfFihs4koWNzhkhyX',
121
+ priceId,
122
122
  cartId,
123
123
  productId,
124
124
  quantity: registrations.length,
@@ -127,6 +127,20 @@ export const skiKrumb = (options = {
127
127
  })
128
128
  .json();
129
129
  });
130
+ const updateSubscription = (subscriptionId, quantity, registrations) => __awaiter(void 0, void 0, void 0, function* () {
131
+ if (!subscriptionId) {
132
+ throw new Error('Subscription ID is required');
133
+ }
134
+ return api
135
+ .patch(`${options.url}/payments/update-subscription`, {
136
+ json: {
137
+ subscriptionId,
138
+ quantity,
139
+ registrations,
140
+ },
141
+ })
142
+ .json();
143
+ });
130
144
  const cancelSubscription = (subscriptionId) => __awaiter(void 0, void 0, void 0, function* () {
131
145
  if (!subscriptionId) {
132
146
  throw new Error('Subscription ID is required');
@@ -177,6 +191,7 @@ export const skiKrumb = (options = {
177
191
  updateCustomerAddress,
178
192
  getTaxCalculation,
179
193
  createSubscription,
194
+ updateSubscription,
180
195
  cancelSubscription,
181
196
  readApiKeys,
182
197
  readDataForDevices,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skikrumb-api",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Wrapper for the skiKrumb API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",