redsys-easy 5.0.0 → 5.2.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/lib/client.d.ts +17 -0
- package/lib/errors.d.ts +7 -7
- package/lib/formatters/types.d.ts +27 -27
- package/lib/index.esm.js +82 -4
- package/lib/index.js +82 -4
- package/lib/soap/utils.d.ts +2 -2
- package/lib/types/3ds-params.d.ts +58 -58
- package/lib/types/input-params.d.ts +44 -44
- package/lib/utils/misc.d.ts +7 -1
- package/package.json +1 -1
package/lib/client.d.ts
CHANGED
|
@@ -36,36 +36,53 @@ export interface RedsysConfig {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Sends a iniciaPeticion request using REST interface
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
39
41
|
*/
|
|
40
42
|
export type RestIniciaPeticion = (paramsInput: RestIniciaPeticionInputParams) => Promise<RestIniciaPeticionOutputParams>;
|
|
41
43
|
/**
|
|
42
44
|
* Sends a trataPeticion request using REST interface
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
43
47
|
*/
|
|
44
48
|
export type RestTrataPeticion = (paramsInput: RestTrataPeticionInputParams) => Promise<RestTrataPeticionOutputParams>;
|
|
45
49
|
/**
|
|
46
50
|
* Creates the parameters needed for a redirect form
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
47
53
|
*/
|
|
48
54
|
export type CreateRedirectForm = (paramsInput: RedirectInputParams) => RedirectForm;
|
|
49
55
|
/**
|
|
50
56
|
* Processes a JSON REST notification
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
51
59
|
*/
|
|
52
60
|
export type ProcessRestNotification = (
|
|
53
61
|
/** Body of JSON notification, as a POJO (Plain Old Javascript Object) */
|
|
54
62
|
body: ResponseJSONSuccess) => RestNotificationOutputParams;
|
|
55
63
|
/**
|
|
56
64
|
* Parses and verifies the body of a SOAP notification
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
57
67
|
*/
|
|
58
68
|
export type ProcessSoapNotification = (
|
|
59
69
|
/** SOAP notification as a XML string */
|
|
60
70
|
xml: string) => SoapNotificationOutputParams;
|
|
61
71
|
/**
|
|
62
72
|
* Creates an answer for a SOAP notification, serializes and signs it
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
63
75
|
*/
|
|
64
76
|
export type CreateSoapNotificationAnswer = (
|
|
65
77
|
/** Order identifier */
|
|
66
78
|
order: string,
|
|
67
79
|
/** Indicates if the payment is allowed to proceed */
|
|
68
80
|
allow: boolean) => string;
|
|
81
|
+
/**
|
|
82
|
+
* Redsys API
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
69
86
|
export interface RedsysAPI {
|
|
70
87
|
restIniciaPeticion: RestIniciaPeticion;
|
|
71
88
|
restTrataPeticion: RestTrataPeticion;
|
package/lib/errors.d.ts
CHANGED
|
@@ -25,12 +25,12 @@ export declare class ParseError extends RedsysError {
|
|
|
25
25
|
value: unknown;
|
|
26
26
|
location: unknown | undefined;
|
|
27
27
|
description: string | undefined;
|
|
28
|
-
constructor(message: string, value?: unknown, location?: unknown);
|
|
28
|
+
constructor(message: string, value?: unknown | undefined, location?: unknown | undefined);
|
|
29
29
|
}
|
|
30
30
|
interface HTTPErrorOptions {
|
|
31
|
-
message?: string;
|
|
31
|
+
message?: string | undefined;
|
|
32
32
|
code: number;
|
|
33
|
-
response?: unknown;
|
|
33
|
+
response?: unknown | undefined;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* HTTP Error
|
|
@@ -43,9 +43,9 @@ export declare class HTTPError extends RedsysError {
|
|
|
43
43
|
constructor({ message, code, response }: HTTPErrorOptions);
|
|
44
44
|
}
|
|
45
45
|
interface GatewayErrorOptions {
|
|
46
|
-
message?: string;
|
|
46
|
+
message?: string | undefined;
|
|
47
47
|
code: string;
|
|
48
|
-
response?: unknown;
|
|
48
|
+
response?: unknown | undefined;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Request could not be processed by Redsys
|
|
@@ -58,9 +58,9 @@ export declare class GatewayError extends RedsysError {
|
|
|
58
58
|
constructor({ message, code, response }: GatewayErrorOptions);
|
|
59
59
|
}
|
|
60
60
|
interface ResponseErrorOptions {
|
|
61
|
-
message?: string;
|
|
61
|
+
message?: string | undefined;
|
|
62
62
|
code: number;
|
|
63
|
-
response?: unknown;
|
|
63
|
+
response?: unknown | undefined;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* Response contained an error code
|
|
@@ -31,77 +31,77 @@ export interface BaseFormatterInput<RawInputParams extends Partial<BaseInputPara
|
|
|
31
31
|
* @remarks
|
|
32
32
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_AMOUNT}
|
|
33
33
|
*/
|
|
34
|
-
amount?: string;
|
|
34
|
+
amount?: string | undefined;
|
|
35
35
|
/**
|
|
36
36
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_CURRENCY}
|
|
37
37
|
*/
|
|
38
|
-
currency?: Currency;
|
|
38
|
+
currency?: Currency | undefined;
|
|
39
39
|
/**
|
|
40
40
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_PAN}
|
|
41
41
|
*/
|
|
42
|
-
pan?: string;
|
|
42
|
+
pan?: string | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* Card expiry year, YY
|
|
45
45
|
*
|
|
46
46
|
* @remarks
|
|
47
47
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_EXPIRYDATE}
|
|
48
48
|
*/
|
|
49
|
-
expiryYear?: string;
|
|
49
|
+
expiryYear?: string | undefined;
|
|
50
50
|
/**
|
|
51
51
|
* Card expiry month, MM
|
|
52
52
|
*
|
|
53
53
|
* @remarks
|
|
54
54
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_EXPIRYDATE}
|
|
55
55
|
*/
|
|
56
|
-
expiryMonth?: string;
|
|
56
|
+
expiryMonth?: string | undefined;
|
|
57
57
|
/**
|
|
58
58
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_CVV2}
|
|
59
59
|
*/
|
|
60
|
-
cvv?: string;
|
|
60
|
+
cvv?: string | undefined;
|
|
61
61
|
/**
|
|
62
62
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_MERCHANTNAME}
|
|
63
63
|
*/
|
|
64
|
-
merchantName?: string;
|
|
64
|
+
merchantName?: string | undefined;
|
|
65
65
|
/**
|
|
66
66
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_IDENTIFIER}
|
|
67
67
|
*/
|
|
68
|
-
identifier?: string;
|
|
68
|
+
identifier?: string | undefined;
|
|
69
69
|
/**
|
|
70
70
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_GROUP}
|
|
71
71
|
*/
|
|
72
|
-
group?: string;
|
|
72
|
+
group?: string | undefined;
|
|
73
73
|
/**
|
|
74
74
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_DIRECTPAYMENT}
|
|
75
75
|
*/
|
|
76
|
-
directPayment?: BaseInputParams['DS_MERCHANT_DIRECTPAYMENT'];
|
|
76
|
+
directPayment?: BaseInputParams['DS_MERCHANT_DIRECTPAYMENT'] | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_MERCHANTDATA}
|
|
79
79
|
*/
|
|
80
|
-
merchantData?: string;
|
|
80
|
+
merchantData?: string | undefined;
|
|
81
81
|
/**
|
|
82
82
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_IDOPER}
|
|
83
83
|
*/
|
|
84
|
-
operationId?: string;
|
|
84
|
+
operationId?: string | undefined;
|
|
85
85
|
/**
|
|
86
86
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_PRODUCTDESCRIPTION}
|
|
87
87
|
*/
|
|
88
|
-
productDescription?: string;
|
|
88
|
+
productDescription?: string | undefined;
|
|
89
89
|
/**
|
|
90
90
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_TAX_REFERENCE}
|
|
91
91
|
*/
|
|
92
|
-
taxReference?: string;
|
|
92
|
+
taxReference?: string | undefined;
|
|
93
93
|
/**
|
|
94
94
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_TRANSACTIONDATE}
|
|
95
95
|
*/
|
|
96
|
-
transactionDate?: string;
|
|
96
|
+
transactionDate?: string | undefined;
|
|
97
97
|
/**
|
|
98
98
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_TITULAR}
|
|
99
99
|
*/
|
|
100
|
-
cardHolder?: string;
|
|
100
|
+
cardHolder?: string | undefined;
|
|
101
101
|
/**
|
|
102
102
|
* @see {@link RestTrataPeticionInputParams}
|
|
103
103
|
*/
|
|
104
|
-
raw?: RawInputParams;
|
|
104
|
+
raw?: RawInputParams | undefined;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Input parameters for the redirect input formatter
|
|
@@ -112,37 +112,37 @@ export interface RedirectFormatterInput<RawInputParams extends Partial<RedirectI
|
|
|
112
112
|
/**
|
|
113
113
|
* @see {@link RedirectInputParams.DS_MERCHANT_MERCHANTURL}
|
|
114
114
|
*/
|
|
115
|
-
merchantURL?: string;
|
|
115
|
+
merchantURL?: string | undefined;
|
|
116
116
|
/**
|
|
117
117
|
* @see {@link RedirectInputParams.DS_MERCHANT_URLOK}
|
|
118
118
|
*/
|
|
119
|
-
successURL?: string;
|
|
119
|
+
successURL?: string | undefined;
|
|
120
120
|
/**
|
|
121
121
|
* @see {@link RedirectInputParams.DS_MERCHANT_URLKO}
|
|
122
122
|
*/
|
|
123
|
-
errorURL?: string;
|
|
123
|
+
errorURL?: string | undefined;
|
|
124
124
|
/**
|
|
125
125
|
* @see {@link RedirectInputParams.DS_MERCHANT_PAYMETHODS}
|
|
126
126
|
*/
|
|
127
|
-
payMethods?: string;
|
|
127
|
+
payMethods?: string | undefined;
|
|
128
128
|
/**
|
|
129
129
|
* @see {@link RedirectInputParams.DS_MERCHANT_CONSUMERLANGUAGE}
|
|
130
130
|
*/
|
|
131
|
-
lang?: Language;
|
|
131
|
+
lang?: Language | undefined;
|
|
132
132
|
}
|
|
133
133
|
export interface RequestFormatterInput<RawInputParams extends Partial<RequestInputParams>> extends BaseFormatterInput<RawInputParams> {
|
|
134
134
|
/**
|
|
135
135
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_CUSTOMER_MOBILE}
|
|
136
136
|
*/
|
|
137
|
-
customerMobile?: string;
|
|
137
|
+
customerMobile?: string | undefined;
|
|
138
138
|
/**
|
|
139
139
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_CUSTOMER_MAIL}
|
|
140
140
|
*/
|
|
141
|
-
customerMail?: string;
|
|
141
|
+
customerMail?: string | undefined;
|
|
142
142
|
/**
|
|
143
143
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_CUSTOMER_SMS_TEXT}
|
|
144
144
|
*/
|
|
145
|
-
smsTemplate?: string;
|
|
145
|
+
smsTemplate?: string | undefined;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Input parameters for the REST iniciaPeticion input formatter
|
|
@@ -153,7 +153,7 @@ export interface RestIniciaPeticionFormatterInput<RawInputParams extends Partial
|
|
|
153
153
|
/**
|
|
154
154
|
* @see {@link RestIniciaPeticionInputParams.DS_MERCHANT_EMV3DS}
|
|
155
155
|
*/
|
|
156
|
-
emv3ds?: RestIniciaPeticionInputParams['DS_MERCHANT_EMV3DS'];
|
|
156
|
+
emv3ds?: RestIniciaPeticionInputParams['DS_MERCHANT_EMV3DS'] | undefined;
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
159
|
* Input parameters for the REST trataPeticion input formatter
|
|
@@ -164,7 +164,7 @@ export interface RestTrataPeticionFormatterInput<RawInputParams extends Partial<
|
|
|
164
164
|
/**
|
|
165
165
|
* @see {@link RestTrataPeticionInputParams.DS_MERCHANT_EMV3DS}
|
|
166
166
|
*/
|
|
167
|
-
emv3ds?: RestTrataPeticionInputParams['DS_MERCHANT_EMV3DS'];
|
|
167
|
+
emv3ds?: RestTrataPeticionInputParams['DS_MERCHANT_EMV3DS'] | undefined;
|
|
168
168
|
}
|
|
169
169
|
export interface BaseFormatterOutput<RawOutputParams extends BaseOutputParams> {
|
|
170
170
|
/**
|
package/lib/index.esm.js
CHANGED
|
@@ -1779,6 +1779,18 @@ class RedsysError extends Error {
|
|
|
1779
1779
|
class ValidationError extends RedsysError {
|
|
1780
1780
|
constructor(message, parameters) {
|
|
1781
1781
|
super(message);
|
|
1782
|
+
Object.defineProperty(this, "value", {
|
|
1783
|
+
enumerable: true,
|
|
1784
|
+
configurable: true,
|
|
1785
|
+
writable: true,
|
|
1786
|
+
value: void 0
|
|
1787
|
+
});
|
|
1788
|
+
Object.defineProperty(this, "parameters", {
|
|
1789
|
+
enumerable: true,
|
|
1790
|
+
configurable: true,
|
|
1791
|
+
writable: true,
|
|
1792
|
+
value: void 0
|
|
1793
|
+
});
|
|
1782
1794
|
this.name = 'RedsysValidationError';
|
|
1783
1795
|
this.parameters = parameters;
|
|
1784
1796
|
}
|
|
@@ -1791,6 +1803,24 @@ class ValidationError extends RedsysError {
|
|
|
1791
1803
|
class ParseError extends RedsysError {
|
|
1792
1804
|
constructor(message, value, location) {
|
|
1793
1805
|
super(message);
|
|
1806
|
+
Object.defineProperty(this, "value", {
|
|
1807
|
+
enumerable: true,
|
|
1808
|
+
configurable: true,
|
|
1809
|
+
writable: true,
|
|
1810
|
+
value: void 0
|
|
1811
|
+
});
|
|
1812
|
+
Object.defineProperty(this, "location", {
|
|
1813
|
+
enumerable: true,
|
|
1814
|
+
configurable: true,
|
|
1815
|
+
writable: true,
|
|
1816
|
+
value: void 0
|
|
1817
|
+
});
|
|
1818
|
+
Object.defineProperty(this, "description", {
|
|
1819
|
+
enumerable: true,
|
|
1820
|
+
configurable: true,
|
|
1821
|
+
writable: true,
|
|
1822
|
+
value: void 0
|
|
1823
|
+
});
|
|
1794
1824
|
this.name = 'RedsysParseError';
|
|
1795
1825
|
this.value = value;
|
|
1796
1826
|
this.location = location;
|
|
@@ -1810,6 +1840,18 @@ class HTTPError extends RedsysError {
|
|
|
1810
1840
|
const augmentationLine = message != null && message ? `\n${message}` : '';
|
|
1811
1841
|
const augmentedMessage = `HTTP error${codeInfo}${augmentationLine}`;
|
|
1812
1842
|
super(augmentedMessage);
|
|
1843
|
+
Object.defineProperty(this, "code", {
|
|
1844
|
+
enumerable: true,
|
|
1845
|
+
configurable: true,
|
|
1846
|
+
writable: true,
|
|
1847
|
+
value: void 0
|
|
1848
|
+
});
|
|
1849
|
+
Object.defineProperty(this, "response", {
|
|
1850
|
+
enumerable: true,
|
|
1851
|
+
configurable: true,
|
|
1852
|
+
writable: true,
|
|
1853
|
+
value: void 0
|
|
1854
|
+
});
|
|
1813
1855
|
this.name = 'RedsysHTTPError';
|
|
1814
1856
|
this.code = code;
|
|
1815
1857
|
this.response = response;
|
|
@@ -1829,6 +1871,18 @@ class GatewayError extends RedsysError {
|
|
|
1829
1871
|
const augmentationLine = message != null && message ? `\n${message}` : '';
|
|
1830
1872
|
const augmentedMessage = `Gateway error${codeInfo}${augmentationLine}`;
|
|
1831
1873
|
super(augmentedMessage);
|
|
1874
|
+
Object.defineProperty(this, "code", {
|
|
1875
|
+
enumerable: true,
|
|
1876
|
+
configurable: true,
|
|
1877
|
+
writable: true,
|
|
1878
|
+
value: void 0
|
|
1879
|
+
});
|
|
1880
|
+
Object.defineProperty(this, "response", {
|
|
1881
|
+
enumerable: true,
|
|
1882
|
+
configurable: true,
|
|
1883
|
+
writable: true,
|
|
1884
|
+
value: void 0
|
|
1885
|
+
});
|
|
1832
1886
|
this.name = 'RedsysGatewayError';
|
|
1833
1887
|
this.code = code;
|
|
1834
1888
|
this.response = response;
|
|
@@ -1848,6 +1902,18 @@ class ResponseError extends RedsysError {
|
|
|
1848
1902
|
const augmentationLine = message != null && message ? `\n${message}` : '';
|
|
1849
1903
|
const augmentedMessage = `Response error${codeInfo}${augmentationLine}`;
|
|
1850
1904
|
super(augmentedMessage);
|
|
1905
|
+
Object.defineProperty(this, "code", {
|
|
1906
|
+
enumerable: true,
|
|
1907
|
+
configurable: true,
|
|
1908
|
+
writable: true,
|
|
1909
|
+
value: void 0
|
|
1910
|
+
});
|
|
1911
|
+
Object.defineProperty(this, "response", {
|
|
1912
|
+
enumerable: true,
|
|
1913
|
+
configurable: true,
|
|
1914
|
+
writable: true,
|
|
1915
|
+
value: void 0
|
|
1916
|
+
});
|
|
1851
1917
|
this.name = 'RedsysResponseError';
|
|
1852
1918
|
this.code = code;
|
|
1853
1919
|
this.response = response;
|
|
@@ -2015,6 +2081,16 @@ const assertSuccessfulResponse = (responseParams) => {
|
|
|
2015
2081
|
}
|
|
2016
2082
|
};
|
|
2017
2083
|
const isStringNotEmpty = (str) => str != null && str.length > 0;
|
|
2084
|
+
/**
|
|
2085
|
+
* Map over maybe monad
|
|
2086
|
+
*
|
|
2087
|
+
* If value is defined apply function and return output, otherwise return undefined.
|
|
2088
|
+
*/
|
|
2089
|
+
const mapMaybeMonad = (value, fn) => {
|
|
2090
|
+
return value !== undefined
|
|
2091
|
+
? fn(value)
|
|
2092
|
+
: undefined;
|
|
2093
|
+
};
|
|
2018
2094
|
|
|
2019
2095
|
const sha256VerifyJSONResponse = (merchantKey, response, responseParams) => {
|
|
2020
2096
|
if (response.Ds_SignatureVersion !== 'HMAC_SHA256_V1') {
|
|
@@ -3292,10 +3368,10 @@ const baseOutputFormatter = (raw) => {
|
|
|
3292
3368
|
? { securePayment: rawSecurePayment === '1' || rawSecurePayment === '2' }
|
|
3293
3369
|
: undefined),
|
|
3294
3370
|
...(isStringNotEmpty(rawCardCountry)
|
|
3295
|
-
?
|
|
3371
|
+
? mapMaybeMonad(formatCountry(rawCardCountry), cardCountry => ({ cardCountry }))
|
|
3296
3372
|
: undefined),
|
|
3297
3373
|
...(isStringNotEmpty(rawCardBrand)
|
|
3298
|
-
?
|
|
3374
|
+
? mapMaybeMonad(formatCardBrand(rawCardBrand), cardBrand => ({ cardBrand }))
|
|
3299
3375
|
: undefined),
|
|
3300
3376
|
...(isStringNotEmpty(rawCardPSD2)
|
|
3301
3377
|
? { cardPSD2: rawCardPSD2 === 'Y' }
|
|
@@ -3333,7 +3409,7 @@ const notificationOutputFormatter = (raw) => {
|
|
|
3333
3409
|
...formatPrice(raw),
|
|
3334
3410
|
response: formatResponse(rawResponse),
|
|
3335
3411
|
...(isStringNotEmpty(rawConsumerLanguage)
|
|
3336
|
-
?
|
|
3412
|
+
? mapMaybeMonad(formatLang(rawConsumerLanguage), lang => ({ lang }))
|
|
3337
3413
|
: undefined)
|
|
3338
3414
|
};
|
|
3339
3415
|
};
|
|
@@ -3385,7 +3461,9 @@ const requestOutputFormatter = (raw) => {
|
|
|
3385
3461
|
expiryMonth: rawExpiryDate.slice(2, 4)
|
|
3386
3462
|
}
|
|
3387
3463
|
: undefined),
|
|
3388
|
-
...(isStringNotEmpty(rawLang)
|
|
3464
|
+
...(isStringNotEmpty(rawLang)
|
|
3465
|
+
? mapMaybeMonad(formatLang(rawLang), lang => ({ lang }))
|
|
3466
|
+
: undefined)
|
|
3389
3467
|
};
|
|
3390
3468
|
};
|
|
3391
3469
|
/**
|
package/lib/index.js
CHANGED
|
@@ -1781,6 +1781,18 @@ class RedsysError extends Error {
|
|
|
1781
1781
|
class ValidationError extends RedsysError {
|
|
1782
1782
|
constructor(message, parameters) {
|
|
1783
1783
|
super(message);
|
|
1784
|
+
Object.defineProperty(this, "value", {
|
|
1785
|
+
enumerable: true,
|
|
1786
|
+
configurable: true,
|
|
1787
|
+
writable: true,
|
|
1788
|
+
value: void 0
|
|
1789
|
+
});
|
|
1790
|
+
Object.defineProperty(this, "parameters", {
|
|
1791
|
+
enumerable: true,
|
|
1792
|
+
configurable: true,
|
|
1793
|
+
writable: true,
|
|
1794
|
+
value: void 0
|
|
1795
|
+
});
|
|
1784
1796
|
this.name = 'RedsysValidationError';
|
|
1785
1797
|
this.parameters = parameters;
|
|
1786
1798
|
}
|
|
@@ -1793,6 +1805,24 @@ class ValidationError extends RedsysError {
|
|
|
1793
1805
|
class ParseError extends RedsysError {
|
|
1794
1806
|
constructor(message, value, location) {
|
|
1795
1807
|
super(message);
|
|
1808
|
+
Object.defineProperty(this, "value", {
|
|
1809
|
+
enumerable: true,
|
|
1810
|
+
configurable: true,
|
|
1811
|
+
writable: true,
|
|
1812
|
+
value: void 0
|
|
1813
|
+
});
|
|
1814
|
+
Object.defineProperty(this, "location", {
|
|
1815
|
+
enumerable: true,
|
|
1816
|
+
configurable: true,
|
|
1817
|
+
writable: true,
|
|
1818
|
+
value: void 0
|
|
1819
|
+
});
|
|
1820
|
+
Object.defineProperty(this, "description", {
|
|
1821
|
+
enumerable: true,
|
|
1822
|
+
configurable: true,
|
|
1823
|
+
writable: true,
|
|
1824
|
+
value: void 0
|
|
1825
|
+
});
|
|
1796
1826
|
this.name = 'RedsysParseError';
|
|
1797
1827
|
this.value = value;
|
|
1798
1828
|
this.location = location;
|
|
@@ -1812,6 +1842,18 @@ class HTTPError extends RedsysError {
|
|
|
1812
1842
|
const augmentationLine = message != null && message ? `\n${message}` : '';
|
|
1813
1843
|
const augmentedMessage = `HTTP error${codeInfo}${augmentationLine}`;
|
|
1814
1844
|
super(augmentedMessage);
|
|
1845
|
+
Object.defineProperty(this, "code", {
|
|
1846
|
+
enumerable: true,
|
|
1847
|
+
configurable: true,
|
|
1848
|
+
writable: true,
|
|
1849
|
+
value: void 0
|
|
1850
|
+
});
|
|
1851
|
+
Object.defineProperty(this, "response", {
|
|
1852
|
+
enumerable: true,
|
|
1853
|
+
configurable: true,
|
|
1854
|
+
writable: true,
|
|
1855
|
+
value: void 0
|
|
1856
|
+
});
|
|
1815
1857
|
this.name = 'RedsysHTTPError';
|
|
1816
1858
|
this.code = code;
|
|
1817
1859
|
this.response = response;
|
|
@@ -1831,6 +1873,18 @@ class GatewayError extends RedsysError {
|
|
|
1831
1873
|
const augmentationLine = message != null && message ? `\n${message}` : '';
|
|
1832
1874
|
const augmentedMessage = `Gateway error${codeInfo}${augmentationLine}`;
|
|
1833
1875
|
super(augmentedMessage);
|
|
1876
|
+
Object.defineProperty(this, "code", {
|
|
1877
|
+
enumerable: true,
|
|
1878
|
+
configurable: true,
|
|
1879
|
+
writable: true,
|
|
1880
|
+
value: void 0
|
|
1881
|
+
});
|
|
1882
|
+
Object.defineProperty(this, "response", {
|
|
1883
|
+
enumerable: true,
|
|
1884
|
+
configurable: true,
|
|
1885
|
+
writable: true,
|
|
1886
|
+
value: void 0
|
|
1887
|
+
});
|
|
1834
1888
|
this.name = 'RedsysGatewayError';
|
|
1835
1889
|
this.code = code;
|
|
1836
1890
|
this.response = response;
|
|
@@ -1850,6 +1904,18 @@ class ResponseError extends RedsysError {
|
|
|
1850
1904
|
const augmentationLine = message != null && message ? `\n${message}` : '';
|
|
1851
1905
|
const augmentedMessage = `Response error${codeInfo}${augmentationLine}`;
|
|
1852
1906
|
super(augmentedMessage);
|
|
1907
|
+
Object.defineProperty(this, "code", {
|
|
1908
|
+
enumerable: true,
|
|
1909
|
+
configurable: true,
|
|
1910
|
+
writable: true,
|
|
1911
|
+
value: void 0
|
|
1912
|
+
});
|
|
1913
|
+
Object.defineProperty(this, "response", {
|
|
1914
|
+
enumerable: true,
|
|
1915
|
+
configurable: true,
|
|
1916
|
+
writable: true,
|
|
1917
|
+
value: void 0
|
|
1918
|
+
});
|
|
1853
1919
|
this.name = 'RedsysResponseError';
|
|
1854
1920
|
this.code = code;
|
|
1855
1921
|
this.response = response;
|
|
@@ -2017,6 +2083,16 @@ const assertSuccessfulResponse = (responseParams) => {
|
|
|
2017
2083
|
}
|
|
2018
2084
|
};
|
|
2019
2085
|
const isStringNotEmpty = (str) => str != null && str.length > 0;
|
|
2086
|
+
/**
|
|
2087
|
+
* Map over maybe monad
|
|
2088
|
+
*
|
|
2089
|
+
* If value is defined apply function and return output, otherwise return undefined.
|
|
2090
|
+
*/
|
|
2091
|
+
const mapMaybeMonad = (value, fn) => {
|
|
2092
|
+
return value !== undefined
|
|
2093
|
+
? fn(value)
|
|
2094
|
+
: undefined;
|
|
2095
|
+
};
|
|
2020
2096
|
|
|
2021
2097
|
const sha256VerifyJSONResponse = (merchantKey, response, responseParams) => {
|
|
2022
2098
|
if (response.Ds_SignatureVersion !== 'HMAC_SHA256_V1') {
|
|
@@ -3294,10 +3370,10 @@ const baseOutputFormatter = (raw) => {
|
|
|
3294
3370
|
? { securePayment: rawSecurePayment === '1' || rawSecurePayment === '2' }
|
|
3295
3371
|
: undefined),
|
|
3296
3372
|
...(isStringNotEmpty(rawCardCountry)
|
|
3297
|
-
?
|
|
3373
|
+
? mapMaybeMonad(formatCountry(rawCardCountry), cardCountry => ({ cardCountry }))
|
|
3298
3374
|
: undefined),
|
|
3299
3375
|
...(isStringNotEmpty(rawCardBrand)
|
|
3300
|
-
?
|
|
3376
|
+
? mapMaybeMonad(formatCardBrand(rawCardBrand), cardBrand => ({ cardBrand }))
|
|
3301
3377
|
: undefined),
|
|
3302
3378
|
...(isStringNotEmpty(rawCardPSD2)
|
|
3303
3379
|
? { cardPSD2: rawCardPSD2 === 'Y' }
|
|
@@ -3335,7 +3411,7 @@ const notificationOutputFormatter = (raw) => {
|
|
|
3335
3411
|
...formatPrice(raw),
|
|
3336
3412
|
response: formatResponse(rawResponse),
|
|
3337
3413
|
...(isStringNotEmpty(rawConsumerLanguage)
|
|
3338
|
-
?
|
|
3414
|
+
? mapMaybeMonad(formatLang(rawConsumerLanguage), lang => ({ lang }))
|
|
3339
3415
|
: undefined)
|
|
3340
3416
|
};
|
|
3341
3417
|
};
|
|
@@ -3387,7 +3463,9 @@ const requestOutputFormatter = (raw) => {
|
|
|
3387
3463
|
expiryMonth: rawExpiryDate.slice(2, 4)
|
|
3388
3464
|
}
|
|
3389
3465
|
: undefined),
|
|
3390
|
-
...(isStringNotEmpty(rawLang)
|
|
3466
|
+
...(isStringNotEmpty(rawLang)
|
|
3467
|
+
? mapMaybeMonad(formatLang(rawLang), lang => ({ lang }))
|
|
3468
|
+
: undefined)
|
|
3391
3469
|
};
|
|
3392
3470
|
};
|
|
3393
3471
|
/**
|
package/lib/soap/utils.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ export declare const unescapeXML: (str: string) => string;
|
|
|
2
2
|
export declare const escapeXML: (str: string) => string;
|
|
3
3
|
type SoapRequest = {
|
|
4
4
|
headers: Record<string, string>;
|
|
5
|
-
body?: string;
|
|
5
|
+
body?: string | undefined;
|
|
6
6
|
} | {
|
|
7
|
-
headers?: Record<string, string
|
|
7
|
+
headers?: Record<string, string> | undefined;
|
|
8
8
|
body: string;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
@@ -14,11 +14,11 @@ export interface ThreeDSRequestorAuthenticationInfo {
|
|
|
14
14
|
}
|
|
15
15
|
export interface ThreeDSRequestorPriorAuthenticationInfo {
|
|
16
16
|
/** Reference */
|
|
17
|
-
threeDSReqPriorRef?: string;
|
|
17
|
+
threeDSReqPriorRef?: string | undefined;
|
|
18
18
|
/** Authentication method code */
|
|
19
|
-
threeDSReqPriorAuthMethod?: string;
|
|
19
|
+
threeDSReqPriorAuthMethod?: string | undefined;
|
|
20
20
|
/** Authentication timestamp, yyyymmddHHMM */
|
|
21
|
-
threeDSReqPriorAuthTimestamp?: string;
|
|
21
|
+
threeDSReqPriorAuthTimestamp?: string | undefined;
|
|
22
22
|
}
|
|
23
23
|
export interface BaseThreeDSAuthenticationDataParams {
|
|
24
24
|
/** 3DSecure protocol version */
|
|
@@ -80,117 +80,117 @@ export interface BaseThreeDSAuthenticationDataParams {
|
|
|
80
80
|
/** Browser Accept Header */
|
|
81
81
|
browserAcceptHeader: string;
|
|
82
82
|
/** Browser IP Address, ipv4 or ipv6 */
|
|
83
|
-
browserIP?: string;
|
|
83
|
+
browserIP?: string | undefined;
|
|
84
84
|
/** Additional account information, max 64 characters */
|
|
85
|
-
acctID?: string;
|
|
85
|
+
acctID?: string | undefined;
|
|
86
86
|
/** Account information, json */
|
|
87
87
|
acctInfo?: {
|
|
88
88
|
/** Account creation ellapsed time code */
|
|
89
|
-
chAccAgeInd?: '01' | '02' | '03' | '04' | '05';
|
|
89
|
+
chAccAgeInd?: '01' | '02' | '03' | '04' | '05' | undefined;
|
|
90
90
|
/** Account modification date, yyyymmdd */
|
|
91
|
-
chAccChange?: string;
|
|
91
|
+
chAccChange?: string | undefined;
|
|
92
92
|
/** Account modification ellapsed time code */
|
|
93
|
-
chAccChangeInd?: '01' | '02' | '03' | '04';
|
|
93
|
+
chAccChangeInd?: '01' | '02' | '03' | '04' | undefined;
|
|
94
94
|
/** Account creation date, yyyymmdd */
|
|
95
|
-
chAccDate?: string;
|
|
95
|
+
chAccDate?: string | undefined;
|
|
96
96
|
/** Last password change date, yyyymmdd */
|
|
97
|
-
chAccPwChange?: string;
|
|
97
|
+
chAccPwChange?: string | undefined;
|
|
98
98
|
/** Password change ellapsed time code */
|
|
99
|
-
chAccPwChangeInd?: '01' | '02' | '03' | '04' | '05';
|
|
99
|
+
chAccPwChangeInd?: '01' | '02' | '03' | '04' | '05' | undefined;
|
|
100
100
|
/** Number of purchases during the last 6 months */
|
|
101
|
-
nbPurchaseAccount?: string;
|
|
101
|
+
nbPurchaseAccount?: string | undefined;
|
|
102
102
|
/** Attemps to add a card during the last 24 hours */
|
|
103
|
-
provisionAttemptsDay?: string;
|
|
103
|
+
provisionAttemptsDay?: string | undefined;
|
|
104
104
|
/** Number of transactions attempted during the last 24 hours */
|
|
105
|
-
txnActivityDay?: string;
|
|
105
|
+
txnActivityDay?: string | undefined;
|
|
106
106
|
/** Number of transactions attempted last year */
|
|
107
|
-
txnActivityYear?: string;
|
|
107
|
+
txnActivityYear?: string | undefined;
|
|
108
108
|
/** Card registration date, yyyymmdd */
|
|
109
|
-
paymentAccAge?: string;
|
|
109
|
+
paymentAccAge?: string | undefined;
|
|
110
110
|
/** Card registration ellapsed time code */
|
|
111
|
-
paymentAccInd?: '01' | '02' | '03' | '04' | '05';
|
|
111
|
+
paymentAccInd?: '01' | '02' | '03' | '04' | '05' | undefined;
|
|
112
112
|
/** First usage of shipping address date, yyyymmdd */
|
|
113
|
-
shipAddressUsage?: string;
|
|
113
|
+
shipAddressUsage?: string | undefined;
|
|
114
114
|
/** First usage of shipping address ellapsed time code */
|
|
115
|
-
shipAddressUsageInd?: '01' | '02' | '03' | '04' | '05';
|
|
115
|
+
shipAddressUsageInd?: '01' | '02' | '03' | '04' | '05' | undefined;
|
|
116
116
|
/** Cardholder shipping name indicator code */
|
|
117
|
-
shipNameIndicator?: '01' | '02';
|
|
117
|
+
shipNameIndicator?: '01' | '02' | undefined;
|
|
118
118
|
/** Suspicious activity code */
|
|
119
|
-
suspiciousAccActivity?: '01' | '02';
|
|
120
|
-
};
|
|
119
|
+
suspiciousAccActivity?: '01' | '02' | undefined;
|
|
120
|
+
} | undefined;
|
|
121
121
|
/** Matching shipping and billing addresses indicator */
|
|
122
|
-
addrMatch?: 'Y' | 'N';
|
|
122
|
+
addrMatch?: 'Y' | 'N' | undefined;
|
|
123
123
|
/** Billing address city */
|
|
124
|
-
billAddrCity?: string;
|
|
124
|
+
billAddrCity?: string | undefined;
|
|
125
125
|
/** Billing address line 1 */
|
|
126
|
-
billAddrLine1?: string;
|
|
126
|
+
billAddrLine1?: string | undefined;
|
|
127
127
|
/** Billing address line 2 */
|
|
128
|
-
billAddrLine2?: string;
|
|
128
|
+
billAddrLine2?: string | undefined;
|
|
129
129
|
/** Billing address line 3 */
|
|
130
|
-
billAddrLine3?: string;
|
|
130
|
+
billAddrLine3?: string | undefined;
|
|
131
131
|
/** Billing address postal code */
|
|
132
|
-
billAddrPostCode?: string;
|
|
132
|
+
billAddrPostCode?: string | undefined;
|
|
133
133
|
/** Billing address state code, ISO 3166-2 */
|
|
134
|
-
billAddrState?: string;
|
|
134
|
+
billAddrState?: string | undefined;
|
|
135
135
|
/** Billing address country code, ISO 3166-1 */
|
|
136
|
-
billAddrCountry?: string;
|
|
136
|
+
billAddrCountry?: string | undefined;
|
|
137
137
|
/** Cardholder name */
|
|
138
|
-
cardholderName?: string;
|
|
138
|
+
cardholderName?: string | undefined;
|
|
139
139
|
/** Challenge window size */
|
|
140
|
-
challengeWindowSize?: string;
|
|
140
|
+
challengeWindowSize?: string | undefined;
|
|
141
141
|
/** Account email address */
|
|
142
|
-
email?: string;
|
|
142
|
+
email?: string | undefined;
|
|
143
143
|
/** Account landline phone number */
|
|
144
|
-
homePhone?: ThreeDSPhone;
|
|
144
|
+
homePhone?: ThreeDSPhone | undefined;
|
|
145
145
|
/** Account mobile phone number */
|
|
146
|
-
mobilePhone?: ThreeDSPhone;
|
|
146
|
+
mobilePhone?: ThreeDSPhone | undefined;
|
|
147
147
|
/** Account work phone number */
|
|
148
|
-
workPhone?: ThreeDSPhone;
|
|
148
|
+
workPhone?: ThreeDSPhone | undefined;
|
|
149
149
|
/** Merchant risk indicator, json */
|
|
150
150
|
merchantRiskIndicator?: {
|
|
151
151
|
/** Delivery email address */
|
|
152
|
-
deliveryEmailAddress?: string;
|
|
152
|
+
deliveryEmailAddress?: string | undefined;
|
|
153
153
|
/** Delivery time code */
|
|
154
|
-
deliveryTimeframe?: '01' | '02' | '03' | '04';
|
|
154
|
+
deliveryTimeframe?: '01' | '02' | '03' | '04' | undefined;
|
|
155
155
|
/** Gift card amount */
|
|
156
|
-
giftCardAmount?: string;
|
|
156
|
+
giftCardAmount?: string | undefined;
|
|
157
157
|
/** Count of gift cards used */
|
|
158
|
-
giftCardCount?: string;
|
|
158
|
+
giftCardCount?: string | undefined;
|
|
159
159
|
/** Gift card currency number, ISO-4217 */
|
|
160
|
-
giftCardCurr?: string;
|
|
160
|
+
giftCardCurr?: string | undefined;
|
|
161
161
|
/** Preorder availability date, yyyymmdd */
|
|
162
|
-
preOrderDate?: string;
|
|
162
|
+
preOrderDate?: string | undefined;
|
|
163
163
|
/** Preorder availability indicator code */
|
|
164
|
-
preOrderPurchaseInd?: '01' | '02';
|
|
164
|
+
preOrderPurchaseInd?: '01' | '02' | undefined;
|
|
165
165
|
/** Reorder indicator code */
|
|
166
|
-
reorderItemsInd?: '01' | '02';
|
|
166
|
+
reorderItemsInd?: '01' | '02' | undefined;
|
|
167
167
|
/** Shipping indicator code */
|
|
168
|
-
shipIndicator?: '01' | '02' | '03' | '04' | '05' | '06' | '07';
|
|
169
|
-
};
|
|
168
|
+
shipIndicator?: '01' | '02' | '03' | '04' | '05' | '06' | '07' | undefined;
|
|
169
|
+
} | undefined;
|
|
170
170
|
/** Number of purchase installments */
|
|
171
|
-
purchaseInstalData?: string;
|
|
171
|
+
purchaseInstalData?: string | undefined;
|
|
172
172
|
/** Recurring payments expiration date, yyyymmdd */
|
|
173
|
-
recurringExpiry?: string;
|
|
173
|
+
recurringExpiry?: string | undefined;
|
|
174
174
|
/** Minimum number of days between recurring payments */
|
|
175
|
-
recurringFrequency?: string;
|
|
175
|
+
recurringFrequency?: string | undefined;
|
|
176
176
|
/** Shipping address city */
|
|
177
|
-
shipAddrCity?: string;
|
|
177
|
+
shipAddrCity?: string | undefined;
|
|
178
178
|
/** Shipping address line 1 */
|
|
179
|
-
shipAddrLine1?: string;
|
|
179
|
+
shipAddrLine1?: string | undefined;
|
|
180
180
|
/** Shipping address line 2 */
|
|
181
|
-
shipAddrLine2?: string;
|
|
181
|
+
shipAddrLine2?: string | undefined;
|
|
182
182
|
/** Shipping address line 3 */
|
|
183
|
-
shipAddrLine3?: string;
|
|
183
|
+
shipAddrLine3?: string | undefined;
|
|
184
184
|
/** Shipping address postal code */
|
|
185
|
-
shipAddrPostCode?: string;
|
|
185
|
+
shipAddrPostCode?: string | undefined;
|
|
186
186
|
/** Shipping address state code, ISO 3166-2 */
|
|
187
|
-
shipAddrState?: string;
|
|
187
|
+
shipAddrState?: string | undefined;
|
|
188
188
|
/** Shipping address country code, ISO 3166-1 */
|
|
189
|
-
shipAddrCountry?: string;
|
|
189
|
+
shipAddrCountry?: string | undefined;
|
|
190
190
|
/** Authentication information, json */
|
|
191
|
-
threeDSRequestorAuthenticationInfo?: ThreeDSRequestorAuthenticationInfo;
|
|
191
|
+
threeDSRequestorAuthenticationInfo?: ThreeDSRequestorAuthenticationInfo | undefined;
|
|
192
192
|
/** Previous authentication information, json */
|
|
193
|
-
threeDSRequestorPriorAuthenticationInfo?: ThreeDSRequestorPriorAuthenticationInfo;
|
|
193
|
+
threeDSRequestorPriorAuthenticationInfo?: ThreeDSRequestorPriorAuthenticationInfo | undefined;
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
196
196
|
* Browser information required by 3DS
|
|
@@ -15,52 +15,52 @@ export interface BaseInputParams {
|
|
|
15
15
|
/** Terminal number */
|
|
16
16
|
DS_MERCHANT_TERMINAL: string;
|
|
17
17
|
/** Stored payment method reference number */
|
|
18
|
-
DS_MERCHANT_IDENTIFIER?: string;
|
|
18
|
+
DS_MERCHANT_IDENTIFIER?: string | undefined;
|
|
19
19
|
/** Merchant group number */
|
|
20
|
-
DS_MERCHANT_GROUP?: string;
|
|
20
|
+
DS_MERCHANT_GROUP?: string | undefined;
|
|
21
21
|
/**
|
|
22
22
|
* Amount designated as an integer in the smallest currency division
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* `'199'` (1.99 EUR)
|
|
26
26
|
*/
|
|
27
|
-
DS_MERCHANT_AMOUNT?: string;
|
|
27
|
+
DS_MERCHANT_AMOUNT?: string | undefined;
|
|
28
28
|
/** Currency number, ISO-4217 */
|
|
29
|
-
DS_MERCHANT_CURRENCY?: CurrencyNum;
|
|
29
|
+
DS_MERCHANT_CURRENCY?: CurrencyNum | undefined;
|
|
30
30
|
/** Card PAN, number */
|
|
31
|
-
DS_MERCHANT_PAN?: string;
|
|
31
|
+
DS_MERCHANT_PAN?: string | undefined;
|
|
32
32
|
/** Card expiry date, YYMM */
|
|
33
|
-
DS_MERCHANT_EXPIRYDATE?: string;
|
|
33
|
+
DS_MERCHANT_EXPIRYDATE?: string | undefined;
|
|
34
34
|
/** Card CVV2 code */
|
|
35
|
-
DS_MERCHANT_CVV2?: string;
|
|
35
|
+
DS_MERCHANT_CVV2?: string | undefined;
|
|
36
36
|
/** PDS2 exemptions */
|
|
37
|
-
DS_MERCHANT_EXCEP_SCA?: string;
|
|
37
|
+
DS_MERCHANT_EXCEP_SCA?: string | undefined;
|
|
38
38
|
/** Merchant data */
|
|
39
|
-
DS_MERCHANT_MERCHANTDATA?: string;
|
|
39
|
+
DS_MERCHANT_MERCHANTDATA?: string | undefined;
|
|
40
40
|
/** Merchant name */
|
|
41
|
-
DS_MERCHANT_MERCHANTNAME?: string;
|
|
41
|
+
DS_MERCHANT_MERCHANTNAME?: string | undefined;
|
|
42
42
|
/** Product description */
|
|
43
|
-
DS_MERCHANT_PRODUCTDESCRIPTION?: string;
|
|
43
|
+
DS_MERCHANT_PRODUCTDESCRIPTION?: string | undefined;
|
|
44
44
|
/** Cardholder name and surname */
|
|
45
|
-
DS_MERCHANT_TITULAR?: string;
|
|
45
|
+
DS_MERCHANT_TITULAR?: string | undefined;
|
|
46
46
|
/** Authorization transaction code, refunds */
|
|
47
|
-
DS_MERCHANT_AUTHORISATIONCODE?: string;
|
|
47
|
+
DS_MERCHANT_AUTHORISATIONCODE?: string | undefined;
|
|
48
48
|
/** Transaction date, YYYY-MM-DD */
|
|
49
|
-
DS_MERCHANT_TRANSACTIONDATE?: string;
|
|
49
|
+
DS_MERCHANT_TRANSACTIONDATE?: string | undefined;
|
|
50
50
|
/** Direct payment */
|
|
51
|
-
DS_MERCHANT_DIRECTPAYMENT?: 'true' | 'moto';
|
|
51
|
+
DS_MERCHANT_DIRECTPAYMENT?: 'true' | 'moto' | undefined;
|
|
52
52
|
/** INSITE operation identifier */
|
|
53
|
-
DS_MERCHANT_IDOPER?: string;
|
|
53
|
+
DS_MERCHANT_IDOPER?: string | undefined;
|
|
54
54
|
/** Tax code number */
|
|
55
|
-
DS_MERCHANT_TAX_REFERENCE?: string;
|
|
55
|
+
DS_MERCHANT_TAX_REFERENCE?: string | undefined;
|
|
56
56
|
/** Online Travel Agency indicator */
|
|
57
|
-
DS_MERCHANT_OTA?: 'S';
|
|
57
|
+
DS_MERCHANT_OTA?: 'S' | undefined;
|
|
58
58
|
/** Initial Credential On File transaction indicator */
|
|
59
|
-
DS_MERCHANT_COF_INI?: 'S' | 'N';
|
|
59
|
+
DS_MERCHANT_COF_INI?: 'S' | 'N' | undefined;
|
|
60
60
|
/** Credential On File transaction identifier */
|
|
61
|
-
DS_MERCHANT_COF_TXNID?: string;
|
|
61
|
+
DS_MERCHANT_COF_TXNID?: string | undefined;
|
|
62
62
|
/** Credential On File transaction type */
|
|
63
|
-
DS_MERCHANT_COF_TYPE?: 'I' | 'R' | 'H' | 'E' | 'D' | 'M' | 'N' | 'C';
|
|
63
|
+
DS_MERCHANT_COF_TYPE?: 'I' | 'R' | 'H' | 'E' | 'D' | 'M' | 'N' | 'C' | undefined;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* Input parameters for a redsys redirect request
|
|
@@ -69,21 +69,21 @@ export interface BaseInputParams {
|
|
|
69
69
|
*/
|
|
70
70
|
export interface RedirectInputParams extends BaseInputParams {
|
|
71
71
|
/** EMV3DS data in json format */
|
|
72
|
-
DS_MERCHANT_EMV3DS?: ThreeDSRedirectInputParams;
|
|
72
|
+
DS_MERCHANT_EMV3DS?: ThreeDSRedirectInputParams | undefined;
|
|
73
73
|
/** Notification url */
|
|
74
|
-
DS_MERCHANT_MERCHANTURL?: string;
|
|
74
|
+
DS_MERCHANT_MERCHANTURL?: string | undefined;
|
|
75
75
|
/** Success redirection url */
|
|
76
|
-
DS_MERCHANT_URLOK?: string;
|
|
76
|
+
DS_MERCHANT_URLOK?: string | undefined;
|
|
77
77
|
/** Failure redirection url */
|
|
78
|
-
DS_MERCHANT_URLKO?: string;
|
|
78
|
+
DS_MERCHANT_URLKO?: string | undefined;
|
|
79
79
|
/** Language */
|
|
80
|
-
DS_MERCHANT_CONSUMERLANGUAGE?: LanguageNum;
|
|
80
|
+
DS_MERCHANT_CONSUMERLANGUAGE?: LanguageNum | undefined;
|
|
81
81
|
/** Payment methods */
|
|
82
|
-
DS_MERCHANT_PAYMETHODS?: string;
|
|
82
|
+
DS_MERCHANT_PAYMETHODS?: string | undefined;
|
|
83
83
|
/** Customization code number */
|
|
84
|
-
DS_MERCHANT_PERSOCODE?: string;
|
|
84
|
+
DS_MERCHANT_PERSOCODE?: string | undefined;
|
|
85
85
|
/** Obtain paypal address */
|
|
86
|
-
DS_MERCHANT_SHIPPINGADDRESSPYP?: 'S' | 'N';
|
|
86
|
+
DS_MERCHANT_SHIPPINGADDRESSPYP?: 'S' | 'N' | undefined;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Common input parameters for redsys request
|
|
@@ -92,33 +92,33 @@ export interface RedirectInputParams extends BaseInputParams {
|
|
|
92
92
|
*/
|
|
93
93
|
export interface RequestInputParams extends BaseInputParams {
|
|
94
94
|
/** xPay data, hex */
|
|
95
|
-
DS_XPAYDATA?: string;
|
|
95
|
+
DS_XPAYDATA?: string | undefined;
|
|
96
96
|
/** xPay origin */
|
|
97
|
-
DS_XPAYORIGEN?: 'Google' | 'Apple';
|
|
97
|
+
DS_XPAYORIGEN?: 'Google' | 'Apple' | undefined;
|
|
98
98
|
/** xPay type */
|
|
99
|
-
DS_XPAYTYPE?: 'WEB' | 'InApp';
|
|
99
|
+
DS_XPAYTYPE?: 'WEB' | 'InApp' | undefined;
|
|
100
100
|
/** PUC identifier, number */
|
|
101
|
-
DS_ACQUIRER_IDENTIFIER?: string;
|
|
101
|
+
DS_ACQUIRER_IDENTIFIER?: string | undefined;
|
|
102
102
|
/** Matching data */
|
|
103
|
-
DS_MERCHANT_MATCHINGDATA?: string;
|
|
103
|
+
DS_MERCHANT_MATCHINGDATA?: string | undefined;
|
|
104
104
|
/** Customer phone, paygold */
|
|
105
|
-
DS_MERCHANT_CUSTOMER_MOBILE?: string;
|
|
105
|
+
DS_MERCHANT_CUSTOMER_MOBILE?: string | undefined;
|
|
106
106
|
/** Customer email address, paygold */
|
|
107
|
-
DS_MERCHANT_CUSTOMER_MAIL?: string;
|
|
107
|
+
DS_MERCHANT_CUSTOMER_MAIL?: string | undefined;
|
|
108
108
|
/** Expiration date for paygold links, YYYY-MM-DD-hh:mm:ss.sss or number of minutes */
|
|
109
|
-
DS_MERCHANT_P2F_EXPIRYDATE?: string;
|
|
109
|
+
DS_MERCHANT_P2F_EXPIRYDATE?: string | undefined;
|
|
110
110
|
/**
|
|
111
111
|
* SMS text content, paygold
|
|
112
112
|
*
|
|
113
113
|
* Parameters: @URL@, @COMERCIO@, @IMPORTE@ and @MONEDA@
|
|
114
114
|
*/
|
|
115
|
-
DS_MERCHANT_CUSTOMER_SMS_TEXT?: string;
|
|
115
|
+
DS_MERCHANT_CUSTOMER_SMS_TEXT?: string | undefined;
|
|
116
116
|
/**
|
|
117
117
|
* Email text content, paygold
|
|
118
118
|
*
|
|
119
119
|
* Parameters: nombreComprador, direccionComprador and textoLibre1.
|
|
120
120
|
*/
|
|
121
|
-
DS_MERCHANT_P2F_XMLDATA?: string;
|
|
121
|
+
DS_MERCHANT_P2F_XMLDATA?: string | undefined;
|
|
122
122
|
}
|
|
123
123
|
export interface CommonRestInputParams extends RequestInputParams {
|
|
124
124
|
/** MPI External parameters, json */
|
|
@@ -145,7 +145,7 @@ export interface CommonRestInputParams extends RequestInputParams {
|
|
|
145
145
|
authenticationType: string;
|
|
146
146
|
/** Authentication flow */
|
|
147
147
|
authenticationFlow: 'F' | 'C';
|
|
148
|
-
};
|
|
148
|
+
} | undefined;
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* Input parameters for a IniciaPeticion HTTP request
|
|
@@ -154,9 +154,9 @@ export interface CommonRestInputParams extends RequestInputParams {
|
|
|
154
154
|
*/
|
|
155
155
|
export interface RestIniciaPeticionInputParams extends CommonRestInputParams {
|
|
156
156
|
/** EMV3DS data in json format */
|
|
157
|
-
DS_MERCHANT_EMV3DS?: ThreeDSPreAuthInputParams;
|
|
157
|
+
DS_MERCHANT_EMV3DS?: ThreeDSPreAuthInputParams | undefined;
|
|
158
158
|
/** Dynamic Currency Conversion data, json */
|
|
159
|
-
DS_MERCHANT_DCC?: 'Y' | 'N';
|
|
159
|
+
DS_MERCHANT_DCC?: 'Y' | 'N' | undefined;
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* Input parameters for a TrataPeticion Peticion HTTP request
|
|
@@ -165,12 +165,12 @@ export interface RestIniciaPeticionInputParams extends CommonRestInputParams {
|
|
|
165
165
|
*/
|
|
166
166
|
export interface RestTrataPeticionInputParams extends CommonRestInputParams {
|
|
167
167
|
/** EMV3DS data in json format */
|
|
168
|
-
DS_MERCHANT_EMV3DS?: ThreeDSv1AuthDataInputParams | ThreeDSv2AuthDataInputParams | ThreeDSv1ChallengeResponseInputParams | ThreeDSv2ChallengeResponseInputParams;
|
|
168
|
+
DS_MERCHANT_EMV3DS?: ThreeDSv1AuthDataInputParams | ThreeDSv2AuthDataInputParams | ThreeDSv1ChallengeResponseInputParams | ThreeDSv2ChallengeResponseInputParams | undefined;
|
|
169
169
|
/** Dynamic Currency Conversion data, json */
|
|
170
170
|
DS_MERCHANT_DCC?: {
|
|
171
171
|
/** Card currency number, ISO-4217 */
|
|
172
172
|
monedaDCC: string;
|
|
173
173
|
/** Amount in card currency, decimal number */
|
|
174
174
|
importeDCC: string;
|
|
175
|
-
};
|
|
175
|
+
} | undefined;
|
|
176
176
|
}
|
package/lib/utils/misc.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ export declare const assertSuccessfulResponseCode: (responseCode: string | numbe
|
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
27
|
export declare const assertSuccessfulResponse: (responseParams: {
|
|
28
|
-
Ds_Response?: string;
|
|
28
|
+
Ds_Response?: string | undefined;
|
|
29
29
|
}) => void;
|
|
30
30
|
export declare const isStringNotEmpty: <T extends string>(str: T | undefined) => str is T;
|
|
31
|
+
/**
|
|
32
|
+
* Map over maybe monad
|
|
33
|
+
*
|
|
34
|
+
* If value is defined apply function and return output, otherwise return undefined.
|
|
35
|
+
*/
|
|
36
|
+
export declare const mapMaybeMonad: <V, Out>(value: V | undefined, fn: (value: V) => Out) => Out | undefined;
|