@singularity-payments/hono 0.1.0 → 1.0.0-alpha.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as hono_types from 'hono/types';
2
2
  import { Context, Hono } from 'hono';
3
3
  import { MpesaClient, MpesaConfig, MpesaClientOptions } from '@singularity-payments/core';
4
- export { AccountBalanceCallback, B2BCallback, B2CCallback, C2BCallback, C2BRegisterRequest, C2BRegisterResponse, MpesaClient, MpesaClientOptions, MpesaConfig, ParsedC2BCallback, ParsedCallbackData, ReversalCallback, STKCallback, STKPushRequest, STKPushResponse, TransactionStatusCallback, TransactionStatusRequest, TransactionStatusResponse } from '@singularity-payments/core';
4
+ export { AccountBalanceCallback, AccountBalanceRequest, AccountBalanceResponse, B2BCallback, B2BRequest, B2BResponse, B2CCallback, B2CRequest, B2CResponse, C2BCallback, C2BRegisterRequest, C2BRegisterResponse, CallbackHandlerOptions, DynamicQRRequest, DynamicQRResponse, GeneralTransactionStatusRequest, GeneralTransactionStatusResponse, MpesaClient, MpesaClientOptions, MpesaConfig, ParsedC2BCallback, ParsedCallbackData, ReversalCallback, ReversalRequest, ReversalResponse, STKCallback, STKPushRequest, STKPushResponse, TransactionStatusCallback, TransactionStatusRequest, TransactionStatusResponse } from '@singularity-payments/core';
5
5
 
