@delopay/sdk 0.513.0 → 0.514.0
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/README.md +23 -0
- package/dist/checkoutSession.cjs +2 -2
- package/dist/checkoutSession.cjs.map +1 -1
- package/dist/checkoutSession.js +1 -1
- package/dist/chunk-3RRZCT6E.js +1 -0
- package/dist/{chunk-FMOJAVHU.js → chunk-ASDC73SO.js} +2 -2
- package/dist/chunk-FS4LIUV7.cjs +1 -0
- package/dist/{chunk-FTWGI7UZ.cjs.map → chunk-FS4LIUV7.cjs.map} +1 -1
- package/dist/{chunk-QQZQ2RHX.cjs → chunk-LLPVB3GT.cjs} +16 -12
- package/dist/chunk-LLPVB3GT.cjs.map +1 -0
- package/dist/{chunk-QQJ66DEY.cjs → chunk-OEZMFX2N.cjs} +3 -3
- package/dist/{chunk-QQJ66DEY.cjs.map → chunk-OEZMFX2N.cjs.map} +1 -1
- package/dist/chunk-P2XLQC7N.cjs +105 -0
- package/dist/chunk-P2XLQC7N.cjs.map +1 -0
- package/dist/{chunk-4ALYDKJF.js → chunk-P5JTNDLM.js} +21 -17
- package/dist/chunk-P5JTNDLM.js.map +1 -0
- package/dist/chunk-U7HQMJVU.js +105 -0
- package/dist/chunk-U7HQMJVU.js.map +1 -0
- package/dist/client.cjs +2 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +3 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.js +1 -1
- package/dist/index.cjs +19 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +22 -18
- package/dist/internal.cjs +26 -22
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -1
- package/dist/internal.d.ts +2 -1
- package/dist/internal.js +30 -26
- package/dist/internal.js.map +1 -1
- package/dist/resources/coupons.cjs +7 -0
- package/dist/resources/coupons.cjs.map +1 -0
- package/dist/resources/coupons.d.cts +90 -0
- package/dist/resources/coupons.d.ts +90 -0
- package/dist/resources/coupons.js +7 -0
- package/dist/resources/coupons.js.map +1 -0
- package/dist/types.d.cts +274 -1
- package/dist/types.d.ts +274 -1
- package/package.json +1 -1
- package/dist/chunk-4ALYDKJF.js.map +0 -1
- package/dist/chunk-FTWGI7UZ.cjs +0 -1
- package/dist/chunk-QQZQ2RHX.cjs.map +0 -1
- package/dist/chunk-Y5AXZVWN.js +0 -1
- /package/dist/{chunk-Y5AXZVWN.js.map → chunk-3RRZCT6E.js.map} +0 -0
- /package/dist/{chunk-FMOJAVHU.js.map → chunk-ASDC73SO.js.map} +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { RequestFn, RequestExtras } from '../core.js';
|
|
2
|
+
import { CouponCreateRequest, CouponResponse, CouponListQuery, CouponListResponse, CouponPreviewRequest, CouponPreviewResponse, CouponUpdateRequest, CouponVersionListQuery, CouponVersionListResponse, CouponDuplicateRequest } from '../types.js';
|
|
3
|
+
import '../eventStream.js';
|
|
4
|
+
import '../error.js';
|
|
5
|
+
import '../currencies.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The merchant's coupon campaigns: a discount, the currencies it is offered
|
|
9
|
+
* in, its dates and limits, and the shops, products and prices it applies to.
|
|
10
|
+
*
|
|
11
|
+
* **A coupon belongs to the merchant, not to a shop.** Call these routes with
|
|
12
|
+
* a merchant-wide secret key or a dashboard session; a shop-scoped API key is
|
|
13
|
+
* refused with a 401 (`DelopayAuthenticationError`). Shops are narrowed inside
|
|
14
|
+
* the terms, with `eligibility.shop_ids`.
|
|
15
|
+
*
|
|
16
|
+
* A coupon reduces a price; it is not a gift card. Its life is
|
|
17
|
+
* `draft` -> `active` <-> `paused` -> `archived`: `activate`, `pause` and
|
|
18
|
+
* `archive` move it, and an archived coupon can no longer be changed. Each
|
|
19
|
+
* change of its terms makes a new version, and a payment keeps the version it
|
|
20
|
+
* accepted. A coupon is live or test (`test_mode`) for good, fixed when it is
|
|
21
|
+
* created.
|
|
22
|
+
*/
|
|
23
|
+
declare class Coupons {
|
|
24
|
+
private readonly request;
|
|
25
|
+
constructor(request: RequestFn);
|
|
26
|
+
/**
|
|
27
|
+
* Create a coupon. It starts as a draft unless `activate` is `true`.
|
|
28
|
+
* `POST /coupons`
|
|
29
|
+
*
|
|
30
|
+
* A code another coupon of the same mode uses is refused with `IR_38`.
|
|
31
|
+
*/
|
|
32
|
+
create(params: CouponCreateRequest, options?: RequestExtras): Promise<CouponResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* One page of the merchant's coupons of one mode, newest first. Without
|
|
35
|
+
* `test_mode: true` it lists live coupons.
|
|
36
|
+
* `GET /coupons`
|
|
37
|
+
*/
|
|
38
|
+
list(params?: CouponListQuery, options?: RequestExtras): Promise<CouponListResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Work out what terms take off an example amount, and what the merchant
|
|
41
|
+
* should know before activating them, such as shops whose checkout does not
|
|
42
|
+
* offer coupon entry. Nothing is saved.
|
|
43
|
+
* `POST /coupons/preview`
|
|
44
|
+
*/
|
|
45
|
+
preview(params: CouponPreviewRequest, options?: RequestExtras): Promise<CouponPreviewResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieve one coupon with its current terms.
|
|
48
|
+
* `GET /coupons/{coupon_id}`
|
|
49
|
+
*/
|
|
50
|
+
retrieve(couponId: string, options?: RequestExtras): Promise<CouponResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Change a coupon's name, description, shared code or terms. Fields left out
|
|
53
|
+
* stay; new `terms` are a new version. Send `expected_version` to have the
|
|
54
|
+
* change refused (`IR_16`) when the coupon moved on since it was read. An
|
|
55
|
+
* archived coupon is refused with `IR_16`, a code in use with `IR_38`.
|
|
56
|
+
* `POST /coupons/{coupon_id}`
|
|
57
|
+
*/
|
|
58
|
+
update(couponId: string, params: CouponUpdateRequest, options?: RequestExtras): Promise<CouponResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* One page of a coupon's versions, newest first, with who wrote each.
|
|
61
|
+
* `GET /coupons/{coupon_id}/versions`
|
|
62
|
+
*/
|
|
63
|
+
versions(couponId: string, params?: CouponVersionListQuery, options?: RequestExtras): Promise<CouponVersionListResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Copy a coupon's terms into a new draft of the same mode. Without `params`
|
|
66
|
+
* the copy takes the original's name and has no shared code.
|
|
67
|
+
* `POST /coupons/{coupon_id}/duplicate`
|
|
68
|
+
*/
|
|
69
|
+
duplicate(couponId: string, params?: CouponDuplicateRequest, options?: RequestExtras): Promise<CouponResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Start a draft or paused coupon. With `valid_from` ahead its status is
|
|
72
|
+
* `scheduled` until then. Any other state is refused with `IR_16`.
|
|
73
|
+
* `POST /coupons/{coupon_id}/activate`
|
|
74
|
+
*/
|
|
75
|
+
activate(couponId: string, options?: RequestExtras): Promise<CouponResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Stop an active coupon until it is activated again. A coupon that is not
|
|
78
|
+
* active is refused with `IR_16`.
|
|
79
|
+
* `POST /coupons/{coupon_id}/pause`
|
|
80
|
+
*/
|
|
81
|
+
pause(couponId: string, options?: RequestExtras): Promise<CouponResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* End a coupon for good and free its code. Its history stays. An archived
|
|
84
|
+
* coupon is refused with `IR_16`.
|
|
85
|
+
* `POST /coupons/{coupon_id}/archive`
|
|
86
|
+
*/
|
|
87
|
+
archive(couponId: string, options?: RequestExtras): Promise<CouponResponse>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { Coupons };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|