@singularity-payments/hono 1.1.1 → 1.2.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.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +24 -0
- package/dist/index.mjs +24 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -48,6 +48,29 @@ function createMpesaHandlers(client) {
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
+
simulateC2B: async (c) => {
|
|
52
|
+
try {
|
|
53
|
+
const { amount, phoneNumber, billRefNumber, commandID } = await c.req.json();
|
|
54
|
+
if (!amount || !phoneNumber || !billRefNumber) {
|
|
55
|
+
return c.json(
|
|
56
|
+
{
|
|
57
|
+
error: "Amount, phone number, and bill reference number are required"
|
|
58
|
+
},
|
|
59
|
+
400
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
const response = await client.simulateC2B({
|
|
63
|
+
amount: Number(amount),
|
|
64
|
+
phoneNumber: String(phoneNumber),
|
|
65
|
+
billRefNumber: String(billRefNumber),
|
|
66
|
+
commandID
|
|
67
|
+
});
|
|
68
|
+
return c.json(response);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error("C2B Simulate error:", error);
|
|
71
|
+
return c.json({ error: error.message || "Request failed" }, 500);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
51
74
|
c2bValidation: async (c) => {
|
|
52
75
|
try {
|
|
53
76
|
const body = await c.req.json();
|
|
@@ -520,6 +543,7 @@ function createMpesa(config, options) {
|
|
|
520
543
|
app.post("/reversal-timeout", handlers.reversalTimeout);
|
|
521
544
|
app.post("/status-result", handlers.statusResult);
|
|
522
545
|
app.post("/status-timeout", handlers.statusTimeout);
|
|
546
|
+
app.post("/simulate-c2b", handlers.simulateC2B);
|
|
523
547
|
return {
|
|
524
548
|
client,
|
|
525
549
|
handlers,
|
package/dist/index.mjs
CHANGED
|
@@ -22,6 +22,29 @@ function createMpesaHandlers(client) {
|
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
+
simulateC2B: async (c) => {
|
|
26
|
+
try {
|
|
27
|
+
const { amount, phoneNumber, billRefNumber, commandID } = await c.req.json();
|
|
28
|
+
if (!amount || !phoneNumber || !billRefNumber) {
|
|
29
|
+
return c.json(
|
|
30
|
+
{
|
|
31
|
+
error: "Amount, phone number, and bill reference number are required"
|
|
32
|
+
},
|
|
33
|
+
400
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
const response = await client.simulateC2B({
|
|
37
|
+
amount: Number(amount),
|
|
38
|
+
phoneNumber: String(phoneNumber),
|
|
39
|
+
billRefNumber: String(billRefNumber),
|
|
40
|
+
commandID
|
|
41
|
+
});
|
|
42
|
+
return c.json(response);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error("C2B Simulate error:", error);
|
|
45
|
+
return c.json({ error: error.message || "Request failed" }, 500);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
25
48
|
c2bValidation: async (c) => {
|
|
26
49
|
try {
|
|
27
50
|
const body = await c.req.json();
|
|
@@ -496,6 +519,7 @@ function createMpesa(config, options) {
|
|
|
496
519
|
app.post("/reversal-timeout", handlers.reversalTimeout);
|
|
497
520
|
app.post("/status-result", handlers.statusResult);
|
|
498
521
|
app.post("/status-timeout", handlers.statusTimeout);
|
|
522
|
+
app.post("/simulate-c2b", handlers.simulateC2B);
|
|
499
523
|
return {
|
|
500
524
|
client,
|
|
501
525
|
handlers,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularity-payments/hono",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"directory": "packages/hono"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@singularity-payments/core": "1.
|
|
39
|
+
"@singularity-payments/core": "1.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^25.0.3",
|