6
6
  interface MpesaHandler {
7
7
  (c: Context): Promise<Response>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as hono_types from 'hono/types';
2
2
  import { Context, Hono } from 'hono';
3
3
  import { MpesaClient, MpesaConfig, MpesaClientOptions } from '@singularity-payments/core';
4
- export { AccountBalanceCallback, B2BCallback, B2CCallback, C2BCallback, C2BRegisterRequest, C2BRegisterResponse, MpesaClient, MpesaClientOptions, MpesaConfig, ParsedC2BCallback, ParsedCallbackData, ReversalCallback, STKCallback, STKPushRequest, STKPushResponse, TransactionStatusCallback, TransactionStatusRequest, TransactionStatusResponse } from '@singularity-payments/core';
4
+ export { AccountBalanceCallback, AccountBalanceRequest, AccountBalanceResponse, B2BCallback, B2BRequest, B2BResponse, B2CCallback, B2CRequest, B2CResponse, C2BCallback, C2BRegisterRequest, C2BRegisterResponse, CallbackHandlerOptions, DynamicQRRequest, DynamicQRResponse, GeneralTransactionStatusRequest, GeneralTransactionStatusResponse, MpesaClient, MpesaClientOptions, MpesaConfig, ParsedC2BCallback, ParsedCallbackData, ReversalCallback, ReversalRequest, ReversalResponse, STKCallback, STKPushRequest, STKPushResponse, TransactionStatusCallback, TransactionStatusRequest, TransactionStatusResponse } from '@singularity-payments/core';
5
5
 
6
6
  interface MpesaHandler {
7
7
  (c: Context): Promise<Response>;
package/dist/index.js CHANGED
@@ -83,8 +83,7 @@ function createMpesaHandlers(client) {
83
83
  b2cResult: async (c) => {
84
84
  try {
85
85
  const body = await c.req.json();
86
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
87
- const response = await client.handleB2CResult(body, ipAddress);
86
+ const response = await client.handleB2CCallback(body);
88
87
  return c.json(response, 200);
89
88
  } catch (error) {
90
89
  console.error("B2C Result error:", error);
@@ -122,8 +121,7 @@ function createMpesaHandlers(client) {
122
121
  b2bResult: async (c) => {
123
122
  try {
124
123
  const body = await c.req.json();
125
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
126
- const response = await client.handleB2BResult(body, ipAddress);
124
+ const response = await client.handleB2BCallback(body);
127
125
  return c.json(response, 200);
128
126
  } catch (error) {
129
127
  console.error("B2B Result error:", error);
@@ -161,11 +159,7 @@ function createMpesaHandlers(client) {
161
159
  balanceResult: async (c) => {
162
160
  try {
163
161
  const body = await c.req.json();
164
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
165
- const response = await client.handleAccountBalanceResult(
166
- body,
167
- ipAddress
168
- );
162
+ const response = await client.handleAccountBalanceCallback(body);
169
163
  return c.json(response, 200);
170
164
  } catch (error) {
171
165
  console.error("Balance Result error:", error);
@@ -203,8 +197,7 @@ function createMpesaHandlers(client) {
203
197
  reversalResult: async (c) => {
204
198
  try {
205
199
  const body = await c.req.json();
206
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
207
- const response = await client.handleReversalResult(body, ipAddress);
200
+ const response = await client.handleReversalCallback(body);
208
201
  return c.json(response, 200);
209
202
  } catch (error) {
210
203
  console.error("Reversal Result error:", error);
@@ -242,11 +235,7 @@ function createMpesaHandlers(client) {
242
235
  statusResult: async (c) => {
243
236
  try {
244
237
  const body = await c.req.json();
245
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
246
- const response = await client.handleTransactionStatusResult(
247
- body,
248
- ipAddress
249
- );
238
+ const response = await client.handleTransactionStatusCallback(body);
250
239
  return c.json(response, 200);
251
240
  } catch (error) {
252
241
  console.error("Status Result error:", error);
package/dist/index.mjs CHANGED
@@ -57,8 +57,7 @@ function createMpesaHandlers(client) {
57
57
  b2cResult: async (c) => {
58
58
  try {
59
59
  const body = await c.req.json();
60
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
61
- const response = await client.handleB2CResult(body, ipAddress);
60
+ const response = await client.handleB2CCallback(body);
62
61
  return c.json(response, 200);
63
62
  } catch (error) {
64
63
  console.error("B2C Result error:", error);
@@ -96,8 +95,7 @@ function createMpesaHandlers(client) {
96
95
  b2bResult: async (c) => {
97
96
  try {
98
97
  const body = await c.req.json();
99
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
100
- const response = await client.handleB2BResult(body, ipAddress);
98
+ const response = await client.handleB2BCallback(body);
101
99
  return c.json(response, 200);
102
100
  } catch (error) {
103
101
  console.error("B2B Result error:", error);
@@ -135,11 +133,7 @@ function createMpesaHandlers(client) {
135
133
  balanceResult: async (c) => {
136
134
  try {
137
135
  const body = await c.req.json();
138
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
139
- const response = await client.handleAccountBalanceResult(
140
- body,
141
- ipAddress
142
- );
136
+ const response = await client.handleAccountBalanceCallback(body);
143
137
  return c.json(response, 200);
144
138
  } catch (error) {
145
139
  console.error("Balance Result error:", error);
@@ -177,8 +171,7 @@ function createMpesaHandlers(client) {
177
171
  reversalResult: async (c) => {
178
172
  try {
179
173
  const body = await c.req.json();
180
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
181
- const response = await client.handleReversalResult(body, ipAddress);
174
+ const response = await client.handleReversalCallback(body);
182
175
  return c.json(response, 200);
183
176
  } catch (error) {
184
177
  console.error("Reversal Result error:", error);
@@ -216,11 +209,7 @@ function createMpesaHandlers(client) {
216
209
  statusResult: async (c) => {
217
210
  try {
218
211
  const body = await c.req.json();
219
- const ipAddress = c.req.header("x-forwarded-for") || c.req.header("x-real-ip") || void 0;
220
- const response = await client.handleTransactionStatusResult(
221
- body,
222
- ipAddress
223
- );
212
+ const response = await client.handleTransactionStatusCallback(body);
224
213
  return c.json(response, 200);
225
214
  } catch (error) {
226
215
  console.error("Status Result error:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularity-payments/hono",
3
- "version": "0.1.0",
3
+ "version": "1.0.0-alpha.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,7 +31,7 @@
31
31
  "hono": ">=4.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@singularity-payments/core": "0.1.0"
34
+ "@singularity-payments/core": "1.0.0-alpha.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^25.0.3",