redsys-easy 5.2.11 → 5.3.1

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/README.md CHANGED
@@ -17,8 +17,7 @@ Checkout the [api documentation](./docs/redsys-easy.md) to explore the utilities
17
17
 
18
18
  These are the most important utilities that redsys-easy provides.
19
19
 
20
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/__readme__/usage.ts) -->
21
- <!-- The below code snippet is automatically added from ./examples/__readme__/usage.ts -->
20
+ <!-- docs CODE src="./examples/__readme__/usage.ts" -->
22
21
  ```ts
23
22
  import {
24
23
  createRedsysAPI,
@@ -48,7 +47,7 @@ const {
48
47
  urls: SANDBOX_URLS
49
48
  });
50
49
  ```
51
- <!-- AUTO-GENERATED-CONTENT:END -->
50
+ <!-- /docs -->
52
51
 
53
52
  ## Examples
54
53
 
@@ -67,8 +66,7 @@ As an example, redsys-easy provides some basic typescript-ready formatters.
67
66
 
68
67
  > :warning: **Format has changed**: Previous versions of redsys-easy used a different format, particularly the `amount` field.
69
68
 
70
- <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./examples/__readme__/formatters.ts) -->
71
- <!-- The below code snippet is automatically added from ./examples/__readme__/formatters.ts -->
69
+ <!-- docs CODE src="./examples/__readme__/formatters.ts" -->
72
70
  ```ts
73
71
  import {
74
72
  createRedsysAPI,
@@ -124,7 +122,7 @@ export const restTrataPeticion = useSingleInputFormatter(
124
122
  export const processRestNotification = useOutputFormatter(baseProcessRestNotification, restNotificationOutputFormatter);
125
123
  export const processSoapNotification = useOutputFormatter(baseProcessSoapNotification, soapNotificationOutputFormatter);
126
124
  ```
127
- <!-- AUTO-GENERATED-CONTENT:END -->
125
+ <!-- /docs -->
128
126
 
129
127
  ## FAQ
130
128
 
@@ -265,6 +265,10 @@ export interface RequestFormatterOutput<RawOutputParams extends RequestOutputPar
265
265
  * @see {@link RestTrataPeticionOutputParams.Ds_Card_Number}
266
266
  */
267
267
  cardNumber?: string;
268
+ /**
269
+ * @see {@link RestTrataPeticionOutputParams.Ds_Card_Last4}
270
+ */
271
+ cardNumberLast4?: string;
268
272
  /**
269
273
  * @see {@link RestTrataPeticionOutputParams.Ds_UrlPago2Fases}
270
274
  */
