namirasoft-payment 1.4.73 → 1.4.74
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/dist/NamirasoftPaymentServer.d.ts +2 -0
- package/dist/NamirasoftPaymentServer.js +3 -1
- package/dist/NamirasoftPaymentServer.js.map +1 -1
- package/dist/NamirasoftPaymentServerMeter.d.ts +20 -0
- package/dist/NamirasoftPaymentServerMeter.js +37 -0
- package/dist/NamirasoftPaymentServerMeter.js.map +1 -0
- package/dist/command/MeterCommand.d.ts +4 -0
- package/dist/command/MeterCommand.js +17 -0
- package/dist/command/MeterCommand.js.map +1 -0
- package/dist/command/Meter_RecordCountForCommand.d.ts +5 -0
- package/dist/command/Meter_RecordCountForCommand.js +67 -0
- package/dist/command/Meter_RecordCountForCommand.js.map +1 -0
- package/dist/command/Meter_RecordSumForCommand.d.ts +5 -0
- package/dist/command/Meter_RecordSumForCommand.js +76 -0
- package/dist/command/Meter_RecordSumForCommand.js.map +1 -0
- package/dist/command/cli.js +2 -0
- package/dist/command/cli.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/meta/OfferItemMetaTable.d.ts +1 -0
- package/dist/meta/OfferItemMetaTable.js +1 -0
- package/dist/meta/OfferItemMetaTable.js.map +1 -1
- package/dist/row/OfferItemRow.d.ts +1 -0
- package/package.json +1 -1
- package/src/NamirasoftPaymentServer.ts +4 -1
- package/src/NamirasoftPaymentServerMeter.ts +44 -0
- package/src/command/MeterCommand.ts +34 -0
- package/src/command/Meter_RecordCountForCommand.ts +74 -0
- package/src/command/Meter_RecordSumForCommand.ts +83 -0
- package/src/command/cli.ts +2 -0
- package/src/index.ts +4 -0
- package/src/meta/OfferItemMetaTable.ts +2 -0
- package/src/row/OfferItemRow.ts +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NSABaseServer } from "namirasoft-account";
|
|
2
2
|
import { NamirasoftPaymentServerHealthz } from "./NamirasoftPaymentServerHealthz";
|
|
3
3
|
import { NamirasoftPaymentServerInvoice } from "./NamirasoftPaymentServerInvoice";
|
|
4
|
+
import { NamirasoftPaymentServerMeter } from "./NamirasoftPaymentServerMeter";
|
|
4
5
|
import { NamirasoftPaymentServerOffer } from "./NamirasoftPaymentServerOffer";
|
|
5
6
|
import { NamirasoftPaymentServerOneTime } from "./NamirasoftPaymentServerOneTime";
|
|
6
7
|
import { NamirasoftPaymentServerPayment } from "./NamirasoftPaymentServerPayment";
|
|
@@ -16,6 +17,7 @@ export declare class NamirasoftPaymentServer extends NSABaseServer {
|
|
|
16
17
|
healthz: NamirasoftPaymentServerHealthz;
|
|
17
18
|
value: NamirasoftPaymentServerValue;
|
|
18
19
|
invoice: NamirasoftPaymentServerInvoice;
|
|
20
|
+
meter: NamirasoftPaymentServerMeter;
|
|
19
21
|
offer: NamirasoftPaymentServerOffer;
|
|
20
22
|
one_time: NamirasoftPaymentServerOneTime;
|
|
21
23
|
payment: NamirasoftPaymentServerPayment;
|
|
@@ -4,6 +4,7 @@ exports.NamirasoftPaymentServer = void 0;
|
|
|
4
4
|
const namirasoft_account_1 = require("namirasoft-account");
|
|
5
5
|
const NamirasoftPaymentServerHealthz_1 = require("./NamirasoftPaymentServerHealthz");
|
|
6
6
|
const NamirasoftPaymentServerInvoice_1 = require("./NamirasoftPaymentServerInvoice");
|
|
7
|
+
const NamirasoftPaymentServerMeter_1 = require("./NamirasoftPaymentServerMeter");
|
|
7
8
|
const NamirasoftPaymentServerOffer_1 = require("./NamirasoftPaymentServerOffer");
|
|
8
9
|
const NamirasoftPaymentServerOneTime_1 = require("./NamirasoftPaymentServerOneTime");
|
|
9
10
|
const NamirasoftPaymentServerPayment_1 = require("./NamirasoftPaymentServerPayment");
|
|
@@ -16,10 +17,11 @@ const NamirasoftPaymentServerSubscriptionPaid_1 = require("./NamirasoftPaymentSe
|
|
|
16
17
|
const NamirasoftPaymentServerValue_1 = require("./NamirasoftPaymentServerValue");
|
|
17
18
|
class NamirasoftPaymentServer extends namirasoft_account_1.NSABaseServer {
|
|
18
19
|
constructor(base_url, manager, onError) {
|
|
19
|
-
super(base_url, `1.4.
|
|
20
|
+
super(base_url, `1.4.74`, manager, onError);
|
|
20
21
|
this.healthz = new NamirasoftPaymentServerHealthz_1.NamirasoftPaymentServerHealthz(this);
|
|
21
22
|
this.value = new NamirasoftPaymentServerValue_1.NamirasoftPaymentServerValue(this);
|
|
22
23
|
this.invoice = new NamirasoftPaymentServerInvoice_1.NamirasoftPaymentServerInvoice(this);
|
|
24
|
+
this.meter = new NamirasoftPaymentServerMeter_1.NamirasoftPaymentServerMeter(this);
|
|
23
25
|
this.offer = new NamirasoftPaymentServerOffer_1.NamirasoftPaymentServerOffer(this);
|
|
24
26
|
this.one_time = new NamirasoftPaymentServerOneTime_1.NamirasoftPaymentServerOneTime(this);
|
|
25
27
|
this.payment = new NamirasoftPaymentServerPayment_1.NamirasoftPaymentServerPayment(this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NamirasoftPaymentServer.js","sourceRoot":"","sources":["../src/NamirasoftPaymentServer.ts"],"names":[],"mappings":";;;AAoBA,2DAAmD;AACnD,qFAAkF;AAClF,qFAAkF;AAClF,iFAA8E;AAC9E,qFAAkF;AAClF,qFAAkF;AAClF,qFAAkF;AAClF,yFAAsF;AACtF,+FAA4F;AAC5F,mIAAgI;AAChI,uGAAoG;AACpG,uGAAoG;AACpG,iFAA8E;AAG9E,MAAa,uBAAwB,SAAQ,kCAAa;
|
|
1
|
+
{"version":3,"file":"NamirasoftPaymentServer.js","sourceRoot":"","sources":["../src/NamirasoftPaymentServer.ts"],"names":[],"mappings":";;;AAoBA,2DAAmD;AACnD,qFAAkF;AAClF,qFAAkF;AAClF,iFAA8E;AAC9E,iFAA8E;AAC9E,qFAAkF;AAClF,qFAAkF;AAClF,qFAAkF;AAClF,yFAAsF;AACtF,+FAA4F;AAC5F,mIAAgI;AAChI,uGAAoG;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NamirasoftPaymentServerBase } from "./NamirasoftPaymentServerBase";
|
|
3
|
+
export declare class NamirasoftPaymentServerMeter extends NamirasoftPaymentServerBase {
|
|
4
|
+
constructor(server: NamirasoftPaymentServer);
|
|
5
|
+
_RecordCountFor(user_id: string, body: {
|
|
6
|
+
sales_item_id: string;
|
|
7
|
+
offer_id: string;
|
|
8
|
+
offer_item_id: string;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
identifier: string;
|
|
11
|
+
}>;
|
|
12
|
+
_RecordSumFor(user_id: string, body: {
|
|
13
|
+
sales_item_id: string;
|
|
14
|
+
offer_id: string;
|
|
15
|
+
offer_item_id: string;
|
|
16
|
+
amount: (number | null);
|
|
17
|
+
}): Promise<{
|
|
18
|
+
identifier: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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.NamirasoftPaymentServerMeter = void 0;
|
|
13
|
+
const NamirasoftPaymentServerBase_1 = require("./NamirasoftPaymentServerBase");
|
|
14
|
+
class NamirasoftPaymentServerMeter extends NamirasoftPaymentServerBase_1.NamirasoftPaymentServerBase {
|
|
15
|
+
constructor(server) {
|
|
16
|
+
super(server);
|
|
17
|
+
this._RecordCountFor = this._RecordCountFor.bind(this);
|
|
18
|
+
this._RecordSumFor = this._RecordSumFor.bind(this);
|
|
19
|
+
}
|
|
20
|
+
_RecordCountFor(user_id, body) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
let path = `/application/user/${user_id}/meter/record/count`;
|
|
23
|
+
let { data } = yield this.server._post(path, {}, body);
|
|
24
|
+
return data;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
_RecordSumFor(user_id, body) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
let path = `/application/user/${user_id}/meter/record/count`;
|
|
30
|
+
let { data } = yield this.server._post(path, {}, body);
|
|
31
|
+
return data;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.NamirasoftPaymentServerMeter = NamirasoftPaymentServerMeter;
|
|
36
|
+
;
|
|
37
|
+
//# sourceMappingURL=NamirasoftPaymentServerMeter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NamirasoftPaymentServerMeter.js","sourceRoot":"","sources":["../src/NamirasoftPaymentServerMeter.ts"],"names":[],"mappings":";;;;;;;;;;;;AAqBA,+EAA4E;AAE5E,MAAa,4BAA6B,SAAQ,yDAA2B;IAEzE,YAAY,MAA+B;QAEvC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IACK,eAAe,CAAC,OAAe,EAAE,IAAwE;;YAE3G,IAAI,IAAI,GAAG,qBAAqB,OAAO,qBAAqB,CAAC;YAC7D,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAyB,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YAC/E,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;IACK,aAAa,CAAC,OAAe,EAAE,IAAiG;;YAElI,IAAI,IAAI,GAAG,qBAAqB,OAAO,qBAAqB,CAAC;YAC7D,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAyB,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YAC/E,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AApBD,oEAoBC;AAAA,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MeterCommand = void 0;
|
|
4
|
+
const namirasoft_node_cli_1 = require("namirasoft-node-cli");
|
|
5
|
+
const Meter_RecordCountForCommand_1 = require("./Meter_RecordCountForCommand");
|
|
6
|
+
const Meter_RecordSumForCommand_1 = require("./Meter_RecordSumForCommand");
|
|
7
|
+
class MeterCommand extends namirasoft_node_cli_1.BaseNavigatorCommand {
|
|
8
|
+
constructor(argv) {
|
|
9
|
+
super(argv, {
|
|
10
|
+
"_recordcountfor": Meter_RecordCountForCommand_1.Meter_RecordCountForCommand,
|
|
11
|
+
"_recordsumfor": Meter_RecordSumForCommand_1.Meter_RecordSumForCommand,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.MeterCommand = MeterCommand;
|
|
16
|
+
;
|
|
17
|
+
//# sourceMappingURL=MeterCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MeterCommand.js","sourceRoot":"","sources":["../../src/command/MeterCommand.ts"],"names":[],"mappings":";;;AAoBA,6DAA2D;AAC3D,+EAA4E;AAC5E,2EAAwE;AAExE,MAAa,YAAa,SAAQ,0CAAoB;IAElD,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE;YACR,iBAAiB,EAAE,yDAA2B;YAC9C,eAAe,EAAE,qDAAyB;SAC7C,CAAC,CAAC;IACP,CAAC;CACJ;AATD,oCASC;AAAA,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.Meter_RecordCountForCommand = 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 Meter_RecordCountForCommand extends namirasoft_node_cli_1.BaseFinalCommand {
|
|
18
|
+
constructor(argv) {
|
|
19
|
+
super(argv, ["user_id"], [
|
|
20
|
+
{
|
|
21
|
+
name: "sales_item_id",
|
|
22
|
+
short: "",
|
|
23
|
+
description: "Provides the value of 'sales_item_id' in body",
|
|
24
|
+
optional: false,
|
|
25
|
+
args: ["sales_item_id"],
|
|
26
|
+
defaults: [""]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "offer_id",
|
|
30
|
+
short: "",
|
|
31
|
+
description: "Provides the value of 'offer_id' in body",
|
|
32
|
+
optional: false,
|
|
33
|
+
args: ["offer_id"],
|
|
34
|
+
defaults: [""]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "offer_item_id",
|
|
38
|
+
short: "",
|
|
39
|
+
description: "Provides the value of 'offer_item_id' in body",
|
|
40
|
+
optional: false,
|
|
41
|
+
args: ["offer_item_id"],
|
|
42
|
+
defaults: [""]
|
|
43
|
+
}
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
exec() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
let token = this.app.storage.getNSAToken();
|
|
49
|
+
if (token == null)
|
|
50
|
+
throw new Error("Token is not available. Please login first using:\nns-payment account config \nor \nns-payment account login.");
|
|
51
|
+
let storage = new namirasoft_core_1.IStorageMemoryDedicated();
|
|
52
|
+
let manager = new namirasoft_account_1.TokenManager(storage, () => { });
|
|
53
|
+
manager.setValue(token, false);
|
|
54
|
+
let url = this.app.storage.getItem("ns-payment-server-url");
|
|
55
|
+
let server = new NamirasoftPaymentServer_1.NamirasoftPaymentServer(url, manager, e => this.app.logger.error(e.message));
|
|
56
|
+
let ans = yield server.meter._RecordCountFor(this.arg_values[0], {
|
|
57
|
+
sales_item_id: this.option_values.sales_item_id,
|
|
58
|
+
offer_id: this.option_values.offer_id,
|
|
59
|
+
offer_item_id: this.option_values.offer_item_id
|
|
60
|
+
});
|
|
61
|
+
this.app.logger.success(JSON.stringify(ans));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.Meter_RecordCountForCommand = Meter_RecordCountForCommand;
|
|
66
|
+
;
|
|
67
|
+
//# sourceMappingURL=Meter_RecordCountForCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Meter_RecordCountForCommand.js","sourceRoot":"","sources":["../../src/command/Meter_RecordCountForCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAA0D;AAC1D,wEAAqE;AACrE,2DAAkD;AAElD,MAAa,2BAA4B,SA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C,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9F,IAAI,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;gBAC7D,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa;gBAC/C,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,QAAQ;gBACrC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa;aAClD,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AAhDD,kEAgDC;AAAA,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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.Meter_RecordSumForCommand = 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 Meter_RecordSumForCommand extends namirasoft_node_cli_1.BaseFinalCommand {
|
|
18
|
+
constructor(argv) {
|
|
19
|
+
super(argv, ["user_id"], [
|
|
20
|
+
{
|
|
21
|
+
name: "sales_item_id",
|
|
22
|
+
short: "",
|
|
23
|
+
description: "Provides the value of 'sales_item_id' in body",
|
|
24
|
+
optional: false,
|
|
25
|
+
args: ["sales_item_id"],
|
|
26
|
+
defaults: [""]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "offer_id",
|
|
30
|
+
short: "",
|
|
31
|
+
description: "Provides the value of 'offer_id' in body",
|
|
32
|
+
optional: false,
|
|
33
|
+
args: ["offer_id"],
|
|
34
|
+
defaults: [""]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "offer_item_id",
|
|
38
|
+
short: "",
|
|
39
|
+
description: "Provides the value of 'offer_item_id' in body",
|
|
40
|
+
optional: false,
|
|
41
|
+
args: ["offer_item_id"],
|
|
42
|
+
defaults: [""]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "amount",
|
|
46
|
+
short: "",
|
|
47
|
+
description: "Provides the value of 'amount' in body",
|
|
48
|
+
optional: true,
|
|
49
|
+
args: ["amount"],
|
|
50
|
+
defaults: [""]
|
|
51
|
+
}
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
exec() {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
let token = this.app.storage.getNSAToken();
|
|
57
|
+
if (token == null)
|
|
58
|
+
throw new Error("Token is not available. Please login first using:\nns-payment account config \nor \nns-payment account login.");
|
|
59
|
+
let storage = new namirasoft_core_1.IStorageMemoryDedicated();
|
|
60
|
+
let manager = new namirasoft_account_1.TokenManager(storage, () => { });
|
|
61
|
+
manager.setValue(token, false);
|
|
62
|
+
let url = this.app.storage.getItem("ns-payment-server-url");
|
|
63
|
+
let server = new NamirasoftPaymentServer_1.NamirasoftPaymentServer(url, manager, e => this.app.logger.error(e.message));
|
|
64
|
+
let ans = yield server.meter._RecordSumFor(this.arg_values[0], {
|
|
65
|
+
sales_item_id: this.option_values.sales_item_id,
|
|
66
|
+
offer_id: this.option_values.offer_id,
|
|
67
|
+
offer_item_id: this.option_values.offer_item_id,
|
|
68
|
+
amount: this.option_values.amount
|
|
69
|
+
});
|
|
70
|
+
this.app.logger.success(JSON.stringify(ans));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.Meter_RecordSumForCommand = Meter_RecordSumForCommand;
|
|
75
|
+
;
|
|
76
|
+
//# sourceMappingURL=Meter_RecordSumForCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Meter_RecordSumForCommand.js","sourceRoot":"","sources":["../../src/command/Meter_RecordSumForCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,6DAAuD;AACvD,qDAA0D;AAC1D,wEAAqE;AACrE,2DAAkD;AAElD,MAAa,yBAA0B,SAAQ,sCAAgB;IAE3D,YAAY,IAAc;QAEtB,KAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;YACrB;gBACI,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,+CAA+C;gBAC5D,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,eAAe,CAAC;gBACvB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,0CAA0C;gBACvD,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,UAAU,CAAC;gBAClB,QAAQ,EAAE,CAAC,EAAE,CAAC;aACjB;YACD;gBACI,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,+CAA+C;gBAC5D,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CA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MAAM;aACpC,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;KAAA;CACJ;AAzDD,8DAyDC;AAAA,CAAC"}
|
package/dist/command/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ const namirasoft_node_cli_1 = require("namirasoft-node-cli");
|
|
|
6
6
|
const namirasoft_node_cli_2 = require("namirasoft-node-cli");
|
|
7
7
|
const HealthzCommand_1 = require("./HealthzCommand");
|
|
8
8
|
const InvoiceCommand_1 = require("./InvoiceCommand");
|
|
9
|
+
const MeterCommand_1 = require("./MeterCommand");
|
|
9
10
|
const OfferCommand_1 = require("./OfferCommand");
|
|
10
11
|
const OneTimeCommand_1 = require("./OneTimeCommand");
|
|
11
12
|
const PaymentCommand_1 = require("./PaymentCommand");
|
|
@@ -20,6 +21,7 @@ let app = new namirasoft_node_cli_1.Application("ns-payment", new namirasoft_nod
|
|
|
20
21
|
"healthz": HealthzCommand_1.HealthzCommand,
|
|
21
22
|
"value": ValueCommand_1.ValueCommand,
|
|
22
23
|
"invoice": InvoiceCommand_1.InvoiceCommand,
|
|
24
|
+
"meter": MeterCommand_1.MeterCommand,
|
|
23
25
|
"offer": OfferCommand_1.OfferCommand,
|
|
24
26
|
"onetime": OneTimeCommand_1.OneTimeCommand,
|
|
25
27
|
"payment": PaymentCommand_1.PaymentCommand,
|
package/dist/command/cli.js.map
CHANGED
|
@@ -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,iDAA8C;AAC9C,qDAAkD;AAClD,qDAAkD;AAClD,qDAAkD;AAClD,yDAAsD;AACtD,mGAAgG;AAChG,+DAA4D;AAC5D,uEAAoE;AACpE,uEAAoE;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ACvE,kBAAkB,EAAE,iDAAuB;IAC3C,kBAAkB,EAAE,iDAAuB;IAC3C,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
|
@@ -2,6 +2,7 @@ export * from "./NamirasoftPaymentServer";
|
|
|
2
2
|
export * from "./NamirasoftPaymentServerBase";
|
|
3
3
|
export * from "./NamirasoftPaymentServerHealthz";
|
|
4
4
|
export * from "./NamirasoftPaymentServerInvoice";
|
|
5
|
+
export * from "./NamirasoftPaymentServerMeter";
|
|
5
6
|
export * from "./NamirasoftPaymentServerOffer";
|
|
6
7
|
export * from "./NamirasoftPaymentServerOneTime";
|
|
7
8
|
export * from "./NamirasoftPaymentServerPayment";
|
|
@@ -21,6 +22,9 @@ export * from "./command/InvoiceGetCommand";
|
|
|
21
22
|
export * from "./command/InvoiceListCommand";
|
|
22
23
|
export * from "./command/Invoice_CreateForCommand";
|
|
23
24
|
export * from "./command/Invoice_DeleteForCommand";
|
|
25
|
+
export * from "./command/MeterCommand";
|
|
26
|
+
export * from "./command/Meter_RecordCountForCommand";
|
|
27
|
+
export * from "./command/Meter_RecordSumForCommand";
|
|
24
28
|
export * from "./command/OfferCommand";
|
|
25
29
|
export * from "./command/OfferGetCommand";
|
|
26
30
|
export * from "./command/OfferListCommand";
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./NamirasoftPaymentServer"), exports);
|
|
|
18
18
|
__exportStar(require("./NamirasoftPaymentServerBase"), exports);
|
|
19
19
|
__exportStar(require("./NamirasoftPaymentServerHealthz"), exports);
|
|
20
20
|
__exportStar(require("./NamirasoftPaymentServerInvoice"), exports);
|
|
21
|
+
__exportStar(require("./NamirasoftPaymentServerMeter"), exports);
|
|
21
22
|
__exportStar(require("./NamirasoftPaymentServerOffer"), exports);
|
|
22
23
|
__exportStar(require("./NamirasoftPaymentServerOneTime"), exports);
|
|
23
24
|
__exportStar(require("./NamirasoftPaymentServerPayment"), exports);
|
|
@@ -37,6 +38,9 @@ __exportStar(require("./command/InvoiceGetCommand"), exports);
|
|
|
37
38
|
__exportStar(require("./command/InvoiceListCommand"), exports);
|
|
38
39
|
__exportStar(require("./command/Invoice_CreateForCommand"), exports);
|
|
39
40
|
__exportStar(require("./command/Invoice_DeleteForCommand"), exports);
|
|
41
|
+
__exportStar(require("./command/MeterCommand"), exports);
|
|
42
|
+
__exportStar(require("./command/Meter_RecordCountForCommand"), exports);
|
|
43
|
+
__exportStar(require("./command/Meter_RecordSumForCommand"), exports);
|
|
40
44
|
__exportStar(require("./command/OfferCommand"), exports);
|
|
41
45
|
__exportStar(require("./command/OfferGetCommand"), exports);
|
|
42
46
|
__exportStar(require("./command/OfferListCommand"), 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;AAC/C,mEAAiD;AACjD,mEAAiD;AACjD,mEAAiD;AACjD,qEAAmD;AACnD,wEAAsD;AACtD,0FAAwE;AACxE,4EAA0D;AAC1D,4EAA0D;AAC1D,iEAA+C;AAC/C,gDAA8B;AAC9B,2DAAyC;AACzC,8DAA4C;AAC5C,iEAA+C;AAC/C,2DAAyC;AACzC,8DAA4C;AAC5C,+DAA6C;AAC7C,qEAAmD;AACnD,qEAAmD;AACnD,yDAAuC;AACvC,4DAA0C;AAC1C,6DAA2C;AAC3C,mEAAiD;AACjD,2DAAyC;AACzC,2DAAyC;AACzC,8DAA4C;AAC5C,+DAA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iD;AACjD,4DAA0C;AAC1C,uDAAqC;AACrC,uDAAqC;AACrC,wDAAsC;AACtC,4DAA0C;AAC1C,uDAAqC;AACrC,mDAAiC;AACjC,qDAAmC;AACnC,qDAAmC;AACnC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,qDAAmC;AACnC,0EAAwD;AACxD,4DAA0C;AAC1C,4DAA0C;AAC1C,4DAA0C;AAC1C,wDAAsC"}
|
|
@@ -38,6 +38,7 @@ export declare class OfferItemMetaTable extends NSBaseMetaTable<NamirasoftPaymen
|
|
|
38
38
|
recurring_usage_type: BaseMetaColumn;
|
|
39
39
|
recurring_usage_name: BaseMetaColumn;
|
|
40
40
|
recurring_usage_duration: BaseMetaColumn;
|
|
41
|
+
recurring_usage_meter_event_name: BaseMetaColumn;
|
|
41
42
|
recurring_usage_unit_amount: BaseMetaColumn;
|
|
42
43
|
recurring_usage_package_amount: BaseMetaColumn;
|
|
43
44
|
recurring_usage_package_ceiling_value: BaseMetaColumn;
|
|
@@ -50,6 +50,7 @@ class OfferItemMetaTable extends namirasoft_site_1.NSBaseMetaTable {
|
|
|
50
50
|
recurring_usage_type: new namirasoft_core_1.BaseMetaColumn(this, "recurring_usage_type", "Recurring Usage Type", "Enum", false),
|
|
51
51
|
recurring_usage_name: new namirasoft_core_1.BaseMetaColumn(this, "recurring_usage_name", "Recurring Usage Name", "String", false),
|
|
52
52
|
recurring_usage_duration: new namirasoft_core_1.BaseMetaColumn(this, "recurring_usage_duration", "Recurring Usage Duration", "String", false),
|
|
53
|
+
recurring_usage_meter_event_name: new namirasoft_core_1.BaseMetaColumn(this, "recurring_usage_meter_event_name", "Recurring Usage Meter Event Name", "String", false),
|
|
53
54
|
recurring_usage_unit_amount: new namirasoft_core_1.BaseMetaColumn(this, "recurring_usage_unit_amount", "Recurring Usage Unit Amount", "Integer", false),
|
|
54
55
|
recurring_usage_package_amount: new namirasoft_core_1.BaseMetaColumn(this, "recurring_usage_package_amount", "Recurring Usage Package Amount", "Integer", false),
|
|
55
56
|
recurring_usage_package_ceiling_value: new namirasoft_core_1.BaseMetaColumn(this, "recurring_usage_package_ceiling_value", "Recurring Usage Package Ceiling Value", "Integer", false),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OfferItemMetaTable.js","sourceRoot":"","sources":["../../src/meta/OfferItemMetaTable.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,qDAAiF;AACjF,qDAAsE;AAItE,MAAa,kBAAmB,SAAQ,iCAAsD;
|
|
1
|
+
{"version":3,"file":"OfferItemMetaTable.js","sourceRoot":"","sources":["../../src/meta/OfferItemMetaTable.ts"],"names":[],"mappings":";;;;;;;;;;;;AAoBA,qDAAiF;AACjF,qDAAsE;AAItE,MAAa,kBAAmB,SAAQ,iCAAsD;IAkD1F,YAAY,QAAqD;QAE7D,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,0BAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG;YACX,EAAE,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC;YACxD,UAAU,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,CAAC;YAChF,aAAa,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,CAAC;YACzF,QAAQ,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC;YAC1E,IAAI,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC;YAC9D,IAAI,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAA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EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC;YAC1E,SAAS,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC;YAC9E,WAAW,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC;YACnF,UAAU,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC;YAClF,UAAU,EAAE,IAAI,gCAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC;SACrF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAO,EAAU,EAAE,EAAE;YAErC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACxD,CAAC,CAAA,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAO,OAA4B,EAAE,IAAqB,EAAE,IAAqB,EAAE,KAAiB,EAAE,EAAE;YAEzH,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzD,CAAC,CAAA,CAAC;IACN,CAAC;CACJ;AAhHD,gDAgHC;AAAA,CAAC"}
|
|
@@ -41,6 +41,7 @@ export type OfferItemRow = {
|
|
|
41
41
|
recurring_usage_type: (OfferItemRecurringUsageType | null);
|
|
42
42
|
recurring_usage_name: (string | null);
|
|
43
43
|
recurring_usage_duration: (string | null);
|
|
44
|
+
recurring_usage_meter_event_name: (string | null);
|
|
44
45
|
recurring_usage_unit_amount: (number | null);
|
|
45
46
|
recurring_usage_package_amount: (number | null);
|
|
46
47
|
recurring_usage_package_ceiling_value: (number | null);
|
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
import { NSABaseServer } from "namirasoft-account";
|
|
22
22
|
import { NamirasoftPaymentServerHealthz } from "./NamirasoftPaymentServerHealthz";
|
|
23
23
|
import { NamirasoftPaymentServerInvoice } from "./NamirasoftPaymentServerInvoice";
|
|
24
|
+
import { NamirasoftPaymentServerMeter } from "./NamirasoftPaymentServerMeter";
|
|
24
25
|
import { NamirasoftPaymentServerOffer } from "./NamirasoftPaymentServerOffer";
|
|
25
26
|
import { NamirasoftPaymentServerOneTime } from "./NamirasoftPaymentServerOneTime";
|
|
26
27
|
import { NamirasoftPaymentServerPayment } from "./NamirasoftPaymentServerPayment";
|
|
@@ -38,6 +39,7 @@ export class NamirasoftPaymentServer extends NSABaseServer
|
|
|
38
39
|
healthz: NamirasoftPaymentServerHealthz;
|
|
39
40
|
value: NamirasoftPaymentServerValue;
|
|
40
41
|
invoice: NamirasoftPaymentServerInvoice;
|
|
42
|
+
meter: NamirasoftPaymentServerMeter;
|
|
41
43
|
offer: NamirasoftPaymentServerOffer;
|
|
42
44
|
one_time: NamirasoftPaymentServerOneTime;
|
|
43
45
|
payment: NamirasoftPaymentServerPayment;
|
|
@@ -49,10 +51,11 @@ export class NamirasoftPaymentServer extends NSABaseServer
|
|
|
49
51
|
product: NamirasoftPaymentServerProduct;
|
|
50
52
|
constructor(base_url: string, manager: TokenManager, onError: (error: Error) => void)
|
|
51
53
|
{
|
|
52
|
-
super(base_url, `1.4.
|
|
54
|
+
super(base_url, `1.4.74`, manager, onError);
|
|
53
55
|
this.healthz = new NamirasoftPaymentServerHealthz(this);
|
|
54
56
|
this.value = new NamirasoftPaymentServerValue(this);
|
|
55
57
|
this.invoice = new NamirasoftPaymentServerInvoice(this);
|
|
58
|
+
this.meter = new NamirasoftPaymentServerMeter(this);
|
|
56
59
|
this.offer = new NamirasoftPaymentServerOffer(this);
|
|
57
60
|
this.one_time = new NamirasoftPaymentServerOneTime(this);
|
|
58
61
|
this.payment = new NamirasoftPaymentServerPayment(this);
|
|
@@ -0,0 +1,44 @@
|
|
|
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 change is required, ns-sdkg command must be used */
|
|
12
|
+
/* */
|
|
13
|
+
/****************************************************************/
|
|
14
|
+
/****************************************************************/
|
|
15
|
+
/* */
|
|
16
|
+
/* Namira Software Corporation */
|
|
17
|
+
/* https://namirasoft.com */
|
|
18
|
+
/* */
|
|
19
|
+
/****************************************************************/
|
|
20
|
+
|
|
21
|
+
import { NamirasoftPaymentServer } from "./NamirasoftPaymentServer";
|
|
22
|
+
import { NamirasoftPaymentServerBase } from "./NamirasoftPaymentServerBase";
|
|
23
|
+
|
|
24
|
+
export class NamirasoftPaymentServerMeter extends NamirasoftPaymentServerBase
|
|
25
|
+
{
|
|
26
|
+
constructor(server: NamirasoftPaymentServer)
|
|
27
|
+
{
|
|
28
|
+
super(server);
|
|
29
|
+
this._RecordCountFor = this._RecordCountFor.bind(this);
|
|
30
|
+
this._RecordSumFor = this._RecordSumFor.bind(this);
|
|
31
|
+
}
|
|
32
|
+
async _RecordCountFor(user_id: string, body: { sales_item_id: string, offer_id: string, offer_item_id: string }): Promise<{ identifier: string }>
|
|
33
|
+
{
|
|
34
|
+
let path = `/application/user/${user_id}/meter/record/count`;
|
|
35
|
+
let { data } = await this.server._post<{ identifier: string }>(path, {}, body);
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
38
|
+
async _RecordSumFor(user_id: string, body: { sales_item_id: string, offer_id: string, offer_item_id: string, amount: (number | null) }): Promise<{ identifier: string }>
|
|
39
|
+
{
|
|
40
|
+
let path = `/application/user/${user_id}/meter/record/count`;
|
|
41
|
+
let { data } = await this.server._post<{ identifier: string }>(path, {}, body);
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -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 change is required, 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 { Meter_RecordCountForCommand } from "./Meter_RecordCountForCommand";
|
|
23
|
+
import { Meter_RecordSumForCommand } from "./Meter_RecordSumForCommand";
|
|
24
|
+
|
|
25
|
+
export class MeterCommand extends BaseNavigatorCommand
|
|
26
|
+
{
|
|
27
|
+
constructor(argv: string[])
|
|
28
|
+
{
|
|
29
|
+
super(argv, {
|
|
30
|
+
"_recordcountfor": Meter_RecordCountForCommand,
|
|
31
|
+
"_recordsumfor": Meter_RecordSumForCommand,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
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 change is required, 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 { IStorageMemoryDedicated } from "namirasoft-core";
|
|
23
|
+
import { NamirasoftPaymentServer } from "../NamirasoftPaymentServer";
|
|
24
|
+
import { TokenManager } from "namirasoft-account";
|
|
25
|
+
|
|
26
|
+
export class Meter_RecordCountForCommand extends BaseFinalCommand
|
|
27
|
+
{
|
|
28
|
+
constructor(argv: string[])
|
|
29
|
+
{
|
|
30
|
+
super(argv, ["user_id"], [
|
|
31
|
+
{
|
|
32
|
+
name: "sales_item_id",
|
|
33
|
+
short: "",
|
|
34
|
+
description: "Provides the value of 'sales_item_id' in body",
|
|
35
|
+
optional: false,
|
|
36
|
+
args: ["sales_item_id"],
|
|
37
|
+
defaults: [""]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "offer_id",
|
|
41
|
+
short: "",
|
|
42
|
+
description: "Provides the value of 'offer_id' in body",
|
|
43
|
+
optional: false,
|
|
44
|
+
args: ["offer_id"],
|
|
45
|
+
defaults: [""]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "offer_item_id",
|
|
49
|
+
short: "",
|
|
50
|
+
description: "Provides the value of 'offer_item_id' in body",
|
|
51
|
+
optional: false,
|
|
52
|
+
args: ["offer_item_id"],
|
|
53
|
+
defaults: [""]
|
|
54
|
+
}
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
override async exec()
|
|
58
|
+
{
|
|
59
|
+
let token = this.app.storage.getNSAToken();
|
|
60
|
+
if (token == null)
|
|
61
|
+
throw new Error("Token is not available. Please login first using:\nns-payment account config \nor \nns-payment account login.");
|
|
62
|
+
let storage = new IStorageMemoryDedicated();
|
|
63
|
+
let manager = new TokenManager(storage, () => { });
|
|
64
|
+
manager.setValue(token, false);
|
|
65
|
+
let url = this.app.storage.getItem("ns-payment-server-url");
|
|
66
|
+
let server = new NamirasoftPaymentServer(url, manager, e => this.app.logger.error(e.message));
|
|
67
|
+
let ans = await server.meter._RecordCountFor(this.arg_values[0], {
|
|
68
|
+
sales_item_id: this.option_values.sales_item_id,
|
|
69
|
+
offer_id: this.option_values.offer_id,
|
|
70
|
+
offer_item_id: this.option_values.offer_item_id
|
|
71
|
+
});
|
|
72
|
+
this.app.logger.success(JSON.stringify(ans));
|
|
73
|
+
}
|
|
74
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
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 change is required, 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 { IStorageMemoryDedicated } from "namirasoft-core";
|
|
23
|
+
import { NamirasoftPaymentServer } from "../NamirasoftPaymentServer";
|
|
24
|
+
import { TokenManager } from "namirasoft-account";
|
|
25
|
+
|
|
26
|
+
export class Meter_RecordSumForCommand extends BaseFinalCommand
|
|
27
|
+
{
|
|
28
|
+
constructor(argv: string[])
|
|
29
|
+
{
|
|
30
|
+
super(argv, ["user_id"], [
|
|
31
|
+
{
|
|
32
|
+
name: "sales_item_id",
|
|
33
|
+
short: "",
|
|
34
|
+
description: "Provides the value of 'sales_item_id' in body",
|
|
35
|
+
optional: false,
|
|
36
|
+
args: ["sales_item_id"],
|
|
37
|
+
defaults: [""]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "offer_id",
|
|
41
|
+
short: "",
|
|
42
|
+
description: "Provides the value of 'offer_id' in body",
|
|
43
|
+
optional: false,
|
|
44
|
+
args: ["offer_id"],
|
|
45
|
+
defaults: [""]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "offer_item_id",
|
|
49
|
+
short: "",
|
|
50
|
+
description: "Provides the value of 'offer_item_id' in body",
|
|
51
|
+
optional: false,
|
|
52
|
+
args: ["offer_item_id"],
|
|
53
|
+
defaults: [""]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "amount",
|
|
57
|
+
short: "",
|
|
58
|
+
description: "Provides the value of 'amount' in body",
|
|
59
|
+
optional: true,
|
|
60
|
+
args: ["amount"],
|
|
61
|
+
defaults: [""]
|
|
62
|
+
}
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
override async exec()
|
|
66
|
+
{
|
|
67
|
+
let token = this.app.storage.getNSAToken();
|
|
68
|
+
if (token == null)
|
|
69
|
+
throw new Error("Token is not available. Please login first using:\nns-payment account config \nor \nns-payment account login.");
|
|
70
|
+
let storage = new IStorageMemoryDedicated();
|
|
71
|
+
let manager = new TokenManager(storage, () => { });
|
|
72
|
+
manager.setValue(token, false);
|
|
73
|
+
let url = this.app.storage.getItem("ns-payment-server-url");
|
|
74
|
+
let server = new NamirasoftPaymentServer(url, manager, e => this.app.logger.error(e.message));
|
|
75
|
+
let ans = await server.meter._RecordSumFor(this.arg_values[0], {
|
|
76
|
+
sales_item_id: this.option_values.sales_item_id,
|
|
77
|
+
offer_id: this.option_values.offer_id,
|
|
78
|
+
offer_item_id: this.option_values.offer_item_id,
|
|
79
|
+
amount: this.option_values.amount
|
|
80
|
+
});
|
|
81
|
+
this.app.logger.success(JSON.stringify(ans));
|
|
82
|
+
}
|
|
83
|
+
};
|
package/src/command/cli.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { Application, BaseStorage } from "namirasoft-node-cli";
|
|
|
24
24
|
import { ConfigCommand } from "namirasoft-node-cli";
|
|
25
25
|
import { HealthzCommand } from "./HealthzCommand";
|
|
26
26
|
import { InvoiceCommand } from "./InvoiceCommand";
|
|
27
|
+
import { MeterCommand } from "./MeterCommand";
|
|
27
28
|
import { OfferCommand } from "./OfferCommand";
|
|
28
29
|
import { OneTimeCommand } from "./OneTimeCommand";
|
|
29
30
|
import { PaymentCommand } from "./PaymentCommand";
|
|
@@ -40,6 +41,7 @@ let app = new Application("ns-payment", new BaseStorage(),
|
|
|
40
41
|
"healthz": HealthzCommand,
|
|
41
42
|
"value": ValueCommand,
|
|
42
43
|
"invoice": InvoiceCommand,
|
|
44
|
+
"meter": MeterCommand,
|
|
43
45
|
"offer": OfferCommand,
|
|
44
46
|
"onetime": OneTimeCommand,
|
|
45
47
|
"payment": PaymentCommand,
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from "./NamirasoftPaymentServer";
|
|
|
22
22
|
export * from "./NamirasoftPaymentServerBase";
|
|
23
23
|
export * from "./NamirasoftPaymentServerHealthz";
|
|
24
24
|
export * from "./NamirasoftPaymentServerInvoice";
|
|
25
|
+
export * from "./NamirasoftPaymentServerMeter";
|
|
25
26
|
export * from "./NamirasoftPaymentServerOffer";
|
|
26
27
|
export * from "./NamirasoftPaymentServerOneTime";
|
|
27
28
|
export * from "./NamirasoftPaymentServerPayment";
|
|
@@ -41,6 +42,9 @@ export * from "./command/InvoiceGetCommand";
|
|
|
41
42
|
export * from "./command/InvoiceListCommand";
|
|
42
43
|
export * from "./command/Invoice_CreateForCommand";
|
|
43
44
|
export * from "./command/Invoice_DeleteForCommand";
|
|
45
|
+
export * from "./command/MeterCommand";
|
|
46
|
+
export * from "./command/Meter_RecordCountForCommand";
|
|
47
|
+
export * from "./command/Meter_RecordSumForCommand";
|
|
44
48
|
export * from "./command/OfferCommand";
|
|
45
49
|
export * from "./command/OfferGetCommand";
|
|
46
50
|
export * from "./command/OfferListCommand";
|
|
@@ -60,6 +60,7 @@ export class OfferItemMetaTable extends NSBaseMetaTable<NamirasoftPaymentServer,
|
|
|
60
60
|
recurring_usage_type: BaseMetaColumn;
|
|
61
61
|
recurring_usage_name: BaseMetaColumn;
|
|
62
62
|
recurring_usage_duration: BaseMetaColumn;
|
|
63
|
+
recurring_usage_meter_event_name: BaseMetaColumn;
|
|
63
64
|
recurring_usage_unit_amount: BaseMetaColumn;
|
|
64
65
|
recurring_usage_package_amount: BaseMetaColumn;
|
|
65
66
|
recurring_usage_package_ceiling_value: BaseMetaColumn;
|
|
@@ -110,6 +111,7 @@ export class OfferItemMetaTable extends NSBaseMetaTable<NamirasoftPaymentServer,
|
|
|
110
111
|
recurring_usage_type: new BaseMetaColumn(this, "recurring_usage_type", "Recurring Usage Type", "Enum", false),
|
|
111
112
|
recurring_usage_name: new BaseMetaColumn(this, "recurring_usage_name", "Recurring Usage Name", "String", false),
|
|
112
113
|
recurring_usage_duration: new BaseMetaColumn(this, "recurring_usage_duration", "Recurring Usage Duration", "String", false),
|
|
114
|
+
recurring_usage_meter_event_name: new BaseMetaColumn(this, "recurring_usage_meter_event_name", "Recurring Usage Meter Event Name", "String", false),
|
|
113
115
|
recurring_usage_unit_amount: new BaseMetaColumn(this, "recurring_usage_unit_amount", "Recurring Usage Unit Amount", "Integer", false),
|
|
114
116
|
recurring_usage_package_amount: new BaseMetaColumn(this, "recurring_usage_package_amount", "Recurring Usage Package Amount", "Integer", false),
|
|
115
117
|
recurring_usage_package_ceiling_value: new BaseMetaColumn(this, "recurring_usage_package_ceiling_value", "Recurring Usage Package Ceiling Value", "Integer", false),
|
package/src/row/OfferItemRow.ts
CHANGED
|
@@ -63,6 +63,7 @@ export type OfferItemRow =
|
|
|
63
63
|
recurring_usage_type: (OfferItemRecurringUsageType | null);
|
|
64
64
|
recurring_usage_name: (string | null);
|
|
65
65
|
recurring_usage_duration: (string | null);
|
|
66
|
+
recurring_usage_meter_event_name: (string | null);
|
|
66
67
|
recurring_usage_unit_amount: (number | null);
|
|
67
68
|
recurring_usage_package_amount: (number | null);
|
|
68
69
|
recurring_usage_package_ceiling_value: (number | null);
|