@houlak/plexo-sdk 0.1.13 → 0.1.15

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.
@@ -204,23 +204,25 @@ var Purchase = function (purchase) { return __awaiter(void 0, void 0, void 0, fu
204
204
  var UnwrapInstrumentCallback = function (instrumentCallback) { return __awaiter(void 0, void 0, void 0, function () {
205
205
  var instrumentCallbackResponse;
206
206
  return __generator(this, function (_a) {
207
- switch (_a.label) {
208
- case 0: return [4 /*yield*/, paymentGatewayClient.UnwrapInstrumentCallbackAsync(instrumentCallback)];
209
- case 1:
210
- instrumentCallbackResponse = _a.sent();
211
- return [2 /*return*/, evaluator_service_1.Evaluator.genericEvaluator(instrumentCallback, instrumentCallbackResponse)];
212
- }
207
+ instrumentCallbackResponse = {
208
+ response: instrumentCallback.Object.object,
209
+ resultCode: index_1.ResultCodes.Ok,
210
+ errorMessage: 'Success',
211
+ };
212
+ // await paymentGatewayClient.UnwrapInstrumentCallbackAsync(instrumentCallback)
213
+ return [2 /*return*/, evaluator_service_1.Evaluator.genericEvaluator(instrumentCallback, instrumentCallbackResponse)];
213
214
  });
214
215
  }); };
215
216
  var UnwrapTransactionCallback = function (transactionCallback) { return __awaiter(void 0, void 0, void 0, function () {
216
217
  var transactionCallbackResponse;
217
218
  return __generator(this, function (_a) {
218
- switch (_a.label) {
219
- case 0: return [4 /*yield*/, paymentGatewayClient.UnwrapTransactionCallbackAsync(transactionCallback)];
220
- case 1:
221
- transactionCallbackResponse = _a.sent();
222
- return [2 /*return*/, evaluator_service_1.Evaluator.genericEvaluator(transactionCallback, transactionCallbackResponse)];
223
- }
219
+ transactionCallbackResponse = {
220
+ response: transactionCallback.Object.object,
221
+ resultCode: index_1.ResultCodes.Ok,
222
+ errorMessage: 'Success',
223
+ };
224
+ // await paymentGatewayClient.UnwrapTransactionCallbackAsync(transactionCallback)
225
+ return [2 /*return*/, evaluator_service_1.Evaluator.genericEvaluator(transactionCallback, transactionCallbackResponse)];
224
226
  });
225
227
  }); };
226
228
  var SignInstrumentCallback = function (instrumentCallback) { return __awaiter(void 0, void 0, void 0, function () {
@@ -44,20 +44,20 @@ var BaseResponse_1 = require("../types/BaseResponse");
44
44
  var getTransactionStatus = function (transaction, transactionType) {
45
45
  if (transactionType === index_1.TransactionType.Cancel) {
46
46
  return {
47
- status: index_1.TransactionResult[+transaction.transactions.cancel.status],
48
- transactionResultText: transaction.transactions.cancel.transactionResultText,
47
+ status: index_1.TransactionResult[+transaction.Transactions.Cancel.Status],
48
+ transactionResultText: transaction.Transactions.Cancel.TransactionResultText,
49
49
  };
50
50
  }
51
51
  if (transactionType === index_1.TransactionType.Reserve) {
52
52
  return {
53
- status: index_1.TransactionResult[+transaction.transactions.reserve.status],
54
- transactionResultText: transaction.transactions.reserve.transactionResultText,
53
+ status: index_1.TransactionResult[+transaction.Transactions.Reserve.Status],
54
+ transactionResultText: transaction.Transactions.Reserve.TransactionResultText,
55
55
  };
56
56
  }
57
57
  if (transactionType === index_1.TransactionType.Purchase) {
58
58
  return {
59
- status: index_1.TransactionResult[+transaction.transactions.purchase.status],
60
- transactionResultText: transaction.transactions.purchase.transactionResultText,
59
+ status: index_1.TransactionResult[+transaction.Transactions.Purchase.Status],
60
+ transactionResultText: transaction.Transactions.Purchase.TransactionResultText,
61
61
  };
62
62
  }
63
63
  };
@@ -184,10 +184,10 @@ var PaymentGatewayMock = /** @class */ (function () {
184
184
  return __generator(this, function (_a) {
185
185
  return [2 /*return*/, {
186
186
  resultCode: IndexSDK_1.ResultCodes.Ok,
187
- response: __assign(__assign({}, mocks_1.mocks.transactionMock), { transactions: {
188
- purchase: mocks_1.mocks.transactionMock.transactions.purchase,
189
- reserve: mocks_1.mocks.transactionMock.transactions.reserve,
190
- cancel: __assign(__assign({}, mocks_1.mocks.transactionMock.transactions.cancel), { clientReferenceId: cancel.clientReferenceId }),
187
+ response: __assign(__assign({}, mocks_1.mocks.transactionMock), { Transactions: {
188
+ Purchase: mocks_1.mocks.transactionMock.Transactions.Purchase,
189
+ Reserve: mocks_1.mocks.transactionMock.Transactions.Reserve,
190
+ Cancel: __assign(__assign({}, mocks_1.mocks.transactionMock.Transactions.Cancel), { ClientReferenceId: cancel.clientReferenceId }),
191
191
  } }),
192
192
  }];
193
193
  });
@@ -198,7 +198,7 @@ var PaymentGatewayMock = /** @class */ (function () {
198
198
  return __generator(this, function (_a) {
199
199
  return [2 /*return*/, {
200
200
  resultCode: IndexSDK_1.ResultCodes.Ok,
201
- response: __assign(__assign({}, mocks_1.mocks.transactionMock), { paymentCode: __assign(__assign({}, mocks_1.mocks.transactionMock.paymentCode), { code: request.code }) }),
201
+ response: __assign(__assign({}, mocks_1.mocks.transactionMock), { PaymentCode: __assign(__assign({}, mocks_1.mocks.transactionMock.PaymentCode), { code: request.code }) }),
202
202
  }];
203
203
  });
204
204
  });
@@ -208,10 +208,10 @@ var PaymentGatewayMock = /** @class */ (function () {
208
208
  return __generator(this, function (_a) {
209
209
  return [2 /*return*/, {
210
210
  resultCode: IndexSDK_1.ResultCodes.Ok,
211
- response: __assign(__assign({}, mocks_1.mocks.transactionMock), { amount: payment.financialInclusion.billedAmount, transactions: {
212
- purchase: mocks_1.mocks.transactionMock.transactions.purchase,
213
- reserve: __assign(__assign({}, mocks_1.mocks.transactionMock.transactions.reserve), { clientReferenceId: payment.clientReferenceId, expirationUTC: payment.expirationUTC }),
214
- cancel: mocks_1.mocks.transactionMock.transactions.cancel,
211
+ response: __assign(__assign({}, mocks_1.mocks.transactionMock), { Amount: payment.financialInclusion.billedAmount, Transactions: {
212
+ Purchase: mocks_1.mocks.transactionMock.Transactions.Purchase,
213
+ Reserve: __assign(__assign({}, mocks_1.mocks.transactionMock.Transactions.Reserve), { ClientReferenceId: payment.clientReferenceId, ExpirationUTC: payment.expirationUTC }),
214
+ Cancel: mocks_1.mocks.transactionMock.Transactions.Cancel,
215
215
  } }),
216
216
  }];
217
217
  });
@@ -262,10 +262,10 @@ var PaymentGatewayMock = /** @class */ (function () {
262
262
  return __generator(this, function (_a) {
263
263
  return [2 /*return*/, {
264
264
  resultCode: IndexSDK_1.ResultCodes.Ok,
265
- response: __assign(__assign({}, mocks_1.mocks.transactionMock), { amount: payment.financialInclusion.billedAmount, currency: __assign(__assign({}, mocks_1.mocks.transactionMock.currency), { currencyId: payment.currencyId }), transactions: {
266
- purchase: __assign(__assign({}, mocks_1.mocks.transactionMock.transactions.purchase), { clientReferenceId: payment.clientReferenceId }),
267
- reserve: mocks_1.mocks.transactionMock.transactions.reserve,
268
- cancel: mocks_1.mocks.transactionMock.transactions.cancel,
265
+ response: __assign(__assign({}, mocks_1.mocks.transactionMock), { Amount: payment.financialInclusion.billedAmount, Currency: __assign(__assign({}, mocks_1.mocks.transactionMock.Currency), { currencyId: payment.currencyId }), Transactions: {
266
+ Purchase: __assign(__assign({}, mocks_1.mocks.transactionMock.Transactions.Purchase), { ClientReferenceId: payment.clientReferenceId }),
267
+ Reserve: mocks_1.mocks.transactionMock.Transactions.Reserve,
268
+ Cancel: mocks_1.mocks.transactionMock.Transactions.Cancel,
269
269
  } }),
270
270
  }];
271
271
  });
@@ -268,11 +268,9 @@ var getPlexoSignature = function (fingerprint, response) { return __awaiter(void
268
268
  switch (_a.label) {
269
269
  case 0:
270
270
  _a.trys.push([0, 2, , 3]);
271
- logger_lib_1.default.info("FINGERPRINT TO GET PLEXO SIGNATURE --> ".concat(fingerprint));
272
271
  return [4 /*yield*/, getPlexoKey(fingerprint)];
273
272
  case 1:
274
273
  plexoResponse = _a.sent();
275
- logger_lib_1.default.info("FINGERPRINT RESPONSE");
276
274
  return [3 /*break*/, 3];
277
275
  case 2:
278
276
  err_1 = _a.sent();
@@ -285,12 +283,10 @@ var getPlexoSignature = function (fingerprint, response) { return __awaiter(void
285
283
  return [2 /*return*/, serverResponse];
286
284
  case 3:
287
285
  key = "-----BEGIN CERTIFICATE-----\n".concat(plexoResponse.Object.Object.Response.Key, "\n-----END CERTIFICATE-----");
288
- logger_lib_1.default.info("KEY -----> ".concat(key));
289
286
  objectBuffer = new util_1.TextEncoder().encode((0, stringifyWithFloats_1.stringifyAmountsWithFloats)(response.Object));
290
287
  verifySignature = (0, crypto_1.createVerify)('SHA512')
291
288
  .update(objectBuffer)
292
289
  .verify(key, response.Signature, 'base64');
293
- logger_lib_1.default.info("VERIFY BUFFER -----> ".concat(verifySignature));
294
290
  serverResponse = {
295
291
  response: response.Object.object,
296
292
  resultCode: verifySignature ? __1.ResultCodes.Ok : __1.ResultCodes.InvalidSignature,
@@ -66,14 +66,14 @@ var financialInclusionMock = {
66
66
  lawNumber: IndexSDK_1.InclusionType.Law17934,
67
67
  };
68
68
  var transactionInfoMock = {
69
- clientReferenceId: (0, crypto_1.randomUUID)(),
70
- clientMetadata: 'metadata',
71
- status: IndexSDK_1.TransactionResult.Ok,
72
- transactionCode: 1900,
73
- transactionResultText: 'OK',
74
- executionDateUTC: 1919276061,
75
- authorization: 'AuthorizationMock',
76
- ticket: 'TicketMock',
69
+ ClientReferenceId: (0, crypto_1.randomUUID)(),
70
+ ClientMetadata: 'metadata',
71
+ Status: IndexSDK_1.TransactionResult.Ok,
72
+ TransactionCode: 1900,
73
+ TransactionResultText: 'OK',
74
+ ExecutionDateUTC: 1919276061,
75
+ Authorization: 'AuthorizationMock',
76
+ Ticket: 'TicketMock',
77
77
  };
78
78
  var commerceMock = {
79
79
  commerceId: 1891,
@@ -97,27 +97,27 @@ var sessionMock = {
97
97
  expirationUTC: 1919276061,
98
98
  };
99
99
  var transactionMock = {
100
- transactionId: (0, crypto_1.randomUUID)(),
101
- commerce: commerceMock,
102
- instrumentToken: 'Token',
103
- instrumentName: 'MasterMock',
104
- issuer: issuerMock,
105
- amount: 100,
106
- installments: 1,
107
- currency: currencyMock,
108
- isAnonymous: true,
109
- currentState: IndexSDK_1.TransactionType.Purchase,
110
- invoiceNumber: '1',
111
- financialInclusion: financialInclusionMock,
112
- transactions: {
113
- purchase: transactionInfoMock,
114
- reserve: transactionInfoMock,
115
- cancel: transactionInfoMock,
100
+ TransactionId: (0, crypto_1.randomUUID)(),
101
+ Commerce: commerceMock,
102
+ InstrumentToken: 'Token',
103
+ InstrumentName: 'MasterMock',
104
+ Issuer: issuerMock,
105
+ Amount: 100,
106
+ Installments: 1,
107
+ Currency: currencyMock,
108
+ IsAnonymous: true,
109
+ CurrentState: IndexSDK_1.TransactionType.Purchase,
110
+ InvoiceNumber: '1',
111
+ FinancialInclusion: financialInclusionMock,
112
+ Transactions: {
113
+ Purchase: transactionInfoMock,
114
+ Reserve: transactionInfoMock,
115
+ Cancel: transactionInfoMock,
116
116
  },
117
- fieldInformation: [],
118
- isAsyncPayment: false,
119
- paymentCode: paymentCodeMock,
120
- utcUnixTimeExpiration: 1919276061,
117
+ FieldInformation: [],
118
+ IsAsyncPayment: false,
119
+ PaymentCode: paymentCodeMock,
120
+ UtcUnixTimeExpiration: 1919276061,
121
121
  };
122
122
  var transactionCursorMock = {
123
123
  start: 0,
@@ -1,31 +1,31 @@
1
- import { PaymentCode } from './CodeAction';
2
- import { Commerce } from './Commerce';
3
- import { Currency } from './Currency';
1
+ import { PaymentCode as PaymentCodeEnum } from './CodeAction';
2
+ import { Commerce as CommerceModel } from './Commerce';
3
+ import { Currency as CurrencyEnum } from './Currency';
4
4
  import { FinancialInclusionResult } from './FinancialInclusionResult';
5
5
  import { IssuerInfo } from './IssuerInfo';
6
6
  import { TransactionInfo } from './TransactionInfo';
7
7
  import { TransactionType } from './TransactionType';
8
8
  export declare class Transaction {
9
- transactionId: string;
10
- commerce: Commerce;
11
- instrumentToken: string;
12
- instrumentName: string;
13
- issuer: IssuerInfo;
14
- amount: number;
15
- installments: number;
16
- currency: Currency;
17
- isAnonymous: boolean;
18
- currentState: TransactionType;
19
- invoiceNumber: string;
20
- financialInclusion: FinancialInclusionResult;
21
- transactions: {
22
- purchase: TransactionInfo;
23
- cancel: TransactionInfo;
24
- reserve: TransactionInfo;
9
+ TransactionId: string;
10
+ Commerce: CommerceModel;
11
+ InstrumentToken: string;
12
+ InstrumentName: string;
13
+ Issuer: IssuerInfo;
14
+ Amount: number;
15
+ Installments: number;
16
+ Currency: CurrencyEnum;
17
+ IsAnonymous: boolean;
18
+ CurrentState: TransactionType;
19
+ InvoiceNumber: string;
20
+ FinancialInclusion: FinancialInclusionResult;
21
+ Transactions: {
22
+ Purchase: TransactionInfo;
23
+ Cancel: TransactionInfo;
24
+ Reserve: TransactionInfo;
25
25
  };
26
- fieldInformation: any;
27
- isAsyncPayment: boolean;
28
- paymentCode: PaymentCode;
29
- utcUnixTimeExpiration: number;
30
- constructor(transactionId: string, commerce: Commerce, instrumentToken: string, instrumentName: string, issuer: IssuerInfo, amount: number, installments: number, currency: Currency, isAnonymous: boolean, currentState: TransactionType, invoiceNumber: string, financialInclusion: FinancialInclusionResult, transactions: any, fieldInformation: any, isAsyncPayment: boolean, paymentCode: PaymentCode, utcUnixTimeExpiration: number);
26
+ FieldInformation: any;
27
+ IsAsyncPayment: boolean;
28
+ PaymentCode: PaymentCodeEnum;
29
+ UtcUnixTimeExpiration: number;
30
+ constructor(TransactionId: string, Commerce: CommerceModel, InstrumentToken: string, InstrumentName: string, Issuer: IssuerInfo, Amount: number, Installments: number, Currency: CurrencyEnum, IsAnonymous: boolean, CurrentState: TransactionType, InvoiceNumber: string, FinancialInclusion: FinancialInclusionResult, Transactions: any, FieldInformation: any, IsAsyncPayment: boolean, PaymentCode: PaymentCodeEnum, UtcUnixTimeExpiration: number);
31
31
  }
@@ -2,24 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Transaction = void 0;
4
4
  var Transaction = /** @class */ (function () {
5
- function Transaction(transactionId, commerce, instrumentToken, instrumentName, issuer, amount, installments, currency, isAnonymous, currentState, invoiceNumber, financialInclusion, transactions, fieldInformation, isAsyncPayment, paymentCode, utcUnixTimeExpiration) {
6
- this.transactionId = transactionId;
7
- this.commerce = commerce;
8
- this.instrumentToken = instrumentToken;
9
- this.instrumentName = instrumentName;
10
- this.issuer = issuer;
11
- this.amount = amount;
12
- this.installments = installments;
13
- this.currency = currency;
14
- this.isAnonymous = isAnonymous;
15
- this.currentState = currentState;
16
- this.invoiceNumber = invoiceNumber;
17
- this.financialInclusion = financialInclusion;
18
- this.transactions = transactions;
19
- this.fieldInformation = fieldInformation;
20
- this.isAsyncPayment = isAsyncPayment;
21
- this.paymentCode = paymentCode;
22
- this.utcUnixTimeExpiration = utcUnixTimeExpiration;
5
+ function Transaction(TransactionId, Commerce, InstrumentToken, InstrumentName, Issuer, Amount, Installments, Currency, IsAnonymous, CurrentState, InvoiceNumber, FinancialInclusion, Transactions, FieldInformation, IsAsyncPayment, PaymentCode, UtcUnixTimeExpiration) {
6
+ this.TransactionId = TransactionId;
7
+ this.Commerce = Commerce;
8
+ this.InstrumentToken = InstrumentToken;
9
+ this.InstrumentName = InstrumentName;
10
+ this.Issuer = Issuer;
11
+ this.Amount = Amount;
12
+ this.Installments = Installments;
13
+ this.Currency = Currency;
14
+ this.IsAnonymous = IsAnonymous;
15
+ this.CurrentState = CurrentState;
16
+ this.InvoiceNumber = InvoiceNumber;
17
+ this.FinancialInclusion = FinancialInclusion;
18
+ this.Transactions = Transactions;
19
+ this.FieldInformation = FieldInformation;
20
+ this.IsAsyncPayment = IsAsyncPayment;
21
+ this.PaymentCode = PaymentCode;
22
+ this.UtcUnixTimeExpiration = UtcUnixTimeExpiration;
23
23
  }
24
24
  return Transaction;
25
25
  }());
@@ -1,12 +1,12 @@
1
1
  import { TransactionResult } from './TransactionResult';
2
2
  export declare type TransactionInfo = {
3
- clientReferenceId: string;
4
- clientMetadata: string;
5
- status: TransactionResult;
6
- transactionCode: number;
7
- transactionResultText: string;
8
- executionDateUTC: number;
9
- authorization: string;
10
- ticket: string;
11
- expirationUTC?: number;
3
+ ClientReferenceId: string;
4
+ ClientMetadata: string;
5
+ Status: TransactionResult;
6
+ TransactionCode: number;
7
+ TransactionResultText: string;
8
+ ExecutionDateUTC: number;
9
+ Authorization: string;
10
+ Ticket: string;
11
+ ExpirationUTC?: number;
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@houlak/plexo-sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Node SDK for Plexo payment services",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",