@konplit-services/common 1.8.1 → 1.9.0

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.
@@ -100,3 +100,4 @@ const toSmalletUnit = (value, exponent = 2) => {
100
100
  return BigInt(minorStr);
101
101
  };
102
102
  exports.toSmalletUnit = toSmalletUnit;
103
+ const value = Number((0, exports.toSmalletUnit)("4543.367487363")); // 454337n
@@ -1,2 +1,3 @@
1
1
  import { Application } from "express";
2
2
  export declare const configureSwagger: (app: Application, paths: string) => void;
3
+ export declare const configureSwaggerForTransaction: (app: Application, paths: string) => void;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.configureSwagger = void 0;
6
+ exports.configureSwaggerForTransaction = exports.configureSwagger = void 0;
7
7
  const swagger_jsdoc_1 = __importDefault(require("swagger-jsdoc"));
8
8
  const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
9
9
  const configureSwagger = (app, paths) => {
@@ -62,3 +62,59 @@ const configureSwagger = (app, paths) => {
62
62
  });
63
63
  };
64
64
  exports.configureSwagger = configureSwagger;
65
+ const configureSwaggerForTransaction = (app, paths) => {
66
+ const options = {
67
+ definition: {
68
+ openapi: "3.1.0",
69
+ info: {
70
+ title: "Valuepay Payment System Documentation",
71
+ version: "1.0.0",
72
+ description: "This is a complete API definition for the Valuepay payment system documented with Swagger UI",
73
+ license: {
74
+ name: "IEC Code Components End-user licence agreement",
75
+ url: "https://spdx.org/licenses/IEC-Code-Components-EULA.html",
76
+ },
77
+ contact: {
78
+ name: "Valuepay",
79
+ url: "https://valuepayng.com",
80
+ email: "info@valuepay.ng",
81
+ },
82
+ },
83
+ servers: [
84
+ {
85
+ url: "https://konplit.com",
86
+ },
87
+ {
88
+ url: " https://valuepay.konplit.com",
89
+ },
90
+ ],
91
+ components: {
92
+ securitySchemes: {
93
+ bearerAuth: {
94
+ type: "http",
95
+ scheme: "bearer",
96
+ bearerFormat: "JWT",
97
+ },
98
+ },
99
+ },
100
+ security: [
101
+ {
102
+ bearerAuth: [],
103
+ },
104
+ ],
105
+ },
106
+ apis: [paths],
107
+ };
108
+ const swaggerSpec = (0, swagger_jsdoc_1.default)(options);
109
+ app.use("/transactions/docs", swagger_ui_express_1.default.serve, swagger_ui_express_1.default.setup(swaggerSpec, {
110
+ explorer: true,
111
+ // customCssUrl:
112
+ // "https://cdn.jsdelivr.net/npm/swagger-ui-themes@3.0.0/themes/3.x/theme-newspaper.css",
113
+ }));
114
+ // ➕ Serve raw Swagger JSON
115
+ app.get("/transactions/api-json", (_, res) => {
116
+ res.setHeader("Content-Type", "application/json");
117
+ res.send(swaggerSpec);
118
+ });
119
+ };
120
+ exports.configureSwaggerForTransaction = configureSwaggerForTransaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",