@voucherify/sdk 2.0.10 → 2.0.13

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @voucherify/sdk
2
2
 
3
+ ## 2.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ff07c8a`](https://github.com/voucherifyio/voucherify-js-sdk/commit/ff07c8adb204c575e656a48beea4a927d311b89a) [#144](https://github.com/voucherifyio/voucherify-js-sdk/pull/144) Thanks [@darekg11](https://github.com/darekg11)! - Add missing 'name', 'start_date' and 'expiration_date' properties to PromotionsValidateResponse interface
8
+
9
+ ## 2.0.12
10
+
11
+ ### Patch Changes
12
+
13
+ - [`df19c77`](https://github.com/voucherifyio/voucherify-js-sdk/commit/df19c7771be945b1d8708a8992f82e22ce098641) [#141](https://github.com/voucherifyio/voucherify-js-sdk/pull/141) Thanks [@darekg11](https://github.com/darekg11)! - Override SimpleCustomer type to make 'id' property not required in 'RedemptionsRedeemBody' interface since passing ID of customer when redeeming is not required by design
14
+
15
+ ## 2.0.11
16
+
17
+ ### Patch Changes
18
+
19
+ - [`ae6110b`](https://github.com/voucherifyio/voucherify-js-sdk/commit/ae6110b1ec8022c80a8f05f16e5c9de0e6cae180) [#137](https://github.com/voucherifyio/voucherify-js-sdk/pull/137) Thanks [@darekg11](https://github.com/darekg11)! - Added support for orders import API
20
+
3
21
  ## 2.0.10
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -645,6 +645,7 @@ Methods are provided within `client.orders.*` namespace.
645
645
  - [Get Order](#get-order)
646
646
  - [Update Order](#update-order)
647
647
  - [List Orders](#list-orders)
648
+ - [Import Orders](#import-orders)
648
649
 
649
650
  #### [Create Order](https://docs.voucherify.io/reference/create-order)
650
651
 
@@ -675,6 +676,11 @@ client.orders.list()
675
676
  client.orders.list(params)
676
677
  ```
677
678
 
679
+ #### [Import Orders](https://docs.voucherify.io/reference/import-orders)
680
+ ```javascript
681
+ client.orders.import(orders)
682
+ ```
683
+
678
684
  ---
679
685
 
680
686
  ### Products
package/dist/Orders.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as T from './types/Orders';
2
+ import * as AAT from './types/AsyncActions';
2
3
  import type { RequestController } from './RequestController';
3
4
  export declare class Orders {
4
5
  private client;
@@ -19,4 +20,8 @@ export declare class Orders {
19
20
  * @see https://docs.voucherify.io/reference/list-orders
20
21
  */
21
22
  list(params?: T.OrdersListParams): Promise<T.OrdersListResponse>;
23
+ /**
24
+ * @see https://docs.voucherify.io/reference/import-orders
25
+ */
26
+ import(orders: T.OrdersCreate[]): Promise<AAT.AsyncActionCreateResponse>;
22
27
  }
@@ -15,4 +15,7 @@ export interface AsyncActionsListResponse {
15
15
  data_ref: 'async_actions';
16
16
  async_actions: Omit<AsyncActionsResponse, 'result'>[];
17
17
  }
18
+ export interface AsyncActionCreateResponse {
19
+ async_action_id: string;
20
+ }
18
21
  export declare type AsyncActionsGetResponse = AsyncActionsResponse;
@@ -79,6 +79,9 @@ export interface PromotionsValidateResponse {
79
79
  id: string;
80
80
  object: 'promotion_tier';
81
81
  banner?: string;
82
+ name: string;
83
+ start_date?: string;
84
+ expiration_date?: string;
82
85
  discount?: DiscountUnit | DiscountAmount | DiscountPercent;
83
86
  discount_amount?: number;
84
87
  metadata?: Record<string, any>;
@@ -7,8 +7,9 @@ import { ValidationSessionParams, ValidationSessionReleaseParams } from './Valid
7
7
  import { StackableOptions, StackableRedeemableParams } from './Stackable';
8
8
  export interface RedemptionsRedeemBody {
9
9
  tracking_id?: string;
10
- customer?: SimpleCustomer & {
10
+ customer?: Omit<SimpleCustomer, 'id'> & {
11
11
  description?: string;
12
+ id?: string;
12
13
  };
13
14
  order?: Pick<Partial<OrdersCreateResponse>, 'id' | 'source_id' | 'amount' | 'items' | 'status' | 'metadata'>;
14
15
  metadata?: Record<string, any>;
@@ -869,6 +869,14 @@ class Orders {
869
869
  list(params = {}) {
870
870
  return this.client.get('/orders', params);
871
871
  }
872
+ /**
873
+ * @see https://docs.voucherify.io/reference/import-orders
874
+ */
875
+
876
+
877
+ import(orders) {
878
+ return this.client.post('/orders/import', orders);
879
+ }
872
880
 
873
881
  }
874
882
 
@@ -1419,7 +1427,7 @@ function VoucherifyServerSide(options) {
1419
1427
  let headers = {
1420
1428
  'X-App-Id': options.applicationId,
1421
1429
  'X-App-Token': options.secretKey,
1422
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.10"}`,
1430
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.13"}`,
1423
1431
  'Content-Type': 'application/json'
1424
1432
  };
1425
1433
 
@@ -1668,7 +1676,7 @@ function VoucherifyClientSide(options) {
1668
1676
  let headers = {
1669
1677
  'X-Client-Application-Id': options.clientApplicationId,
1670
1678
  'X-Client-Token': options.clientSecretKey,
1671
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.10"}`
1679
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.13"}`
1672
1680
  };
1673
1681
 
1674
1682
  if (environment().startsWith('Node')) {