@nimee/api-clients 1.1.4 → 1.1.5
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/src/index.d.ts +1 -0
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/payment.d.ts +8 -0
- package/dist/src/payment.js +32 -0
- package/dist/src/payment.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/payment.ts +13 -0
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventOrderClient = exports.AccountClient = exports.UserEventClient = exports.TicketClient = exports.EventClient = exports.UserClient = void 0;
|
|
3
|
+
exports.PaymentClient = exports.EventOrderClient = exports.AccountClient = exports.UserEventClient = exports.TicketClient = exports.EventClient = exports.UserClient = void 0;
|
|
4
4
|
var user_1 = require("./user");
|
|
5
5
|
Object.defineProperty(exports, "UserClient", { enumerable: true, get: function () { return user_1.UserClient; } });
|
|
6
6
|
var event_1 = require("./event");
|
|
@@ -13,4 +13,6 @@ var account_1 = require("./account");
|
|
|
13
13
|
Object.defineProperty(exports, "AccountClient", { enumerable: true, get: function () { return account_1.AccountClient; } });
|
|
14
14
|
var eventOrder_1 = require("./eventOrder");
|
|
15
15
|
Object.defineProperty(exports, "EventOrderClient", { enumerable: true, get: function () { return eventOrder_1.EventOrderClient; } });
|
|
16
|
+
var payment_1 = require("./payment");
|
|
17
|
+
Object.defineProperty(exports, "PaymentClient", { enumerable: true, get: function () { return payment_1.PaymentClient; } });
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,iCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AACrB,yCAA8C;AAArC,4GAAA,eAAe,OAAA;AACxB,qCAA0C;AAAjC,wGAAA,aAAa,OAAA;AACtB,2CAAgD;AAAvC,8GAAA,gBAAgB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,iCAAsC;AAA7B,oGAAA,WAAW,OAAA;AACpB,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AACrB,yCAA8C;AAArC,4GAAA,eAAe,OAAA;AACxB,qCAA0C;AAAjC,wGAAA,aAAa,OAAA;AACtB,2CAAgD;AAAvC,8GAAA,gBAAgB,OAAA;AACzB,qCAA0C;AAAjC,wGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PaymentClient = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const port = process.env.PAYMENT_PORT;
|
|
18
|
+
const basePath = process.env.IS_LOCAL === "true" ? `http://localhost:${port}` : "http://payment";
|
|
19
|
+
const paymentUrl = `${basePath}/payment`;
|
|
20
|
+
class PaymentClient {
|
|
21
|
+
getCouponById(params) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const { accountId, eventId, couponId, jwt } = params;
|
|
24
|
+
const response = yield axios_1.default.get(`${paymentUrl}/coupon/getById/${accountId}/${eventId}/${couponId}`, {
|
|
25
|
+
headers: { jwt },
|
|
26
|
+
});
|
|
27
|
+
return response === null || response === void 0 ? void 0 : response.data;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.PaymentClient = PaymentClient;
|
|
32
|
+
//# sourceMappingURL=payment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../src/payment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;AACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;AACjG,MAAM,UAAU,GAAG,GAAG,QAAQ,UAAU,CAAC;AACzC,MAAa,aAAa;IAClB,aAAa,CAAC,MAA6E;;YAC/F,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,UAAU,mBAAmB,SAAS,IAAI,OAAO,IAAI,QAAQ,EAAE,EAAE;gBACnG,OAAO,EAAE,EAAE,GAAG,EAAE;aACjB,CAAC,CAAC;YACH,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC;QACxB,CAAC;KAAA;CACF;AARD,sCAQC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/payment.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
const port = process.env.PAYMENT_PORT;
|
|
3
|
+
const basePath = process.env.IS_LOCAL === "true" ? `http://localhost:${port}` : "http://payment";
|
|
4
|
+
const paymentUrl = `${basePath}/payment`;
|
|
5
|
+
export class PaymentClient {
|
|
6
|
+
async getCouponById(params: { accountId: string; eventId: string; couponId: string; jwt: string }) {
|
|
7
|
+
const { accountId, eventId, couponId, jwt } = params;
|
|
8
|
+
const response = await axios.get(`${paymentUrl}/coupon/getById/${accountId}/${eventId}/${couponId}`, {
|
|
9
|
+
headers: { jwt },
|
|
10
|
+
});
|
|
11
|
+
return response?.data;
|
|
12
|
+
}
|
|
13
|
+
}
|