@betterstore/sdk 0.3.56 → 0.3.58
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +30 -6
- package/dist/index.mjs +30 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -233,11 +233,15 @@ declare class Checkout {
|
|
|
233
233
|
*/
|
|
234
234
|
update(checkoutId: string, params: CheckoutUpdateParams): Promise<CheckoutSession>;
|
|
235
235
|
/**
|
|
236
|
-
*
|
|
236
|
+
* Apply a discount code to a checkout session
|
|
237
237
|
*/
|
|
238
238
|
applyDiscountCode(checkoutId: string, discountCode: string): Promise<CheckoutSession>;
|
|
239
239
|
/**
|
|
240
|
-
*
|
|
240
|
+
* Remove a discount code from a checkout session
|
|
241
|
+
*/
|
|
242
|
+
removeDiscountCode(checkoutId: string, discountId: string): Promise<CheckoutSession>;
|
|
243
|
+
/**
|
|
244
|
+
* Revalidate a checkout session
|
|
241
245
|
*/
|
|
242
246
|
revalidateDiscounts(checkoutId: string): Promise<CheckoutSession>;
|
|
243
247
|
/**
|
|
@@ -266,11 +270,15 @@ declare class Client {
|
|
|
266
270
|
*/
|
|
267
271
|
updateCheckout(clientSecret: string, checkoutId: string, params: CheckoutUpdateParams): Promise<CheckoutSession>;
|
|
268
272
|
/**
|
|
269
|
-
*
|
|
273
|
+
* Apply a discount code to a checkout session
|
|
270
274
|
*/
|
|
271
275
|
applyDiscountCode(clientSecret: string, checkoutId: string, discountCode: string): Promise<CheckoutSession>;
|
|
272
276
|
/**
|
|
273
|
-
*
|
|
277
|
+
* Remove a discount code from a checkout session
|
|
278
|
+
*/
|
|
279
|
+
removeDiscountCode(clientSecret: string, checkoutId: string, discountId: string): Promise<CheckoutSession>;
|
|
280
|
+
/**
|
|
281
|
+
* Revalidate a checkout session
|
|
274
282
|
*/
|
|
275
283
|
revalidateDiscounts(clientSecret: string, checkoutId: string): Promise<CheckoutSession>;
|
|
276
284
|
/**
|
|
@@ -280,9 +288,10 @@ declare class Client {
|
|
|
280
288
|
/**
|
|
281
289
|
* Generate payment secret for a checkout session
|
|
282
290
|
*/
|
|
283
|
-
|
|
291
|
+
generateCheckoutPaymentSecret(clientSecret: string, checkoutId: string): Promise<{
|
|
284
292
|
paymentSecret: string;
|
|
285
293
|
publicKey: string;
|
|
294
|
+
checkoutSession: CheckoutSession;
|
|
286
295
|
}>;
|
|
287
296
|
/**
|
|
288
297
|
* Create a new customer
|
package/dist/index.d.ts
CHANGED
|
@@ -233,11 +233,15 @@ declare class Checkout {
|
|
|
233
233
|
*/
|
|
234
234
|
update(checkoutId: string, params: CheckoutUpdateParams): Promise<CheckoutSession>;
|
|
235
235
|
/**
|
|
236
|
-
*
|
|
236
|
+
* Apply a discount code to a checkout session
|
|
237
237
|
*/
|
|
238
238
|
applyDiscountCode(checkoutId: string, discountCode: string): Promise<CheckoutSession>;
|
|
239
239
|
/**
|
|
240
|
-
*
|
|
240
|
+
* Remove a discount code from a checkout session
|
|
241
|
+
*/
|
|
242
|
+
removeDiscountCode(checkoutId: string, discountId: string): Promise<CheckoutSession>;
|
|
243
|
+
/**
|
|
244
|
+
* Revalidate a checkout session
|
|
241
245
|
*/
|
|
242
246
|
revalidateDiscounts(checkoutId: string): Promise<CheckoutSession>;
|
|
243
247
|
/**
|
|
@@ -266,11 +270,15 @@ declare class Client {
|
|
|
266
270
|
*/
|
|
267
271
|
updateCheckout(clientSecret: string, checkoutId: string, params: CheckoutUpdateParams): Promise<CheckoutSession>;
|
|
268
272
|
/**
|
|
269
|
-
*
|
|
273
|
+
* Apply a discount code to a checkout session
|
|
270
274
|
*/
|
|
271
275
|
applyDiscountCode(clientSecret: string, checkoutId: string, discountCode: string): Promise<CheckoutSession>;
|
|
272
276
|
/**
|
|
273
|
-
*
|
|
277
|
+
* Remove a discount code from a checkout session
|
|
278
|
+
*/
|
|
279
|
+
removeDiscountCode(clientSecret: string, checkoutId: string, discountId: string): Promise<CheckoutSession>;
|
|
280
|
+
/**
|
|
281
|
+
* Revalidate a checkout session
|
|
274
282
|
*/
|
|
275
283
|
revalidateDiscounts(clientSecret: string, checkoutId: string): Promise<CheckoutSession>;
|
|
276
284
|
/**
|
|
@@ -280,9 +288,10 @@ declare class Client {
|
|
|
280
288
|
/**
|
|
281
289
|
* Generate payment secret for a checkout session
|
|
282
290
|
*/
|
|
283
|
-
|
|
291
|
+
generateCheckoutPaymentSecret(clientSecret: string, checkoutId: string): Promise<{
|
|
284
292
|
paymentSecret: string;
|
|
285
293
|
publicKey: string;
|
|
294
|
+
checkoutSession: CheckoutSession;
|
|
286
295
|
}>;
|
|
287
296
|
/**
|
|
288
297
|
* Create a new customer
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,7 @@ var Checkout = class {
|
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
|
-
*
|
|
167
|
+
* Apply a discount code to a checkout session
|
|
168
168
|
*/
|
|
169
169
|
applyDiscountCode(checkoutId, discountCode) {
|
|
170
170
|
return __async(this, null, function* () {
|
|
@@ -176,7 +176,18 @@ var Checkout = class {
|
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
*
|
|
179
|
+
* Remove a discount code from a checkout session
|
|
180
|
+
*/
|
|
181
|
+
removeDiscountCode(checkoutId, discountId) {
|
|
182
|
+
return __async(this, null, function* () {
|
|
183
|
+
const data = yield this.apiClient.delete(
|
|
184
|
+
`/checkout/${checkoutId}/discounts/${discountId}`
|
|
185
|
+
);
|
|
186
|
+
return data;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Revalidate a checkout session
|
|
180
191
|
*/
|
|
181
192
|
revalidateDiscounts(checkoutId) {
|
|
182
193
|
return __async(this, null, function* () {
|
|
@@ -245,7 +256,7 @@ var Client = class {
|
|
|
245
256
|
});
|
|
246
257
|
}
|
|
247
258
|
/**
|
|
248
|
-
*
|
|
259
|
+
* Apply a discount code to a checkout session
|
|
249
260
|
*/
|
|
250
261
|
applyDiscountCode(clientSecret, checkoutId, discountCode) {
|
|
251
262
|
return __async(this, null, function* () {
|
|
@@ -258,7 +269,19 @@ var Client = class {
|
|
|
258
269
|
});
|
|
259
270
|
}
|
|
260
271
|
/**
|
|
261
|
-
*
|
|
272
|
+
* Remove a discount code from a checkout session
|
|
273
|
+
*/
|
|
274
|
+
removeDiscountCode(clientSecret, checkoutId, discountId) {
|
|
275
|
+
return __async(this, null, function* () {
|
|
276
|
+
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
277
|
+
const data = yield apiClient.delete(
|
|
278
|
+
`/checkout/${checkoutId}/discounts/${discountId}`
|
|
279
|
+
);
|
|
280
|
+
return data;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Revalidate a checkout session
|
|
262
285
|
*/
|
|
263
286
|
revalidateDiscounts(clientSecret, checkoutId) {
|
|
264
287
|
return __async(this, null, function* () {
|
|
@@ -284,13 +307,14 @@ var Client = class {
|
|
|
284
307
|
/**
|
|
285
308
|
* Generate payment secret for a checkout session
|
|
286
309
|
*/
|
|
287
|
-
|
|
310
|
+
generateCheckoutPaymentSecret(clientSecret, checkoutId) {
|
|
288
311
|
return __async(this, null, function* () {
|
|
289
312
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
290
313
|
const data = yield apiClient.post(`/checkout/payment/${checkoutId}`);
|
|
291
314
|
return {
|
|
292
315
|
paymentSecret: data.paymentSecret,
|
|
293
|
-
publicKey: data.publicKey
|
|
316
|
+
publicKey: data.publicKey,
|
|
317
|
+
checkoutSession: data.checkoutSession
|
|
294
318
|
};
|
|
295
319
|
});
|
|
296
320
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -128,7 +128,7 @@ var Checkout = class {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
* Apply a discount code to a checkout session
|
|
132
132
|
*/
|
|
133
133
|
applyDiscountCode(checkoutId, discountCode) {
|
|
134
134
|
return __async(this, null, function* () {
|
|
@@ -140,7 +140,18 @@ var Checkout = class {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Remove a discount code from a checkout session
|
|
144
|
+
*/
|
|
145
|
+
removeDiscountCode(checkoutId, discountId) {
|
|
146
|
+
return __async(this, null, function* () {
|
|
147
|
+
const data = yield this.apiClient.delete(
|
|
148
|
+
`/checkout/${checkoutId}/discounts/${discountId}`
|
|
149
|
+
);
|
|
150
|
+
return data;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Revalidate a checkout session
|
|
144
155
|
*/
|
|
145
156
|
revalidateDiscounts(checkoutId) {
|
|
146
157
|
return __async(this, null, function* () {
|
|
@@ -209,7 +220,7 @@ var Client = class {
|
|
|
209
220
|
});
|
|
210
221
|
}
|
|
211
222
|
/**
|
|
212
|
-
*
|
|
223
|
+
* Apply a discount code to a checkout session
|
|
213
224
|
*/
|
|
214
225
|
applyDiscountCode(clientSecret, checkoutId, discountCode) {
|
|
215
226
|
return __async(this, null, function* () {
|
|
@@ -222,7 +233,19 @@ var Client = class {
|
|
|
222
233
|
});
|
|
223
234
|
}
|
|
224
235
|
/**
|
|
225
|
-
*
|
|
236
|
+
* Remove a discount code from a checkout session
|
|
237
|
+
*/
|
|
238
|
+
removeDiscountCode(clientSecret, checkoutId, discountId) {
|
|
239
|
+
return __async(this, null, function* () {
|
|
240
|
+
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
241
|
+
const data = yield apiClient.delete(
|
|
242
|
+
`/checkout/${checkoutId}/discounts/${discountId}`
|
|
243
|
+
);
|
|
244
|
+
return data;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Revalidate a checkout session
|
|
226
249
|
*/
|
|
227
250
|
revalidateDiscounts(clientSecret, checkoutId) {
|
|
228
251
|
return __async(this, null, function* () {
|
|
@@ -248,13 +271,14 @@ var Client = class {
|
|
|
248
271
|
/**
|
|
249
272
|
* Generate payment secret for a checkout session
|
|
250
273
|
*/
|
|
251
|
-
|
|
274
|
+
generateCheckoutPaymentSecret(clientSecret, checkoutId) {
|
|
252
275
|
return __async(this, null, function* () {
|
|
253
276
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
254
277
|
const data = yield apiClient.post(`/checkout/payment/${checkoutId}`);
|
|
255
278
|
return {
|
|
256
279
|
paymentSecret: data.paymentSecret,
|
|
257
|
-
publicKey: data.publicKey
|
|
280
|
+
publicKey: data.publicKey,
|
|
281
|
+
checkoutSession: data.checkoutSession
|
|
258
282
|
};
|
|
259
283
|
});
|
|
260
284
|
}
|