@voucherify/sdk 2.9.2 → 2.9.4

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.
Files changed (75) hide show
  1. package/dist/ApiLimitsHandler.d.ts +13 -10
  2. package/dist/AsyncActions.d.ts +17 -15
  3. package/dist/Balance.d.ts +15 -12
  4. package/dist/Campaigns.d.ts +66 -58
  5. package/dist/Categories.d.ts +29 -26
  6. package/dist/ClientSide.d.ts +77 -53
  7. package/dist/Consents.d.ts +13 -10
  8. package/dist/Customers.d.ts +75 -72
  9. package/dist/Distributions.d.ts +29 -22
  10. package/dist/Events.d.ts +15 -10
  11. package/dist/Exports.d.ts +25 -22
  12. package/dist/Loyalties.d.ts +171 -159
  13. package/dist/MetadataSchemas.d.ts +17 -14
  14. package/dist/Orders.d.ts +32 -27
  15. package/dist/ProductCollections.d.ts +30 -26
  16. package/dist/Products.d.ts +66 -63
  17. package/dist/PromotionTiers.d.ts +43 -34
  18. package/dist/Promotions.d.ts +30 -18
  19. package/dist/PromotionsStacks.d.ts +34 -30
  20. package/dist/Qualifications.d.ts +24 -10
  21. package/dist/Redemptions.d.ts +53 -35
  22. package/dist/RequestController.d.ts +31 -29
  23. package/dist/Rewards.d.ts +46 -43
  24. package/dist/Segments.d.ts +25 -22
  25. package/dist/ValidationRules.d.ts +47 -43
  26. package/dist/Validations.d.ts +39 -17
  27. package/dist/VoucherifyClientSide.d.ts +112 -86
  28. package/dist/VoucherifyError.d.ts +23 -20
  29. package/dist/VoucherifyServerSide.d.ts +170 -131
  30. package/dist/Vouchers.d.ts +84 -78
  31. package/dist/helpers.d.ts +20 -18
  32. package/dist/index.d.ts +63 -25
  33. package/dist/types/ApplicableTo.d.ts +32 -30
  34. package/dist/types/AsyncActions.d.ts +23 -21
  35. package/dist/types/Balance.d.ts +18 -16
  36. package/dist/types/Campaigns.d.ts +124 -120
  37. package/dist/types/Categories.d.ts +40 -38
  38. package/dist/types/ClientSide.d.ts +145 -134
  39. package/dist/types/Consents.d.ts +34 -33
  40. package/dist/types/Customers.d.ts +363 -361
  41. package/dist/types/DiscountVoucher.d.ts +94 -93
  42. package/dist/types/Distributions.d.ts +148 -144
  43. package/dist/types/Events.d.ts +21 -17
  44. package/dist/types/Exports.d.ts +151 -149
  45. package/dist/types/Gift.d.ts +5 -3
  46. package/dist/types/Loyalties.d.ts +1061 -1057
  47. package/dist/types/MetadataSchemas.d.ts +34 -33
  48. package/dist/types/Orders.d.ts +199 -195
  49. package/dist/types/ProductCollections.d.ts +99 -96
  50. package/dist/types/Products.d.ts +108 -106
  51. package/dist/types/PromotionTiers.d.ts +131 -127
  52. package/dist/types/Promotions.d.ts +113 -108
  53. package/dist/types/PromotionsStacks.d.ts +74 -71
  54. package/dist/types/Qualifications.d.ts +92 -86
  55. package/dist/types/Redemptions.d.ts +215 -205
  56. package/dist/types/Rewards.d.ts +220 -219
  57. package/dist/types/Segments.d.ts +34 -32
  58. package/dist/types/Stackable.d.ts +106 -101
  59. package/dist/types/UtilityTypes.d.ts +5 -3
  60. package/dist/types/ValidateSession.d.ts +19 -17
  61. package/dist/types/ValidationError.d.ts +9 -7
  62. package/dist/types/ValidationRules.d.ts +96 -93
  63. package/dist/types/Validations.d.ts +109 -98
  64. package/dist/types/Vouchers.d.ts +452 -364
  65. package/dist/types/index.d.ts +27 -25
  66. package/dist/voucherifysdk.cjs +2023 -0
  67. package/dist/voucherifysdk.cjs.map +1 -0
  68. package/dist/voucherifysdk.esm.js +981 -1256
  69. package/dist/voucherifysdk.esm.js.map +1 -1
  70. package/package.json +13 -9
  71. package/CHANGELOG.md +0 -663
  72. package/dist/voucherifysdk.umd.development.js +0 -2270
  73. package/dist/voucherifysdk.umd.development.js.map +0 -1
  74. package/dist/voucherifysdk.umd.production.min.js +0 -2
  75. package/dist/voucherifysdk.umd.production.min.js.map +0 -1
