@monnify/mcp-server 1.0.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.
Files changed (192) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +563 -0
  3. package/build/auth/tokenManager.d.ts +11 -0
  4. package/build/auth/tokenManager.d.ts.map +1 -0
  5. package/build/auth/tokenManager.js +62 -0
  6. package/build/auth/tokenManager.js.map +1 -0
  7. package/build/cli.d.ts +3 -0
  8. package/build/cli.d.ts.map +1 -0
  9. package/build/cli.js +39 -0
  10. package/build/cli.js.map +1 -0
  11. package/build/client/monnifyClient.d.ts +7 -0
  12. package/build/client/monnifyClient.d.ts.map +1 -0
  13. package/build/client/monnifyClient.js +119 -0
  14. package/build/client/monnifyClient.js.map +1 -0
  15. package/build/config/env.d.ts +47 -0
  16. package/build/config/env.d.ts.map +1 -0
  17. package/build/config/env.js +39 -0
  18. package/build/config/env.js.map +1 -0
  19. package/build/index.d.ts +36 -0
  20. package/build/index.d.ts.map +1 -0
  21. package/build/index.js +84 -0
  22. package/build/index.js.map +1 -0
  23. package/build/schemas/compat.d.ts +24 -0
  24. package/build/schemas/compat.d.ts.map +1 -0
  25. package/build/schemas/compat.js +20 -0
  26. package/build/schemas/compat.js.map +1 -0
  27. package/build/schemas/extended/collections.d.ts +439 -0
  28. package/build/schemas/extended/collections.d.ts.map +1 -0
  29. package/build/schemas/extended/collections.js +403 -0
  30. package/build/schemas/extended/collections.js.map +1 -0
  31. package/build/schemas/extended/directDebit.d.ts +123 -0
  32. package/build/schemas/extended/directDebit.d.ts.map +1 -0
  33. package/build/schemas/extended/directDebit.js +121 -0
  34. package/build/schemas/extended/directDebit.js.map +1 -0
  35. package/build/schemas/extended/verification.d.ts +55 -0
  36. package/build/schemas/extended/verification.d.ts.map +1 -0
  37. package/build/schemas/extended/verification.js +51 -0
  38. package/build/schemas/extended/verification.js.map +1 -0
  39. package/build/schemas/generated.d.ts +4 -0
  40. package/build/schemas/generated.d.ts.map +1 -0
  41. package/build/schemas/generated.js +2603 -0
  42. package/build/schemas/generated.js.map +1 -0
  43. package/build/security/guards.d.ts +5 -0
  44. package/build/security/guards.d.ts.map +1 -0
  45. package/build/security/guards.js +43 -0
  46. package/build/security/guards.js.map +1 -0
  47. package/build/security/sanitiser.d.ts +46 -0
  48. package/build/security/sanitiser.d.ts.map +1 -0
  49. package/build/security/sanitiser.js +269 -0
  50. package/build/security/sanitiser.js.map +1 -0
  51. package/build/tools/collections/authoriseCard3ds.d.ts +7 -0
  52. package/build/tools/collections/authoriseCard3ds.d.ts.map +1 -0
  53. package/build/tools/collections/authoriseCard3ds.js +63 -0
  54. package/build/tools/collections/authoriseCard3ds.js.map +1 -0
  55. package/build/tools/collections/authoriseCardOtp.d.ts +7 -0
  56. package/build/tools/collections/authoriseCardOtp.d.ts.map +1 -0
  57. package/build/tools/collections/authoriseCardOtp.js +55 -0
  58. package/build/tools/collections/authoriseCardOtp.js.map +1 -0
  59. package/build/tools/collections/chargeCard.d.ts +7 -0
  60. package/build/tools/collections/chargeCard.d.ts.map +1 -0
  61. package/build/tools/collections/chargeCard.js +59 -0
  62. package/build/tools/collections/chargeCard.js.map +1 -0
  63. package/build/tools/collections/chargeCardToken.d.ts +7 -0
  64. package/build/tools/collections/chargeCardToken.d.ts.map +1 -0
  65. package/build/tools/collections/chargeCardToken.js +68 -0
  66. package/build/tools/collections/chargeCardToken.js.map +1 -0
  67. package/build/tools/collections/createInvoice.d.ts +7 -0
  68. package/build/tools/collections/createInvoice.d.ts.map +1 -0
  69. package/build/tools/collections/createInvoice.js +57 -0
  70. package/build/tools/collections/createInvoice.js.map +1 -0
  71. package/build/tools/collections/deallocateReservedAccount.d.ts +14 -0
  72. package/build/tools/collections/deallocateReservedAccount.d.ts.map +1 -0
  73. package/build/tools/collections/deallocateReservedAccount.js +55 -0
  74. package/build/tools/collections/deallocateReservedAccount.js.map +1 -0
  75. package/build/tools/collections/getAllTransactions.d.ts +47 -0
  76. package/build/tools/collections/getAllTransactions.d.ts.map +1 -0
  77. package/build/tools/collections/getAllTransactions.js +140 -0
  78. package/build/tools/collections/getAllTransactions.js.map +1 -0
  79. package/build/tools/collections/getReservedAccount.d.ts +14 -0
  80. package/build/tools/collections/getReservedAccount.d.ts.map +1 -0
  81. package/build/tools/collections/getReservedAccount.js +55 -0
  82. package/build/tools/collections/getReservedAccount.js.map +1 -0
  83. package/build/tools/collections/getReservedAccountTransactions.d.ts +20 -0
  84. package/build/tools/collections/getReservedAccountTransactions.d.ts.map +1 -0
  85. package/build/tools/collections/getReservedAccountTransactions.js +86 -0
  86. package/build/tools/collections/getReservedAccountTransactions.js.map +1 -0
  87. package/build/tools/collections/getTransactionDetails.d.ts +14 -0
  88. package/build/tools/collections/getTransactionDetails.d.ts.map +1 -0
  89. package/build/tools/collections/getTransactionDetails.js +60 -0
  90. package/build/tools/collections/getTransactionDetails.js.map +1 -0
  91. package/build/tools/collections/getTransactionStatus.d.ts +7 -0
  92. package/build/tools/collections/getTransactionStatus.d.ts.map +1 -0
  93. package/build/tools/collections/getTransactionStatus.js +58 -0
  94. package/build/tools/collections/getTransactionStatus.js.map +1 -0
  95. package/build/tools/collections/initiatePayment.d.ts +7 -0
  96. package/build/tools/collections/initiatePayment.d.ts.map +1 -0
  97. package/build/tools/collections/initiatePayment.js +63 -0
  98. package/build/tools/collections/initiatePayment.js.map +1 -0
  99. package/build/tools/collections/payWithBankTransfer.d.ts +7 -0
  100. package/build/tools/collections/payWithBankTransfer.d.ts.map +1 -0
  101. package/build/tools/collections/payWithBankTransfer.js +55 -0
  102. package/build/tools/collections/payWithBankTransfer.js.map +1 -0
  103. package/build/tools/collections/processRefund.d.ts +7 -0
  104. package/build/tools/collections/processRefund.d.ts.map +1 -0
  105. package/build/tools/collections/processRefund.js +55 -0
  106. package/build/tools/collections/processRefund.js.map +1 -0
  107. package/build/tools/collections/reserveAccount.d.ts +7 -0
  108. package/build/tools/collections/reserveAccount.d.ts.map +1 -0
  109. package/build/tools/collections/reserveAccount.js +57 -0
  110. package/build/tools/collections/reserveAccount.js.map +1 -0
  111. package/build/tools/directDebit/cancelMandate.d.ts +7 -0
  112. package/build/tools/directDebit/cancelMandate.d.ts.map +1 -0
  113. package/build/tools/directDebit/cancelMandate.js +55 -0
  114. package/build/tools/directDebit/cancelMandate.js.map +1 -0
  115. package/build/tools/directDebit/createMandate.d.ts +7 -0
  116. package/build/tools/directDebit/createMandate.d.ts.map +1 -0
  117. package/build/tools/directDebit/createMandate.js +55 -0
  118. package/build/tools/directDebit/createMandate.js.map +1 -0
  119. package/build/tools/directDebit/debitMandate.d.ts +7 -0
  120. package/build/tools/directDebit/debitMandate.d.ts.map +1 -0
  121. package/build/tools/directDebit/debitMandate.js +55 -0
  122. package/build/tools/directDebit/debitMandate.js.map +1 -0
  123. package/build/tools/directDebit/getMandateDebitStatus.d.ts +7 -0
  124. package/build/tools/directDebit/getMandateDebitStatus.d.ts.map +1 -0
  125. package/build/tools/directDebit/getMandateDebitStatus.js +55 -0
  126. package/build/tools/directDebit/getMandateDebitStatus.js.map +1 -0
  127. package/build/tools/directDebit/getMandateStatus.d.ts +7 -0
  128. package/build/tools/directDebit/getMandateStatus.d.ts.map +1 -0
  129. package/build/tools/directDebit/getMandateStatus.js +55 -0
  130. package/build/tools/directDebit/getMandateStatus.js.map +1 -0
  131. package/build/tools/registry.d.ts +11 -0
  132. package/build/tools/registry.d.ts.map +1 -0
  133. package/build/tools/registry.js +15 -0
  134. package/build/tools/registry.js.map +1 -0
  135. package/build/tools/utilities/getSupportedBanks.d.ts +8 -0
  136. package/build/tools/utilities/getSupportedBanks.d.ts.map +1 -0
  137. package/build/tools/utilities/getSupportedBanks.js +47 -0
  138. package/build/tools/utilities/getSupportedBanks.js.map +1 -0
  139. package/build/tools/utilities/getTransactionList.d.ts +47 -0
  140. package/build/tools/utilities/getTransactionList.d.ts.map +1 -0
  141. package/build/tools/utilities/getTransactionList.js +136 -0
  142. package/build/tools/utilities/getTransactionList.js.map +1 -0
  143. package/build/tools/verification/verifyBankAccount.d.ts +7 -0
  144. package/build/tools/verification/verifyBankAccount.d.ts.map +1 -0
  145. package/build/tools/verification/verifyBankAccount.js +58 -0
  146. package/build/tools/verification/verifyBankAccount.js.map +1 -0
  147. package/build/tools/verification/verifyBvn.d.ts +7 -0
  148. package/build/tools/verification/verifyBvn.d.ts.map +1 -0
  149. package/build/tools/verification/verifyBvn.js +55 -0
  150. package/build/tools/verification/verifyBvn.js.map +1 -0
  151. package/build/tools/verification/verifyBvnInfo.d.ts +7 -0
  152. package/build/tools/verification/verifyBvnInfo.d.ts.map +1 -0
  153. package/build/tools/verification/verifyBvnInfo.js +55 -0
  154. package/build/tools/verification/verifyBvnInfo.js.map +1 -0
  155. package/build/tools/verification/verifyNin.d.ts +7 -0
  156. package/build/tools/verification/verifyNin.d.ts.map +1 -0
  157. package/build/tools/verification/verifyNin.js +55 -0
  158. package/build/tools/verification/verifyNin.js.map +1 -0
  159. package/build/transport/http.d.ts +3 -0
  160. package/build/transport/http.d.ts.map +1 -0
  161. package/build/transport/http.js +71 -0
  162. package/build/transport/http.js.map +1 -0
  163. package/build/transport/stdio.d.ts +3 -0
  164. package/build/transport/stdio.d.ts.map +1 -0
  165. package/build/transport/stdio.js +8 -0
  166. package/build/transport/stdio.js.map +1 -0
  167. package/build/types/mcp.d.ts +11 -0
  168. package/build/types/mcp.d.ts.map +1 -0
  169. package/build/types/mcp.js +7 -0
  170. package/build/types/mcp.js.map +1 -0
  171. package/build/utils/clientContext.d.ts +7 -0
  172. package/build/utils/clientContext.d.ts.map +1 -0
  173. package/build/utils/clientContext.js +24 -0
  174. package/build/utils/clientContext.js.map +1 -0
  175. package/build/utils/errors.d.ts +21 -0
  176. package/build/utils/errors.d.ts.map +1 -0
  177. package/build/utils/errors.js +45 -0
  178. package/build/utils/errors.js.map +1 -0
  179. package/build/utils/format.d.ts +34 -0
  180. package/build/utils/format.d.ts.map +1 -0
  181. package/build/utils/format.js +362 -0
  182. package/build/utils/format.js.map +1 -0
  183. package/build/utils/formatters.d.ts +4 -0
  184. package/build/utils/formatters.d.ts.map +1 -0
  185. package/build/utils/formatters.js +26 -0
  186. package/build/utils/formatters.js.map +1 -0
  187. package/build/utils/logger.d.ts +3 -0
  188. package/build/utils/logger.d.ts.map +1 -0
  189. package/build/utils/logger.js +30 -0
  190. package/build/utils/logger.js.map +1 -0
  191. package/openapi/monnify.yaml +9295 -0
  192. package/package.json +55 -0
