@singularity-payments/nuxt 0.1.0 → 1.0.0-alpha.3

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,6 +1,6 @@
1
1
  import { EventHandler } from 'h3';
2
2
  import { MpesaClient, MpesaConfig, MpesaClientOptions } from '@singularity-payments/core';
3
- export { AccountBalanceCallback, B2BCallback, B2CCallback, C2BCallback, C2BRegisterRequest, C2BRegisterResponse, MpesaClient, MpesaClientOptions, MpesaConfig, ParsedC2BCallback, ParsedCallbackData, ReversalCallback, STKCallback, STKPushRequest, STKPushResponse, TransactionStatusCallback, TransactionStatusRequest, TransactionStatusResponse } from '@singularity-payments/core';
3
+ 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';
4
4
 
5
5
  type MpesaEventHandler = EventHandler;
6
6
  interface MpesaEventHandlers {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventHandler } from 'h3';
2
2
  import { MpesaClient, MpesaConfig, MpesaClientOptions } from '@singularity-payments/core';
3
- export { AccountBalanceCallback, B2BCallback, B2CCallback, C2BCallback, C2BRegisterRequest, C2BRegisterResponse, MpesaClient, MpesaClientOptions, MpesaConfig, ParsedC2BCallback, ParsedCallbackData, ReversalCallback, STKCallback, STKPushRequest, STKPushResponse, TransactionStatusCallback, TransactionStatusRequest, TransactionStatusResponse } from '@singularity-payments/core';
3
+ 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';
4
4
 
5
5
  type MpesaEventHandler = EventHandler;