@@ -1,364 +1,452 @@
1
- import { OrdersGetResponse } from './Orders';
2
- import { SimpleCustomer } from './Customers';
3
- import { DiscountUnit, DiscountAmount, DiscountPercent, DiscountFixed } from './DiscountVoucher';
4
- import { LoyaltyCardTransaction } from './Loyalties';
5
- export declare type VoucherType = 'GIFT_VOUCHER' | 'DISCOUNT_VOUCHER' | 'LOYALTY_CARD' | 'LUCKY_DRAW';
6
- export interface SimpleVoucher {
7
- code_config?: {
8
- length?: number;
9
- charset?: string;
10
- pattern?: string;
11
- prefix?: string;
12
- suffix?: string;
13
- };
14
- type: VoucherType;
15
- is_referral_code?: boolean;
16
- discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed;
17
- loyalty_card?: {
18
- points: number;
19
- balance: number;
20
- };
21
- redemption?: {
22
- quantity: number;
23
- };
24
- }
25
- export interface VouchersResponse {
26
- id: string;
27
- code: string;
28
- campaign?: string;
29
- category?: string;
30
- type?: 'DISCOUNT_VOUCHER' | 'GIFT_VOUCHER';
31
- discount?: DiscountAmount | DiscountPercent | DiscountUnit | DiscountFixed;
32
- gift?: {
33
- amount: number;
34
- balance: number;
35
- };
36
- loyalty_card?: {
37
- points: number;
38
- balance: number;
39
- next_expiration_date?: string;
40
- next_expiration_points?: number;
41
- };
42
- start_date?: string;
43
- expiration_date?: string;
44
- validity_timeframe?: {
45
- interval: string;
46
- duration: string;
47
- };
48
- validity_day_of_week?: number[];
49
- publish?: {
50
- object: 'list';
51
- count: number;
52
- data_ref: 'entries';
53
- entries: string[];
54
- total: number;
55
- url: string;
56
- };
57
- redemption?: {
58
- object: 'list';
59
- quantity?: number;
60
- redeemed_quantity: number;
61
- data_ref: 'redemption_entries';
62
- redemption_entries: string[];
63
- total: number;
64
- url: string;
65
- };
66
- active: boolean;
67
- additional_info?: string;
68
- metadata?: Record<string, any>;
69
- assets?: {
70
- qr?: {
71
- id: string;
72
- url: string;
73
- };
74
- barcode?: {
75
- id: string;
76
- url: string;
77
- };
78
- };
79
- is_referral_code: boolean;
80
- referrer_id?: string;
81
- holder_id?: string;
82
- updated_at?: string;
83
- created_at: string;
84
- object: 'voucher';
85
- validation_rules_assignments: {
86
- object: 'list';
87
- total: number;
88
- data_ref: 'data';
89
- data?: {
90
- id: string;
91
- rule_id?: string;
92
- related_object_id?: string;
93
- related_object_type?: string;
94
- created_at: string;
95
- object: 'validation_rules_assignment';
96
- }[];
97
- };
98
- }
99
- export interface VouchersQualificationExamineBody {
100
- customer?: Omit<SimpleCustomer, 'object'> & {
101
- description: string;
102
- };
103
- order?: Pick<OrdersGetResponse, 'id' | 'source_id' | 'amount' | 'items' | 'metadata'>;
104
- reward?: {
105
- id: string;
106
- assignment_id?: string;
107
- };
108
- metadata?: Record<string, any>;
109
- }
110
- export interface VouchersQualificationExamineParams {
111
- audienceRulesOnly?: boolean;
112
- order?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at';
113
- limit?: number;
114
- }
115
- export interface VouchersQualificationExamineResponse {
116
- object: 'list';
117
- total: number;
118
- data_ref: 'data';
119
- data?: VouchersResponse[];
120
- }
121
- export interface VouchersCreateParameters {
122
- active?: boolean;
123
- code?: string;
124
- code_config?: {
125
- length?: number;
126
- charset?: string;
127
- pattern?: string;
128
- prefix?: string;
129
- suffix?: string;
130
- };
131
- redemption?: {
132
- quantity: number;
133
- };
134
- validation_rules?: string[];
135
- }
136
- export declare type VouchersCreate = VouchersCreateParameters & Pick<VouchersResponse, 'type' | 'discount' | 'gift' | 'category' | 'additional_info' | 'start_date' | 'expiration_date' | 'metadata'>;
137
- export declare type VouchersCreateResponse = Omit<VouchersResponse, 'validation_rules_assignments'>;
138
- export declare type VouchersGetResponse = VouchersResponse;
139
- export interface VouchersUpdate {
140
- code: string;
141
- category?: string;
142
- start_date?: string;
143
- expiration_date?: string;
144
- active?: boolean;
145
- additional_info?: string;
146
- metadata?: Record<string, any>;
147
- gift?: {
148
- amount: number;
149
- };
150
- }
151
- export declare type VouchersUpdateResponse = VouchersResponse;
152
- export interface VouchersDeleteParams {
153
- force?: boolean;
154
- }
155
- export interface VouchersListParams {
156
- limit?: number;
157
- page?: number;
158
- category?: string;
159
- campaign?: string;
160
- customer?: string;
161
- created_at?: {
162
- after?: string;
163
- before?: string;
164
- };
165
- updated_at?: {
166
- after?: string;
167
- before?: string;
168
- };
169
- order?: '-created_at' | 'created_at' | '-updated_at' | 'updated_at' | '-type' | 'type' | '-code' | 'code' | '-campaign' | 'campaign' | '-category' | 'category';
170
- filters?: {
171
- junction?: string;
172
- [filter_condition: string]: any;
173
- };
174
- }
175
- export interface VouchersListResponse {
176
- object: 'list';
177
- total: number;
178
- data_ref: 'vouchers';
179
- vouchers: VouchersResponse[];
180
- }
181
- export declare type VouchersEnableResponse = VouchersResponse;
182
- export declare type VouchersDisableResponse = VouchersResponse;
183
- export interface VouchersImport {
184
- code: string;
185
- category?: string;
186
- type?: 'DISCOUNT_VOUCHER' | 'GIFT_VOUCHER';
187
- discount: DiscountAmount | DiscountPercent | DiscountUnit | DiscountFixed;
188
- additional_info?: string;
189
- start_date?: string;
190
- expiration_date?: string;
191
- active?: boolean;
192
- metadata?: Record<string, any>;
193
- redemption?: {
194
- quantity: number;
195
- };
196
- code_config?: {
197
- length?: number;
198
- charset?: string;
199
- pattern?: string;
200
- prefix?: string;
201
- suffix?: string;
202
- };
203
- }
204
- export interface VouchersBulkUpdateObject {
205
- code: string;
206
- metadata: Record<string, any>;
207
- }
208
- export declare type VouchersBulkUpdate = VouchersBulkUpdateObject[];
209
- export interface VouchersBulkUpdateMetadata {
210
- codes: string[];
211
- metadata: Record<string, any>;
212
- }
213
- export declare type VouchersImportResponse = {
214
- async_action_id: string;
215
- };
216
- export declare type VouchersBulkUpdateMetadataResponse = {
217
- async_action_id: string;
218
- };
219
- export declare type VouchersBulkUpdateResponse = {
220
- async_action_id: string;
221
- };
222
- export declare type GiftCardTransaction = GiftCardTransactionBase & GiftCardTransactionDetails;
223
- export interface GiftCardTransactionBase {
224
- id: string;
225
- source_id: string | null;
226
- voucher_id: string;
227
- campaign_id: string | null;
228
- related_transaction_id: string | null;
229
- reason: string | null;
230
- created_at: string;
231
- }
232
- export declare type GiftCardTransactionDetails = GiftCardTransactionRedemptionDetails | GiftCardTransactionRefundDetails | GiftCardTransactionAdditionDetails | GiftCardTransactionRemovalDetails;
233
- export interface GiftCardTransactionRedemptionDetails {
234
- source: null;
235
- type: 'CREDITS_REDEMPTION';
236
- details: {
237
- balance: {
238
- type: 'gift_voucher';
239
- total: number;
240
- amount: number;
241
- object: 'balance';
242
- balance: number;
243
- related_object: {
244
- id: string;
245
- type: 'voucher';
246
- };
247
- };
248
- order: {
249
- id: string;
250
- source_id: string | null;
251
- };
252
- redemption: {
253
- id: string;
254
- };
255
- };
256
- }
257
- export interface GiftCardTransactionRefundDetails {
258
- source: null;
259
- type: 'CREDITS_REFUND';
260
- details: {
261
- balance: {
262
- type: 'gift_voucher';
263
- total: number;
264
- amount: number;
265
- object: 'balance';
266
- balance: number;
267
- related_object: {
268
- id: string;
269
- type: 'voucher';
270
- };
271
- };
272
- order: {
273
- id: string;
274
- source_id: string | null;
275
- };
276
- redemption: {
277
- id: string;
278
- };
279
- rollback: {
280
- id: string;
281
- };
282
- };
283
- }
284
- export interface GiftCardTransactionAdditionDetails {
285
- source: 'voucherify-web-ui' | 'API';
286
- type: 'CREDITS_ADDITION';
287
- details: {
288
- balance: {
289
- type: 'gift_voucher';
290
- total: number;
291
- amount: number;
292
- object: 'balance';
293
- balance: number;
294
- operation_type: 'MANUAL' | 'AUTOMATIC';
295
- related_object: {
296
- id: string;
297
- type: 'voucher';
298
- };
299
- };
300
- };
301
- }
302
- export interface GiftCardTransactionRemovalDetails {
303
- source: 'voucherify-web-ui' | 'API';
304
- type: 'CREDITS_REMOVAL';
305
- details: {
306
- balance: {
307
- type: 'gift_voucher';
308
- total: number;
309
- amount: number;
310
- object: 'balance';
311
- balance: number;
312
- operation_type: 'MANUAL' | 'AUTOMATIC';
313
- related_object: {
314
- id: string;
315
- type: 'voucher';
316
- };
317
- };
318
- };
319
- }
320
- export declare type VoucherTransaction = GiftCardTransaction | LoyaltyCardTransaction;
321
- export declare type VoucherTransactionsExportFields = 'id' | 'campaign_id' | 'voucher_id' | 'type' | 'source_id' | 'reason' | 'source' | 'balance' | 'amount' | 'related_transaction_id' | 'created_at' | 'details';
322
- export interface VouchersListTransactionsRequestQuery {
323
- limit?: number;
324
- starting_after_id?: string;
325
- order?: 'id' | '-id';
326
- /**
327
- * @deprecated Use starting_after_id
328
- */
329
- page?: number;
330
- }
331
- export interface VouchersListTransactionsResponseBody {
332
- object: 'list';
333
- data_ref: 'data';
334
- data: VoucherTransaction[];
335
- has_more: boolean;
336
- more_starting_after?: string;
337
- }
338
- export interface VouchersExportTransactionsRequestBody {
339
- parameters?: {
340
- order?: '-created_at' | 'created_at';
341
- fields?: VoucherTransactionsExportFields[];
342
- };
343
- }
344
- export interface VouchersExportTransactionsResponseBody {
345
- id: string;
346
- status: 'SCHEDULED';
347
- channel: string;
348
- parameters: {
349
- order?: string;
350
- fields?: VoucherTransactionsExportFields[];
351
- filters: {
352
- voucher_id: {
353
- conditions: {
354
- $in: [string];
355
- };
356
- };
357
- };
358
- };
359
- result: null;
360
- user_id: string | null;
361
- exported_object: 'voucher_transactions';
362
- object: 'export';
363
- created_at: string;
364
- }
1
+ import { OrdersGetResponse } from './Orders.js';
2
+ import { SimpleCustomer } from './Customers.js';
3
+ import { DiscountUnit, DiscountAmount, DiscountPercent, DiscountFixed } from './DiscountVoucher.js';
4
+
5
+ interface LoyaltyCardTransaction {
6
+ id: string;
7
+ source_id: string | null;
8
+ voucher_id: string;
9
+ campaign_id: string;
10
+ source: string | null;
11
+ reason: string | null;
12
+ type: LoyaltyCardTransactionsType;
13
+ details: {
14
+ balance: {
15
+ type: 'loyalty_card';
16
+ total: number;
17
+ object: 'balance';
18
+ operation_type: 'MANUAL' | 'AUTOMATIC';
19
+ points: number;
20
+ balance: number;
21
+ related_object: {
22
+ id: string;
23
+ type: 'voucher';
24
+ };
25
+ };
26
+ order?: {
27
+ id: string;
28
+ source_id: string;
29
+ };
30
+ event?: {
31
+ id: string;
32
+ type: string;
33
+ };
34
+ earning_rule?: {
35
+ id: string;
36
+ source: {
37
+ banner: string;
38
+ };
39
+ };
40
+ segment?: {
41
+ id: string;
42
+ name: string;
43
+ };
44
+ loyalty_tier?: {
45
+ id: string;
46
+ name: string;
47
+ };
48
+ redemption?: {
49
+ id: string;
50
+ };
51
+ rollback?: {
52
+ id: string;
53
+ };
54
+ reward?: {
55
+ id: string;
56
+ name: string;
57
+ };
58
+ custom_event?: {
59
+ id: string;
60
+ type: string;
61
+ };
62
+ event_schema?: {
63
+ id: string;
64
+ name: string;
65
+ };
66
+ source_voucher?: SimpleLoyaltyVoucher;
67
+ destination_voucher?: SimpleLoyaltyVoucher;
68
+ };
69
+ related_transaction_id: string | null;
70
+ created_at: string;
71
+ }
72
+ type LoyaltyCardTransactionsType = 'POINTS_ACCRUAL' | 'POINTS_CANCELLATION' | 'POINTS_REDEMPTION' | 'POINTS_REFUND' | 'POINTS_ADDITION' | 'POINTS_REMOVAL' | 'POINTS_EXPIRATION' | 'POINTS_TRANSFER_IN' | 'POINTS_TRANSFER_OUT';
73
+ interface SimpleLoyaltyVoucher {
74
+ id: string;
75
+ code: string;
76
+ loyalty_card: {
77
+ points: number;
78
+ balance: number;
79
+ next_expiration_date?: string;
80
+ next_expiration_points?: string;
81
+ };
82
+ type: 'LOYALTY_CARD';
83
+ campaign: string;
84
+ campaign_id: string;
85
+ is_referral_code?: boolean;
86
+ holder_id?: string;
87
+ referrer_id?: string;
88
+ created_at?: string;
89
+ object: 'voucher';
90
+ }
91
+ type VoucherType = 'GIFT_VOUCHER' | 'DISCOUNT_VOUCHER' | 'LOYALTY_CARD' | 'LUCKY_DRAW';
92
+ interface SimpleVoucher {
93
+ code_config?: {
94
+ length?: number;
95
+ charset?: string;
96
+ pattern?: string;
97
+ prefix?: string;
98
+ suffix?: string;
99
+ };
100
+ type: VoucherType;
101
+ is_referral_code?: boolean;
102
+ discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed;
103
+ loyalty_card?: {
104
+ points: number;
105
+ balance: number;
106
+ };
107
+ redemption?: {
108
+ quantity: number;
109
+ };
110
+ }
111
+ interface VouchersResponse {
112
+ id: string;
113
+ code: string;
114
+ campaign?: string;
115
+ category?: string;
116
+ type?: 'DISCOUNT_VOUCHER' | 'GIFT_VOUCHER';
117
+ discount?: DiscountAmount | DiscountPercent | DiscountUnit | DiscountFixed;
118
+ gift?: {
119
+ amount: number;
120
+ balance: number;
121
+ };
122
+ loyalty_card?: {
123
+ points: number;
124
+ balance: number;
125
+ next_expiration_date?: string;
126
+ next_expiration_points?: number;
127
+ };
128
+ start_date?: string;
129
+ expiration_date?: string;
130
+ validity_timeframe?: {
131
+ interval: string;
132
+ duration: string;
133
+ };
134
+ validity_day_of_week?: number[];
135
+ publish?: {
136
+ object: 'list';
137
+ count: number;
138
+ data_ref: 'entries';
139
+ entries: string[];
140
+ total: number;
141
+ url: string;
142
+ };
143
+ redemption?: {
144
+ object: 'list';
145
+ quantity?: number;
146
+ redeemed_quantity: number;
147
+ data_ref: 'redemption_entries';
148
+ redemption_entries: string[];
149
+ total: number;
150
+ url: string;
151
+ };
152
+ active: boolean;
153
+ additional_info?: string;
154
+ metadata?: Record<string, any>;
155
+ assets?: {
156
+ qr?: {
157
+ id: string;
158
+ url: string;
159
+ };
160
+ barcode?: {
161
+ id: string;
162
+ url: string;
163
+ };
164
+ };
165
+ is_referral_code: boolean;
166
+ referrer_id?: string;
167
+ holder_id?: string;
168
+ updated_at?: string;
169
+ created_at: string;
170
+ object: 'voucher';
171
+ validation_rules_assignments: {
172
+ object: 'list';
173
+ total: number;
174
+ data_ref: 'data';
175
+ data?: {
176
+ id: string;
177
+ rule_id?: string;
178
+ related_object_id?: string;
179
+ related_object_type?: string;
180
+ created_at: string;
181
+ object: 'validation_rules_assignment';
182
+ }[];
183
+ };
184
+ }
185
+ interface VouchersQualificationExamineBody {
186
+ customer?: Omit<SimpleCustomer, 'object'> & {
187
+ description: string;
188
+ };
189
+ order?: Pick<OrdersGetResponse, 'id' | 'source_id' | 'amount' | 'items' | 'metadata'>;
190
+ reward?: {
191
+ id: string;
192
+ assignment_id?: string;
193
+ };
194
+ metadata?: Record<string, any>;
195
+ }
196
+ interface VouchersQualificationExamineParams {
197
+ audienceRulesOnly?: boolean;
198
+ order?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at';
199
+ limit?: number;
200
+ }
201
+ interface VouchersQualificationExamineResponse {
202
+ object: 'list';
203
+ total: number;
204
+ data_ref: 'data';
205
+ data?: VouchersResponse[];
206
+ }
207
+ interface VouchersCreateParameters {
208
+ active?: boolean;
209
+ code?: string;
210
+ code_config?: {
211
+ length?: number;
212
+ charset?: string;
213
+ pattern?: string;
214
+ prefix?: string;
215
+ suffix?: string;
216
+ };
217
+ redemption?: {
218
+ quantity: number;
219
+ };
220
+ validation_rules?: string[];
221
+ }
222
+ type VouchersCreate = VouchersCreateParameters & Pick<VouchersResponse, 'type' | 'discount' | 'gift' | 'category' | 'additional_info' | 'start_date' | 'expiration_date' | 'metadata'>;
223
+ type VouchersCreateResponse = Omit<VouchersResponse, 'validation_rules_assignments'>;
224
+ type VouchersGetResponse = VouchersResponse;
225
+ interface VouchersUpdate {
226
+ code: string;
227
+ category?: string;
228
+ start_date?: string;
229
+ expiration_date?: string;
230
+ active?: boolean;
231
+ additional_info?: string;
232
+ metadata?: Record<string, any>;
233
+ gift?: {
234
+ amount: number;
235
+ };
236
+ }
237
+ type VouchersUpdateResponse = VouchersResponse;
238
+ interface VouchersDeleteParams {
239
+ force?: boolean;
240
+ }
241
+ interface VouchersListParams {
242
+ limit?: number;
243
+ page?: number;
244
+ category?: string;
245
+ campaign?: string;
246
+ customer?: string;
247
+ created_at?: {
248
+ after?: string;
249
+ before?: string;
250
+ };
251
+ updated_at?: {
252
+ after?: string;
253
+ before?: string;
254
+ };
255
+ order?: '-created_at' | 'created_at' | '-updated_at' | 'updated_at' | '-type' | 'type' | '-code' | 'code' | '-campaign' | 'campaign' | '-category' | 'category';
256
+ filters?: {
257
+ junction?: string;
258
+ [filter_condition: string]: any;
259
+ };
260
+ }
261
+ interface VouchersListResponse {
262
+ object: 'list';
263
+ total: number;
264
+ data_ref: 'vouchers';
265
+ vouchers: VouchersResponse[];
266
+ }
267
+ type VouchersEnableResponse = VouchersResponse;
268
+ type VouchersDisableResponse = VouchersResponse;
269
+ interface VouchersImport {
270
+ code: string;
271
+ category?: string;
272
+ type?: 'DISCOUNT_VOUCHER' | 'GIFT_VOUCHER';
273
+ discount: DiscountAmount | DiscountPercent | DiscountUnit | DiscountFixed;
274
+ additional_info?: string;
275
+ start_date?: string;
276
+ expiration_date?: string;
277
+ active?: boolean;
278
+ metadata?: Record<string, any>;
279
+ redemption?: {
280
+ quantity: number;
281
+ };
282
+ code_config?: {
283
+ length?: number;
284
+ charset?: string;
285
+ pattern?: string;
286
+ prefix?: string;
287
+ suffix?: string;
288
+ };
289
+ }
290
+ interface VouchersBulkUpdateObject {
291
+ code: string;
292
+ metadata: Record<string, any>;
293
+ }
294
+ type VouchersBulkUpdate = VouchersBulkUpdateObject[];
295
+ interface VouchersBulkUpdateMetadata {
296
+ codes: string[];
297
+ metadata: Record<string, any>;
298
+ }
299
+ type VouchersImportResponse = {
300
+ async_action_id: string;
301
+ };
302
+ type VouchersBulkUpdateMetadataResponse = {
303
+ async_action_id: string;
304
+ };
305
+ type VouchersBulkUpdateResponse = {
306
+ async_action_id: string;
307
+ };
308
+ type GiftCardTransaction = GiftCardTransactionBase & GiftCardTransactionDetails;
309
+ interface GiftCardTransactionBase {
310
+ id: string;
311
+ source_id: string | null;
312
+ voucher_id: string;
313
+ campaign_id: string | null;
314
+ related_transaction_id: string | null;
315
+ reason: string | null;
316
+ created_at: string;
317
+ }
318
+ type GiftCardTransactionDetails = GiftCardTransactionRedemptionDetails | GiftCardTransactionRefundDetails | GiftCardTransactionAdditionDetails | GiftCardTransactionRemovalDetails;
319
+ interface GiftCardTransactionRedemptionDetails {
320
+ source: null;
321
+ type: 'CREDITS_REDEMPTION';
322
+ details: {
323
+ balance: {
324
+ type: 'gift_voucher';
325
+ total: number;
326
+ amount: number;
327
+ object: 'balance';
328
+ balance: number;
329
+ related_object: {
330
+ id: string;
331
+ type: 'voucher';
332
+ };
333
+ };
334
+ order: {
335
+ id: string;
336
+ source_id: string | null;
337
+ };
338
+ redemption: {
339
+ id: string;
340
+ };
341
+ };
342
+ }
343
+ interface GiftCardTransactionRefundDetails {
344
+ source: null;
345
+ type: 'CREDITS_REFUND';
346
+ details: {
347
+ balance: {
348
+ type: 'gift_voucher';
349
+ total: number;
350
+ amount: number;
351
+ object: 'balance';
352
+ balance: number;
353
+ related_object: {
354
+ id: string;
355
+ type: 'voucher';
356
+ };
357
+ };
358
+ order: {
359
+ id: string;
360
+ source_id: string | null;
361
+ };
362
+ redemption: {
363
+ id: string;
364
+ };
365
+ rollback: {
366
+ id: string;
367
+ };
368
+ };
369
+ }
370
+ interface GiftCardTransactionAdditionDetails {
371
+ source: 'voucherify-web-ui' | 'API';
372
+ type: 'CREDITS_ADDITION';
373
+ details: {
374
+ balance: {
375
+ type: 'gift_voucher';
376
+ total: number;
377
+ amount: number;
378
+ object: 'balance';
379
+ balance: number;
380
+ operation_type: 'MANUAL' | 'AUTOMATIC';
381
+ related_object: {
382
+ id: string;
383
+ type: 'voucher';
384
+ };
385
+ };
386
+ };
387
+ }
388
+ interface GiftCardTransactionRemovalDetails {
389
+ source: 'voucherify-web-ui' | 'API';
390
+ type: 'CREDITS_REMOVAL';
391
+ details: {
392
+ balance: {
393
+ type: 'gift_voucher';
394
+ total: number;
395
+ amount: number;
396
+ object: 'balance';
397
+ balance: number;
398
+ operation_type: 'MANUAL' | 'AUTOMATIC';
399
+ related_object: {
400
+ id: string;
401
+ type: 'voucher';
402
+ };
403
+ };
404
+ };
405
+ }
406
+ type VoucherTransaction = GiftCardTransaction | LoyaltyCardTransaction;
407
+ type VoucherTransactionsExportFields = 'id' | 'campaign_id' | 'voucher_id' | 'type' | 'source_id' | 'reason' | 'source' | 'balance' | 'amount' | 'related_transaction_id' | 'created_at' | 'details';
408
+ interface VouchersListTransactionsRequestQuery {
409
+ limit?: number;
410
+ starting_after_id?: string;
411
+ order?: 'id' | '-id';
412
+ /**
413
+ * @deprecated Use starting_after_id
414
+ */
415
+ page?: number;
416
+ }
417
+ interface VouchersListTransactionsResponseBody {
418
+ object: 'list';
419
+ data_ref: 'data';
420
+ data: VoucherTransaction[];
421
+ has_more: boolean;
422
+ more_starting_after?: string;
423
+ }
424
+ interface VouchersExportTransactionsRequestBody {
425
+ parameters?: {
426
+ order?: '-created_at' | 'created_at';
427
+ fields?: VoucherTransactionsExportFields[];
428
+ };
429
+ }
430
+ interface VouchersExportTransactionsResponseBody {
431
+ id: string;
432
+ status: 'SCHEDULED';
433
+ channel: string;
434
+ parameters: {
435
+ order?: string;
436
+ fields?: VoucherTransactionsExportFields[];
437
+ filters: {
438
+ voucher_id: {
439
+ conditions: {
440
+ $in: [string];
441
+ };
442
+ };
443
+ };
444
+ };
445
+ result: null;
446
+ user_id: string | null;
447
+ exported_object: 'voucher_transactions';
448
+ object: 'export';
449
+ created_at: string;
450
+ }
451
+
452
+ export type { GiftCardTransaction, GiftCardTransactionAdditionDetails, GiftCardTransactionBase, GiftCardTransactionDetails, GiftCardTransactionRedemptionDetails, GiftCardTransactionRefundDetails, GiftCardTransactionRemovalDetails, SimpleVoucher, VoucherTransaction, VoucherTransactionsExportFields, VoucherType, VouchersBulkUpdate, VouchersBulkUpdateMetadata, VouchersBulkUpdateMetadataResponse, VouchersBulkUpdateObject, VouchersBulkUpdateResponse, VouchersCreate, VouchersCreateParameters, VouchersCreateResponse, VouchersDeleteParams, VouchersDisableResponse, VouchersEnableResponse, VouchersExportTransactionsRequestBody, VouchersExportTransactionsResponseBody, VouchersGetResponse, VouchersImport, VouchersImportResponse, VouchersListParams, VouchersListResponse, VouchersListTransactionsRequestQuery, VouchersListTransactionsResponseBody, VouchersQualificationExamineBody, VouchersQualificationExamineParams, VouchersQualificationExamineResponse, VouchersResponse, VouchersUpdate, VouchersUpdateResponse };