@ikonintegration/mod-license-client 2.0.17 → 2.0.19

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/lib/Client.js CHANGED
@@ -7,6 +7,7 @@ import OperationProduct from "./operations/Product";
7
7
  import OperationLicense from "./operations/License";
8
8
  import OperationLicenseConsumption from "./operations/LicenseConsumption";
9
9
  import OperationOrder from "./operations/Order";
10
+ import OperationProductOrder from "./operations/ProductOrder";
10
11
  import OperationVoucher from "./operations/Voucher";
11
12
  import OperationKey from "./operations/Key";
12
13
  import OperationVault from "./operations/Vault";
@@ -0,0 +1,85 @@
1
+ export default class Order {
2
+ constructor(API) {
3
+ this.api = API;
4
+ }
5
+ getProviderFromProduct(product) {
6
+ return product.allowedProviders[0].toLowerCase();
7
+ }
8
+ isMonerisEnabledForProduct(product) {
9
+ return this.getProviderFromProduct(product).indexOf("moneris") != -1;
10
+ }
11
+ isBraintreeEnabledForProduct(product) {
12
+ return this.getProviderFromProduct(product).indexOf("braintree") != -1;
13
+ }
14
+ //CC/Skip order
15
+ async preOrder(productOrderObj) {
16
+ const req = await this.api.newBaseRequest("POST");
17
+ req.path = `/productOrder/pre/common`;
18
+ req.body = productOrderObj;
19
+ return await req.exec();
20
+ }
21
+ async beginOrder(productOrderObj, provider) {
22
+ const req = await this.api.newBaseRequest("POST");
23
+ req.path = `/productOrder/begin/${provider}`;
24
+ req.body = productOrderObj;
25
+ return await req.exec();
26
+ }
27
+ async completeOrder(productOrderObj, provider) {
28
+ const req = await this.api.newBaseRequest("POST");
29
+ req.path = `/productOrder/complete/${provider}`;
30
+ req.body = productOrderObj;
31
+ return await req.exec();
32
+ }
33
+ async refundOrder(productOrderObj, provider) {
34
+ const req = await this.api.newBaseRequest("POST");
35
+ req.path = `/productOrder/refund/${provider}`;
36
+ req.body = productOrderObj;
37
+ return await req.exec();
38
+ }
39
+ async cancelOrder(productOrderObj, provider) {
40
+ const req = await this.api.newBaseRequest("POST");
41
+ req.path = `/productOrder/cancel/${provider}`;
42
+ req.body = productOrderObj;
43
+ return await req.exec();
44
+ }
45
+ //Get order(s)
46
+ async getProductOrder(externalID, orderID) {
47
+ const req = await this.api.newBaseRequest("GET");
48
+ req.path = `/productOrder/${externalID}/${orderID}`;
49
+ return await req.exec();
50
+ }
51
+ async getProductOrdersByExternalID(externalID) {
52
+ const req = await this.api.newBaseRequest("GET");
53
+ req.path = "/productOrders/" + externalID;
54
+ return await req.exec();
55
+ }
56
+ async getProductOrdersFromToTimestamp(from, to) {
57
+ const req = await this.api.newBaseRequest("GET");
58
+ req.path = "/productOrders/report";
59
+ req.appendQueryParam("from", from);
60
+ req.appendQueryParam("to", to);
61
+ return await req.exec();
62
+ }
63
+ async getProductOrdersByExternalID(externalID) {
64
+ const req = await this.api.newBaseRequest("GET");
65
+ req.path = "/productOrders/" + externalID;
66
+ return await req.exec();
67
+ }
68
+ async getProductOrderReceipt(externalID, orderID) {
69
+ const req = await this.api.newBaseRequest("GET");
70
+ req.path = `/productOrder/${externalID}/${orderID}/receipt`;
71
+ req.bodyType = "BINARY";
72
+ return await req.exec();
73
+ }
74
+ async getProductOrderByID(orderID) {
75
+ const req = await this.api.newBaseRequest("GET");
76
+ req.path = `/productOrder/${orderID}`;
77
+ return await req.exec();
78
+ }
79
+ async searchProductOrdersByExternalID(externalID, filters) {
80
+ const req = await this.api.newBaseRequest("POST");
81
+ req.path = "/productOrders/" + externalID;
82
+ if (filters) req.body = filters;
83
+ return await req.exec();
84
+ }
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonintegration/mod-license-client",
3
- "version": "2.0.17",
3
+ "version": "2.0.19",
4
4
  "description": "Shared module license API client",
5
5
  "main": "index.js",
6
6
  "scripts": {