redsys-easy 5.2.11 → 5.3.0

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)
@@ -48,6 +48,8 @@ export interface BaseOutputParams {
48
48
  Ds_CardNumber?: string;
49
49
  /** Card number with some digits replaced with asterisks */
50
50
  Ds_Card_Number?: string;
51
+ /** Last 4 digits of card number */
52
+ Ds_Card_Last4?: string;
51
53
  /** Card expiry date, YYmm */
52
54
  Ds_ExpiryDate?: string;
53
55
  /** 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": "5.2.11",
4
+ "version": "5.3.0",
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.0",
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
  }