@@ -0,0 +1,71 @@
1
+ import express from "express";
2
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
3
+ import { env } from "../config/env.js";
4
+ import { logger } from "../utils/logger.js";
5
+ // In-memory rate limiter: 100 requests per minute per IP
6
+ const rlMap = new Map();
7
+ function rateLimit(req, res, next) {
8
+ const ip = req.ip ?? "unknown";
9
+ const now = Date.now();
10
+ const entry = rlMap.get(ip);
11
+ if (!entry || now > entry.resetAt) {
12
+ rlMap.set(ip, { count: 1, resetAt: now + 60_000 });
13
+ next();
14
+ return;
15
+ }
16
+ if (entry.count >= 100) {
17
+ res.setHeader("Retry-After", "60");
18
+ res.status(429).json({ error: "Rate limit exceeded. Try again in 60 seconds." });
19
+ return;
20
+ }
21
+ entry.count++;
22
+ next();
23
+ }
24
+ function bearerAuth(token) {
25
+ return (req, res, next) => {
26
+ const auth = req.headers["authorization"];
27
+ if (!auth || auth !== `Bearer ${token}`) {
28
+ res
29
+ .status(401)
30
+ .json({ error: "Unauthorized. Provide a valid Authorization: Bearer <token> header." });
31
+ return;
32
+ }
33
+ next();
34
+ };
35
+ }
36
+ export async function startHttpTransport(server) {
37
+ const app = express();
38
+ app.use(express.json());
39
+ const httpToken = env().MONNIFY_HTTP_TOKEN;
40
+ if (!httpToken) {
41
+ logger.warn("HTTP transport is running WITHOUT authentication. " +
42
+ "Set MONNIFY_HTTP_TOKEN to secure the /mcp endpoint before exposing it beyond localhost.");
43
+ }
44
+ // Health check — unauthenticated, no sensitive data
45
+ app.get("/health", (_req, res) => {
46
+ res.json({ status: "ok", service: "monnify-mcp" });
47
+ });
48
+ const transport = new StreamableHTTPServerTransport();
49
+ await server.connect(transport);
50
+ const guards = [rateLimit];
51
+ if (httpToken)
52
+ guards.push(bearerAuth(httpToken));
53
+ app.post("/mcp", guards, async (req, res) => {
54
+ await transport.handleRequest(req, res, req.body);
55
+ });
56
+ app.get("/mcp", guards, async (req, res) => {
57
+ await transport.handleRequest(req, res);
58
+ });
59
+ app.delete("/mcp", guards, async (req, res) => {
60
+ await transport.handleRequest(req, res);
61
+ });
62
+ const port = env().PORT;
63
+ app.listen(port, () => {
64
+ logger.info("Monnify MCP server started", {
65
+ transport: "http",
66
+ port,
67
+ auth: httpToken ? "bearer-token" : "none (unauthenticated — set MONNIFY_HTTP_TOKEN)",
68
+ });
69
+ });
70
+ }
71
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/transport/http.ts"],"names":[],"mappings":"AAAA,OAAO,OAA2D,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAGnG,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,yDAAyD;AACzD,MAAM,KAAK,GAAG,IAAI,GAAG,EAA8C,CAAC;AAEpE,SAAS,SAAS,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB;IAChE,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,IAAI,SAAS,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAE5B,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;QAClC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,EAA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,iDAAiD;SACrF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ export declare function startStdioTransport(server: Server): Promise<void>;
3
+ //# sourceMappingURL=stdio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/transport/stdio.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGxE,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvE"}
@@ -0,0 +1,8 @@
1
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
+ import { logger } from "../utils/logger.js";
3
+ export async function startStdioTransport(server) {
4
+ const transport = new StdioServerTransport();
5
+ await server.connect(transport);
6
+ logger.info("Monnify MCP server started", { transport: "stdio" });
7
+ }
8
+ //# sourceMappingURL=stdio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/transport/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAc;IACtD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface McpTextContent {
2
+ type: "text";
3
+ text: string;
4
+ }
5
+ export interface McpToolResult {
6
+ content: McpTextContent[];
7
+ isError?: boolean;
8
+ }
9
+ export declare function successResult(text: string): McpToolResult;
10
+ export declare function errorResult(text: string): McpToolResult;
11
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAEzD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAEvD"}
@@ -0,0 +1,7 @@
1
+ export function successResult(text) {
2
+ return { content: [{ type: "text", text }] };
3
+ }
4
+ export function errorResult(text) {
5
+ return { content: [{ type: "text", text }], isError: true };
6
+ }
7
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,7 @@
1
+ type ResponseFormat = "markdown" | "json";
2
+ export declare function setClientName(name: string | undefined): void;
3
+ export declare function setFormatOverride(format: ResponseFormat | undefined): void;
4
+ export declare function getClientName(): string | undefined;
5
+ export declare function getResponseFormat(): ResponseFormat;
6
+ export {};
7
+ //# sourceMappingURL=clientContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientContext.d.ts","sourceRoot":"","sources":["../../src/utils/clientContext.ts"],"names":[],"mappings":"AAGA,KAAK,cAAc,GAAG,UAAU,GAAG,MAAM,CAAC;AAQ1C,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAE5D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAE1E;AAED,wBAAgB,aAAa,IAAI,MAAM,GAAG,SAAS,CAElD;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAKlD"}
@@ -0,0 +1,24 @@
1
+ // Tracks which MCP client connected and derives the preferred response format.
2
+ // Set once during server initialization via setClientName(); read everywhere else.
3
+ let _clientName;
4
+ let _formatOverride;
5
+ // Claude-based clients that prefer conversational Markdown responses
6
+ const MARKDOWN_CLIENTS = ["claude", "anthropic"];
7
+ export function setClientName(name) {
8
+ _clientName = name?.toLowerCase();
9
+ }
10
+ export function setFormatOverride(format) {
11
+ _formatOverride = format;
12
+ }
13
+ export function getClientName() {
14
+ return _clientName;
15
+ }
16
+ export function getResponseFormat() {
17
+ if (_formatOverride)
18
+ return _formatOverride;
19
+ if (!_clientName)
20
+ return "markdown"; // default: conversational until we know otherwise
21
+ const isClaudeClient = MARKDOWN_CLIENTS.some(n => _clientName.includes(n));
22
+ return isClaudeClient ? "markdown" : "json";
23
+ }
24
+ //# sourceMappingURL=clientContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientContext.js","sourceRoot":"","sources":["../../src/utils/clientContext.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,mFAAmF;AAInF,IAAI,WAA+B,CAAC;AACpC,IAAI,eAA2C,CAAC;AAEhD,qEAAqE;AACrE,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEjD,MAAM,UAAU,aAAa,CAAC,IAAwB;IACpD,WAAW,GAAG,IAAI,EAAE,WAAW,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAkC;IAClE,eAAe,GAAG,MAAM,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,IAAI,eAAe;QAAE,OAAO,eAAe,CAAC;IAC5C,IAAI,CAAC,WAAW;QAAE,OAAO,UAAU,CAAC,CAAC,kDAAkD;IACvF,MAAM,cAAc,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,WAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,OAAO,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ import type { McpTextContent } from "../types/mcp.js";
3
+ export declare class MonnifyApiError extends Error {
4
+ readonly responseCode: string;
5
+ readonly responseMessage: string;
6
+ readonly httpStatus: number;
7
+ readonly requestReference?: string | undefined;
8
+ constructor(responseCode: string, responseMessage: string, httpStatus: number, requestReference?: string | undefined);
9
+ toMcpContent(): McpTextContent;
10
+ }
11
+ export declare class ValidationError extends Error {
12
+ readonly zodError: z.ZodError;
13
+ constructor(zodError: z.ZodError);
14
+ toMcpContent(): McpTextContent;
15
+ }
16
+ export declare class McpToolError extends Error {
17
+ readonly toolName: string;
18
+ readonly cause: unknown;
19
+ constructor(toolName: string, cause: unknown);
20
+ }
21
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,qBAAa,eAAgB,SAAQ,KAAK;aAEtB,YAAY,EAAE,MAAM;aACpB,eAAe,EAAE,MAAM;aACvB,UAAU,EAAE,MAAM;aAClB,gBAAgB,CAAC,EAAE,MAAM;gBAHzB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,MAAM,YAAA;IAM3C,YAAY,IAAI,cAAc;CAQ/B;AAED,qBAAa,eAAgB,SAAQ,KAAK;aACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBAApB,QAAQ,EAAE,CAAC,CAAC,QAAQ;IAKhD,YAAY,IAAI,cAAc;CAM/B;AAED,qBAAa,YAAa,SAAQ,KAAK;aAEnB,QAAQ,EAAE,MAAM;aAChB,KAAK,EAAE,OAAO;gBADd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO;CAKjC"}
@@ -0,0 +1,45 @@
1
+ export class MonnifyApiError extends Error {
2
+ responseCode;
3
+ responseMessage;
4
+ httpStatus;
5
+ requestReference;
6
+ constructor(responseCode, responseMessage, httpStatus, requestReference) {
7
+ super(responseMessage);
8
+ this.responseCode = responseCode;
9
+ this.responseMessage = responseMessage;
10
+ this.httpStatus = httpStatus;
11
+ this.requestReference = requestReference;
12
+ this.name = "MonnifyApiError";
13
+ }
14
+ toMcpContent() {
15
+ return {
16
+ type: "text",
17
+ text: `Monnify API Error [${this.responseCode}]: ${this.responseMessage}${this.requestReference ? ` (ref: ${this.requestReference})` : ""}`,
18
+ };
19
+ }
20
+ }
21
+ export class ValidationError extends Error {
22
+ zodError;
23
+ constructor(zodError) {
24
+ super("Input validation failed");
25
+ this.zodError = zodError;
26
+ this.name = "ValidationError";
27
+ }
28
+ toMcpContent() {
29
+ const issues = this.zodError.issues
30
+ .map((i) => ` - ${i.path.join(".")}: ${i.message}`)
31
+ .join("\n");
32
+ return { type: "text", text: `Validation failed:\n${issues}` };
33
+ }
34
+ }
35
+ export class McpToolError extends Error {
36
+ toolName;
37
+ cause;
38
+ constructor(toolName, cause) {
39
+ super(`Tool ${toolName} failed`);
40
+ this.toolName = toolName;
41
+ this.cause = cause;
42
+ this.name = "McpToolError";
43
+ }
44
+ }
45
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAEtB;IACA;IACA;IACA;IAJlB,YACkB,YAAoB,EACpB,eAAuB,EACvB,UAAkB,EAClB,gBAAyB;QAEzC,KAAK,CAAC,eAAe,CAAC,CAAC;QALP,iBAAY,GAAZ,YAAY,CAAQ;QACpB,oBAAe,GAAf,eAAe,CAAQ;QACvB,eAAU,GAAV,UAAU,CAAQ;QAClB,qBAAgB,GAAhB,gBAAgB,CAAS;QAGzC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;IAED,YAAY;QACV,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,sBAAsB,IAAI,CAAC,YAAY,MAAM,IAAI,CAAC,eAAe,GACrE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,EAC/D,EAAE;SACH,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACZ;IAA5B,YAA4B,QAAoB;QAC9C,KAAK,CAAC,yBAAyB,CAAC,CAAC;QADP,aAAQ,GAAR,QAAQ,CAAY;QAE9C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;IAED,YAAY;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM;aAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;aACnD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,MAAM,EAAE,EAAE,CAAC;IACjE,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IAEnB;IACA;IAFlB,YACkB,QAAgB,EAChB,KAAc;QAE9B,KAAK,CAAC,QAAQ,QAAQ,SAAS,CAAC,CAAC;QAHjB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,UAAK,GAAL,KAAK,CAAS;QAG9B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,34 @@
1
+ export declare function formatBankAccountVerification(d: Record<string, unknown>): string;
2
+ export declare function formatBvnVerification(d: Record<string, unknown>): string;
3
+ export declare function formatBvnInfo(d: Record<string, unknown>): string;
4
+ export declare function formatNinVerification(d: Record<string, unknown>): string;
5
+ export declare function formatSupportedBanks(banks: Array<Record<string, unknown>>): string;
6
+ export declare function formatInitiatePayment(d: Record<string, unknown>): string;
7
+ export declare function formatTransactionStatus(d: Record<string, unknown>): string;
8
+ export declare function formatAllTransactions(content: Array<Record<string, unknown>>, meta: {
9
+ totalElements: unknown;
10
+ totalPages: unknown;
11
+ size: unknown;
12
+ number: unknown;
13
+ }): string;
14
+ export declare function formatReserveAccount(d: Record<string, unknown>): string;
15
+ export declare function formatCreateInvoice(d: Record<string, unknown>): string;
16
+ export declare function formatChargeCard(d: Record<string, unknown>): string;
17
+ export declare function formatAuthoriseCardOtp(d: Record<string, unknown>): string;
18
+ export declare function formatAuthoriseCard3ds(d: Record<string, unknown>): string;
19
+ export declare function formatChargeCardToken(d: Record<string, unknown>): string;
20
+ export declare function formatBankTransferPayment(d: Record<string, unknown>): string;
21
+ export declare function formatProcessRefund(d: Record<string, unknown>): string;
22
+ export declare function formatCreateMandate(d: Record<string, unknown>): string;
23
+ export declare function formatMandateStatus(d: Record<string, unknown>): string;
24
+ export declare function formatDebitStatus(d: Record<string, unknown>): string;
25
+ export declare function formatReservedAccountDetails(d: Record<string, unknown>): string;
26
+ export declare function formatReservedAccountTransactions(transactions: Array<Record<string, unknown>>, meta: {
27
+ totalElements: unknown;
28
+ totalPages: unknown;
29
+ number: unknown;
30
+ accountReference: string;
31
+ }): string;
32
+ export declare function formatDeallocateAccount(d: Record<string, unknown>): string;
33
+ export declare function formatCancelMandate(d: Record<string, unknown>): string;
34
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAgCA,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQhF;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CASxE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAUhE;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAWxE;AAID,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAUlF;AAID,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAgBxE;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAc1E;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACvC,IAAI,EAAE;IAAE,aAAa,EAAE,OAAO,CAAC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AAC,GAAG,MAAM,CAqB/E;AAED,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC5C,IAAI,EAAE;IAAE,aAAa,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,GAC/F,MAAM,CAmBR;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAU1E;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQtE"}
@@ -0,0 +1,362 @@
1
+ // Formatting helpers — convert sanitised API payloads into readable Markdown for MCP responses.
2
+ function naira(amount) {
3
+ const n = Number(amount);
4
+ if (isNaN(n))
5
+ return String(amount ?? "—");
6
+ return `â‚Ļ${n.toLocaleString("en-NG", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
7
+ }
8
+ function humanDate(raw) {
9
+ if (!raw)
10
+ return "—";
11
+ const d = new Date(String(raw));
12
+ if (isNaN(d.getTime()))
13
+ return String(raw);
14
+ return d.toLocaleString("en-NG", {
15
+ day: "numeric", month: "short", year: "numeric",
16
+ hour: "2-digit", minute: "2-digit", timeZone: "Africa/Lagos",
17
+ });
18
+ }
19
+ function statusIcon(status) {
20
+ const s = String(status ?? "").toUpperCase();
21
+ if (["PAID", "SUCCESS", "ACTIVE", "APPROVED", "VERIFIED", "MATCHED", "COMPLETED"].some(v => s.includes(v)))
22
+ return "✅";
23
+ if (["FAILED", "CANCELLED", "REJECTED", "INVALID", "DECLINED"].some(v => s.includes(v)))
24
+ return "❌";
25
+ if (["PENDING", "PROCESSING", "INITIATED"].some(v => s.includes(v)))
26
+ return "âŗ";
27
+ return "â„šī¸";
28
+ }
29
+ function boolIcon(val) {
30
+ return val === true || val === "true" ? "✅ Yes" : val === false || val === "false" ? "❌ No" : "—";
31
+ }
32
+ // ── Verification ──────────────────────────────────────────────────────────────
33
+ export function formatBankAccountVerification(d) {
34
+ return [
35
+ `✅ **Account Verified**`,
36
+ ``,
37
+ `**Account Name:** ${d["accountName"] ?? "—"}`,
38
+ `**Account Number:** ${d["accountNumber"] ?? "—"}`,
39
+ `**Bank:** ${d["bankName"] ?? "—"} (${d["bankCode"] ?? "—"})`,
40
+ ].join("\n");
41
+ }
42
+ export function formatBvnVerification(d) {
43
+ return [
44
+ `🔍 **BVN Verification Result**`,
45
+ ``,
46
+ `**BVN:** ${d["bvn"] ?? "—"}`,
47
+ `**Name Match:** ${boolIcon(d["nameMatch"])}`,
48
+ `**Mobile Number Match:** ${boolIcon(d["mobileNoMatch"])}`,
49
+ `**Date of Birth Match:** ${boolIcon(d["dateOfBirthMatch"])}`,
50
+ ].join("\n");
51
+ }
52
+ export function formatBvnInfo(d) {
53
+ return [
54
+ `🔍 **BVN Information**`,
55
+ ``,
56
+ `**BVN:** ${d["bvn"] ?? "—"}`,
57
+ `**Name:** ${d["name"] ?? "—"}`,
58
+ `**Date of Birth:** ${d["dateOfBirth"] ?? "—"}`,
59
+ `**Mobile Number:** ${d["mobileNo"] ?? "—"}`,
60
+ `**Information Match:** ${boolIcon(d["bvnInformationMatch"])}`,
61
+ ].join("\n");
62
+ }
63
+ export function formatNinVerification(d) {
64
+ return [
65
+ `🔍 **NIN Verification Result**`,
66
+ ``,
67
+ `**NIN:** ${d["nin"] ?? "—"}`,
68
+ `**Name:** ${[d["firstName"], d["lastName"]].filter(Boolean).join(" ") || "—"}`,
69
+ `**Date of Birth:** ${d["dateOfBirth"] ?? "—"}`,
70
+ `**Gender:** ${d["gender"] ?? "—"}`,
71
+ `**Phone Number:** ${d["phoneNumber"] ?? "—"}`,
72
+ `**Information Match:** ${boolIcon(d["ninInformationMatch"])}`,
73
+ ].join("\n");
74
+ }
75
+ // ── Utilities ─────────────────────────────────────────────────────────────────
76
+ export function formatSupportedBanks(banks) {
77
+ if (!banks.length)
78
+ return "No supported banks found.";
79
+ const rows = banks.map(b => `| ${b["name"] ?? "—"} | ${b["code"] ?? "—"} |`).join("\n");
80
+ return [
81
+ `đŸĻ **Supported Banks** (${banks.length} total)`,
82
+ ``,
83
+ `| Bank Name | Code |`,
84
+ `|-----------|------|`,
85
+ rows,
86
+ ].join("\n");
87
+ }
88
+ // ── Collections ───────────────────────────────────────────────────────────────
89
+ export function formatInitiatePayment(d) {
90
+ const methods = Array.isArray(d["enabledPaymentMethod"])
91
+ ? d["enabledPaymentMethod"].join(", ")
92
+ : String(d["enabledPaymentMethod"] ?? "—");
93
+ return [
94
+ `đŸ’ŗ **Payment Initiated**`,
95
+ ``,
96
+ `**Transaction Reference:** ${d["transactionReference"] ?? "—"}`,
97
+ `**Payment Reference:** ${d["paymentReference"] ?? "—"}`,
98
+ `**Merchant:** ${d["merchantName"] ?? "—"}`,
99
+ `**Payment Methods:** ${methods}`,
100
+ ``,
101
+ `**Checkout URL:** ${d["checkoutUrl"] ?? "—"}`,
102
+ ``,
103
+ `> Share the checkout URL with your customer to complete payment.`,
104
+ ].join("\n");
105
+ }
106
+ export function formatTransactionStatus(d) {
107
+ const status = String(d["paymentStatus"] ?? "UNKNOWN");
108
+ return [
109
+ `${statusIcon(status)} **Transaction Status: ${status}**`,
110
+ ``,
111
+ `**Transaction Reference:** ${d["transactionReference"] ?? "—"}`,
112
+ `**Payment Reference:** ${d["paymentReference"] ?? "—"}`,
113
+ `**Amount Paid:** ${naira(d["amountPaid"])}`,
114
+ `**Total Payable:** ${naira(d["totalPayable"])}`,
115
+ d["settledAmount"] !== undefined ? `**Settled Amount:** ${naira(d["settledAmount"])}` : null,
116
+ `**Currency:** ${d["currencyCode"] ?? "—"}`,
117
+ `**Payment Method:** ${d["paymentMethod"] ?? "—"}`,
118
+ `**Paid On:** ${humanDate(d["paidOn"])}`,
119
+ ].filter(Boolean).join("\n");
120
+ }
121
+ export function formatAllTransactions(content, meta) {
122
+ if (!content.length) {
123
+ return `📭 **No transactions found** matching your filters.`;
124
+ }
125
+ const rows = content.map(tx => {
126
+ const status = String(tx["paymentStatus"] ?? "");
127
+ return `| ${statusIcon(status)} ${status} | ${tx["transactionReference"] ?? "—"} | ${naira(tx["amountPaid"])} | ${humanDate(tx["paidOn"])} |`;
128
+ }).join("\n");
129
+ const page = Number(meta.number ?? 0) + 1;
130
+ const totalPages = Number(meta.totalPages ?? 1);
131
+ return [
132
+ `📋 **Transactions** — ${meta.totalElements ?? 0} total | Page ${page} of ${totalPages}`,
133
+ ``,
134
+ `| Status | Reference | Amount | Date |`,
135
+ `|--------|-----------|--------|------|`,
136
+ rows,
137
+ ].join("\n");
138
+ }
139
+ export function formatReserveAccount(d) {
140
+ const accounts = Array.isArray(d["accounts"])
141
+ ? d["accounts"]
142
+ .map(a => ` â€ĸ **${a["bankName"] ?? a["bankCode"] ?? "Bank"}:** ${a["accountNumber"] ?? "—"}`)
143
+ .join("\n")
144
+ : "—";
145
+ return [
146
+ `đŸĻ **Reserved Account Created**`,
147
+ ``,
148
+ `**Account Name:** ${d["accountName"] ?? "—"}`,
149
+ `**Customer:** ${d["customerName"] ?? "—"} (${d["customerEmail"] ?? "—"})`,
150
+ `**Status:** ${statusIcon(d["status"])} ${d["status"] ?? "—"}`,
151
+ `**Account Reference:** ${d["accountReference"] ?? "—"}`,
152
+ `**Reservation Reference:** ${d["reservationReference"] ?? "—"}`,
153
+ `**Currency:** ${d["currencyCode"] ?? "—"}`,
154
+ `**Created On:** ${humanDate(d["createdOn"])}`,
155
+ ``,
156
+ `**Virtual Account Numbers:**`,
157
+ accounts,
158
+ ].join("\n");
159
+ }
160
+ export function formatCreateInvoice(d) {
161
+ return [
162
+ `🧾 **Invoice Created**`,
163
+ ``,
164
+ `**Invoice Reference:** ${d["invoiceReference"] ?? "—"}`,
165
+ `**Status:** ${statusIcon(d["invoiceStatus"])} ${d["invoiceStatus"] ?? "—"}`,
166
+ `**Amount:** ${naira(d["amount"])}`,
167
+ `**Customer:** ${d["customerName"] ?? "—"} (${d["customerEmail"] ?? "—"})`,
168
+ `**Expires:** ${humanDate(d["expiryDate"])}`,
169
+ `**Created On:** ${humanDate(d["createdOn"])}`,
170
+ d["offlinePaymentCode"] ? `**Offline Payment Code:** ${d["offlinePaymentCode"]}` : null,
171
+ ``,
172
+ `**Invoice URL:** ${d["invoiceUrl"] ?? d["checkoutUrl"] ?? "—"}`,
173
+ ].filter(Boolean).join("\n");
174
+ }
175
+ export function formatChargeCard(d) {
176
+ const status = String(d["status"] ?? "");
177
+ const lines = [
178
+ `đŸ’ŗ **Card Charge ${statusIcon(status)} ${status}**`,
179
+ ``,
180
+ `**Transaction Reference:** ${d["transactionReference"] ?? "—"}`,
181
+ `**Payment Reference:** ${d["paymentReference"] ?? "—"}`,
182
+ `**Authorized Amount:** ${naira(d["authorizedAmount"])}`,
183
+ `**Message:** ${d["message"] ?? "—"}`,
184
+ ];
185
+ if (d["otpData"]) {
186
+ lines.push(``, `> An OTP has been sent. Use \`monnify_authorise_card_otp\` to complete this transaction.`);
187
+ }
188
+ if (d["secure3dData"]) {
189
+ const redirect = d["secure3dData"]?.["redirectUrl"] ?? "—";
190
+ lines.push(``, `**3DS Redirect URL:** ${redirect}`);
191
+ lines.push(`> Redirect the customer to complete 3D Secure authentication.`);
192
+ }
193
+ return lines.join("\n");
194
+ }
195
+ export function formatAuthoriseCardOtp(d) {
196
+ const status = String(d["status"] ?? "");
197
+ return [
198
+ `🔐 **OTP Authorisation ${statusIcon(status)} ${status}**`,
199
+ ``,
200
+ `**Transaction Reference:** ${d["transactionReference"] ?? "—"}`,
201
+ `**Payment Reference:** ${d["paymentReference"] ?? "—"}`,
202
+ `**Authorized Amount:** ${naira(d["authorizedAmount"])}`,
203
+ `**Message:** ${d["message"] ?? "—"}`,
204
+ ].join("\n");
205
+ }
206
+ export function formatAuthoriseCard3ds(d) {
207
+ const status = String(d["status"] ?? "");
208
+ return [
209
+ `🔐 **3DS Authorisation ${statusIcon(status)} ${status}**`,
210
+ ``,
211
+ `**Transaction Reference:** ${d["transactionReference"] ?? "—"}`,
212
+ `**Payment Reference:** ${d["paymentReference"] ?? "—"}`,
213
+ `**Authorized Amount:** ${naira(d["authorizedAmount"])}`,
214
+ d["redirectUrl"] ? `**Redirect URL:** ${d["redirectUrl"]}` : null,
215
+ ].filter(Boolean).join("\n");
216
+ }
217
+ export function formatChargeCardToken(d) {
218
+ const status = String(d["paymentStatus"] ?? "");
219
+ return [
220
+ `đŸ’ŗ **Card Token Charge ${statusIcon(status)} ${status}**`,
221
+ ``,
222
+ `**Transaction Reference:** ${d["transactionReference"] ?? "—"}`,
223
+ `**Payment Reference:** ${d["paymentReference"] ?? "—"}`,
224
+ `**Amount Paid:** ${naira(d["amountPaid"])}`,
225
+ `**Total Payable:** ${naira(d["totalPayable"])}`,
226
+ `**Settlement Amount:** ${naira(d["settlementAmount"])}`,
227
+ `**Currency:** ${d["currency"] ?? "—"}`,
228
+ `**Payment Method:** ${d["paymentMethod"] ?? "—"}`,
229
+ `**Paid On:** ${humanDate(d["paidOn"])}`,
230
+ ].join("\n");
231
+ }
232
+ export function formatBankTransferPayment(d) {
233
+ return [
234
+ `đŸĻ **Bank Transfer Payment Details**`,
235
+ ``,
236
+ `**Pay ${naira(d["amount"])} to:**`,
237
+ `**Account Number:** ${d["accountNumber"] ?? "—"}`,
238
+ `**Account Name:** ${d["accountName"] ?? "—"}`,
239
+ `**Bank:** ${d["bankName"] ?? "—"} (${d["bankCode"] ?? "—"})`,
240
+ ``,
241
+ `**Fee:** ${naira(d["fee"])}`,
242
+ `**Total Payable (inc. fee):** ${naira(d["totalPayableFee"])}`,
243
+ `**Expires:** ${humanDate(d["expiryDate"])}`,
244
+ ``,
245
+ `> Transfer the exact amount above before the expiry time.`,
246
+ ].join("\n");
247
+ }
248
+ export function formatProcessRefund(d) {
249
+ const status = String(d["refundStatus"] ?? "");
250
+ return [
251
+ `â†Šī¸ **Refund ${statusIcon(status)} ${status}**`,
252
+ ``,
253
+ `**Refund Reference:** ${d["refundReference"] ?? "—"}`,
254
+ `**Transaction Reference:** ${d["transactionReference"] ?? "—"}`,
255
+ `**Refund Amount:** ${naira(d["refundAmount"])}`,
256
+ `**Reason:** ${d["refundReason"] ?? "—"}`,
257
+ `**Destination Account:** ${d["destinationAccountNumber"] ?? "—"} (${d["destinationAccountBankCode"] ?? "—"})`,
258
+ `**Initiated On:** ${humanDate(d["createdOn"])}`,
259
+ ].join("\n");
260
+ }
261
+ // ── Direct Debit ──────────────────────────────────────────────────────────────
262
+ export function formatCreateMandate(d) {
263
+ const status = String(d["mandateStatus"] ?? "");
264
+ return [
265
+ `📄 **Direct Debit Mandate Created**`,
266
+ ``,
267
+ `**Mandate Reference:** ${d["mandateReference"] ?? "—"}`,
268
+ `**Mandate Code:** ${d["mandateCode"] ?? "—"}`,
269
+ `**Status:** ${statusIcon(status)} ${status}`,
270
+ `**Amount:** ${naira(d["mandateAmount"])}`,
271
+ `**Valid:** ${humanDate(d["startDate"])} → ${humanDate(d["endDate"])}`,
272
+ ``,
273
+ `**Authorization Link:** ${d["authorizationLink"] ?? "—"}`,
274
+ ``,
275
+ `> Share the authorization link with the customer to approve the mandate.`,
276
+ ].join("\n");
277
+ }
278
+ export function formatMandateStatus(d) {
279
+ const status = String(d["mandateStatus"] ?? "");
280
+ return [
281
+ `${statusIcon(status)} **Mandate Status: ${status}**`,
282
+ ``,
283
+ `**Mandate Reference:** ${d["mandateReference"] ?? "—"}`,
284
+ `**Mandate Code:** ${d["mandateCode"] ?? "—"}`,
285
+ `**Customer:** ${d["customerName"] ?? "—"} — ${d["customerAccountNumber"] ?? "—"}`,
286
+ `**Amount:** ${naira(d["mandateAmount"])}`,
287
+ `**Valid:** ${humanDate(d["startDate"])} → ${humanDate(d["endDate"])}`,
288
+ d["authorizationLink"] ? `**Authorization Link:** ${d["authorizationLink"]}` : null,
289
+ ].filter(Boolean).join("\n");
290
+ }
291
+ export function formatDebitStatus(d) {
292
+ const status = String(d["debitStatus"] ?? "");
293
+ return [
294
+ `${statusIcon(status)} **Debit Status: ${status}**`,
295
+ ``,
296
+ `**Debit Reference:** ${d["debitReference"] ?? "—"}`,
297
+ `**Mandate Reference:** ${d["mandateReference"] ?? "—"}`,
298
+ `**Amount:** ${naira(d["amount"])}`,
299
+ `**Debit Date:** ${humanDate(d["debitDate"])}`,
300
+ ].join("\n");
301
+ }
302
+ // ── Reserved Account Management ───────────────────────────────────────────────
303
+ export function formatReservedAccountDetails(d) {
304
+ const accounts = Array.isArray(d["accounts"])
305
+ ? d["accounts"]
306
+ .map(a => ` â€ĸ **${a["bankName"] ?? a["bankCode"] ?? "Bank"}:** ${a["accountNumber"] ?? "—"}`)
307
+ .join("\n")
308
+ : "—";
309
+ return [
310
+ `đŸĻ **Reserved Account Details**`,
311
+ ``,
312
+ `**Account Name:** ${d["accountName"] ?? "—"}`,
313
+ `**Customer:** ${d["customerName"] ?? "—"} (${d["customerEmail"] ?? "—"})`,
314
+ `**Status:** ${statusIcon(d["status"])} ${d["status"] ?? "—"}`,
315
+ `**Account Reference:** ${d["accountReference"] ?? "—"}`,
316
+ `**Reservation Reference:** ${d["reservationReference"] ?? "—"}`,
317
+ `**Currency:** ${d["currencyCode"] ?? "—"}`,
318
+ `**Created On:** ${humanDate(d["createdOn"])}`,
319
+ ``,
320
+ `**Virtual Account Numbers:**`,
321
+ accounts,
322
+ ].join("\n");
323
+ }
324
+ export function formatReservedAccountTransactions(transactions, meta) {
325
+ if (!transactions.length) {
326
+ return `📭 **No transactions found** for reserved account **${meta.accountReference}**.`;
327
+ }
328
+ const rows = transactions.map(tx => {
329
+ const status = String(tx["paymentStatus"] ?? "");
330
+ return `| ${statusIcon(status)} ${status} | ${tx["transactionReference"] ?? "—"} | ${naira(tx["amountPaid"])} | ${humanDate(tx["paidOn"])} |`;
331
+ }).join("\n");
332
+ const page = Number(meta.number ?? 0) + 1;
333
+ const totalPages = Number(meta.totalPages ?? 1);
334
+ return [
335
+ `📋 **Transactions for ${meta.accountReference}** — ${meta.totalElements ?? 0} total | Page ${page} of ${totalPages}`,
336
+ ``,
337
+ `| Status | Reference | Amount | Date |`,
338
+ `|--------|-----------|--------|------|`,
339
+ rows,
340
+ ].join("\n");
341
+ }
342
+ export function formatDeallocateAccount(d) {
343
+ return [
344
+ `đŸ—‘ī¸ **Reserved Account Deallocated**`,
345
+ ``,
346
+ `**Account Reference:** ${d["accountReference"] ?? "—"}`,
347
+ `**Account Name:** ${d["accountName"] ?? "—"}`,
348
+ `**Status:** ${d["status"] ?? "—"}`,
349
+ ``,
350
+ `> This virtual account has been permanently removed and can no longer receive payments.`,
351
+ ].join("\n");
352
+ }
353
+ export function formatCancelMandate(d) {
354
+ const status = String(d["mandateStatus"] ?? "");
355
+ return [
356
+ `${statusIcon(status)} **Mandate ${status}**`,
357
+ ``,
358
+ `**Mandate Reference:** ${d["mandateReference"] ?? "—"}`,
359
+ `**Status:** ${status}`,
360
+ ].join("\n");
361
+ }
362
+ //# sourceMappingURL=format.js.map