@voucherify/sdk 2.0.9 → 2.0.12

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,25 @@
1
1
  # @voucherify/sdk
2
2
 
3
+ ## 2.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`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
8
+
9
+ ## 2.0.11
10
+
11
+ ### Patch Changes
12
+
13
+ - [`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
14
+
15
+ ## 2.0.10
16
+
17
+ ### Patch Changes
18
+
19
+ - [`e03db27`](https://github.com/voucherifyio/voucherify-js-sdk/commit/e03db276226a579e7d886a8acb5db58b703a6989) [#136](https://github.com/voucherifyio/voucherify-js-sdk/pull/136) Thanks [@darekg11](https://github.com/darekg11)! - Added documentation links to MetadataSchemas API methods
20
+
21
+ * [`a8557d1`](https://github.com/voucherifyio/voucherify-js-sdk/commit/a8557d1c70f0732c6996175d3b1e917c29986cee) [#134](https://github.com/voucherifyio/voucherify-js-sdk/pull/134) Thanks [@salzhrani](https://github.com/salzhrani)! - add metadata property to ProductsCreateResponse
22
+
3
23
  ## 2.0.9
4
24
 
5
25
  ### 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
@@ -3,6 +3,12 @@ import type { RequestController } from './RequestController';
3
3
  export declare class MetadataSchemas {
4
4
  private client;
5
5
  constructor(client: RequestController);
6
+ /**
7
+ * @see https://docs.voucherify.io/reference/list-metadata-schemas
8
+ */
6
9
  list(): Promise<T.MetadataSchemasListResponse>;
10
+ /**
11
+ * @see https://docs.voucherify.io/reference/get-metadata-schema
12
+ */
7
13
  get(schemaName: string): Promise<T.MetadataSchema>;
8
14
  }
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;
@@ -22,6 +22,7 @@ export interface ProductsCreateResponse {
22
22
  attributes?: string[];
23
23
  created_at: string;
24
24
  image_url?: string;
25
+ metadata?: Record<string, any>;
25
26
  }
26
27
  export declare type ProductsGetResponse = ProductsCreateResponse & ProductsGetResponseSkus;
27
28
  export declare type ProductsUpdate = {
@@ -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
 
@@ -1370,10 +1378,18 @@ class MetadataSchemas {
1370
1378
  this.client = void 0;
1371
1379
  this.client = client;
1372
1380
  }
1381
+ /**
1382
+ * @see https://docs.voucherify.io/reference/list-metadata-schemas
1383
+ */
1384
+
1373
1385
 
1374
1386
  list() {
1375
1387
  return this.client.get('/metadata-schemas');
1376
1388
  }
1389
+ /**
1390
+ * @see https://docs.voucherify.io/reference/get-metadata-schema
1391
+ */
1392
+
1377
1393
 
1378
1394
  get(schemaName) {
1379
1395
  return this.client.get(`/metadata-schemas/${encode(schemaName)}`);
@@ -1411,7 +1427,7 @@ function VoucherifyServerSide(options) {
1411
1427
  let headers = {
1412
1428
  'X-App-Id': options.applicationId,
1413
1429
  'X-App-Token': options.secretKey,
1414
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.9"}`,
1430
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.12"}`,
1415
1431
  'Content-Type': 'application/json'
1416
1432
  };
1417
1433
 
@@ -1660,7 +1676,7 @@ function VoucherifyClientSide(options) {
1660
1676
  let headers = {
1661
1677
  'X-Client-Application-Id': options.clientApplicationId,
1662
1678
  'X-Client-Token': options.clientSecretKey,
1663
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.9"}`
1679
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.12"}`
1664
1680
  };
1665
1681
 
1666
1682
  if (environment().startsWith('Node')) {