@houlak/plexo-sdk 0.1.44 → 0.1.46

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.
@@ -115,7 +115,7 @@ var unwrapCallback = function (fingerprint, response) { return __awaiter(void 0,
115
115
  case 3:
116
116
  certificate = new crypto_1.X509Certificate(Buffer.from(plexoResponse.Object.Object.Response.Key, 'base64'));
117
117
  key = certificate.publicKey.export({ format: 'pem', type: 'pkcs1' });
118
- logger_lib_1.default.info(response.object, 'Objeto de respuesta de Plexo');
118
+ logger_lib_1.default.info(response, 'Callback de Plexo');
119
119
  canonizedObject = signatureUtils_1.signatureUtils.canonizeJson(response.object, [
120
120
  'CreditLimits',
121
121
  'creditLimits',
@@ -123,7 +123,7 @@ var unwrapCallback = function (fingerprint, response) { return __awaiter(void 0,
123
123
  logger_lib_1.default.info(canonizedObject, 'Objeto canonizado');
124
124
  objectInPascalCase = utils_1.caseUtils.toPascalKeys(canonizedObject);
125
125
  objectSorted = signatureUtils_1.signatureUtils.sortObject(objectInPascalCase);
126
- objectWithAmounts = (0, stringifyWithFloats_1.stringifyAmountsWithFloats)(objectSorted);
126
+ objectWithAmounts = (0, stringifyWithFloats_1.stringifyAmountsWithFloats)(objectSorted, 2);
127
127
  logger_lib_1.default.info(objectWithAmounts, 'Objeto a verificar');
128
128
  objectBuffer = Buffer.from(JSON.stringify(objectWithAmounts));
129
129
  verifySignature = (0, crypto_1.createVerify)('SHA512')
@@ -135,6 +135,7 @@ var unwrapCallback = function (fingerprint, response) { return __awaiter(void 0,
135
135
  resultCode: verifySignature ? __1.ResultCodes.Ok : __1.ResultCodes.InvalidSignature,
136
136
  errorMessage: verifySignature ? 'Success' : 'Signature do not match',
137
137
  };
138
+ logger_lib_1.default.info(serverResponse, 'Server response, end of unwrap');
138
139
  return [2 /*return*/, serverResponse];
139
140
  }
140
141
  });
@@ -1 +1 @@
1
- export declare const stringifyAmountsWithFloats: (object: any) => string;
1
+ export declare const stringifyAmountsWithFloats: (object: any, amountAfterComma?: number) => string;
@@ -56,7 +56,7 @@ var stringifyWithFloats = function (config, decimals) {
56
56
  // By using this, when we have for example Amount: 100, we replace that for Amount: 100.0.
57
57
  // If we send just 100, Plexo doesn't like that and we receive a
58
58
  // "signature does not match" error message
59
- var stringifyAmountsWithFloats = function (object) {
59
+ var stringifyAmountsWithFloats = function (object, amountAfterComma) {
60
60
  return stringifyWithFloats({
61
61
  amount: 'float',
62
62
  billedAmount: 'float',
@@ -68,6 +68,6 @@ var stringifyAmountsWithFloats = function (object) {
68
68
  TaxedAmount: 'float',
69
69
  VATAmount: 'float',
70
70
  ReturnAmount: 'float',
71
- }, 1)(object, null, 0);
71
+ }, amountAfterComma || 1)(object, null, 0);
72
72
  };
73
73
  exports.stringifyAmountsWithFloats = stringifyAmountsWithFloats;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@houlak/plexo-sdk",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "description": "Node SDK for Plexo payment services",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",