redsys-easy 4.0.1 → 4.0.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/lib/formatters/types.d.ts +1 -1
- package/lib/index.esm.js +5 -3
- package/lib/index.js +5 -4
- package/lib/types/output-params.d.ts +6 -1
- package/package.json +5 -5
|
@@ -262,7 +262,7 @@ export interface RequestFormatterOutput<RawOutputParams extends RequestOutputPar
|
|
|
262
262
|
*/
|
|
263
263
|
identifier?: string;
|
|
264
264
|
/**
|
|
265
|
-
* @see {@link RestTrataPeticionOutputParams.
|
|
265
|
+
* @see {@link RestTrataPeticionOutputParams.Ds_Card_Number}
|
|
266
266
|
*/
|
|
267
267
|
cardNumber?: string;
|
|
268
268
|
/**
|
package/lib/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { STATUS_CODES } from 'http';
|
|
2
2
|
import base64url from 'base64url';
|
|
3
3
|
import crypto from 'crypto';
|
|
4
|
-
import
|
|
4
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
5
5
|
import fetch from 'node-fetch';
|
|
6
6
|
import Decimal from 'decimal.js';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
@@ -756,8 +756,9 @@ const serializeSoapNotificationResponse = ({ allow: allowOperation }) => {
|
|
|
756
756
|
const answer = allowOperation ? 'OK' : 'KO';
|
|
757
757
|
return `<Response Ds_Version="0.0"><Ds_Response_Merchant>${answer}</Ds_Response_Merchant></Response>`;
|
|
758
758
|
};
|
|
759
|
+
const xmlParser = new XMLParser({ parseTagValue: false });
|
|
759
760
|
const deserializeSoapNotification = (xml) => {
|
|
760
|
-
return xmlParser.parse(xml
|
|
761
|
+
return xmlParser.parse(xml).Message;
|
|
761
762
|
};
|
|
762
763
|
|
|
763
764
|
const verifySoapNotification = (merchantKey, xml, msg) => {
|
|
@@ -1998,7 +1999,8 @@ const soapNotificationOutputFormatter = (raw) => {
|
|
|
1998
1999
|
};
|
|
1999
2000
|
};
|
|
2000
2001
|
const requestOutputFormatter = (raw) => {
|
|
2001
|
-
const { Ds_CardNumber:
|
|
2002
|
+
const { Ds_CardNumber: deprecatedCardNumber, Ds_Card_Number: newCardNumber, Ds_Merchant_Identifier: identifier, Ds_ExpiryDate: rawExpiryDate, Ds_UrlPago2Fases: payURL, Ds_Language: rawLang } = raw;
|
|
2003
|
+
const cardNumber = newCardNumber !== null && newCardNumber !== void 0 ? newCardNumber : deprecatedCardNumber;
|
|
2002
2004
|
return {
|
|
2003
2005
|
...baseOutputFormatter(raw),
|
|
2004
2006
|
...(isStringNotEmpty(cardNumber) ? { cardNumber } : undefined),
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var http = require('http');
|
|
6
6
|
var base64url = require('base64url');
|
|
7
7
|
var crypto = require('crypto');
|
|
8
|
-
var
|
|
8
|
+
var fastXmlParser = require('fast-xml-parser');
|
|
9
9
|
var fetch = require('node-fetch');
|
|
10
10
|
var Decimal = require('decimal.js');
|
|
11
11
|
var dayjs = require('dayjs');
|
|
@@ -16,7 +16,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
|
|
17
17
|
var base64url__default = /*#__PURE__*/_interopDefaultLegacy(base64url);
|
|
18
18
|
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
|
19
|
-
var xmlParser__default = /*#__PURE__*/_interopDefaultLegacy(xmlParser);
|
|
20
19
|
var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
|
|
21
20
|
var Decimal__default = /*#__PURE__*/_interopDefaultLegacy(Decimal);
|
|
22
21
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
@@ -771,8 +770,9 @@ const serializeSoapNotificationResponse = ({ allow: allowOperation }) => {
|
|
|
771
770
|
const answer = allowOperation ? 'OK' : 'KO';
|
|
772
771
|
return `<Response Ds_Version="0.0"><Ds_Response_Merchant>${answer}</Ds_Response_Merchant></Response>`;
|
|
773
772
|
};
|
|
773
|
+
const xmlParser = new fastXmlParser.XMLParser({ parseTagValue: false });
|
|
774
774
|
const deserializeSoapNotification = (xml) => {
|
|
775
|
-
return
|
|
775
|
+
return xmlParser.parse(xml).Message;
|
|
776
776
|
};
|
|
777
777
|
|
|
778
778
|
const verifySoapNotification = (merchantKey, xml, msg) => {
|
|
@@ -2013,7 +2013,8 @@ const soapNotificationOutputFormatter = (raw) => {
|
|
|
2013
2013
|
};
|
|
2014
2014
|
};
|
|
2015
2015
|
const requestOutputFormatter = (raw) => {
|
|
2016
|
-
const { Ds_CardNumber:
|
|
2016
|
+
const { Ds_CardNumber: deprecatedCardNumber, Ds_Card_Number: newCardNumber, Ds_Merchant_Identifier: identifier, Ds_ExpiryDate: rawExpiryDate, Ds_UrlPago2Fases: payURL, Ds_Language: rawLang } = raw;
|
|
2017
|
+
const cardNumber = newCardNumber !== null && newCardNumber !== void 0 ? newCardNumber : deprecatedCardNumber;
|
|
2017
2018
|
return {
|
|
2018
2019
|
...baseOutputFormatter(raw),
|
|
2019
2020
|
...(isStringNotEmpty(cardNumber) ? { cardNumber } : undefined),
|
|
@@ -41,8 +41,13 @@ export interface BaseOutputParams {
|
|
|
41
41
|
Ds_ProcessedPayMethod?: string;
|
|
42
42
|
/** Credential On File transaction identifier */
|
|
43
43
|
Ds_Merchant_Cof_Txnid?: string;
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Card number with some digits replaced with asterisks
|
|
46
|
+
* @deprecated
|
|
47
|
+
*/
|
|
45
48
|
Ds_CardNumber?: string;
|
|
49
|
+
/** Card number with some digits replaced with asterisks */
|
|
50
|
+
Ds_Card_Number?: string;
|
|
46
51
|
/** Card expiry date, YYmm */
|
|
47
52
|
Ds_ExpiryDate?: string;
|
|
48
53
|
/** Stored payment method reference number */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redsys-easy",
|
|
3
3
|
"description": "Node JS interface for Redsys payment gateway",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.3",
|
|
5
5
|
"author": "Javier Garcia <javiertury@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"*.{js,ts}": "eslint"
|
|
37
37
|
},
|
|
38
38
|
"simple-git-hooks": {
|
|
39
|
-
"pre-commit": "
|
|
40
|
-
"commit-msg": "
|
|
39
|
+
"pre-commit": "pnpm exec lint-staged",
|
|
40
|
+
"commit-msg": "pnpm exec commitlint -e"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@types/node-fetch": "^2.5.11",
|
|
44
44
|
"base64url": "^3.0.1",
|
|
45
45
|
"dayjs": "^1.10.6",
|
|
46
46
|
"decimal.js": "^10.3.1",
|
|
47
|
-
"fast-xml-parser": "^
|
|
47
|
+
"fast-xml-parser": "^4.0.0",
|
|
48
48
|
"node-fetch": "^2.6.1",
|
|
49
49
|
"tslib": "^2.3.0"
|
|
50
50
|
},
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"markdown-magic": "^2.3.2",
|
|
79
79
|
"rimraf": "^3.0.2",
|
|
80
80
|
"rollup": "^2.53.2",
|
|
81
|
-
"rollup-plugin-typescript2": "^0.
|
|
81
|
+
"rollup-plugin-typescript2": "^0.35.0",
|
|
82
82
|
"simple-git-hooks": "^2.5.1",
|
|
83
83
|
"standard-version": "^9.3.1",
|
|
84
84
|
"ts-expect": "^1.3.0",
|