namirasoft-payment 1.4.16 → 1.4.18

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 (40) hide show
  1. package/dist/NamirasoftPaymentServer.d.ts +2 -0
  2. package/dist/NamirasoftPaymentServer.js +2 -0
  3. package/dist/NamirasoftPaymentServer.js.map +1 -1
  4. package/dist/NamirasoftPaymentServerBase.js +1 -1
  5. package/dist/NamirasoftPaymentServerProduct.d.ts +12 -0
  6. package/dist/NamirasoftPaymentServerProduct.js +39 -0
  7. package/dist/NamirasoftPaymentServerProduct.js.map +1 -0
  8. package/dist/command/ProductCommand.d.ts +4 -0
  9. package/dist/command/ProductCommand.js +17 -0
  10. package/dist/command/ProductCommand.js.map +1 -0
  11. package/dist/command/ProductGetCommand.d.ts +5 -0
  12. package/dist/command/ProductGetCommand.js +38 -0
  13. package/dist/command/ProductGetCommand.js.map +1 -0
  14. package/dist/command/ProductListCommand.d.ts +5 -0
  15. package/dist/command/ProductListCommand.js +38 -0
  16. package/dist/command/ProductListCommand.js.map +1 -0
  17. package/dist/command/cli.js +2 -0
  18. package/dist/command/cli.js.map +1 -1
  19. package/dist/index.d.ts +5 -0
  20. package/dist/index.js +5 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/meta/SalesItemMetaTable.d.ts +2 -0
  23. package/dist/meta/SalesItemMetaTable.js +2 -0
  24. package/dist/meta/SalesItemMetaTable.js.map +1 -1
  25. package/dist/row/ProductRow.d.ts +9 -0
  26. package/dist/row/ProductRow.js +3 -0
  27. package/dist/row/ProductRow.js.map +1 -0
  28. package/dist/row/SalesItemRow.d.ts +2 -0
  29. package/package.json +1 -1
  30. package/src/NamirasoftPaymentServer.ts +3 -0
  31. package/src/NamirasoftPaymentServerBase.ts +1 -1
  32. package/src/NamirasoftPaymentServerProduct.ts +47 -0
  33. package/src/command/ProductCommand.ts +34 -0
  34. package/src/command/ProductGetCommand.ts +45 -0
  35. package/src/command/ProductListCommand.ts +45 -0
  36. package/src/command/cli.ts +2 -0
  37. package/src/index.ts +5 -0
  38. package/src/meta/SalesItemMetaTable.ts +4 -0
  39. package/src/row/ProductRow.ts +30 -0
  40. package/src/row/SalesItemRow.ts +2 -0
@@ -3,6 +3,7 @@ import { NamirasoftPaymentServerInvoice } from "./NamirasoftPaymentServerInvoice
3
3
  import { NamirasoftPaymentServerOffer } from "./NamirasoftPaymentServerOffer";
4
4
  import { NamirasoftPaymentServerOneTime } from "./NamirasoftPaymentServerOneTime";
5
5
  import { NamirasoftPaymentServerPayment } from "./NamirasoftPaymentServerPayment";
6
+ import { NamirasoftPaymentServerProduct } from "./NamirasoftPaymentServerProduct";
6
7
  import { NamirasoftPaymentServerSalesItem } from "./NamirasoftPaymentServerSalesItem";
7
8
  import { NamirasoftPaymentServerSubscription } from "./NamirasoftPaymentServerSubscription";
8
9
  import { NamirasoftPaymentServerSubscriptionCategory } from "./NamirasoftPaymentServerSubscriptionCategory";
@@ -25,5 +26,6 @@ export declare class NamirasoftPaymentServer {
25
26
  subscriptionfield: NamirasoftPaymentServerSubscriptionField;
26
27
  subscriptiontag: NamirasoftPaymentServerSubscriptionTag;
27
28
  subscription: NamirasoftPaymentServerSubscription;
29
+ product: NamirasoftPaymentServerProduct;
28
30
  constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void);
29
31
  }
@@ -6,6 +6,7 @@ const NamirasoftPaymentServerInvoice_1 = require("./NamirasoftPaymentServerInvoi
6
6
  const NamirasoftPaymentServerOffer_1 = require("./NamirasoftPaymentServerOffer");
7
7
  const NamirasoftPaymentServerOneTime_1 = require("./NamirasoftPaymentServerOneTime");
8
8
  const NamirasoftPaymentServerPayment_1 = require("./NamirasoftPaymentServerPayment");
9
+ const NamirasoftPaymentServerProduct_1 = require("./NamirasoftPaymentServerProduct");
9
10
  const NamirasoftPaymentServerSalesItem_1 = require("./NamirasoftPaymentServerSalesItem");
10
11
  const NamirasoftPaymentServerSubscription_1 = require("./NamirasoftPaymentServerSubscription");
11
12
  const NamirasoftPaymentServerSubscriptionCategory_1 = require("./NamirasoftPaymentServerSubscriptionCategory");
@@ -28,6 +29,7 @@ class NamirasoftPaymentServer {
28
29
  this.subscriptionfield = new NamirasoftPaymentServerSubscriptionField_1.NamirasoftPaymentServerSubscriptionField(base_url, manager, onError);
29
30
  this.subscriptiontag = new NamirasoftPaymentServerSubscriptionTag_1.NamirasoftPaymentServerSubscriptionTag(base_url, manager, onError);
30
31
  this.subscription = new NamirasoftPaymentServerSubscription_1.NamirasoftPaymentServerSubscription(base_url, manager, onError);
32
+ this.product = new NamirasoftPaymentServerProduct_1.NamirasoftPaymentServerProduct(base_url, manager, onError);
31
33
  }
32
34
  }