package/lib/index.esm.js CHANGED
@@ -4755,11 +4755,12 @@ const soapNotificationOutputFormatter = (raw) => {
4755
4755
  const requestOutputFormatter = (raw) => {
4756
4756
  const {
4757
4757
  // eslint-disable-next-line @typescript-eslint/no-deprecated -- robust to old format
4758
- Ds_CardNumber: deprecatedCardNumber, Ds_Card_Number: newCardNumber, Ds_Merchant_Identifier: identifier, Ds_ExpiryDate: rawExpiryDate, Ds_UrlPago2Fases: payURL, Ds_Language: rawLang } = raw;
4758
+ Ds_CardNumber: deprecatedCardNumber, Ds_Card_Number: newCardNumber, Ds_Card_Last4: cardNumberLast4, Ds_Merchant_Identifier: identifier, Ds_ExpiryDate: rawExpiryDate, Ds_UrlPago2Fases: payURL, Ds_Language: rawLang } = raw;
4759
4759
  const cardNumber = newCardNumber !== null && newCardNumber !== void 0 ? newCardNumber : deprecatedCardNumber;
4760
4760
  return {
4761
4761
  ...baseOutputFormatter(raw),
4762
4762
  ...(isStringNotEmpty(cardNumber) ? { cardNumber } : undefined),
4763
+ ...(isStringNotEmpty(cardNumberLast4) ? { cardNumberLast4 } : undefined),
4763
4764
  ...(isStringNotEmpty(identifier) ? { identifier } : undefined),
4764
4765
  ...(isStringNotEmpty(payURL) ? { payURL } : undefined),
4765
4766
  ...(isStringNotEmpty(rawExpiryDate)
package/lib/index.js CHANGED
@@ -4757,11 +4757,12 @@ const soapNotificationOutputFormatter = (raw) => {
4757
4757
  const requestOutputFormatter = (raw) => {
4758
4758
  const {
4759
4759
  // eslint-disable-next-line @typescript-eslint/no-deprecated -- robust to old format
4760
- Ds_CardNumber: deprecatedCardNumber, Ds_Card_Number: newCardNumber, Ds_Merchant_Identifier: identifier, Ds_ExpiryDate: rawExpiryDate, Ds_UrlPago2Fases: payURL, Ds_Language: rawLang } = raw;
4760
+ Ds_CardNumber: deprecatedCardNumber, Ds_Card_Number: newCardNumber, Ds_Card_Last4: cardNumberLast4, Ds_Merchant_Identifier: identifier, Ds_ExpiryDate: rawExpiryDate, Ds_UrlPago2Fases: payURL, Ds_Language: rawLang } = raw;
4761
4761
  const cardNumber = newCardNumber !== null && newCardNumber !== void 0 ? newCardNumber : deprecatedCardNumber;
4762
4762
  return {
4763
4763
  ...baseOutputFormatter(raw),
4764
4764
  ...(isStringNotEmpty(cardNumber) ? { cardNumber } : undefined),
4765
+ ...(isStringNotEmpty(cardNumberLast4) ? { cardNumberLast4 } : undefined),
4765
4766
  ...(isStringNotEmpty(identifier) ? { identifier } : undefined),
4766
4767
  ...(isStringNotEmpty(payURL) ? { payURL } : undefined),
4767
4768
  ...(isStringNotEmpty(rawExpiryDate)
@@ -91,12 +91,14 @@ export interface RedirectInputParams extends BaseInputParams {
91
91
  * @public
92
92
  */
93
93
  export interface RequestInputParams extends BaseInputParams, Pick<RedirectInputParams, 'DS_MERCHANT_MERCHANTURL' | 'DS_MERCHANT_URLOK' | 'DS_MERCHANT_URLKO' | 'DS_MERCHANT_CONSUMERLANGUAGE' | 'DS_MERCHANT_PAYMETHODS' | 'DS_MERCHANT_PERSOCODE' | 'DS_MERCHANT_SHIPPINGADDRESSPYP'> {
94
- /** xPay data, hex */
94
+ /** xPay data in base64 format, mutually exclusive with DS_XPAYDECODEDDATA */
95
95
  DS_XPAYDATA?: string | undefined;
96
+ /** xPay data in json format, mutually exclusive with DS_XPAYDATA */
97
+ DS_XPAYDECODEDDATA?: Record<string, unknown> | undefined;
96
98
  /** xPay origin */
97
- DS_XPAYORIGEN?: 'Google' | 'Apple' | undefined;
99
+ DS_XPAYORIGEN?: 'WEB' | 'InApp' | undefined;
98
100
  /** xPay type */
99
- DS_XPAYTYPE?: 'WEB' | 'InApp' | undefined;
101
+ DS_XPAYTYPE?: 'Google' | 'Apple' | undefined;
100
102
  /** PUC identifier, number */
101
103
  DS_ACQUIRER_IDENTIFIER?: string | undefined;
102
104
  /** Matching data */
@@ -28,6 +28,8 @@ export interface BaseOutputParams {
28
28
  Ds_MerchantData?: string;
29
29
  /** Card brand */
30
30
  Ds_Card_Brand?: CardBrandNum;
31
+ /** Card typology */
32
+ Ds_Card_Typology?: string | undefined;
31
33
  /** Card is under PSD2 */
32
34
  Ds_Card_PSD2?: 'Y' | 'N';
33
35
  /**
@@ -48,10 +50,14 @@ export interface BaseOutputParams {
48
50
  Ds_CardNumber?: string;
49
51
  /** Card number with some digits replaced with asterisks */
50
52
  Ds_Card_Number?: string;
53
+ /** Last 4 digits of card number */
54
+ Ds_Card_Last4?: string;
51
55
  /** Card expiry date, YYmm */
52
56
  Ds_ExpiryDate?: string;
53
57
  /** Stored payment method reference number */
54
58
  Ds_Merchant_Identifier?: string;
59
+ /** Electronic Commerce Indicator */
60
+ Ds_ECI?: string | undefined;
55
61
  }
56
62
  /**
57
63
  * Common output parameters of resolved requests or notifications
@@ -68,6 +74,10 @@ export interface ResolvedTransactionTrait {
68
74
  Ds_Currency: CurrencyNum;
69
75
  /** Response code */
70
76
  Ds_Response: string;
77
+ /** Response description */
78
+ Ds_Response_Description?: string | undefined;
79
+ /** Response subcode indicating motive, it appears in denials with code 190 */
80
+ Ds_ResponseInt?: string | undefined;
71
81
  }
72
82
  /**
73
83
  * Common output parameters of a all requests
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": "5.2.11",
4
+ "version": "5.3.1",
5
5
  "author": "Javier Garcia <javiertury@gmail.com>",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -51,30 +51,30 @@
51
51
  "@commitlint/cli": "^17.6.7",
52
52
  "@commitlint/config-conventional": "^17.6.7",
53
53
  "@koa/router": "^12.0.0",
54
- "@microsoft/api-documenter": "^7.22.32",
54
+ "@microsoft/api-documenter": "^7.28.0",
55
55
  "@microsoft/api-extractor": "^7.36.3",
56
56
  "@rollup/plugin-node-resolve": "^15.1.0",
57
57
  "@types/cheerio": "^0.22.31",
58
- "@types/jest": "^29.5.3",
59
- "@types/koa": "^2.13.8",
58
+ "@types/jest": "^30.0.0",
59
+ "@types/koa": "^3.0.0",
60
60
  "@types/koa-bodyparser": "^4.3.10",
61
61
  "@types/koa__router": "^12.0.0",
62
62
  "cheerio": "1.0.0-rc.12",
63
63
  "commit-and-tag-version": "^12.5.0",
64
- "eslint": "^9.17.0",
64
+ "eslint": "^9.39.1",
65
65
  "eslint-config-love": "^114.0.0",
66
- "eslint-plugin-jest": "^28.10.0",
67
- "jest": "^29.6.2",
68
- "koa": "^2.14.2",
66
+ "eslint-plugin-jest": "^28.14.0",
67
+ "jest": "^30.2.0",
68
+ "koa": "^3.0.0",
69
69
  "koa-bodyparser": "^4.4.1",
70
70
  "lint-staged": "^15.3.0",
71
- "markdown-magic": "^2.6.1",
72
- "rimraf": "^5.0.1",
71
+ "markdown-magic": "^4.0.4",
72
+ "rimraf": "^6.1.2",
73
73
  "rollup": "^3.29.5",
74
74
  "rollup-plugin-typescript2": "^0.35.0",
75
75
  "simple-git-hooks": "^2.9.0",
76
76
  "ts-expect": "^1.3.0",
77
- "ts-jest": "^29.1.1",
77
+ "ts-jest": "^29.4.5",
78
78
  "typescript": "^5.1.6"
79
79
  },
80
80
  "jest": {
@@ -88,10 +88,13 @@
88
88
  "setupFilesAfterEnv": [
89
89
  "./test/jest.setup.ts"
90
90
  ],
91
- "globals": {
92
- "ts-jest": {
93
- "tsconfig": "./tsconfig.test.json"
94
- }
91
+ "transform": {
92
+ "^.+\\.tsx?$": [
93
+ "ts-jest",
94
+ {
95
+ "tsconfig": "tsconfig.test.json"
96
+ }
97
+ ]
95
98
  },
96
99
  "moduleNameMapper": {
97
100
  "redsys-easy": "<rootDir>/src"
@@ -109,7 +112,7 @@
109
112
  "test:readme": "tsc -p ./tsconfig.readme.json",
110
113
  "test": "pnpm run test:code && pnpm run test:readme",
111
114
  "docs:api": "api-documenter markdown --input-folder ./api/temp --output-folder ./docs",
112
- "docs:readme": "md-magic --path ./README.md",
115
+ "docs:readme": "md-magic --files ./README.md",
113
116
  "docs": "pnpm run docs:api && pnpm run docs:readme",
114
117
  "release": "pnpm run test && commit-and-tag-version --dry-run && pnpm run docs && git add docs CHANGELOG.md && commit-and-tag-version --commit-all"
115
118
  }