@singularity-payments/fastify 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
@@ -2,7 +2,7 @@ import * as node_http from 'node:http';
2
2
  import * as fastify from 'fastify';
3
3
  import { FastifyRequest, FastifyReply, FastifyInstance } from 'fastify';
4
4
  import { MpesaClient, MpesaConfig, MpesaClientOptions } from '@singularity-payments/core';
5
- export { AccountBalanceCallback, B2BCallback, B2CCallback, C2BCallback, C2BRegisterRequest, C2BRegisterResponse, MpesaClient, MpesaClientOptions, MpesaConfig, ParsedC2BCallback, ParsedCallbackData, ReversalCallback, STKCallback, STKPushRequest, STKPushResponse, TransactionStatusCallback, TransactionStatusRequest, TransactionStatusResponse } from '@singularity-payments/core';
5
+ 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';
6
6
 
7
7
  interface MpesaRouteHandler {
8
8
  (req: FastifyRequest, reply: FastifyReply): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as node_http from 'node:http';
2
2
  import * as fastify from 'fastify';
3
3
  import { FastifyRequest, FastifyReply, FastifyInstance } from 'fastify';
4
4
  import { MpesaClient, MpesaConfig, MpesaClientOptions } from '@singularity-payments/core';
5
- export { AccountBalanceCallback, B2BCallback, B2CCallback, C2BCallback, C2BRegisterRequest, C2BRegisterResponse, MpesaClient, MpesaClientOptions, MpesaConfig, ParsedC2BCallback, ParsedCallbackData, ReversalCallback, STKCallback, STKPushRequest, STKPushResponse, TransactionStatusCallback, TransactionStatusRequest, TransactionStatusResponse } from '@singularity-payments/core';
5
+ 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';
6
6
 
7
7
  interface MpesaRouteHandler {
8
8
  (req: FastifyRequest, reply: FastifyReply): Promise<void>;
package/dist/index.js CHANGED
@@ -76,11 +76,7 @@ function createMpesaHandlers(client) {
76
76
  b2cResult: async (req, reply) => {
77
77
  try {
78
78
  const body = req.body;
79
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
80
- const response = await client.handleB2CResult(
81
- body,
82
- typeof ipAddress === "string" ? ipAddress : void 0
83
- );
79
+ const response = await client.handleB2CCallback(body);
84
80
  reply.status(200).send(response);
85
81
  } catch (error) {
86
82
  console.error("B2C Result error:", error);
@@ -109,11 +105,7 @@ function createMpesaHandlers(client) {
109
105
  b2bResult: async (req, reply) => {
110
106
  try {
111
107
  const body = req.body;
112
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
113
- const response = await client.handleB2BResult(
114
- body,
115
- typeof ipAddress === "string" ? ipAddress : void 0
116
- );
108
+ const response = await client.handleB2BCallback(body);
117
109
  reply.status(200).send(response);
118
110
  } catch (error) {
119
111
  console.error("B2B Result error:", error);
@@ -142,11 +134,7 @@ function createMpesaHandlers(client) {
142
134
  balanceResult: async (req, reply) => {
143
135
  try {
144
136
  const body = req.body;
145
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
146
- const response = await client.handleAccountBalanceResult(
147
- body,
148
- typeof ipAddress === "string" ? ipAddress : void 0
149
- );
137
+ const response = await client.handleAccountBalanceCallback(body);
150
138
  reply.status(200).send(response);
151
139
  } catch (error) {
152
140
  console.error("Balance Result error:", error);
@@ -175,11 +163,7 @@ function createMpesaHandlers(client) {
175
163
  reversalResult: async (req, reply) => {
176
164
  try {
177
165
  const body = req.body;
178
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
179
- const response = await client.handleReversalResult(
180
- body,
181
- typeof ipAddress === "string" ? ipAddress : void 0
182
- );
166
+ const response = await client.handleReversalCallback(body);
183
167
  reply.status(200).send(response);
184
168
  } catch (error) {
185
169
  console.error("Reversal Result error:", error);
@@ -208,11 +192,7 @@ function createMpesaHandlers(client) {
208
192
  statusResult: async (req, reply) => {
209
193
  try {
210
194
  const body = req.body;
211
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
212
- const response = await client.handleTransactionStatusResult(
213
- body,
214
- typeof ipAddress === "string" ? ipAddress : void 0
215
- );
195
+ const response = await client.handleTransactionStatusCallback(body);
216
196
  reply.status(200).send(response);
217
197
  } catch (error) {
218
198
  console.error("Status Result error:", error);
package/dist/index.mjs CHANGED
@@ -50,11 +50,7 @@ function createMpesaHandlers(client) {
50
50
  b2cResult: async (req, reply) => {
51
51
  try {
52
52
  const body = req.body;
53
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
54
- const response = await client.handleB2CResult(
55
- body,
56
- typeof ipAddress === "string" ? ipAddress : void 0
57
- );
53
+ const response = await client.handleB2CCallback(body);
58
54
  reply.status(200).send(response);
59
55
  } catch (error) {
60
56
  console.error("B2C Result error:", error);
@@ -83,11 +79,7 @@ function createMpesaHandlers(client) {
83
79
  b2bResult: async (req, reply) => {
84
80
  try {
85
81
  const body = req.body;
86
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
87
- const response = await client.handleB2BResult(
88
- body,
89
- typeof ipAddress === "string" ? ipAddress : void 0
90
- );
82
+ const response = await client.handleB2BCallback(body);
91
83
  reply.status(200).send(response);
92
84
  } catch (error) {
93
85
  console.error("B2B Result error:", error);
@@ -116,11 +108,7 @@ function createMpesaHandlers(client) {
116
108
  balanceResult: async (req, reply) => {
117
109
  try {
118
110
  const body = req.body;
119
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
120
- const response = await client.handleAccountBalanceResult(
121
- body,
122
- typeof ipAddress === "string" ? ipAddress : void 0
123
- );
111
+ const response = await client.handleAccountBalanceCallback(body);
124
112
  reply.status(200).send(response);
125
113
  } catch (error) {
126
114
  console.error("Balance Result error:", error);
@@ -149,11 +137,7 @@ function createMpesaHandlers(client) {
149
137
  reversalResult: async (req, reply) => {
150
138
  try {
151
139
  const body = req.body;
152
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
153
- const response = await client.handleReversalResult(
154
- body,
155
- typeof ipAddress === "string" ? ipAddress : void 0
156
- );
140
+ const response = await client.handleReversalCallback(body);
157
141
  reply.status(200).send(response);
158
142
  } catch (error) {
159
143
  console.error("Reversal Result error:", error);
@@ -182,11 +166,7 @@ function createMpesaHandlers(client) {
182
166
  statusResult: async (req, reply) => {
183
167
  try {
184
168
  const body = req.body;
185
- const ipAddress = req.headers["x-forwarded-for"] || req.headers["x-real-ip"] || req.ip || void 0;
186
- const response = await client.handleTransactionStatusResult(
187
- body,
188
- typeof ipAddress === "string" ? ipAddress : void 0
189
- );
169
+ const response = await client.handleTransactionStatusCallback(body);
190
170
  reply.status(200).send(response);
191
171
  } catch (error) {
192
172
  console.error("Status Result error:", error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularity-payments/fastify",
3
- "version": "0.1.0",
3
+ "version": "1.0.0-alpha.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,7 +31,7 @@
31
31
  "fastify": ">=4.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@singularity-payments/core": "0.1.0"
34
+ "@singularity-payments/core": "1.0.0-alpha.3"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^25.0.3",