@voucherify/sdk 2.0.1 → 2.0.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.
- package/CHANGELOG.md +18 -0
- package/README.md +41 -0
- package/dist/ClientSide.d.ts +8 -0
- package/dist/Customers.d.ts +4 -0
- package/dist/Promotions.d.ts +1 -1
- package/dist/Redemptions.d.ts +9 -0
- package/dist/Validations.d.ts +4 -0
- package/dist/types/ApplicableTo.d.ts +15 -0
- package/dist/types/ClientSide.d.ts +12 -13
- package/dist/types/Customers.d.ts +14 -0
- package/dist/types/DiscountVoucher.d.ts +27 -0
- package/dist/types/Gift.d.ts +3 -0
- package/dist/types/Loyalties.d.ts +4 -0
- package/dist/types/Orders.d.ts +10 -0
- package/dist/types/Products.d.ts +10 -0
- package/dist/types/PromotionTiers.d.ts +3 -4
- package/dist/types/Promotions.d.ts +5 -1
- package/dist/types/Redemptions.d.ts +63 -13
- package/dist/types/Rewards.d.ts +5 -0
- package/dist/types/Stackable.d.ts +63 -0
- package/dist/types/ValidateSession.d.ts +17 -0
- package/dist/types/ValidationRules.d.ts +2 -5
- package/dist/types/Validations.d.ts +23 -17
- package/dist/types/Vouchers.d.ts +1 -15
- package/dist/types/index.d.ts +5 -0
- package/dist/voucherifysdk.esm.js +66 -5
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +63 -4
- package/dist/voucherifysdk.umd.development.js.map +1 -1
- package/dist/voucherifysdk.umd.production.min.js +1 -1
- package/dist/voucherifysdk.umd.production.min.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @voucherify/sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f411c1a`](https://github.com/voucherifyio/voucherify-js-sdk/commit/f411c1a56085d80560fdca634e5fdc059a556091) [#119](https://github.com/voucherifyio/voucherify-js-sdk/pull/119) Thanks [@darekg11](https://github.com/darekg11)! - Added support for stackable API methods - validation, redemptions, rollback for both Server Side and Client Side SDKs. Added some missing fields in already existing types definitions and cleaned up other definitions by reusing interfaces
|
|
8
|
+
|
|
9
|
+
## 2.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`da9e103`](https://github.com/voucherifyio/voucherify-js-sdk/commit/da9e103a43590b55cb80d64e1743f7ede1e09946) [#117](https://github.com/voucherifyio/voucherify-js-sdk/pull/117) Thanks [@darekg11](https://github.com/darekg11)! - Added support for listing customer activities by customerId. Additionally user can pass query params allowing for better filtering. API Reference: https://docs.voucherify.io/reference/get-customer-activities
|
|
14
|
+
|
|
15
|
+
## 2.0.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`b5f04fa`](https://github.com/voucherifyio/voucherify-js-sdk/commit/b5f04fa09db6849f514910747a5ac9a721f63891) [#112](https://github.com/voucherifyio/voucherify-js-sdk/pull/112) Thanks [@darekg11](https://github.com/darekg11)! - Query params passed to `this.client.post` method are now correctly stringified. Added possibility to pass query params to `voucherify.promotions.validate` method in order to allow developers using SDK to pass advanced filters to restrict possible range of promotion campaigns against which validation should be performed.
|
|
20
|
+
|
|
3
21
|
## 2.0.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -362,6 +362,7 @@ Methods are provided within `client.validations.*` or `client.promotions.*` name
|
|
|
362
362
|
|
|
363
363
|
- [Validate Voucher](#validate-voucher)
|
|
364
364
|
- [Validate Promotion Campaign](#validate-promotion-campaign)
|
|
365
|
+
- [Validate Stackable](#validate-stackable)
|
|
365
366
|
|
|
366
367
|
#### [Validate Voucher](https://docs.voucherify.io/reference/validate-voucher)
|
|
367
368
|
|
|
@@ -389,6 +390,11 @@ Other possibility
|
|
|
389
390
|
client.validations.validate(params)
|
|
390
391
|
```
|
|
391
392
|
|
|
393
|
+
#### [Validate Stackable](https://docs.voucherify.io/reference/validate-stacked-discounts-1)
|
|
394
|
+
```javascript
|
|
395
|
+
client.validations.validateStackable(params)
|
|
396
|
+
```
|
|
397
|
+
|
|
392
398
|
---
|
|
393
399
|
|
|
394
400
|
### Redemptions
|
|
@@ -396,12 +402,14 @@ client.validations.validate(params)
|
|
|
396
402
|
Methods are provided within `client.redemptions.*` namespace.
|
|
397
403
|
|
|
398
404
|
- [Redeem Voucher](#redeem-voucher)
|
|
405
|
+
- [Redeem Stackable](#redeem-stackable)
|
|
399
406
|
- [Get Redemption](#get-redemption)
|
|
400
407
|
- [Redeem Promotion's Tier](#redeem-promotions-tier)
|
|
401
408
|
- [Redeem Loyalty Card](#redeem-loyalty-card)
|
|
402
409
|
- [List Redemptions](#list-redemptions)
|
|
403
410
|
- [Get Voucher's Redemptions](#get-vouchers-redemptions)
|
|
404
411
|
- [Rollback Redemption](#rollback-redemption)
|
|
412
|
+
- [Rollback Stackable](#rollback-stackable)
|
|
405
413
|
|
|
406
414
|
#### [Redeem Voucher](https://docs.voucherify.io/reference/redeem-voucher)
|
|
407
415
|
|
|
@@ -410,6 +418,11 @@ client.redemptions.redeem(code)
|
|
|
410
418
|
client.redemptions.redeem(code, params)
|
|
411
419
|
```
|
|
412
420
|
|
|
421
|
+
#### [Redeem Stackable](https://docs.voucherify.io/reference/redeem-stacked-discounts)
|
|
422
|
+
```javascript
|
|
423
|
+
client.redemptions.redeemStackable(params)
|
|
424
|
+
```
|
|
425
|
+
|
|
413
426
|
#### [Get Redemption](https://docs.voucherify.io/reference/get-redemption)
|
|
414
427
|
|
|
415
428
|
```javascript
|
|
@@ -436,6 +449,12 @@ client.redemptions.rollback(redemptionId)
|
|
|
436
449
|
client.redemptions.rollback(redemptionId, params)
|
|
437
450
|
```
|
|
438
451
|
|
|
452
|
+
#### [Rollback Stackable](https://docs.voucherify.io/reference/rollback-stackable-redemptions)
|
|
453
|
+
```javascript
|
|
454
|
+
client.redemptions.rollbackStackable(parentRedemptionId)
|
|
455
|
+
client.redemptions.rollbackStackable(parentRedemptionId, params, queryParams)
|
|
456
|
+
```
|
|
457
|
+
|
|
439
458
|
Check [redemption rollback object](https://docs.voucherify.io/reference/the-redemption-rollback-object).
|
|
440
459
|
|
|
441
460
|
---
|
|
@@ -514,6 +533,7 @@ Methods are provided within `client.customers.*` namespace.
|
|
|
514
533
|
- [Delete Customer](#delete-customer)
|
|
515
534
|
- [List Customers](#list-customers)
|
|
516
535
|
- [Update Customer's Consents](#update-customers-consents)
|
|
536
|
+
- [List Customer's Activities](#list-customers-activities)
|
|
517
537
|
|
|
518
538
|
#### [Create Customer](https://docs.voucherify.io/reference/create-customer)
|
|
519
539
|
|
|
@@ -588,6 +608,13 @@ Keep in mind this operation may drain your API call limits fairly quickly - each
|
|
|
588
608
|
client.customers.updateConsents(customer, consents)
|
|
589
609
|
```
|
|
590
610
|
|
|
611
|
+
#### [List Customers Activities](https://docs.voucherify.io/reference/get-customer-activities)
|
|
612
|
+
|
|
613
|
+
```javascript
|
|
614
|
+
client.customers.listActivities(customerId)
|
|
615
|
+
client.customers.listActivities(customerId, params)
|
|
616
|
+
```
|
|
617
|
+
|
|
591
618
|
---
|
|
592
619
|
|
|
593
620
|
### Consents
|
|
@@ -1129,7 +1156,9 @@ Methods are provided within `client.*` namespace.
|
|
|
1129
1156
|
|
|
1130
1157
|
- [Set Identity](#set-identity)
|
|
1131
1158
|
- [Validate](#validate)
|
|
1159
|
+
- [Validate Stackable](#validate-stackable-client-side)
|
|
1132
1160
|
- [Redeem](#redeem)
|
|
1161
|
+
- [Redeem Stackable](#redeem-stackable-client-side)
|
|
1133
1162
|
- [Publish](#publish)
|
|
1134
1163
|
- [List vouchers](#list-vouchers)
|
|
1135
1164
|
- [Create customer](#create-customer)
|
|
@@ -1149,12 +1178,24 @@ client.setIdentity(trackingId)
|
|
|
1149
1178
|
client.validate(params)
|
|
1150
1179
|
```
|
|
1151
1180
|
|
|
1181
|
+
#### [Validate Stackable Client Side](https://docs.voucherify.io/reference/validate-stackable-discounts-client-side)
|
|
1182
|
+
|
|
1183
|
+
```javascript
|
|
1184
|
+
client.validateStackable(params)
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1152
1187
|
#### [Redeem](https://docs.voucherify.io/reference/redeem-voucher-client-side)
|
|
1153
1188
|
|
|
1154
1189
|
```javascript
|
|
1155
1190
|
client.redeem(code, payload)
|
|
1156
1191
|
```
|
|
1157
1192
|
|
|
1193
|
+
#### [Redeem Stackable Client Side](https://docs.voucherify.io/reference/redeem-stackable-discounts-client-side)
|
|
1194
|
+
|
|
1195
|
+
```javascript
|
|
1196
|
+
client.redeemStackable(params)
|
|
1197
|
+
```
|
|
1198
|
+
|
|
1158
1199
|
#### Publish
|
|
1159
1200
|
|
|
1160
1201
|
```javascript
|
package/dist/ClientSide.d.ts
CHANGED
|
@@ -37,4 +37,12 @@ export declare class ClientSide {
|
|
|
37
37
|
* @see https://docs.voucherify.io/reference/update-customers-consents-client
|
|
38
38
|
*/
|
|
39
39
|
updateConsents(idOrSourceId: string, consents: T.ClientSideCustomersUpdateConsentsBody): Promise<undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* @see https://docs.voucherify.io/reference/validate-stackable-discounts-client-side
|
|
42
|
+
*/
|
|
43
|
+
validateStackable(params: T.ClientSideValidationsValidateStackableParams): Promise<import("./types").ValidationValidateStackableResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* @see https://docs.voucherify.io/reference/redeem-stackable-discounts-client-side
|
|
46
|
+
*/
|
|
47
|
+
redeemStackable(params: T.ClientSideRedemptionsRedeemStackableParams): Promise<import("./types").RedemptionsRedeemStackableResponse>;
|
|
40
48
|
}
|
package/dist/Customers.d.ts
CHANGED
|
@@ -39,5 +39,9 @@ declare class Customers {
|
|
|
39
39
|
* @see https://docs.voucherify.io/reference/update-customers-consents
|
|
40
40
|
*/
|
|
41
41
|
updateConsents(idOrSourceId: string, consents: T.CustomersUpdateConsentsBody): Promise<undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* @see https://docs.voucherify.io/reference/get-customer-activities
|
|
44
|
+
*/
|
|
45
|
+
listActivities(customerId: string, params?: T.CustomerActivitiesListQueryParams): Promise<T.CustomerActivitiesListResponse>;
|
|
42
46
|
}
|
|
43
47
|
export { Customers };
|
package/dist/Promotions.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export declare class Promotions {
|
|
|
12
12
|
/**
|
|
13
13
|
* @see https://docs.voucherify.io/reference/validate-promotions-1
|
|
14
14
|
*/
|
|
15
|
-
validate(
|
|
15
|
+
validate(body: T.PromotionsValidateParams, params?: T.PromotionsValidateQueryParams): Promise<T.PromotionsValidateResponse>;
|
|
16
16
|
}
|
package/dist/Redemptions.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export declare class Redemptions {
|
|
|
7
7
|
* @see https://docs.voucherify.io/reference/redeem-voucher
|
|
8
8
|
*/
|
|
9
9
|
redeem(code: string, body?: T.RedemptionsRedeemBody): Promise<T.RedemptionsRedeemResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* @see https://docs.voucherify.io/reference/redeem-stacked-discounts
|
|
12
|
+
*/
|
|
13
|
+
redeemStackable(params: T.RedemptionsRedeemStackableParams): Promise<T.RedemptionsRedeemStackableResponse>;
|
|
10
14
|
/**
|
|
11
15
|
* @see https://docs.voucherify.io/reference/get-redemption
|
|
12
16
|
*/
|
|
@@ -23,4 +27,9 @@ export declare class Redemptions {
|
|
|
23
27
|
* @see https://docs.voucherify.io/reference/rollback-redemption
|
|
24
28
|
*/
|
|
25
29
|
rollback(redemptionId: string, params?: T.RedemptionsRollbackParams): Promise<T.RedemptionsRollbackResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* @see https://docs.voucherify.io/reference/rollback-stackable-redemptions
|
|
32
|
+
* Types of params and queryParams WILL be changed in future - please do not depend on it!
|
|
33
|
+
*/
|
|
34
|
+
rollbackStackable(parentRedemptionId: string, params?: any, queryParams?: any): Promise<T.RedemptionsRollbackStackableResponse>;
|
|
26
35
|
}
|
package/dist/Validations.d.ts
CHANGED
|
@@ -10,4 +10,8 @@ export declare class Validations {
|
|
|
10
10
|
*/
|
|
11
11
|
validateVoucher(code: string, params?: T.ValidationsValidateVoucherParams): Promise<T.ValidationsValidateVoucherResponse>;
|
|
12
12
|
validate(code: string | T.ValidationsValidateCode, context?: T.ValidationsValidateContext): Promise<T.ValidationsValidateVoucherResponse> | Promise<import("./types").PromotionsValidateResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* @see https://docs.voucherify.io/reference/validate-stacked-discounts-1
|
|
15
|
+
*/
|
|
16
|
+
validateStackable(params: T.ValidationsValidateStackableParams): Promise<T.ValidationValidateStackableResponse>;
|
|
13
17
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type ApplicableToEffect = 'APPLY_TO_EVERY' | 'APPLY_TO_CHEAPEST' | 'APPLY_TO_MOST_EXPENSIVE';
|
|
2
|
+
export interface ApplicableTo {
|
|
3
|
+
object: 'product' | 'sku' | 'products_collection';
|
|
4
|
+
id: string;
|
|
5
|
+
source_id?: string;
|
|
6
|
+
strict: boolean;
|
|
7
|
+
price?: number;
|
|
8
|
+
price_formula?: number;
|
|
9
|
+
effect: ApplicableToEffect;
|
|
10
|
+
}
|
|
11
|
+
export interface ApplicableToResultList {
|
|
12
|
+
object: 'list';
|
|
13
|
+
total: number;
|
|
14
|
+
data: ApplicableTo[];
|
|
15
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { CustomerRequest, CustomersCreateBody, CustomersCreateResponse, CustomersUpdateConsentsBody } from './Customers';
|
|
2
|
-
import {
|
|
2
|
+
import { VouchersListParams, VouchersResponse } from './Vouchers';
|
|
3
|
+
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
|
|
3
4
|
import { OrdersCreateResponse, OrdersItem } from './Orders';
|
|
4
5
|
import { ConsentsListResponse } from './Consents';
|
|
5
6
|
import { DistributionsPublicationsCreateResponse } from './Distributions';
|
|
6
7
|
import { SimplePromotionTier } from './PromotionTiers';
|
|
8
|
+
import { ValidationSessionReleaseParams } from './ValidateSession';
|
|
9
|
+
import { ApplicableToResultList } from './ApplicableTo';
|
|
10
|
+
import { ValidationsValidateStackableParams, ValidationValidateStackableResponse } from './Validations';
|
|
11
|
+
import { RedemptionsRedeemStackableParams, RedemptionsRedeemStackableResponse } from './Redemptions';
|
|
7
12
|
declare type ClientSideItem = Pick<OrdersItem, 'source_id' | 'sku_id' | 'product_id' | 'sku' | 'quantity' | 'related_object' | 'amount'>;
|
|
8
13
|
export declare type ClientSideCustomersUpdateConsentsBody = CustomersUpdateConsentsBody;
|
|
9
14
|
export declare type ClientSideCustomersCreateParams = CustomersCreateBody;
|
|
@@ -36,15 +41,7 @@ export interface ClientSideValidateResponse {
|
|
|
36
41
|
code?: string;
|
|
37
42
|
valid: boolean;
|
|
38
43
|
discount?: DiscountUnit | DiscountAmount | DiscountPercent;
|
|
39
|
-
applicable_to?:
|
|
40
|
-
object: 'list';
|
|
41
|
-
total: number;
|
|
42
|
-
data?: {
|
|
43
|
-
id: string;
|
|
44
|
-
object: 'product';
|
|
45
|
-
source_id?: string;
|
|
46
|
-
}[];
|
|
47
|
-
};
|
|
44
|
+
applicable_to?: ApplicableToResultList;
|
|
48
45
|
order?: {
|
|
49
46
|
amount: number;
|
|
50
47
|
discount_amount: number;
|
|
@@ -71,9 +68,7 @@ export interface ClientSideRedeemPayload {
|
|
|
71
68
|
reward?: {
|
|
72
69
|
id: string;
|
|
73
70
|
};
|
|
74
|
-
session?:
|
|
75
|
-
key: string;
|
|
76
|
-
};
|
|
71
|
+
session?: ValidationSessionReleaseParams;
|
|
77
72
|
}
|
|
78
73
|
export interface ClientSideRedeemResponse {
|
|
79
74
|
id: string;
|
|
@@ -132,4 +127,8 @@ export interface ClientSideRedeemWidgetPayload {
|
|
|
132
127
|
}
|
|
133
128
|
export declare type ClientSideTrackCustomer = CustomerRequest;
|
|
134
129
|
export declare type ClientSideConsentsListResponse = ConsentsListResponse;
|
|
130
|
+
export declare type ClientSideValidationsValidateStackableParams = ValidationsValidateStackableParams;
|
|
131
|
+
export declare type ClientSideValidationValidateStackableResponse = ValidationValidateStackableResponse;
|
|
132
|
+
export declare type ClientSideRedemptionsRedeemStackableParams = RedemptionsRedeemStackableParams;
|
|
133
|
+
export declare type ClientSideRedemptionsRedeemStackableResponse = RedemptionsRedeemStackableResponse;
|
|
135
134
|
export {};
|
|
@@ -94,6 +94,20 @@ export interface CustomersCommonListResponse {
|
|
|
94
94
|
customers: CustomerObject[];
|
|
95
95
|
has_more?: boolean;
|
|
96
96
|
}
|
|
97
|
+
export interface CustomerActivitiesListQueryParams {
|
|
98
|
+
limit?: number;
|
|
99
|
+
order?: 'created_at' | '-created_at';
|
|
100
|
+
starting_after?: string;
|
|
101
|
+
starting_after_id?: string;
|
|
102
|
+
campaign_type?: 'LOYALTY_PROGRAM' | 'PROMOTION' | 'DISCOUNT_COUPONS' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM';
|
|
103
|
+
campaign_id?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface CustomerActivitiesListResponse {
|
|
106
|
+
object: 'list';
|
|
107
|
+
total: number;
|
|
108
|
+
data_ref: 'data';
|
|
109
|
+
data: Record<string, any>[];
|
|
110
|
+
}
|
|
97
111
|
export declare type CustomersCreateBody = CustomerRequest;
|
|
98
112
|
export declare type CustomersCreateResponse = CustomerObject | CustomerUnconfirmed;
|
|
99
113
|
export declare type CustomersGetResponse = CustomerObject | CustomerUnconfirmed;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare type DiscountVouchersTypes = 'AMOUNT' | 'PERCENT' | 'UNIT' | 'FIXED';
|
|
2
|
+
export declare enum DiscountVouchersTypesEnum {
|
|
3
|
+
AMOUNT = "AMOUNT",
|
|
4
|
+
PERCENT = "PERCENT",
|
|
5
|
+
UNIT = "UNIT",
|
|
6
|
+
FIXED = "FIXED"
|
|
7
|
+
}
|
|
8
|
+
export declare type DiscountVouchersEffectTypes = 'ADD_MISSING_ITEMS' | 'ADD_NEW_ITEMS' | 'ADD_MANY_ITEMS' | 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY';
|
|
9
|
+
export declare type DiscountUnitVouchersEffectTypes = 'ADD_MISSING_ITEMS' | 'ADD_NEW_ITEMS' | 'ADD_MANY_ITEMS';
|
|
10
|
+
export declare type DiscountAmountVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY';
|
|
11
|
+
export declare type DiscountPercentVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS';
|
|
12
|
+
export declare type DiscountFixedVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS';
|
|
13
|
+
export interface DiscountUnit {
|
|
14
|
+
type?: DiscountVouchersTypesEnum.UNIT;
|
|
15
|
+
unit_off?: number;
|
|
16
|
+
effect?: DiscountUnitVouchersEffectTypes;
|
|
17
|
+
unit_type?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DiscountAmount {
|
|
20
|
+
type?: DiscountVouchersTypesEnum.AMOUNT;
|
|
21
|
+
amount_off?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface DiscountPercent {
|
|
24
|
+
type?: DiscountVouchersTypesEnum.PERCENT;
|
|
25
|
+
percent_off?: number;
|
|
26
|
+
amount_limit?: number;
|
|
27
|
+
}
|
package/dist/types/Orders.d.ts
CHANGED
|
@@ -18,8 +18,11 @@ export interface OrdersItem {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
export interface OrdersCreate {
|
|
21
|
+
source_id?: string;
|
|
22
|
+
status?: 'CREATED' | 'PAID' | 'CANCELLED' | 'FULFILLED';
|
|
21
23
|
customer?: CustomerRequest;
|
|
22
24
|
amount?: number;
|
|
25
|
+
discount_amount?: number;
|
|
23
26
|
items?: OrdersItem[];
|
|
24
27
|
metadata?: Record<string, any>;
|
|
25
28
|
}
|
|
@@ -30,7 +33,13 @@ export interface OrdersCreateResponse {
|
|
|
30
33
|
updated_at?: string;
|
|
31
34
|
status?: 'CREATED' | 'PAID' | 'PROCESSING' | 'CANCELED' | 'FULFILLED';
|
|
32
35
|
amount?: number;
|
|
36
|
+
initial_amount?: number;
|
|
33
37
|
discount_amount?: number;
|
|
38
|
+
items_discount_amount?: number;
|
|
39
|
+
total_discount_amount?: number;
|
|
40
|
+
applied_discount_amount?: number;
|
|
41
|
+
items_applied_discount_amount?: number;
|
|
42
|
+
total_applied_discount_amount?: number;
|
|
34
43
|
items?: OrdersItem[];
|
|
35
44
|
metadata?: Record<string, any>;
|
|
36
45
|
customer?: CustomerRequest;
|
|
@@ -43,6 +52,7 @@ export interface OrdersUpdate {
|
|
|
43
52
|
status?: 'CREATED' | 'PAID' | 'CANCELLED' | 'FULFILLED';
|
|
44
53
|
items?: OrdersItem[];
|
|
45
54
|
amount?: number;
|
|
55
|
+
discount_amount?: number;
|
|
46
56
|
metadata?: Record<string, any>;
|
|
47
57
|
customer?: {
|
|
48
58
|
id: string;
|
package/dist/types/Products.d.ts
CHANGED
|
@@ -93,3 +93,13 @@ export interface ProductsListSkus {
|
|
|
93
93
|
total: number;
|
|
94
94
|
skus: ProductsGetSkuResponse[];
|
|
95
95
|
}
|
|
96
|
+
export interface SimpleProduct {
|
|
97
|
+
id: string;
|
|
98
|
+
source_id?: string;
|
|
99
|
+
name?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface SimpleSku {
|
|
102
|
+
id: string;
|
|
103
|
+
source_id?: string;
|
|
104
|
+
sku?: string;
|
|
105
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DiscountAmount, DiscountPercent, DiscountUnit } from './
|
|
1
|
+
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
|
|
2
2
|
import { OrdersCreateResponse, OrdersItem } from './Orders';
|
|
3
3
|
import { SimpleCustomer } from './Customers';
|
|
4
4
|
import { ValidationRulesListAssignmentsResponse } from './ValidationRules';
|
|
5
|
+
import { ValidationSessionReleaseParams } from './ValidateSession';
|
|
5
6
|
export interface SimplePromotionTier {
|
|
6
7
|
tracking_id: string;
|
|
7
8
|
metadata?: Record<string, any>;
|
|
@@ -66,9 +67,7 @@ export interface PromotionTiersRedeemParams {
|
|
|
66
67
|
metadata?: Record<string, any>;
|
|
67
68
|
};
|
|
68
69
|
metadata?: Record<string, any>;
|
|
69
|
-
session?:
|
|
70
|
-
key: string;
|
|
71
|
-
};
|
|
70
|
+
session?: ValidationSessionReleaseParams;
|
|
72
71
|
}
|
|
73
72
|
export interface PromotionTiersRedeemResponse {
|
|
74
73
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiscountAmount, DiscountPercent, DiscountUnit } from './
|
|
1
|
+
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
|
|
2
2
|
import { OrdersItem } from './Orders';
|
|
3
3
|
import { PromotionTier } from './PromotionTiers';
|
|
4
4
|
import { SimpleCustomer } from './Customers';
|
|
@@ -69,6 +69,10 @@ export interface PromotionsValidateParams {
|
|
|
69
69
|
};
|
|
70
70
|
metadata?: Record<string, any>;
|
|
71
71
|
}
|
|
72
|
+
export interface PromotionsValidateQueryParams {
|
|
73
|
+
audienceRulesOnly?: boolean;
|
|
74
|
+
filters?: Record<string, any>;
|
|
75
|
+
}
|
|
72
76
|
export interface PromotionsValidateResponse {
|
|
73
77
|
valid: boolean;
|
|
74
78
|
promotions?: {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { OrdersCreateResponse } from './Orders';
|
|
2
|
-
import { RewardsCreateResponse } from './Rewards';
|
|
3
|
-
import { SimpleCustomer } from './Customers';
|
|
1
|
+
import { OrdersCreateResponse, OrdersCreate } from './Orders';
|
|
2
|
+
import { RewardsCreateResponse, RewardRedemptionParams } from './Rewards';
|
|
3
|
+
import { CustomersCreateBody, SimpleCustomer } from './Customers';
|
|
4
4
|
import { VouchersResponse } from './Vouchers';
|
|
5
|
+
import { GiftRedemptionParams } from './Gift';
|
|
6
|
+
import { ValidationSessionParams, ValidationSessionReleaseParams } from './ValidateSession';
|
|
7
|
+
import { StackableOptions, StackableRedeemableParams } from './Stackable';
|
|
5
8
|
export interface RedemptionsRedeemBody {
|
|
6
9
|
tracking_id?: string;
|
|
7
10
|
customer?: SimpleCustomer & {
|
|
@@ -9,16 +12,9 @@ export interface RedemptionsRedeemBody {
|
|
|
9
12
|
};
|
|
10
13
|
order?: Pick<Partial<OrdersCreateResponse>, 'id' | 'source_id' | 'amount' | 'items' | 'status' | 'metadata'>;
|
|
11
14
|
metadata?: Record<string, any>;
|
|
12
|
-
reward?:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
gift?: {
|
|
17
|
-
credits: number;
|
|
18
|
-
};
|
|
19
|
-
session?: {
|
|
20
|
-
key: string;
|
|
21
|
-
};
|
|
15
|
+
reward?: RewardRedemptionParams;
|
|
16
|
+
gift?: GiftRedemptionParams;
|
|
17
|
+
session?: ValidationSessionReleaseParams;
|
|
22
18
|
}
|
|
23
19
|
export interface RedemptionsRedeemResponse {
|
|
24
20
|
id: string;
|
|
@@ -148,3 +144,57 @@ export declare type SimpleRollback = Pick<RedemptionsRollbackResponse, 'id' | 'o
|
|
|
148
144
|
points: number;
|
|
149
145
|
};
|
|
150
146
|
};
|
|
147
|
+
export interface RedemptionsRedeemStackableParams {
|
|
148
|
+
options?: StackableOptions;
|
|
149
|
+
redeemables: StackableRedeemableParams[];
|
|
150
|
+
session?: ValidationSessionParams;
|
|
151
|
+
order?: OrdersCreate;
|
|
152
|
+
customer?: CustomersCreateBody;
|
|
153
|
+
metadata?: Record<string, any>;
|
|
154
|
+
}
|
|
155
|
+
export declare type RedemptionsRedeemStackableRedemptionResult = RedemptionsRedeemResponse & {
|
|
156
|
+
redemption: string;
|
|
157
|
+
};
|
|
158
|
+
export declare type RedemptionsRedeemStackableOrderResponse = OrdersCreateResponse & {
|
|
159
|
+
redemptions?: Record<string, {
|
|
160
|
+
date: string;
|
|
161
|
+
rollback_id?: string;
|
|
162
|
+
rollback_date?: string;
|
|
163
|
+
related_object_type: 'redemption';
|
|
164
|
+
related_object_id: string;
|
|
165
|
+
stacked: string[];
|
|
166
|
+
rollback_stacked?: string[];
|
|
167
|
+
}>;
|
|
168
|
+
};
|
|
169
|
+
export interface RedemptionsRedeemStackableResponse {
|
|
170
|
+
redemptions: RedemptionsRedeemStackableRedemptionResult[];
|
|
171
|
+
parent_redemption: {
|
|
172
|
+
id: string;
|
|
173
|
+
object: 'redemption';
|
|
174
|
+
date: string;
|
|
175
|
+
customer_id?: string;
|
|
176
|
+
tracking_id?: string;
|
|
177
|
+
metadata?: Record<string, any>;
|
|
178
|
+
result: 'SUCCESS' | 'FAILURE';
|
|
179
|
+
order?: RedemptionsRedeemStackableOrderResponse;
|
|
180
|
+
customer?: SimpleCustomer;
|
|
181
|
+
related_object_type: 'redemption';
|
|
182
|
+
related_object_id: string;
|
|
183
|
+
};
|
|
184
|
+
order?: RedemptionsRedeemStackableOrderResponse;
|
|
185
|
+
}
|
|
186
|
+
export interface RedemptionsRollbackStackableResponse {
|
|
187
|
+
rollbacks: RedemptionsRedeemStackableRedemptionResult[];
|
|
188
|
+
parent_rollback: {
|
|
189
|
+
id: string;
|
|
190
|
+
date: string;
|
|
191
|
+
customer_id?: string;
|
|
192
|
+
tracking_id?: string;
|
|
193
|
+
metadata?: Record<string, any>;
|
|
194
|
+
result: 'SUCCESS' | 'FAILURE';
|
|
195
|
+
order?: OrdersCreateResponse;
|
|
196
|
+
customer?: SimpleCustomer;
|
|
197
|
+
redemption: string;
|
|
198
|
+
};
|
|
199
|
+
order?: RedemptionsRedeemStackableOrderResponse;
|
|
200
|
+
}
|
package/dist/types/Rewards.d.ts
CHANGED
|
@@ -111,4 +111,9 @@ export declare type RewardsUpdateAssignment = RewardsCreateAssignment & {
|
|
|
111
111
|
id: string;
|
|
112
112
|
};
|
|
113
113
|
export declare type RewardsUpdateAssignmentResponse = RewardsAssignmentObject;
|
|
114
|
+
export interface RewardRedemptionParams {
|
|
115
|
+
points?: number;
|
|
116
|
+
assignment_id?: string;
|
|
117
|
+
id?: string;
|
|
118
|
+
}
|
|
114
119
|
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { RewardRedemptionParams } from './Rewards';
|
|
2
|
+
import { GiftRedemptionParams } from './Gift';
|
|
3
|
+
import { OrdersCreateResponse } from './Orders';
|
|
4
|
+
import { ApplicableToResultList } from './ApplicableTo';
|
|
5
|
+
import { DiscountVouchersTypes, DiscountVouchersEffectTypes, DiscountUnitVouchersEffectTypes } from './DiscountVoucher';
|
|
6
|
+
import { SimpleProduct, SimpleSku } from './Products';
|
|
7
|
+
import { LoyaltyPointsTransfer } from './Loyalties';
|
|
8
|
+
declare type ExpandOption = 'order' | 'redeemable' | 'redemption';
|
|
9
|
+
export interface StackableOptions {
|
|
10
|
+
expand: ExpandOption[];
|
|
11
|
+
}
|
|
12
|
+
export declare type StackableRedeemableObject = 'promotion_stack' | 'promotion_tier' | 'voucher';
|
|
13
|
+
export interface StackableRedeemableParams {
|
|
14
|
+
object: StackableRedeemableObject;
|
|
15
|
+
id: string;
|
|
16
|
+
reward?: RewardRedemptionParams;
|
|
17
|
+
gift?: GiftRedemptionParams;
|
|
18
|
+
}
|
|
19
|
+
export declare type StackableRedeemableResponseStatus = 'APPLICABLE' | 'INAPPLICABLE' | 'SKIPPED';
|
|
20
|
+
export interface StackableRedeemableResultDiscountUnit {
|
|
21
|
+
effect: DiscountUnitVouchersEffectTypes;
|
|
22
|
+
unit_off: number;
|
|
23
|
+
unit_type: string;
|
|
24
|
+
sku?: SimpleSku;
|
|
25
|
+
product?: SimpleProduct;
|
|
26
|
+
}
|
|
27
|
+
export interface StackableRedeemableResultDiscount {
|
|
28
|
+
type: DiscountVouchersTypes;
|
|
29
|
+
effect: DiscountVouchersEffectTypes;
|
|
30
|
+
amount_off?: number;
|
|
31
|
+
percent_off?: number;
|
|
32
|
+
amount_limit?: number;
|
|
33
|
+
fixed_amount?: number;
|
|
34
|
+
unit_off?: number;
|
|
35
|
+
unit_type?: string;
|
|
36
|
+
sku?: SimpleSku;
|
|
37
|
+
product?: SimpleProduct;
|
|
38
|
+
units?: StackableRedeemableResultDiscountUnit[];
|
|
39
|
+
}
|
|
40
|
+
export interface StackableRedeemableResultGift {
|
|
41
|
+
credits?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface StackableRedeemableResultLoyaltyCard {
|
|
44
|
+
points?: number;
|
|
45
|
+
transfers?: LoyaltyPointsTransfer[];
|
|
46
|
+
}
|
|
47
|
+
export interface StackableRedeemableResultResponse {
|
|
48
|
+
discount?: StackableRedeemableResultDiscount;
|
|
49
|
+
gift?: StackableRedeemableResultGift;
|
|
50
|
+
loyalty_card?: StackableRedeemableResultLoyaltyCard;
|
|
51
|
+
error?: any;
|
|
52
|
+
}
|
|
53
|
+
export interface StackableRedeemableResponse {
|
|
54
|
+
status: StackableRedeemableResponseStatus;
|
|
55
|
+
id: string;
|
|
56
|
+
object: StackableRedeemableObject;
|
|
57
|
+
order?: OrdersCreateResponse;
|
|
58
|
+
applicable_to?: ApplicableToResultList;
|
|
59
|
+
inapplicable_to?: ApplicableToResultList;
|
|
60
|
+
result?: StackableRedeemableResultResponse;
|
|
61
|
+
metadata?: Record<string, any>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare type ValidationSessionType = 'LOCK';
|
|
2
|
+
export declare type ValidationSessionTTLUnit = 'DAYS' | 'HOURS' | 'MICROSECONDS' | 'MILLISECONDS' | 'MINUTES' | 'NANOSECONDS' | 'SECONDS';
|
|
3
|
+
export interface ValidationSessionParams {
|
|
4
|
+
key?: string;
|
|
5
|
+
type?: ValidationSessionType;
|
|
6
|
+
ttl?: number;
|
|
7
|
+
ttl_unit?: ValidationSessionTTLUnit;
|
|
8
|
+
}
|
|
9
|
+
export interface ValidationSessionResponse {
|
|
10
|
+
key: string;
|
|
11
|
+
type: ValidationSessionType;
|
|
12
|
+
ttl: number;
|
|
13
|
+
ttl_unit: ValidationSessionTTLUnit;
|
|
14
|
+
}
|
|
15
|
+
export interface ValidationSessionReleaseParams {
|
|
16
|
+
key: string;
|
|
17
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApplicableToResultList } from './ApplicableTo';
|
|
1
2
|
export interface ValidationRulesCreate {
|
|
2
3
|
name: string;
|
|
3
4
|
error?: {
|
|
@@ -25,11 +26,7 @@ export interface ValidationRulesCreateResponse {
|
|
|
25
26
|
export interface ValidationRulesValidateResponse {
|
|
26
27
|
valid: boolean;
|
|
27
28
|
rule_id: string;
|
|
28
|
-
applicable_to:
|
|
29
|
-
data: any[];
|
|
30
|
-
object: 'list';
|
|
31
|
-
total: number;
|
|
32
|
-
};
|
|
29
|
+
applicable_to: ApplicableToResultList;
|
|
33
30
|
}
|
|
34
31
|
export declare type ValidationRulesGetResponse = ValidationRulesCreateResponse & {
|
|
35
32
|
assignments_count?: string;
|