6
6
  interface MpesaEventHandlers {
package/dist/index.js CHANGED
@@ -90,8 +90,7 @@ function createMpesaHandlers(client) {
90
90
  b2cResult: (0, import_h3.defineEventHandler)(async (event) => {
91
91
  try {
92
92
  const body = await (0, import_h3.readBody)(event);
93
- const ipAddress = (0, import_h3.getRequestHeader)(event, "x-forwarded-for") || (0, import_h3.getRequestHeader)(event, "x-real-ip") || void 0;
94
- const response = await client.handleB2CResult(body, ipAddress);
93
+ const response = await client.handleB2CCallback(body);
95
94
  return response;
96
95
  } catch (error) {
97
96
  console.error("B2C Result error:", error);
@@ -180,8 +179,7 @@ function createMpesaHandlers(client) {
180
179
  }
181
180
  if (lastSegment === "b2c-result") {
182
181
  const body = await (0, import_h3.readBody)(event);
183
- const ipAddress = (0, import_h3.getRequestHeader)(event, "x-forwarded-for") || (0, import_h3.getRequestHeader)(event, "x-real-ip") || void 0;
184
- const response = await client.handleB2CResult(body, ipAddress);
182
+ const response = await client.handleB2CCallback(body);
185
183
  return response;
186
184
  }
187
185
  if (lastSegment === "b2c-timeout") {
@@ -191,8 +189,7 @@ function createMpesaHandlers(client) {
191
189
  }
192
190
  if (lastSegment === "b2b-result") {
193
191
  const body = await (0, import_h3.readBody)(event);
194
- const ipAddress = (0, import_h3.getRequestHeader)(event, "x-forwarded-for") || (0, import_h3.getRequestHeader)(event, "x-real-ip") || void 0;
195
- const response = await client.handleB2BResult(body, ipAddress);
192
+ const response = await client.handleB2BCallback(body);
196
193
  return response;
197
194
  }
198
195
  if (lastSegment === "b2b-timeout") {
@@ -202,11 +199,7 @@ function createMpesaHandlers(client) {
202
199
  }
203
200
  if (lastSegment === "balance-result") {
204
201
  const body = await (0, import_h3.readBody)(event);
205
- const ipAddress = (0, import_h3.getRequestHeader)(event, "x-forwarded-for") || (0, import_h3.getRequestHeader)(event, "x-real-ip") || void 0;
206
- const response = await client.handleAccountBalanceResult(
207
- body,
208
- ipAddress
209
- );
202
+ const response = await client.handleAccountBalanceCallback(body);
210
203
  return response;
211
204
  }
212
205
  if (lastSegment === "balance-timeout") {
@@ -216,11 +209,7 @@ function createMpesaHandlers(client) {
216
209
  }
217
210
  if (lastSegment === "status-result") {
218
211
  const body = await (0, import_h3.readBody)(event);
219
- const ipAddress = (0, import_h3.getRequestHeader)(event, "x-forwarded-for") || (0, import_h3.getRequestHeader)(event, "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 response;
225
214
  }
226
215
  if (lastSegment === "status-timeout") {
@@ -230,8 +219,7 @@ function createMpesaHandlers(client) {
230
219
  }
231
220
  if (lastSegment === "reversal-result") {
232
221
  const body = await (0, import_h3.readBody)(event);
233
- const ipAddress = (0, import_h3.getRequestHeader)(event, "x-forwarded-for") || (0, import_h3.getRequestHeader)(event, "x-real-ip") || void 0;
234
- const response = await client.handleReversalResult(body, ipAddress);
222
+ const response = await client.handleReversalCallback(body);
235
223
  return response;
236
224
  }
237
225
  if (lastSegment === "reversal-timeout") {
package/dist/index.mjs CHANGED
@@ -70,8 +70,7 @@ function createMpesaHandlers(client) {
70
70
  b2cResult: defineEventHandler(async (event) => {
71
71
  try {
72
72
  const body = await readBody(event);
73
- const ipAddress = getRequestHeader(event, "x-forwarded-for") || getRequestHeader(event, "x-real-ip") || void 0;
74
- const response = await client.handleB2CResult(body, ipAddress);
73
+ const response = await client.handleB2CCallback(body);
75
74
  return response;
76
75
  } catch (error) {
77
76
  console.error("B2C Result error:", error);
@@ -160,8 +159,7 @@ function createMpesaHandlers(client) {
160
159
  }
161
160
  if (lastSegment === "b2c-result") {
162
161
  const body = await readBody(event);
163
- const ipAddress = getRequestHeader(event, "x-forwarded-for") || getRequestHeader(event, "x-real-ip") || void 0;
164
- const response = await client.handleB2CResult(body, ipAddress);
162
+ const response = await client.handleB2CCallback(body);
165
163
  return response;
166
164
  }
167
165
  if (lastSegment === "b2c-timeout") {
@@ -171,8 +169,7 @@ function createMpesaHandlers(client) {
171
169
  }
172
170
  if (lastSegment === "b2b-result") {
173
171
  const body = await readBody(event);
174
- const ipAddress = getRequestHeader(event, "x-forwarded-for") || getRequestHeader(event, "x-real-ip") || void 0;
175
- const response = await client.handleB2BResult(body, ipAddress);
172
+ const response = await client.handleB2BCallback(body);
176
173
  return response;
177
174
  }
178
175
  if (lastSegment === "b2b-timeout") {
@@ -182,11 +179,7 @@ function createMpesaHandlers(client) {
182
179
  }
183
180
  if (lastSegment === "balance-result") {
184
181
  const body = await readBody(event);
185
- const ipAddress = getRequestHeader(event, "x-forwarded-for") || getRequestHeader(event, "x-real-ip") || void 0;
186
- const response = await client.handleAccountBalanceResult(
187
- body,
188
- ipAddress
189
- );
182
+ const response = await client.handleAccountBalanceCallback(body);
190
183
  return response;
191
184
  }
192
185
  if (lastSegment === "balance-timeout") {
@@ -196,11 +189,7 @@ function createMpesaHandlers(client) {
196
189
  }
197
190
  if (lastSegment === "status-result") {
198
191
  const body = await readBody(event);
199
- const ipAddress = getRequestHeader(event, "x-forwarded-for") || getRequestHeader(event, "x-real-ip") || void 0;
200
- const response = await client.handleTransactionStatusResult(
201
- body,
202
- ipAddress
203
- );
192
+ const response = await client.handleTransactionStatusCallback(body);
204
193
  return response;
205
194
  }
206
195
  if (lastSegment === "status-timeout") {
@@ -210,8 +199,7 @@ function createMpesaHandlers(client) {
210
199
  }
211
200
  if (lastSegment === "reversal-result") {
212
201
  const body = await readBody(event);
213
- const ipAddress = getRequestHeader(event, "x-forwarded-for") || getRequestHeader(event, "x-real-ip") || void 0;
214
- const response = await client.handleReversalResult(body, ipAddress);
202
+ const response = await client.handleReversalCallback(body);
215
203
  return response;
216
204
  }
217
205
  if (lastSegment === "reversal-timeout") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularity-payments/nuxt",
3
- "version": "0.1.0",
3
+ "version": "1.0.0-alpha.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,7 +32,7 @@
32
32
  "nuxt": ">=3.0.0"
33
33
  },
34
34
  "dependencies": {
35
- "@singularity-payments/core": "0.1.0"
35
+ "@singularity-payments/core": "1.0.0-alpha.3"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^25.0.3",