@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,105 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/resources/coupons.ts
|
|
2
|
+
var Coupons = class {
|
|
3
|
+
constructor(request) {
|
|
4
|
+
this.request = request;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Create a coupon. It starts as a draft unless `activate` is `true`.
|
|
8
|
+
* `POST /coupons`
|
|
9
|
+
*
|
|
10
|
+
* A code another coupon of the same mode uses is refused with `IR_38`.
|
|
11
|
+
*/
|
|
12
|
+
async create(params, options) {
|
|
13
|
+
return this.request("POST", "/coupons", { ...options, body: params });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* One page of the merchant's coupons of one mode, newest first. Without
|
|
17
|
+
* `test_mode: true` it lists live coupons.
|
|
18
|
+
* `GET /coupons`
|
|
19
|
+
*/
|
|
20
|
+
async list(params, options) {
|
|
21
|
+
return this.request("GET", "/coupons", {
|
|
22
|
+
...options,
|
|
23
|
+
query: params === void 0 ? void 0 : { ...params }
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Work out what terms take off an example amount, and what the merchant
|
|
28
|
+
* should know before activating them, such as shops whose checkout does not
|
|
29
|
+
* offer coupon entry. Nothing is saved.
|
|
30
|
+
* `POST /coupons/preview`
|
|
31
|
+
*/
|
|
32
|
+
async preview(params, options) {
|
|
33
|
+
return this.request("POST", "/coupons/preview", { ...options, body: params });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve one coupon with its current terms.
|
|
37
|
+
* `GET /coupons/{coupon_id}`
|
|
38
|
+
*/
|
|
39
|
+
async retrieve(couponId, options) {
|
|
40
|
+
return this.request("GET", `/coupons/${encodeURIComponent(couponId)}`, options);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Change a coupon's name, description, shared code or terms. Fields left out
|
|
44
|
+
* stay; new `terms` are a new version. Send `expected_version` to have the
|
|
45
|
+
* change refused (`IR_16`) when the coupon moved on since it was read. An
|
|
46
|
+
* archived coupon is refused with `IR_16`, a code in use with `IR_38`.
|
|
47
|
+
* `POST /coupons/{coupon_id}`
|
|
48
|
+
*/
|
|
49
|
+
async update(couponId, params, options) {
|
|
50
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}`, {
|
|
51
|
+
...options,
|
|
52
|
+
body: params
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One page of a coupon's versions, newest first, with who wrote each.
|
|
57
|
+
* `GET /coupons/{coupon_id}/versions`
|
|
58
|
+
*/
|
|
59
|
+
async versions(couponId, params, options) {
|
|
60
|
+
return this.request("GET", `/coupons/${encodeURIComponent(couponId)}/versions`, {
|
|
61
|
+
...options,
|
|
62
|
+
query: params === void 0 ? void 0 : { ...params }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Copy a coupon's terms into a new draft of the same mode. Without `params`
|
|
67
|
+
* the copy takes the original's name and has no shared code.
|
|
68
|
+
* `POST /coupons/{coupon_id}/duplicate`
|
|
69
|
+
*/
|
|
70
|
+
async duplicate(couponId, params = {}, options) {
|
|
71
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}/duplicate`, {
|
|
72
|
+
...options,
|
|
73
|
+
body: params
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Start a draft or paused coupon. With `valid_from` ahead its status is
|
|
78
|
+
* `scheduled` until then. Any other state is refused with `IR_16`.
|
|
79
|
+
* `POST /coupons/{coupon_id}/activate`
|
|
80
|
+
*/
|
|
81
|
+
async activate(couponId, options) {
|
|
82
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}/activate`, options);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Stop an active coupon until it is activated again. A coupon that is not
|
|
86
|
+
* active is refused with `IR_16`.
|
|
87
|
+
* `POST /coupons/{coupon_id}/pause`
|
|
88
|
+
*/
|
|
89
|
+
async pause(couponId, options) {
|
|
90
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}/pause`, options);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* End a coupon for good and free its code. Its history stays. An archived
|
|
94
|
+
* coupon is refused with `IR_16`.
|
|
95
|
+
* `POST /coupons/{coupon_id}/archive`
|
|
96
|
+
*/
|
|
97
|
+
async archive(couponId, options) {
|
|
98
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}/archive`, options);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
exports.Coupons = Coupons;
|
|
105
|
+
//# sourceMappingURL=chunk-P2XLQC7N.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/delopay-typescript-sdk/delopay-typescript-sdk/sdk/dist/chunk-P2XLQC7N.cjs","../src/resources/coupons.ts"],"names":[],"mappings":"AAAA;AC8BO,IAAM,QAAA,EAAN,MAAc;AAAA,EACnB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,MAAA,CAAO,MAAA,EAA6B,OAAA,EA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A;AACb,IAAA;AACtE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOgF,EAAA;AACV,IAAA;AACtE,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOkF,EAAA;AACZ,IAAA;AACtE,EAAA;AACF;ADpDwE;AACA;AACA;AACA","file":"/home/runner/work/delopay-typescript-sdk/delopay-typescript-sdk/sdk/dist/chunk-P2XLQC7N.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../client';\nimport type {\n CouponCreateRequest,\n CouponDuplicateRequest,\n CouponListQuery,\n CouponListResponse,\n CouponPreviewRequest,\n CouponPreviewResponse,\n CouponResponse,\n CouponUpdateRequest,\n CouponVersionListQuery,\n CouponVersionListResponse,\n} from '../types';\n\n/**\n * The merchant's coupon campaigns: a discount, the currencies it is offered\n * in, its dates and limits, and the shops, products and prices it applies to.\n *\n * **A coupon belongs to the merchant, not to a shop.** Call these routes with\n * a merchant-wide secret key or a dashboard session; a shop-scoped API key is\n * refused with a 401 (`DelopayAuthenticationError`). Shops are narrowed inside\n * the terms, with `eligibility.shop_ids`.\n *\n * A coupon reduces a price; it is not a gift card. Its life is\n * `draft` -> `active` <-> `paused` -> `archived`: `activate`, `pause` and\n * `archive` move it, and an archived coupon can no longer be changed. Each\n * change of its terms makes a new version, and a payment keeps the version it\n * accepted. A coupon is live or test (`test_mode`) for good, fixed when it is\n * created.\n */\nexport class Coupons {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Create a coupon. It starts as a draft unless `activate` is `true`.\n * `POST /coupons`\n *\n * A code another coupon of the same mode uses is refused with `IR_38`.\n */\n async create(params: CouponCreateRequest, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('POST', '/coupons', { ...options, body: params });\n }\n\n /**\n * One page of the merchant's coupons of one mode, newest first. Without\n * `test_mode: true` it lists live coupons.\n * `GET /coupons`\n */\n async list(params?: CouponListQuery, options?: RequestExtras): Promise<CouponListResponse> {\n return this.request('GET', '/coupons', {\n ...options,\n query: params === undefined ? undefined : { ...params },\n });\n }\n\n /**\n * Work out what terms take off an example amount, and what the merchant\n * should know before activating them, such as shops whose checkout does not\n * offer coupon entry. Nothing is saved.\n * `POST /coupons/preview`\n */\n async preview(\n params: CouponPreviewRequest,\n options?: RequestExtras,\n ): Promise<CouponPreviewResponse> {\n return this.request('POST', '/coupons/preview', { ...options, body: params });\n }\n\n /**\n * Retrieve one coupon with its current terms.\n * `GET /coupons/{coupon_id}`\n */\n async retrieve(couponId: string, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('GET', `/coupons/${encodeURIComponent(couponId)}`, options);\n }\n\n /**\n * Change a coupon's name, description, shared code or terms. Fields left out\n * stay; new `terms` are a new version. Send `expected_version` to have the\n * change refused (`IR_16`) when the coupon moved on since it was read. An\n * archived coupon is refused with `IR_16`, a code in use with `IR_38`.\n * `POST /coupons/{coupon_id}`\n */\n async update(\n couponId: string,\n params: CouponUpdateRequest,\n options?: RequestExtras,\n ): Promise<CouponResponse> {\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}`, {\n ...options,\n body: params,\n });\n }\n\n /**\n * One page of a coupon's versions, newest first, with who wrote each.\n * `GET /coupons/{coupon_id}/versions`\n */\n async versions(\n couponId: string,\n params?: CouponVersionListQuery,\n options?: RequestExtras,\n ): Promise<CouponVersionListResponse> {\n return this.request('GET', `/coupons/${encodeURIComponent(couponId)}/versions`, {\n ...options,\n query: params === undefined ? undefined : { ...params },\n });\n }\n\n /**\n * Copy a coupon's terms into a new draft of the same mode. Without `params`\n * the copy takes the original's name and has no shared code.\n * `POST /coupons/{coupon_id}/duplicate`\n */\n async duplicate(\n couponId: string,\n params: CouponDuplicateRequest = {},\n options?: RequestExtras,\n ): Promise<CouponResponse> {\n // The route requires a JSON body; `{}` asks for the defaults.\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}/duplicate`, {\n ...options,\n body: params,\n });\n }\n\n /**\n * Start a draft or paused coupon. With `valid_from` ahead its status is\n * `scheduled` until then. Any other state is refused with `IR_16`.\n * `POST /coupons/{coupon_id}/activate`\n */\n async activate(couponId: string, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}/activate`, options);\n }\n\n /**\n * Stop an active coupon until it is activated again. A coupon that is not\n * active is refused with `IR_16`.\n * `POST /coupons/{coupon_id}/pause`\n */\n async pause(couponId: string, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}/pause`, options);\n }\n\n /**\n * End a coupon for good and free its code. Its history stays. An archived\n * coupon is refused with `IR_16`.\n * `POST /coupons/{coupon_id}/archive`\n */\n async archive(couponId: string, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}/archive`, options);\n }\n}\n"]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VatRates
|
|
3
|
+
} from "./chunk-RUDKQPEO.js";
|
|
1
4
|
import {
|
|
2
5
|
Verification
|
|
3
6
|
} from "./chunk-L7474OST.js";
|
|
@@ -7,6 +10,9 @@ import {
|
|
|
7
10
|
import {
|
|
8
11
|
WhopResolutionCases
|
|
9
12
|
} from "./chunk-OMGDHJYX.js";
|
|
13
|
+
import {
|
|
14
|
+
ShopLabels
|
|
15
|
+
} from "./chunk-UH2A7ZDK.js";
|
|
10
16
|
import {
|
|
11
17
|
Shopify
|
|
12
18
|
} from "./chunk-X6J2JYPK.js";
|
|
@@ -29,8 +35,8 @@ import {
|
|
|
29
35
|
Users
|
|
30
36
|
} from "./chunk-3NKFPZRS.js";
|
|
31
37
|
import {
|
|
32
|
-
|
|
33
|
-
} from "./chunk-
|
|
38
|
+
Relay
|
|
39
|
+
} from "./chunk-RWCCRTLZ.js";
|
|
34
40
|
import {
|
|
35
41
|
Risk
|
|
36
42
|
} from "./chunk-2ZUXSUNF.js";
|
|
@@ -53,8 +59,8 @@ import {
|
|
|
53
59
|
ShareLinks
|
|
54
60
|
} from "./chunk-IBUGYGGZ.js";
|
|
55
61
|
import {
|
|
56
|
-
|
|
57
|
-
} from "./chunk-
|
|
62
|
+
ProcessorCosts
|
|
63
|
+
} from "./chunk-Y4XILACH.js";
|
|
58
64
|
import {
|
|
59
65
|
ProcessorImports
|
|
60
66
|
} from "./chunk-6TBA7KZO.js";
|
|
@@ -77,8 +83,8 @@ import {
|
|
|
77
83
|
Regions
|
|
78
84
|
} from "./chunk-LX6E5TTR.js";
|
|
79
85
|
import {
|
|
80
|
-
|
|
81
|
-
} from "./chunk-
|
|
86
|
+
PaymentLinks
|
|
87
|
+
} from "./chunk-EXW4VDRM.js";
|
|
82
88
|
import {
|
|
83
89
|
PaymentMethods
|
|
84
90
|
} from "./chunk-IVQDVFFR.js";
|
|
@@ -101,8 +107,8 @@ import {
|
|
|
101
107
|
Poll
|
|
102
108
|
} from "./chunk-ULZWGW2O.js";
|
|
103
109
|
import {
|
|
104
|
-
|
|
105
|
-
} from "./chunk-
|
|
110
|
+
InvoiceSettingsResource
|
|
111
|
+
} from "./chunk-T6N35YFJ.js";
|
|
106
112
|
import {
|
|
107
113
|
Invoices
|
|
108
114
|
} from "./chunk-5P2AO6XY.js";
|
|
@@ -125,8 +131,8 @@ import {
|
|
|
125
131
|
OperationLimits
|
|
126
132
|
} from "./chunk-LBDI47TC.js";
|
|
127
133
|
import {
|
|
128
|
-
|
|
129
|
-
} from "./chunk-
|
|
134
|
+
Export
|
|
135
|
+
} from "./chunk-R4TZEQ33.js";
|
|
130
136
|
import {
|
|
131
137
|
ExternalRecords
|
|
132
138
|
} from "./chunk-CTB54SCJ.js";
|
|
@@ -148,15 +154,15 @@ import {
|
|
|
148
154
|
import {
|
|
149
155
|
Industries
|
|
150
156
|
} from "./chunk-XYX25TII.js";
|
|
151
|
-
import {
|
|
152
|
-
InvoiceSettingsResource
|
|
153
|
-
} from "./chunk-T6N35YFJ.js";
|
|
154
157
|
import {
|
|
155
158
|
ContentEncryption
|
|
156
159
|
} from "./chunk-3MS2HPSJ.js";
|
|
157
160
|
import {
|
|
158
161
|
CostRules
|
|
159
162
|
} from "./chunk-FZYEZLTM.js";
|
|
163
|
+
import {
|
|
164
|
+
Coupons
|
|
165
|
+
} from "./chunk-U7HQMJVU.js";
|
|
160
166
|
import {
|
|
161
167
|
Customers
|
|
162
168
|
} from "./chunk-5LSXCHJU.js";
|
|
@@ -172,9 +178,6 @@ import {
|
|
|
172
178
|
import {
|
|
173
179
|
Events
|
|
174
180
|
} from "./chunk-DVA3T3MD.js";
|
|
175
|
-
import {
|
|
176
|
-
Export
|
|
177
|
-
} from "./chunk-R4TZEQ33.js";
|
|
178
181
|
import {
|
|
179
182
|
BuyerPortal
|
|
180
183
|
} from "./chunk-2OJJ3KGP.js";
|
|
@@ -329,6 +332,7 @@ var Delopay = class extends DelopayCore {
|
|
|
329
332
|
this.search = new Search(request);
|
|
330
333
|
this.aiTools = new AiTools(request);
|
|
331
334
|
this.shareLinks = new ShareLinks(request);
|
|
335
|
+
this.coupons = new Coupons(request);
|
|
332
336
|
}
|
|
333
337
|
};
|
|
334
338
|
/** Utility for verifying incoming webhook signatures (static, no instance needed). */
|
|
@@ -337,4 +341,4 @@ Delopay.webhooks = Webhooks;
|
|
|
337
341
|
export {
|
|
338
342
|
Delopay
|
|
339
343
|
};
|
|
340
|
-
//# sourceMappingURL=chunk-
|
|
344
|
+
//# sourceMappingURL=chunk-P5JTNDLM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"sourcesContent":["import { DelopayCore } from './core';\nimport type { DelopayOptions } from './core';\nimport { ApiKeys } from './resources/apiKeys';\nimport { Authentication } from './resources/authentication';\nimport { Billing } from './resources/billing';\nimport { Connectors } from './resources/connectors';\nimport { Customers } from './resources/customers';\nimport { Disputes } from './resources/disputes';\nimport { ChargebackPrevention } from './resources/chargebackPrevention';\nimport { PaypalDisputes } from './resources/paypalDisputes';\nimport { WhopResolutionCases } from './resources/whopResolutionCases';\nimport { EphemeralKeys } from './resources/ephemeralKeys';\nimport { Events } from './resources/events';\nimport { Fees } from './resources/fees';\nimport { Mandates } from './resources/mandates';\nimport { MerchantAccounts } from './resources/merchantAccounts';\nimport { PaymentLinks } from './resources/paymentLinks';\nimport { PaymentMethods } from './resources/paymentMethods';\nimport { Payments } from './resources/payments';\nimport { Payouts } from './resources/payouts';\nimport { Poll } from './resources/poll';\nimport { ProfileAcquirers } from './resources/profileAcquirers';\nimport { Profiles } from './resources/profiles';\nimport { Projects } from './resources/projects';\nimport { Refunds } from './resources/refunds';\nimport { Relay } from './resources/relay';\nimport { Routing } from './resources/routing';\nimport { Search } from './resources/search';\nimport { AiTools } from './resources/aiTools';\nimport { Shops } from './resources/shops';\nimport { StripeConnect } from './resources/stripeConnect';\nimport { ThreeDsRules } from './resources/threeDsRules';\nimport { Users } from './resources/users';\nimport { Verification } from './resources/verification';\nimport { IdentityVerifications } from './resources/identityVerifications';\nimport { Webhooks } from './resources/webhooks';\nimport { Analytics } from './resources/analytics';\nimport { AnalyticsDashboard } from './resources/analyticsDashboard';\nimport { Cards } from './resources/cards';\nimport { Export } from './resources/export';\nimport { FeatureMatrix } from './resources/featureMatrix';\nimport { Files } from './resources/files';\nimport { Forex } from './resources/forex';\nimport { Regions } from './resources/regions';\nimport { AvailabilityOverrides } from './resources/availabilityOverrides';\nimport { SellToRestrictions } from './resources/sellToRestrictions';\nimport { VatRates } from './resources/vatRates';\nimport { BuyerBlocklist } from './resources/buyerBlocklist';\nimport { CheckoutDomains } from './resources/checkoutDomains';\nimport { Persons } from './resources/persons';\nimport { ShopLabels } from './resources/shopLabels';\nimport { Industries } from './resources/industries';\nimport { PayoutDestinations } from './resources/payoutDestinations';\nimport { Notices } from './resources/notices';\nimport { Shopify } from './resources/shopify';\nimport { CheckoutTemplates } from './resources/checkoutTemplates';\nimport { BuyerConversations } from './resources/buyerConversations';\nimport { BuyerEvidenceReviews } from './resources/buyerEvidenceReviews';\nimport { CheckoutRecovery } from './resources/checkoutRecovery';\nimport { CostRules } from './resources/costRules';\nimport { ExternalRecords } from './resources/externalRecords';\nimport { Products } from './resources/products';\nimport { Support } from './resources/support';\nimport { Invoices } from './resources/invoices';\nimport { InvoiceSettingsResource } from './resources/invoiceSettings';\nimport { ProcessorCosts } from './resources/processorCosts';\nimport { CheckoutMethods } from './resources/checkoutMethods';\nimport { Subscriptions } from './resources/subscriptions';\nimport { BuyerAccount } from './resources/buyerAccount';\nimport { BuyerPortal } from './resources/buyerPortal';\nimport { Audit } from './resources/audit';\nimport { Settlement } from './resources/settlement';\nimport { OperationLimits } from './resources/operationLimits';\nimport { Settings } from './resources/settings';\nimport { MessageTemplates } from './resources/messageTemplates';\nimport { Risk } from './resources/risk';\nimport { Live } from './resources/live';\nimport { ProcessorImports } from './resources/processorImports';\nimport { Branding } from './resources/deploymentBranding';\nimport { ContentEncryption } from './resources/contentEncryption';\nimport { ShareLinks } from './resources/shareLinks';\nimport { Coupons } from './resources/coupons';\n\nexport * from './core';\n\n/**\n * Delopay API client.\n *\n * Instantiate once with your API key and reuse across your application.\n * All resource sub-clients (payments, refunds, customers, …) are exposed\n * as properties on the instance.\n *\n * Every resource is in the bundle of an application that uses this class. A\n * browser application that wants only the resources it calls uses\n * {@link DelopayCore} instead.\n *\n * @example\n * ```typescript\n * const delopay = new Delopay('prd_...', { sandbox: false });\n * const payment = await delopay.payments.create({ amount: 5000, currency: 'EUR' });\n * ```\n */\nexport class Delopay extends DelopayCore {\n /** Utility for verifying incoming webhook signatures (static, no instance needed). */\n static webhooks = Webhooks;\n\n // Merchant-facing\n readonly payments: Payments;\n readonly refunds: Refunds;\n readonly customers: Customers;\n readonly paymentMethods: PaymentMethods;\n readonly paymentLinks: PaymentLinks;\n readonly mandates: Mandates;\n readonly disputes: Disputes;\n readonly chargebackPrevention: ChargebackPrevention;\n readonly paypalDisputes: PaypalDisputes;\n readonly whopResolutionCases: WhopResolutionCases;\n /** Import refunds and disputes from connected processor accounts. */\n readonly processorImports: ProcessorImports;\n readonly payouts: Payouts;\n readonly ephemeralKeys: EphemeralKeys;\n readonly events: Events;\n readonly poll: Poll;\n\n // Connector / routing\n readonly connectors: Connectors;\n readonly routing: Routing;\n readonly profiles: Profiles;\n readonly shops: Shops;\n readonly profileAcquirers: ProfileAcquirers;\n\n // Authentication & verification\n readonly authentication: Authentication;\n readonly verification: Verification;\n readonly identityVerifications: IdentityVerifications;\n\n // Dashboard / internal\n readonly users: Users;\n readonly apiKeys: ApiKeys;\n readonly billing: Billing;\n readonly fees: Fees;\n readonly merchantAccounts: MerchantAccounts;\n readonly projects: Projects;\n readonly relay: Relay;\n readonly stripeConnect: StripeConnect;\n readonly threeDsRules: ThreeDsRules;\n /**\n * A merchant's own audit log. Needs a dashboard JWT, not an API key —\n * see {@link Audit}.\n */\n readonly audit: Audit;\n readonly settlement: Settlement;\n readonly operationLimits: OperationLimits;\n /** Every setting of the merchant, its projects and its shops, audited per change. */\n readonly settings: Settings;\n /** A shop's own texts of the emails it sends its buyers. */\n readonly messageTemplates: MessageTemplates;\n readonly risk: Risk;\n /**\n * Live updates of the dashboard: the stream of what changed and the\n * versions a save names in `If-Match`. Needs a dashboard JWT — see\n * {@link Live}.\n */\n readonly live: Live;\n /**\n * The deployment's branding (name, logos, favicon, default checkout\n * colours) as the operator saved it. Public: no credential is needed.\n */\n readonly branding: Branding;\n /**\n * Whether the deployment stores new messages and uploaded files encrypted\n * with its own key. Public: no credential is needed.\n */\n readonly contentEncryption: ContentEncryption;\n\n // New resources (Phases 3-4)\n readonly subscriptions: Subscriptions;\n /** Buyer portal grant access. Construct a separate client with the portal token. */\n readonly buyerPortal: BuyerPortal;\n /**\n * The buyer account: email sign-in, and purchases across merchants.\n * Construct a separate client with the buyer account session token for\n * everything after the sign-in.\n */\n readonly buyerAccount: BuyerAccount;\n readonly files: Files;\n readonly export: Export;\n readonly forex: Forex;\n readonly regions: Regions;\n readonly availabilityOverrides: AvailabilityOverrides;\n readonly sellToRestrictions: SellToRestrictions;\n /** The platform VAT rate table buyer tax charges from, read-only. */\n readonly vatRates: VatRates;\n /** Buyers the merchant refuses to sell to again (email, IP, customer, device, card, BIN), with Stripe Radar sync. */\n readonly buyerBlocklist: BuyerBlocklist;\n /** The merchant's own checkout addresses: subdomains and own domains, their setup, shops and Apple Pay file. */\n readonly checkoutDomains: CheckoutDomains;\n /** The merchant's payments grouped by the person behind them. */\n readonly persons: Persons;\n /** The merchant's labels for grouping shops, several per shop. */\n readonly shopLabels: ShopLabels;\n /** The industry of the merchant, its projects and its shops, with what each inherits. */\n readonly industries: Industries;\n /** Payouts: how team members want to be paid. Moves no money. */\n readonly payoutDestinations: PayoutDestinations;\n /** Notices a merchant's people send each other. */\n readonly notices: Notices;\n /** A shop's link to the merchant's Shopify store, its storefront settings and its sync log. */\n readonly shopify: Shopify;\n /** Payment methods, behaviour and smart routing defined once and used in many shops. */\n readonly checkoutTemplates: CheckoutTemplates;\n /** Conversations between buyers and the shop's team: the team inbox. */\n readonly buyerConversations: BuyerConversations;\n /** The evidence buyers hand in for the shop's cases, as the shop's team reviews it. */\n readonly buyerEvidence: BuyerEvidenceReviews;\n readonly checkoutRecovery: CheckoutRecovery;\n readonly costRules: CostRules;\n\n /** Out-of-band transitions a PSP made that DeloPay never observed. */\n readonly externalRecords: ExternalRecords;\n\n /** A shop's product catalogue: what it sells, and at which prices. */\n readonly products: Products;\n /** Conversations with DeloPay's support team. */\n readonly support: Support;\n /** The invoices and credit notes the merchant issues to its buyers. */\n readonly invoices: Invoices;\n /** How those invoices look and are taxed: the merchant default and each shop's override. */\n readonly invoiceSettings: InvoiceSettingsResource;\n /** What the merchant's own processor charges it — see {@link ProcessorCosts}. */\n readonly processorCosts: ProcessorCosts;\n readonly checkoutMethods: CheckoutMethods;\n readonly analytics: Analytics;\n readonly analyticsDashboard: AnalyticsDashboard;\n readonly featureMatrix: FeatureMatrix;\n readonly cards: Cards;\n readonly search: Search;\n /** AI tools working in the account through the MCP server: their confirmations and connections. */\n readonly aiTools: AiTools;\n /** Expiring external read-only share links for a person or payment. */\n readonly shareLinks: ShareLinks;\n /** The merchant's coupon campaigns: create, preview, change, version and move them between states. */\n readonly coupons: Coupons;\n\n /**\n * Create a new Delopay client.\n *\n * @param apiKey - Your Delopay API key (e.g. `prd_...` or `snd_...`).\n * Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).\n * @param options - Optional configuration (sandbox mode, base URL override, timeout).\n */\n constructor(apiKey?: string, options?: DelopayOptions) {\n super(apiKey, options);\n const { request, openStream } = this.transport;\n\n // Merchant-facing\n this.payments = new Payments(request);\n this.refunds = new Refunds(request);\n this.customers = new Customers(request);\n this.paymentMethods = new PaymentMethods(request);\n this.paymentLinks = new PaymentLinks(request);\n this.mandates = new Mandates(request);\n this.disputes = new Disputes(request);\n this.chargebackPrevention = new ChargebackPrevention(request);\n this.paypalDisputes = new PaypalDisputes(request);\n this.whopResolutionCases = new WhopResolutionCases(request);\n this.payouts = new Payouts(request);\n this.ephemeralKeys = new EphemeralKeys(request);\n this.events = new Events(request);\n this.poll = new Poll(request);\n\n // Connector / routing\n this.connectors = new Connectors(request);\n this.routing = new Routing(request);\n this.profiles = new Profiles(request);\n this.shops = new Shops(request);\n this.profileAcquirers = new ProfileAcquirers(request);\n\n // Authentication & verification\n this.authentication = new Authentication(request);\n this.verification = new Verification(request);\n this.identityVerifications = new IdentityVerifications(request);\n\n // Dashboard / internal\n this.users = new Users(request);\n this.apiKeys = new ApiKeys(request);\n this.billing = new Billing(request);\n this.fees = new Fees(request);\n this.merchantAccounts = new MerchantAccounts(request);\n this.projects = new Projects(request);\n this.relay = new Relay(request);\n this.stripeConnect = new StripeConnect(request);\n this.threeDsRules = new ThreeDsRules(request);\n this.audit = new Audit(request);\n this.settlement = new Settlement(request);\n this.operationLimits = new OperationLimits(request);\n this.settings = new Settings(request);\n this.messageTemplates = new MessageTemplates(request);\n this.risk = new Risk(request);\n this.live = new Live(request, openStream);\n this.processorImports = new ProcessorImports(request, openStream);\n this.branding = new Branding(request, this.baseUrl);\n this.contentEncryption = new ContentEncryption(request);\n\n // New resources (Phases 3-4)\n this.subscriptions = new Subscriptions(request);\n this.buyerPortal = new BuyerPortal(request);\n this.buyerAccount = new BuyerAccount(request);\n this.files = new Files(request);\n this.export = new Export(request);\n this.forex = new Forex(request);\n this.regions = new Regions(request);\n this.availabilityOverrides = new AvailabilityOverrides(request);\n this.sellToRestrictions = new SellToRestrictions(request);\n this.vatRates = new VatRates(request);\n this.buyerBlocklist = new BuyerBlocklist(request);\n this.checkoutDomains = new CheckoutDomains(request);\n this.persons = new Persons(request);\n this.shopLabels = new ShopLabels(request);\n this.industries = new Industries(request);\n this.payoutDestinations = new PayoutDestinations(request);\n this.notices = new Notices(request);\n this.shopify = new Shopify(request);\n this.checkoutTemplates = new CheckoutTemplates(request);\n this.buyerConversations = new BuyerConversations(request);\n this.buyerEvidence = new BuyerEvidenceReviews(request);\n this.checkoutRecovery = new CheckoutRecovery(request);\n this.costRules = new CostRules(request);\n this.externalRecords = new ExternalRecords(request);\n this.products = new Products(request);\n this.support = new Support(request);\n this.invoices = new Invoices(request);\n this.invoiceSettings = new InvoiceSettingsResource(request);\n this.processorCosts = new ProcessorCosts(request);\n this.checkoutMethods = new CheckoutMethods(request);\n this.analytics = new Analytics(request);\n this.analyticsDashboard = new AnalyticsDashboard(request);\n this.featureMatrix = new FeatureMatrix(request);\n this.cards = new Cards(request);\n this.search = new Search(request);\n this.aiTools = new AiTools(request);\n this.shareLinks = new ShareLinks(request);\n this.coupons = new Coupons(request);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AClC,SAAK,oBAAoB,IAAI,kBAAkB,OAAO;AACtD,SAAK,qBAAqB,IAAI,mBAAmB,OAAO;AACxD,SAAK,gBAAgB,IAAI,qBAAqB,OAAO;AACrD,SAAK,mBAAmB,IAAI,iBAAiB,OAAO;AACpD,SAAK,YAAY,IAAI,UAAU,OAAO;AACtC,SAAK,kBAAkB,IAAI,gBAAgB,OAAO;AAClD,SAAK,WAAW,IAAI,SAAS,OAAO;AACpC,SAAK,UAAU,IAAI,QAAQ,OAAO;AAClC,SAAK,WAAW,IAAI,SAAS,OAAO;AACpC,SAAK,kBAAkB,IAAI,wBAAwB,OAAO;AAC1D,SAAK,iBAAiB,IAAI,eAAe,OAAO;AAChD,SAAK,kBAAkB,IAAI,gBAAgB,OAAO;AAClD,SAAK,YAAY,IAAI,UAAU,OAAO;AACtC,SAAK,qBAAqB,IAAI,mBAAmB,OAAO;AACxD,SAAK,gBAAgB,IAAI,cAAc,OAAO;AAC9C,SAAK,QAAQ,IAAI,MAAM,OAAO;AAC9B,SAAK,SAAS,IAAI,OAAO,OAAO;AAChC,SAAK,UAAU,IAAI,QAAQ,OAAO;AAClC,SAAK,aAAa,IAAI,WAAW,OAAO;AACxC,SAAK,UAAU,IAAI,QAAQ,OAAO;AAAA,EACpC;AACF;AAAA;AAlPa,QAEJ,WAAW;","names":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// src/resources/coupons.ts
|
|
2
|
+
var Coupons = class {
|
|
3
|
+
constructor(request) {
|
|
4
|
+
this.request = request;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Create a coupon. It starts as a draft unless `activate` is `true`.
|
|
8
|
+
* `POST /coupons`
|
|
9
|
+
*
|
|
10
|
+
* A code another coupon of the same mode uses is refused with `IR_38`.
|
|
11
|
+
*/
|
|
12
|
+
async create(params, options) {
|
|
13
|
+
return this.request("POST", "/coupons", { ...options, body: params });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* One page of the merchant's coupons of one mode, newest first. Without
|
|
17
|
+
* `test_mode: true` it lists live coupons.
|
|
18
|
+
* `GET /coupons`
|
|
19
|
+
*/
|
|
20
|
+
async list(params, options) {
|
|
21
|
+
return this.request("GET", "/coupons", {
|
|
22
|
+
...options,
|
|
23
|
+
query: params === void 0 ? void 0 : { ...params }
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Work out what terms take off an example amount, and what the merchant
|
|
28
|
+
* should know before activating them, such as shops whose checkout does not
|
|
29
|
+
* offer coupon entry. Nothing is saved.
|
|
30
|
+
* `POST /coupons/preview`
|
|
31
|
+
*/
|
|
32
|
+
async preview(params, options) {
|
|
33
|
+
return this.request("POST", "/coupons/preview", { ...options, body: params });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve one coupon with its current terms.
|
|
37
|
+
* `GET /coupons/{coupon_id}`
|
|
38
|
+
*/
|
|
39
|
+
async retrieve(couponId, options) {
|
|
40
|
+
return this.request("GET", `/coupons/${encodeURIComponent(couponId)}`, options);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Change a coupon's name, description, shared code or terms. Fields left out
|
|
44
|
+
* stay; new `terms` are a new version. Send `expected_version` to have the
|
|
45
|
+
* change refused (`IR_16`) when the coupon moved on since it was read. An
|
|
46
|
+
* archived coupon is refused with `IR_16`, a code in use with `IR_38`.
|
|
47
|
+
* `POST /coupons/{coupon_id}`
|
|
48
|
+
*/
|
|
49
|
+
async update(couponId, params, options) {
|
|
50
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}`, {
|
|
51
|
+
...options,
|
|
52
|
+
body: params
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One page of a coupon's versions, newest first, with who wrote each.
|
|
57
|
+
* `GET /coupons/{coupon_id}/versions`
|
|
58
|
+
*/
|
|
59
|
+
async versions(couponId, params, options) {
|
|
60
|
+
return this.request("GET", `/coupons/${encodeURIComponent(couponId)}/versions`, {
|
|
61
|
+
...options,
|
|
62
|
+
query: params === void 0 ? void 0 : { ...params }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Copy a coupon's terms into a new draft of the same mode. Without `params`
|
|
67
|
+
* the copy takes the original's name and has no shared code.
|
|
68
|
+
* `POST /coupons/{coupon_id}/duplicate`
|
|
69
|
+
*/
|
|
70
|
+
async duplicate(couponId, params = {}, options) {
|
|
71
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}/duplicate`, {
|
|
72
|
+
...options,
|
|
73
|
+
body: params
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Start a draft or paused coupon. With `valid_from` ahead its status is
|
|
78
|
+
* `scheduled` until then. Any other state is refused with `IR_16`.
|
|
79
|
+
* `POST /coupons/{coupon_id}/activate`
|
|
80
|
+
*/
|
|
81
|
+
async activate(couponId, options) {
|
|
82
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}/activate`, options);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Stop an active coupon until it is activated again. A coupon that is not
|
|
86
|
+
* active is refused with `IR_16`.
|
|
87
|
+
* `POST /coupons/{coupon_id}/pause`
|
|
88
|
+
*/
|
|
89
|
+
async pause(couponId, options) {
|
|
90
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}/pause`, options);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* End a coupon for good and free its code. Its history stays. An archived
|
|
94
|
+
* coupon is refused with `IR_16`.
|
|
95
|
+
* `POST /coupons/{coupon_id}/archive`
|
|
96
|
+
*/
|
|
97
|
+
async archive(couponId, options) {
|
|
98
|
+
return this.request("POST", `/coupons/${encodeURIComponent(couponId)}/archive`, options);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
Coupons
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=chunk-U7HQMJVU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resources/coupons.ts"],"sourcesContent":["import type { RequestExtras, RequestFn } from '../client';\nimport type {\n CouponCreateRequest,\n CouponDuplicateRequest,\n CouponListQuery,\n CouponListResponse,\n CouponPreviewRequest,\n CouponPreviewResponse,\n CouponResponse,\n CouponUpdateRequest,\n CouponVersionListQuery,\n CouponVersionListResponse,\n} from '../types';\n\n/**\n * The merchant's coupon campaigns: a discount, the currencies it is offered\n * in, its dates and limits, and the shops, products and prices it applies to.\n *\n * **A coupon belongs to the merchant, not to a shop.** Call these routes with\n * a merchant-wide secret key or a dashboard session; a shop-scoped API key is\n * refused with a 401 (`DelopayAuthenticationError`). Shops are narrowed inside\n * the terms, with `eligibility.shop_ids`.\n *\n * A coupon reduces a price; it is not a gift card. Its life is\n * `draft` -> `active` <-> `paused` -> `archived`: `activate`, `pause` and\n * `archive` move it, and an archived coupon can no longer be changed. Each\n * change of its terms makes a new version, and a payment keeps the version it\n * accepted. A coupon is live or test (`test_mode`) for good, fixed when it is\n * created.\n */\nexport class Coupons {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Create a coupon. It starts as a draft unless `activate` is `true`.\n * `POST /coupons`\n *\n * A code another coupon of the same mode uses is refused with `IR_38`.\n */\n async create(params: CouponCreateRequest, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('POST', '/coupons', { ...options, body: params });\n }\n\n /**\n * One page of the merchant's coupons of one mode, newest first. Without\n * `test_mode: true` it lists live coupons.\n * `GET /coupons`\n */\n async list(params?: CouponListQuery, options?: RequestExtras): Promise<CouponListResponse> {\n return this.request('GET', '/coupons', {\n ...options,\n query: params === undefined ? undefined : { ...params },\n });\n }\n\n /**\n * Work out what terms take off an example amount, and what the merchant\n * should know before activating them, such as shops whose checkout does not\n * offer coupon entry. Nothing is saved.\n * `POST /coupons/preview`\n */\n async preview(\n params: CouponPreviewRequest,\n options?: RequestExtras,\n ): Promise<CouponPreviewResponse> {\n return this.request('POST', '/coupons/preview', { ...options, body: params });\n }\n\n /**\n * Retrieve one coupon with its current terms.\n * `GET /coupons/{coupon_id}`\n */\n async retrieve(couponId: string, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('GET', `/coupons/${encodeURIComponent(couponId)}`, options);\n }\n\n /**\n * Change a coupon's name, description, shared code or terms. Fields left out\n * stay; new `terms` are a new version. Send `expected_version` to have the\n * change refused (`IR_16`) when the coupon moved on since it was read. An\n * archived coupon is refused with `IR_16`, a code in use with `IR_38`.\n * `POST /coupons/{coupon_id}`\n */\n async update(\n couponId: string,\n params: CouponUpdateRequest,\n options?: RequestExtras,\n ): Promise<CouponResponse> {\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}`, {\n ...options,\n body: params,\n });\n }\n\n /**\n * One page of a coupon's versions, newest first, with who wrote each.\n * `GET /coupons/{coupon_id}/versions`\n */\n async versions(\n couponId: string,\n params?: CouponVersionListQuery,\n options?: RequestExtras,\n ): Promise<CouponVersionListResponse> {\n return this.request('GET', `/coupons/${encodeURIComponent(couponId)}/versions`, {\n ...options,\n query: params === undefined ? undefined : { ...params },\n });\n }\n\n /**\n * Copy a coupon's terms into a new draft of the same mode. Without `params`\n * the copy takes the original's name and has no shared code.\n * `POST /coupons/{coupon_id}/duplicate`\n */\n async duplicate(\n couponId: string,\n params: CouponDuplicateRequest = {},\n options?: RequestExtras,\n ): Promise<CouponResponse> {\n // The route requires a JSON body; `{}` asks for the defaults.\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}/duplicate`, {\n ...options,\n body: params,\n });\n }\n\n /**\n * Start a draft or paused coupon. With `valid_from` ahead its status is\n * `scheduled` until then. Any other state is refused with `IR_16`.\n * `POST /coupons/{coupon_id}/activate`\n */\n async activate(couponId: string, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}/activate`, options);\n }\n\n /**\n * Stop an active coupon until it is activated again. A coupon that is not\n * active is refused with `IR_16`.\n * `POST /coupons/{coupon_id}/pause`\n */\n async pause(couponId: string, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}/pause`, options);\n }\n\n /**\n * End a coupon for good and free its code. Its history stays. An archived\n * coupon is refused with `IR_16`.\n * `POST /coupons/{coupon_id}/archive`\n */\n async archive(couponId: string, options?: RequestExtras): Promise<CouponResponse> {\n return this.request('POST', `/coupons/${encodeURIComponent(couponId)}/archive`, options);\n }\n}\n"],"mappings":";AA8BO,IAAM,UAAN,MAAc;AAAA,EACnB,YAA6B,SAAoB;AAApB;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,OAAO,QAA6B,SAAkD;AAC1F,WAAO,KAAK,QAAQ,QAAQ,YAAY,EAAE,GAAG,SAAS,MAAM,OAAO,CAAC;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,KAAK,QAA0B,SAAsD;AACzF,WAAO,KAAK,QAAQ,OAAO,YAAY;AAAA,MACrC,GAAG;AAAA,MACH,OAAO,WAAW,SAAY,SAAY,EAAE,GAAG,OAAO;AAAA,IACxD,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,QACJ,QACA,SACgC;AAChC,WAAO,KAAK,QAAQ,QAAQ,oBAAoB,EAAE,GAAG,SAAS,MAAM,OAAO,CAAC;AAAA,EAC9E;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,SAAS,UAAkB,SAAkD;AACjF,WAAO,KAAK,QAAQ,OAAO,YAAY,mBAAmB,QAAQ,CAAC,IAAI,OAAO;AAAA,EAChF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,OACJ,UACA,QACA,SACyB;AACzB,WAAO,KAAK,QAAQ,QAAQ,YAAY,mBAAmB,QAAQ,CAAC,IAAI;AAAA,MACtE,GAAG;AAAA,MACH,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,SACJ,UACA,QACA,SACoC;AACpC,WAAO,KAAK,QAAQ,OAAO,YAAY,mBAAmB,QAAQ,CAAC,aAAa;AAAA,MAC9E,GAAG;AAAA,MACH,OAAO,WAAW,SAAY,SAAY,EAAE,GAAG,OAAO;AAAA,IACxD,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,UACJ,UACA,SAAiC,CAAC,GAClC,SACyB;AAEzB,WAAO,KAAK,QAAQ,QAAQ,YAAY,mBAAmB,QAAQ,CAAC,cAAc;AAAA,MAChF,GAAG;AAAA,MACH,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,SAAS,UAAkB,SAAkD;AACjF,WAAO,KAAK,QAAQ,QAAQ,YAAY,mBAAmB,QAAQ,CAAC,aAAa,OAAO;AAAA,EAC1F;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,MAAM,UAAkB,SAAkD;AAC9E,WAAO,KAAK,QAAQ,QAAQ,YAAY,mBAAmB,QAAQ,CAAC,UAAU,OAAO;AAAA,EACvF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,QAAQ,UAAkB,SAAkD;AAChF,WAAO,KAAK,QAAQ,QAAQ,YAAY,mBAAmB,QAAQ,CAAC,YAAY,OAAO;AAAA,EACzF;AACF;","names":[]}
|
package/dist/client.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLLPVB3GTcjs = require('./chunk-LLPVB3GT.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkO7SQCN44cjs = require('./chunk-O7SQCN44.cjs');
|
|
@@ -13,5 +13,5 @@ var _chunkI2W7AO4Bcjs = require('./chunk-I2W7AO4B.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.Delopay =
|
|
16
|
+
exports.Delopay = _chunkLLPVB3GTcjs.Delopay; exports.DelopayAuthenticationError = _chunkI2W7AO4Bcjs.DelopayAuthenticationError; exports.DelopayCore = _chunkO7SQCN44cjs.DelopayCore; exports.DelopayError = _chunkI2W7AO4Bcjs.DelopayError;
|
|
17
17
|
//# sourceMappingURL=client.cjs.map
|
package/dist/client.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/delopay-typescript-sdk/delopay-typescript-sdk/sdk/dist/client.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,2OAAC","file":"/home/runner/work/delopay-typescript-sdk/delopay-typescript-sdk/sdk/dist/client.cjs"}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/delopay-typescript-sdk/delopay-typescript-sdk/sdk/dist/client.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,2OAAC","file":"/home/runner/work/delopay-typescript-sdk/delopay-typescript-sdk/sdk/dist/client.cjs"}
|
package/dist/client.d.cts
CHANGED
|
@@ -4,6 +4,7 @@ export { DelopayAuthenticationError, DelopayError } from './error.cjs';
|
|
|
4
4
|
import { PaypalDisputes } from './resources/paypalDisputes.cjs';
|
|
5
5
|
import { WhopResolutionCases } from './resources/whopResolutionCases.cjs';
|
|
6
6
|
import { ShareLinks } from './resources/shareLinks.cjs';
|
|
7
|
+
import { Coupons } from './resources/coupons.cjs';
|
|
7
8
|
import { WebhookEvent } from './resources/webhooks.cjs';
|
|
8
9
|
import { ApiKeys } from './resources/apiKeys.cjs';
|
|
9
10
|
import { Authentication } from './resources/authentication.cjs';
|
|
@@ -230,6 +231,8 @@ declare class Delopay extends DelopayCore {
|
|
|
230
231
|
readonly aiTools: AiTools;
|
|
231
232
|
/** Expiring external read-only share links for a person or payment. */
|
|
232
233
|
readonly shareLinks: ShareLinks;
|
|
234
|
+
/** The merchant's coupon campaigns: create, preview, change, version and move them between states. */
|
|
235
|
+
readonly coupons: Coupons;
|
|
233
236
|
/**
|
|
234
237
|
* Create a new Delopay client.
|
|
235
238
|
*
|
package/dist/client.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { DelopayAuthenticationError, DelopayError } from './error.js';
|
|
|
4
4
|
import { PaypalDisputes } from './resources/paypalDisputes.js';
|
|
5
5
|
import { WhopResolutionCases } from './resources/whopResolutionCases.js';
|
|
6
6
|
import { ShareLinks } from './resources/shareLinks.js';
|
|
7
|
+
import { Coupons } from './resources/coupons.js';
|
|
7
8
|
import { WebhookEvent } from './resources/webhooks.js';
|
|
8
9
|
import { ApiKeys } from './resources/apiKeys.js';
|
|
9
10
|
import { Authentication } from './resources/authentication.js';
|
|
@@ -230,6 +231,8 @@ declare class Delopay extends DelopayCore {
|
|
|
230
231
|
readonly aiTools: AiTools;
|
|
231
232
|
/** Expiring external read-only share links for a person or payment. */
|
|
232
233
|
readonly shareLinks: ShareLinks;
|
|
234
|
+
/** The merchant's coupon campaigns: create, preview, change, version and move them between states. */
|
|
235
|
+
readonly coupons: Coupons;
|
|
233
236
|
/**
|
|
234
237
|
* Create a new Delopay client.
|
|
235
238
|
*
|