33
35
  exports.NamirasoftPaymentServer = NamirasoftPaymentServer;
@@ -1 +1 @@
1
- {"version":3,"file":"NamirasoftPaymentServer.js","sourceRoot":"","sources":["../src/NamirasoftPaymentServer.ts"],"names":[],"mappings":";;;AAoBA,qFAAkF;AAClF,qFAAkF;AAClF,iFAA8E;AAC9E,qFAAkF;AAClF,qFAAkF;AAClF,yFAAsF;AACtF,+FAA4F;AAC5F,+GAA4G;AAC5G,yGAAsG;AACtG,uGAAoG;AACpG,qGAAkG;AAClG,iFAA8E;AAG9E,MAAa,uBAAuB;IAehC,YAAY,QAAgB,EAAE,OAAqB,EAAE,OAA+B;QAEhF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,+DAA8B,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9E,IAAI,CAAC,KAAK,GAAG,IAAI,2DAA4B,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1E,IAAI,CAAC,OAAO,GAAG,IAAI,+DAA8B,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9E,IAAI,CAAC,KAAK,GAAG,IAAI,2DAA4B,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,C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C;CACJ;AAjCD,0DAiCC;AAAA,CAAC"}
@@ -4,7 +4,7 @@ exports.NamirasoftPaymentServerBase = void 0;
4
4
  const namirasoft_account_1 = require("namirasoft-account");
5
5
  class NamirasoftPaymentServerBase extends namirasoft_account_1.NamirasoftServerBase {
6
6
  constructor(base_url, manager, onError) {
7
- super(base_url, `1.4.16`, manager, onError);
7
+ super(base_url, `1.4.18`, manager, onError);
8
8
  }
9
9
  }
10
10
  exports.NamirasoftPaymentServerBase = NamirasoftPaymentServerBase;
@@ -0,0 +1,12 @@
1
+ import { FilterItem } from "namirasoft-core";
2
+ import { NamirasoftPaymentServerBase } from "./NamirasoftPaymentServerBase";
3
+ import { ProductRow } from "./row/ProductRow";
4
+ import { TokenManager } from "namirasoft-account";
5
+ export declare class NamirasoftPaymentServerProduct extends NamirasoftPaymentServerBase {
6
+ constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void);
7
+ List(filters: FilterItem[] | null, page: (number | null), size: (number | null), user_id: (string | null)): Promise<{
8
+ rows: ProductRow[];
9
+ count: number;
10
+ }>;
11
+ Get(id: string): Promise<ProductRow>;
12
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.NamirasoftPaymentServerProduct = void 0;
13
+ const namirasoft_core_1 = require("namirasoft-core");
14
+ const NamirasoftPaymentServerBase_1 = require("./NamirasoftPaymentServerBase");
15
+ class NamirasoftPaymentServerProduct extends NamirasoftPaymentServerBase_1.NamirasoftPaymentServerBase {
16
+ constructor(base_url, manager, onError) {
17
+ super(base_url, manager, onError);
18
+ this.List = this.List.bind(this);
19
+ this.Get = this.Get.bind(this);
20
+ }
21
+ List(filters, page, size, user_id) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ let filters_string_value = namirasoft_core_1.FilterItem.stringify(filters);
24
+ let path = `/product/list`;
25
+ let { data } = yield this._get(path, { filters: filters_string_value, page, size, user_id });
26
+ return data;
27
+ });
28
+ }
29
+ Get(id) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ let path = `/product/${id}`;
32
+ let { data } = yield this._get(path, {});
33
+ return data;
34
+ });
35
+ }
36
+ }
37
+ exports.NamirasoftPaymentServerProduct = NamirasoftPaymentServerProduct;
38
+ ;
39
+ //# sourceMappingURL=NamirasoftPaymentServerProduct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NamirasoftPaymentServerProduct.js","sourceRoot":"","sources":["../src/NamirasoftPaymentServerProduct.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,qDAA6C;AAC7C,+EAA4E;AAI5E,MAAa,8BAA+B,SAAQ,yDAA2B;IAE3E,YAAY,QAAgB,EAAE,OAAqB,EAAE,OAA+B;QAEhF,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACK,IAAI,CAAC,OAA4B,EAAE,IAAqB,EAAE,IAAqB,EAAE,OAAwB;;YAE3G,IAAI,oBAAoB,GAAW,4BAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACjE,IAAI,IAAI,GAAG,eAAe,CAAC;YAC3B,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAwC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YACpI,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;IACK,GAAG,CAAC,EAAU;;YAEhB,IAAI,IAAI,GAAG,YAAY,EAAE,EAAE,CAAC;YAC5B,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAa,IAAI,EAAE,EAAE,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AArBD,wEAqBC;AAAA,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BaseNavigatorCommand } from "namirasoft-node-cli";
2
+ export declare class ProductCommand extends BaseNavigatorCommand {
3
+ constructor(argv: string[]);
4
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductCommand = void 0;
4
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
5
+ const ProductGetCommand_1 = require("./ProductGetCommand");
6
+ const ProductListCommand_1 = require("./ProductListCommand");
7
+ class ProductCommand extends namirasoft_node_cli_1.BaseNavigatorCommand {
8
+ constructor(argv) {
9
+ super(argv, {
10
+ "list": ProductListCommand_1.ProductListCommand,
11
+ "get": ProductGetCommand_1.ProductGetCommand,
12
+ });
13
+ }
14
+ }
15
+ exports.ProductCommand = ProductCommand;
16
+ ;
17
+ //# sourceMappingURL=ProductCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductCommand.js","sourceRoot":"","sources":["../../src/command/ProductCommand.ts"],"names":[],"mappings":";;;AAoBA,6DAA2D;AAC3D,2DAAwD;AACxD,6DAA0D;AAE1D,MAAa,cAAe,SAAQ,0CAAoB;IAEpD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE;YACR,MAAM,EAAE,uCAAkB;YAC1B,KAAK,EAAE,qCAAiB;SAC3B,CAAC,CAAC;IACP,CAAC;CACJ;AATD,wCASC;AAAA,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { BaseFinalCommand } from "namirasoft-node-cli";
2
+ export declare class ProductGetCommand extends BaseFinalCommand {
3
+ constructor(argv: string[]);
4
+ exec(): Promise<void>;
5
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProductGetCommand = void 0;
13
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
14
+ const namirasoft_core_1 = require("namirasoft-core");
15
+ const NamirasoftPaymentServer_1 = require("../NamirasoftPaymentServer");
16
+ const namirasoft_account_1 = require("namirasoft-account");
17
+ class ProductGetCommand extends namirasoft_node_cli_1.BaseFinalCommand {
18
+ constructor(argv) {
19
+ super(argv, ["id"], []);
20
+ }
21
+ exec() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ let token = this.app.storage.getNSAToken();
24
+ if (token == null)
25
+ throw new Error("Token is not available. Please login first using:\nns-payment account config \nor \n{this.command} account login.");
26
+ let storage = new namirasoft_core_1.IStorageMemory();
27
+ let manager = new namirasoft_account_1.TokenManager(storage, () => { });
28
+ manager.setValue(token, false);
29
+ let url = this.app.storage.getItem("ns-payment-server-url");
30
+ let server = new NamirasoftPaymentServer_1.NamirasoftPaymentServer(url, manager, e => this.app.logger.error(e.message));
31
+ let ans = yield server.product.Get(this.arg_values[0]);
32
+ this.app.logger.success(JSON.stringify(ans));
33
+ });
34
+ }
35
+ }
36
+ exports.ProductGetCommand = ProductGetCommand;
37
+ ;
38
+ //# sourceMappingURL=ProductGetCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductGetCommand.js","sourceRoot":"","sources":["../../src/command/ProductGetCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAAiD;AACjD,wEAAqE;AACrE,2DAAkD;AAElD,MAAa,iBAAkB,SAAQ,sCAAgB;IAEnD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5B,CAAC;IACc,IAAI;;YAEf,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC3C,IAAI,KAAK,IAAI,IAAI;gBACb,MAAM,IAAI,KAAK,CAAC,mHAAmH,CAAC,CAAC;YACzI,IAAI,OAAO,GAAG,IAAI,gCAAc,EAAE,CAAC;YACnC,IAAI,OAAO,GAAG,IAAI,iCAAY,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC/B,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;YAC5D,IAAI,MAAM,GAAG,IAAI,iDAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9F,IAAI,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AAnBD,8CAmBC;AAAA,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { BaseFinalCommand } from "namirasoft-node-cli";
2
+ export declare class ProductListCommand extends BaseFinalCommand {
3
+ constructor(argv: string[]);
4
+ exec(): Promise<void>;
5
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ProductListCommand = void 0;
13
+ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
14
+ const namirasoft_core_1 = require("namirasoft-core");
15
+ const NamirasoftPaymentServer_1 = require("../NamirasoftPaymentServer");
16
+ const namirasoft_account_1 = require("namirasoft-account");
17
+ class ProductListCommand extends namirasoft_node_cli_1.BaseFinalCommand {
18
+ constructor(argv) {
19
+ super(argv, ["filters", "page", "size", "user_id"], []);
20
+ }
21
+ exec() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ let token = this.app.storage.getNSAToken();
24
+ if (token == null)
25
+ throw new Error("Token is not available. Please login first using:\nns-payment account config \nor \n{this.command} account login.");
26
+ let storage = new namirasoft_core_1.IStorageMemory();
27
+ let manager = new namirasoft_account_1.TokenManager(storage, () => { });
28
+ manager.setValue(token, false);
29
+ let url = this.app.storage.getItem("ns-payment-server-url");
30
+ let server = new NamirasoftPaymentServer_1.NamirasoftPaymentServer(url, manager, e => this.app.logger.error(e.message));
31
+ let ans = yield server.product.List(this.arg_values[0], this.arg_values[1], this.arg_values[2], this.arg_values[3]);
32
+ this.app.logger.success(JSON.stringify(ans));
33
+ });
34
+ }
35
+ }
36
+ exports.ProductListCommand = ProductListCommand;
37
+ ;
38
+ //# sourceMappingURL=ProductListCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductListCommand.js","sourceRoot":"","sources":["../../src/command/ProductListCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAAiD;AACjD,wEAAqE;AACrE,2DAAkD;AAElD,MAAa,kBAAmB,SAAQ,sCAAgB;IAEpD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC;IACc,IAAI;;YAEf,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC3C,IAAI,KAAK,IAAI,IAAI;gBACb,MAAM,IAAI,KAAK,CAAC,mHAAmH,CAAC,CAAC;YACzI,IAAI,OAAO,GAAG,IAAI,gCAAc,EAAE,CAAC;YACnC,IAAI,OAAO,GAAG,IAAI,iCAAY,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC/B,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;YAC5D,IAAI,MAAM,GAAG,IAAI,iDAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9F,IAAI,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YACpH,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AAnBD,gDAmBC;AAAA,CAAC"}
@@ -9,6 +9,7 @@ const InvoiceCommand_1 = require("./InvoiceCommand");
9
9
  const OfferCommand_1 = require("./OfferCommand");
10
10
  const OneTimeCommand_1 = require("./OneTimeCommand");
11
11
  const PaymentCommand_1 = require("./PaymentCommand");
12
+ const ProductCommand_1 = require("./ProductCommand");
12
13
  const SalesItemCommand_1 = require("./SalesItemCommand");
13
14
  const SubscriptionCategoryCommand_1 = require("./SubscriptionCategoryCommand");
14
15
  const SubscriptionCommand_1 = require("./SubscriptionCommand");
@@ -29,6 +30,7 @@ let app = new namirasoft_node_cli_1.Application("ns-payment", new namirasoft_nod
29
30
  "subscriptionfield": SubscriptionFieldCommand_1.SubscriptionFieldCommand,
30
31
  "subscriptiontag": SubscriptionTagCommand_1.SubscriptionTagCommand,
31
32
  "subscription": SubscriptionCommand_1.SubscriptionCommand,
33
+ "product": ProductCommand_1.ProductCommand,
32
34
  "account": namirasoft_account_1.AccountCommand,
33
35
  "config": (argv) => new namirasoft_node_cli_2.ConfigCommand(argv, ["ns-payment-server-url"])
34
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/command/cli.ts"],"names":[],"mappings":";;;AAqBA,2DAAoD;AACpD,6DAA+D;AAC/D,6DAAoD;AACpD,qDAAkD;AAClD,qDAAkD;AAClD,iDAA8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E,+BAAc;IACzB,SAAS,EAAE,+BAAc;IACzB,WAAW,EAAE,mCAAgB;IAC7B,kBAAkB,EAAE,iDAAuB;IAC3C,sBAAsB,EAAE,yDAA2B;IACnD,mBAAmB,EAAE,mDAAwB;IAC7C,iBAAiB,EAAE,+CAAsB;IACzC,cAAc,EAAE,yCAAmB;IACnC,SAAS,EAAE,+BAAc;IACzB,SAAS,EAAE,mCAAc;IACzB,QAAQ,EAAE,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,mCAAa,CAAC,IAAI,EAAE,CAAC,uBAAuB,CAAC,CAAC;CACnF,CAAC,CAAC;AACP,GAAG,CAAC,GAAG,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./NamirasoftPaymentServerInvoice";
5
5
  export * from "./NamirasoftPaymentServerOffer";
6
6
  export * from "./NamirasoftPaymentServerOneTime";
7
7
  export * from "./NamirasoftPaymentServerPayment";
8
+ export * from "./NamirasoftPaymentServerProduct";
8
9
  export * from "./NamirasoftPaymentServerSalesItem";
9
10
  export * from "./NamirasoftPaymentServerSubscription";
10
11
  export * from "./NamirasoftPaymentServerSubscriptionCategory";
@@ -28,6 +29,9 @@ export * from "./command/OneTimeCommand";
28
29
  export * from "./command/PaymentCommand";
29
30
  export * from "./command/PaymentGetCommand";
30
31
  export * from "./command/PaymentListCommand";
32
+ export * from "./command/ProductCommand";
33
+ export * from "./command/ProductGetCommand";
34
+ export * from "./command/ProductListCommand";
31
35
  export * from "./command/SalesItemCommand";
32
36
  export * from "./command/SalesItemGetCommand";
33
37
  export * from "./command/SalesItemListCommand";
@@ -88,6 +92,7 @@ export * from "./row/InvoiceItemInputRow";
88
92
  export * from "./row/InvoiceRow";
89
93
  export * from "./row/OfferRow";
90
94
  export * from "./row/PaymentRow";
95
+ export * from "./row/ProductRow";
91
96
  export * from "./row/SalesItemRow";
92
97
  export * from "./row/SubscriptionCategoryRow";
93
98
  export * from "./row/SubscriptionFieldRow";
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ __exportStar(require("./NamirasoftPaymentServerInvoice"), exports);
21
21
  __exportStar(require("./NamirasoftPaymentServerOffer"), exports);
22
22
  __exportStar(require("./NamirasoftPaymentServerOneTime"), exports);
23
23
  __exportStar(require("./NamirasoftPaymentServerPayment"), exports);
24
+ __exportStar(require("./NamirasoftPaymentServerProduct"), exports);
24
25
  __exportStar(require("./NamirasoftPaymentServerSalesItem"), exports);
25
26
  __exportStar(require("./NamirasoftPaymentServerSubscription"), exports);
26
27
  __exportStar(require("./NamirasoftPaymentServerSubscriptionCategory"), exports);
@@ -44,6 +45,9 @@ __exportStar(require("./command/OneTimeCommand"), exports);
44
45
  __exportStar(require("./command/PaymentCommand"), exports);
45
46
  __exportStar(require("./command/PaymentGetCommand"), exports);
46
47
  __exportStar(require("./command/PaymentListCommand"), exports);
48
+ __exportStar(require("./command/ProductCommand"), exports);
49
+ __exportStar(require("./command/ProductGetCommand"), exports);
50
+ __exportStar(require("./command/ProductListCommand"), exports);
47
51
  __exportStar(require("./command/SalesItemCommand"), exports);
48
52
  __exportStar(require("./command/SalesItemGetCommand"), exports);
49
53
  __exportStar(require("./command/SalesItemListCommand"), exports);
@@ -104,6 +108,7 @@ __exportStar(require("./row/InvoiceItemInputRow"), exports);
104
108
  __exportStar(require("./row/InvoiceRow"), exports);
105
109
  __exportStar(require("./row/OfferRow"), exports);
106
110
  __exportStar(require("./row/PaymentRow"), exports);
111
+ __exportStar(require("./row/ProductRow"), exports);
107
112
  __exportStar(require("./row/SalesItemRow"), exports);
108
113
  __exportStar(require("./row/SubscriptionCategoryRow"), exports);
109
114
  __exportStar(require("./row/SubscriptionFieldRow"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoBA,4DAA0C;AAC1C,gEAA8C;AAC9C,mEAAiD;AACjD,mEAAiD;AACjD,iEAA+C;AA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;AACtC,uDAAqC;AACrC,yDAAuC;AACvC,oEAAkD;AAClD,mEAAiD;AACjD,6DAA2C;AAC3C,4DAA0C;AAC1C,0DAAwC;AACxC,sDAAoC;AACpC,wDAAsC;AACtC,0DAAwC;AACxC,4DAA0C;AAC1C,uEAAqD;AACrD,oEAAkD;AAClD,+DAA6C;AAC7C,kEAAgD;AAChD,+DAA6C;AAC7C,4DAA0C;AAC1C,0DAAwC;AACxC,4DAA0C;AAC1C,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,mDAAiC;AACjC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,qDAAmC;AACnC,gEAA8C;AAC9C,6DAA2C;AAC3C,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC"}
@@ -4,6 +4,8 @@ export declare class SalesItemMetaTable extends BaseMetaTable {
4
4
  id: BaseMetaColumn;
5
5
  product_id: BaseMetaColumn;
6
6
  name: BaseMetaColumn;
7
+ slug: BaseMetaColumn;
8
+ logo: BaseMetaColumn;
7
9
  method: BaseMetaColumn;
8
10
  onetime_consumable: BaseMetaColumn;
9
11
  onetime_expire_unit: BaseMetaColumn;
@@ -9,6 +9,8 @@ class SalesItemMetaTable extends namirasoft_core_1.BaseMetaTable {
9
9
  id: new namirasoft_core_1.BaseMetaColumn("id", "Id", "String", true),
10
10
  product_id: new namirasoft_core_1.BaseMetaColumn("product_id", "Product Id", "String", true),
11
11
  name: new namirasoft_core_1.BaseMetaColumn("name", "Name", "String", true),
12
+ slug: new namirasoft_core_1.BaseMetaColumn("slug", "Slug", "String", true),
13
+ logo: new namirasoft_core_1.BaseMetaColumn("logo", "Logo", "String", true),
12
14
  method: new namirasoft_core_1.BaseMetaColumn("method", "Method", "Enum", true),
13
15
  onetime_consumable: new namirasoft_core_1.BaseMetaColumn("onetime_consumable", "Onetime Consumable", "Boolean", true),
14
16
  onetime_expire_unit: new namirasoft_core_1.BaseMetaColumn("onetime_expire_unit", "Onetime Expire Unit", "En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logo: string;
6
+ description: (string | null);
7
+ created_at: Date;
8
+ updated_at: Date;
9
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ProductRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductRow.js","sourceRoot":"","sources":["../../src/row/ProductRow.ts"],"names":[],"mappings":""}
@@ -5,6 +5,8 @@ export type SalesItemRow = {
5
5
  id: string;
6
6
  product_id: string;
7
7
  name: string;
8
+ slug: string;
9
+ logo: string;
8
10
  method: SalesItemMethod;
9
11
  onetime_consumable: boolean;
10
12
  onetime_expire_unit: SalesItemOnetimeExpireUnit;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.4.16",
11
+ "version": "1.4.18",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
@@ -23,6 +23,7 @@ import { NamirasoftPaymentServerInvoice } from "./NamirasoftPaymentServerInvoice
23
23
  import { NamirasoftPaymentServerOffer } from "./NamirasoftPaymentServerOffer";
24
24
  import { NamirasoftPaymentServerOneTime } from "./NamirasoftPaymentServerOneTime";
25
25
  import { NamirasoftPaymentServerPayment } from "./NamirasoftPaymentServerPayment";
26
+ import { NamirasoftPaymentServerProduct } from "./NamirasoftPaymentServerProduct";
26
27
  import { NamirasoftPaymentServerSalesItem } from "./NamirasoftPaymentServerSalesItem";
27
28
  import { NamirasoftPaymentServerSubscription } from "./NamirasoftPaymentServerSubscription";
28
29
  import { NamirasoftPaymentServerSubscriptionCategory } from "./NamirasoftPaymentServerSubscriptionCategory";
@@ -47,6 +48,7 @@ export class NamirasoftPaymentServer
47
48
  subscriptionfield: NamirasoftPaymentServerSubscriptionField;
48
49
  subscriptiontag: NamirasoftPaymentServerSubscriptionTag;
49
50
  subscription: NamirasoftPaymentServerSubscription;
51
+ product: NamirasoftPaymentServerProduct;
50
52
  constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
51
53
  {
52
54
  this.manager = manager;
@@ -62,5 +64,6 @@ export class NamirasoftPaymentServer
62
64
  this.subscriptionfield = new NamirasoftPaymentServerSubscriptionField(base_url, manager, onError);
63
65
  this.subscriptiontag = new NamirasoftPaymentServerSubscriptionTag(base_url, manager, onError);
64
66
  this.subscription = new NamirasoftPaymentServerSubscription(base_url, manager, onError);
67
+ this.product = new NamirasoftPaymentServerProduct(base_url, manager, onError);
65
68
  }
66
69
  };
@@ -25,6 +25,6 @@ export class NamirasoftPaymentServerBase extends NamirasoftServerBase
25
25
  {
26
26
  constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
27
27
  {
28
- super(base_url, `1.4.16`, manager, onError);
28
+ super(base_url, `1.4.18`, manager, onError);
29
29
  }
30
30
  };
@@ -0,0 +1,47 @@
1
+ /****************************************************************/
2
+ /* */
3
+ /* This is an Auto-Generated File */
4
+ /* Made By */
5
+ /* Namirasoft SDK Generator NPM Package */
6
+ /* */
7
+ /****************************************************************/
8
+ /****************************************************************/
9
+ /* */
10
+ /* Please do not make any change to this file */
11
+ /* If any changed is reqired, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { FilterItem } from "namirasoft-core";
22
+ import { NamirasoftPaymentServerBase } from "./NamirasoftPaymentServerBase";
23
+ import { ProductRow } from "./row/ProductRow";
24
+ import { TokenManager } from "namirasoft-account";
25
+
26
+ export class NamirasoftPaymentServerProduct extends NamirasoftPaymentServerBase
27
+ {
28
+ constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
29
+ {
30
+ super(base_url, manager, onError);
31
+ this.List = this.List.bind(this);
32
+ this.Get = this.Get.bind(this);
33
+ }
34
+ async List(filters: FilterItem[] | null, page: (number | null), size: (number | null), user_id: (string | null)): Promise<{ rows: ProductRow[], count: number }>
35
+ {
36
+ let filters_string_value: string = FilterItem.stringify(filters);
37
+ let path = `/product/list`;
38
+ let { data } = await this._get<{ rows: ProductRow[], count: number }>(path, { filters: filters_string_value, page, size, user_id });
39
+ return data;
40
+ }
41
+ async Get(id: string): Promise<ProductRow>
42
+ {
43
+ let path = `/product/${id}`;
44
+ let { data } = await this._get<ProductRow>(path, {});
45
+ return data;
46
+ }
47
+ };
@@ -0,0 +1,34 @@
1
+ /****************************************************************/
2
+ /* */
3
+ /* This is an Auto-Generated File */
4
+ /* Made By */
5
+ /* Namirasoft SDK Generator NPM Package */
6
+ /* */
7
+ /****************************************************************/
8
+ /****************************************************************/
9
+ /* */
10
+ /* Please do not make any change to this file */
11
+ /* If any changed is reqired, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { BaseNavigatorCommand } from "namirasoft-node-cli";
22
+ import { ProductGetCommand } from "./ProductGetCommand";
23
+ import { ProductListCommand } from "./ProductListCommand";
24
+
25
+ export class ProductCommand extends BaseNavigatorCommand
26
+ {
27
+ constructor(argv: string[])
28
+ {
29
+ super(argv, {
30
+ "list": ProductListCommand,
31
+ "get": ProductGetCommand,
32
+ });
33
+ }
34
+ };
@@ -0,0 +1,45 @@
1
+ /****************************************************************/
2
+ /* */
3
+ /* This is an Auto-Generated File */
4
+ /* Made By */
5
+ /* Namirasoft SDK Generator NPM Package */
6
+ /* */
7
+ /****************************************************************/
8
+ /****************************************************************/
9
+ /* */
10
+ /* Please do not make any change to this file */
11
+ /* If any changed is reqired, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { BaseFinalCommand } from "namirasoft-node-cli";
22
+ import { IStorageMemory } from "namirasoft-core";
23
+ import { NamirasoftPaymentServer } from "../NamirasoftPaymentServer";
24
+ import { TokenManager } from "namirasoft-account";
25
+
26
+ export class ProductGetCommand extends BaseFinalCommand
27
+ {
28
+ constructor(argv: string[])
29
+ {
30
+ super(argv, ["id"], []);
31
+ }
32
+ override async exec()
33
+ {
34
+ let token = this.app.storage.getNSAToken();
35
+ if (token == null)
36
+ throw new Error("Token is not available. Please login first using:\nns-payment account config \nor \n{this.command} account login.");
37
+ let storage = new IStorageMemory();
38
+ let manager = new TokenManager(storage, () => { });
39
+ manager.setValue(token, false);
40
+ let url = this.app.storage.getItem("ns-payment-server-url");
41
+ let server = new NamirasoftPaymentServer(url, manager, e => this.app.logger.error(e.message));
42
+ let ans = await server.product.Get(this.arg_values[0]);
43
+ this.app.logger.success(JSON.stringify(ans));
44
+ }
45
+ };
@@ -0,0 +1,45 @@
1
+ /****************************************************************/
2
+ /* */
3
+ /* This is an Auto-Generated File */
4
+ /* Made By */
5
+ /* Namirasoft SDK Generator NPM Package */
6
+ /* */
7
+ /****************************************************************/
8
+ /****************************************************************/
9
+ /* */
10
+ /* Please do not make any change to this file */
11
+ /* If any changed is reqired, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ import { BaseFinalCommand } from "namirasoft-node-cli";
22
+ import { IStorageMemory } from "namirasoft-core";
23
+ import { NamirasoftPaymentServer } from "../NamirasoftPaymentServer";
24
+ import { TokenManager } from "namirasoft-account";
25
+
26
+ export class ProductListCommand extends BaseFinalCommand
27
+ {
28
+ constructor(argv: string[])
29
+ {
30
+ super(argv, ["filters", "page", "size", "user_id"], []);
31
+ }
32
+ override async exec()
33
+ {
34
+ let token = this.app.storage.getNSAToken();
35
+ if (token == null)
36
+ throw new Error("Token is not available. Please login first using:\nns-payment account config \nor \n{this.command} account login.");
37
+ let storage = new IStorageMemory();
38
+ let manager = new TokenManager(storage, () => { });
39
+ manager.setValue(token, false);
40
+ let url = this.app.storage.getItem("ns-payment-server-url");
41
+ let server = new NamirasoftPaymentServer(url, manager, e => this.app.logger.error(e.message));
42
+ let ans = await server.product.List(this.arg_values[0], this.arg_values[1], this.arg_values[2], this.arg_values[3]);
43
+ this.app.logger.success(JSON.stringify(ans));
44
+ }
45
+ };
@@ -27,6 +27,7 @@ import { InvoiceCommand } from "./InvoiceCommand";
27
27
  import { OfferCommand } from "./OfferCommand";
28
28
  import { OneTimeCommand } from "./OneTimeCommand";
29
29
  import { PaymentCommand } from "./PaymentCommand";
30
+ import { ProductCommand } from "./ProductCommand";
30
31
  import { SalesItemCommand } from "./SalesItemCommand";
31
32
  import { SubscriptionCategoryCommand } from "./SubscriptionCategoryCommand";
32
33
  import { SubscriptionCommand } from "./SubscriptionCommand";
@@ -49,6 +50,7 @@ let app = new Application("ns-payment", new BaseStorage(),
49
50
  "subscriptionfield": SubscriptionFieldCommand,
50
51
  "subscriptiontag": SubscriptionTagCommand,
51
52
  "subscription": SubscriptionCommand,
53
+ "product": ProductCommand,
52
54
  "account": AccountCommand,
53
55
  "config": (argv: string[]) => new ConfigCommand(argv, ["ns-payment-server-url"])
54
56
  });
package/src/index.ts CHANGED
@@ -25,6 +25,7 @@ export * from "./NamirasoftPaymentServerInvoice";
25
25
  export * from "./NamirasoftPaymentServerOffer";
26
26
  export * from "./NamirasoftPaymentServerOneTime";
27
27
  export * from "./NamirasoftPaymentServerPayment";
28
+ export * from "./NamirasoftPaymentServerProduct";
28
29
  export * from "./NamirasoftPaymentServerSalesItem";
29
30
  export * from "./NamirasoftPaymentServerSubscription";
30
31
  export * from "./NamirasoftPaymentServerSubscriptionCategory";
@@ -48,6 +49,9 @@ export * from "./command/OneTimeCommand";
48
49
  export * from "./command/PaymentCommand";
49
50
  export * from "./command/PaymentGetCommand";
50
51
  export * from "./command/PaymentListCommand";
52
+ export * from "./command/ProductCommand";
53
+ export * from "./command/ProductGetCommand";
54
+ export * from "./command/ProductListCommand";
51
55
  export * from "./command/SalesItemCommand";
52
56
  export * from "./command/SalesItemGetCommand";
53
57
  export * from "./command/SalesItemListCommand";
@@ -108,6 +112,7 @@ export * from "./row/InvoiceItemInputRow";
108
112
  export * from "./row/InvoiceRow";
109
113
  export * from "./row/OfferRow";
110
114
  export * from "./row/PaymentRow";
115
+ export * from "./row/ProductRow";
111
116
  export * from "./row/SalesItemRow";
112
117
  export * from "./row/SubscriptionCategoryRow";
113
118
  export * from "./row/SubscriptionFieldRow";
@@ -26,6 +26,8 @@ export class SalesItemMetaTable extends BaseMetaTable
26
26
  id: BaseMetaColumn;
27
27
  product_id: BaseMetaColumn;
28
28
  name: BaseMetaColumn;
29
+ slug: BaseMetaColumn;
30
+ logo: BaseMetaColumn;
29
31
  method: BaseMetaColumn;
30
32
  onetime_consumable: BaseMetaColumn;
31
33
  onetime_expire_unit: BaseMetaColumn;
@@ -47,6 +49,8 @@ export class SalesItemMetaTable extends BaseMetaTable
47
49
  id: new BaseMetaColumn("id", "Id", "String", true),
48
50
  product_id: new BaseMetaColumn("product_id", "Product Id", "String", true),
49
51
  name: new BaseMetaColumn("name", "Name", "String", true),
52
+ slug: new BaseMetaColumn("slug", "Slug", "String", true),
53
+ logo: new BaseMetaColumn("logo", "Logo", "String", true),
50
54
  method: new BaseMetaColumn("method", "Method", "Enum", true),
51
55
  onetime_consumable: new BaseMetaColumn("onetime_consumable", "Onetime Consumable", "Boolean", true),
52
56
  onetime_expire_unit: new BaseMetaColumn("onetime_expire_unit", "Onetime Expire Unit", "Enum", true),
@@ -0,0 +1,30 @@
1
+ /****************************************************************/
2
+ /* */
3
+ /* This is an Auto-Generated File */
4
+ /* Made By */
5
+ /* Namirasoft SDK Generator NPM Package */
6
+ /* */
7
+ /****************************************************************/
8
+ /****************************************************************/
9
+ /* */
10
+ /* Please do not make any change to this file */
11
+ /* If any changed is reqired, ns-sdkg command must be used */
12
+ /* */
13
+ /****************************************************************/
14
+ /****************************************************************/
15
+ /* */
16
+ /* Namira Software Corporation */
17
+ /* https://namirasoft.com */
18
+ /* */
19
+ /****************************************************************/
20
+
21
+ export type ProductRow =
22
+ {
23
+ id: string;
24
+ name: string;
25
+ slug: string;
26
+ logo: string;
27
+ description: (string | null);
28
+ created_at: Date;
29
+ updated_at: Date;
30
+ }
@@ -27,6 +27,8 @@ export type SalesItemRow =
27
27
  id: string;
28
28
  product_id: string;
29
29
  name: string;
30
+ slug: string;
31
+ logo: string;
30
32
  method: SalesItemMethod;
31
33
  onetime_consumable: boolean;
32
34
  onetime_expire_unit: SalesItemOnetimeExpireUnit;