redsys-easy 3.1.0 → 4.0.2
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 +94 -419
- package/lib/assets/card-brands.d.ts +26 -2
- package/lib/assets/countries.d.ts +29 -2
- package/lib/assets/currencies.d.ts +26 -2
- package/lib/assets/lang-codes.d.ts +29 -2
- package/lib/assets/transaction-types.d.ts +38 -3
- package/lib/client.d.ts +50 -0
- package/lib/crypto.d.ts +25 -0
- package/lib/errors.d.ts +61 -6
- package/lib/formatter-utils.d.ts +24 -0
- package/lib/formatters/input-params.d.ts +21 -0
- package/lib/formatters/output-params.d.ts +29 -0
- package/lib/formatters/types.d.ts +316 -0
- package/lib/index.d.ts +30 -56
- package/lib/index.esm.js +957 -746
- package/lib/index.js +990 -747
- package/lib/rest/3ds.d.ts +31 -0
- package/lib/rest/json-serialization.d.ts +2 -0
- package/lib/rest/json-sha256-signature.d.ts +3 -0
- package/lib/rest/json.d.ts +3 -0
- package/lib/rest/requests.d.ts +2 -0
- package/lib/soap/notification-serialization.d.ts +3 -0
- package/lib/soap/notification-signature.d.ts +3 -0
- package/lib/soap/notification.d.ts +4 -0
- package/lib/soap/utils.d.ts +43 -0
- package/lib/types/3ds-params.d.ts +345 -0
- package/lib/types/api.d.ts +69 -78
- package/lib/types/input-params.d.ts +176 -0
- package/lib/types/output-params.d.ts +158 -0
- package/lib/utils/codes.d.ts +13 -0
- package/lib/utils/misc.d.ts +24 -0
- package/package.json +63 -57
- package/CHANGELOG.md +0 -53
- package/lib/params-formatter.d.ts +0 -7
- package/lib/response-formatter.d.ts +0 -5
- package/lib/utils.d.ts +0 -39
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ThreeDSv1ChallengeOutputParams, ThreeDSv2ChallengeOutputParams, ThreeDSv2PreAuthWithMethodOutputParams, ThreeDSMethodData, ThreeDSMethodForm, ThreeDSv1ChallengeForm, ThreeDSv2ChallengeForm, ThreeDSCres } from '../types/3ds-params';
|
|
2
|
+
/**
|
|
3
|
+
* Creates parameters for a 3DS method form
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare const create3DSMethodForm: (emv3dsParams: Pick<ThreeDSv2PreAuthWithMethodOutputParams, 'threeDSServerTransID' | 'threeDSMethodURL'>, notificationURL: string) => ThreeDSMethodForm;
|
|
8
|
+
/**
|
|
9
|
+
* Creates parameters for a 3DS v1 challenge form
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export declare const create3DSv1ChallengeForm: (emv3dsV1Challenge: ThreeDSv1ChallengeOutputParams, challengeNotificationUrl: string) => ThreeDSv1ChallengeForm;
|
|
14
|
+
/**
|
|
15
|
+
* Creates parameters for a 3DS v2 challenge form
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare const create3DSv2ChallengeForm: (emv3dsV2Challenge: ThreeDSv2ChallengeOutputParams) => ThreeDSv2ChallengeForm;
|
|
20
|
+
/**
|
|
21
|
+
* Deserialize threeDSMethodData
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare const deserializeThreeDSMethodData: (threeDSMethodData: string) => ThreeDSMethodData;
|
|
26
|
+
/**
|
|
27
|
+
* Deserialize `cres` field of a 3DS v2 challenge
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export declare const deserializeCres: (cres: string) => ThreeDSCres;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ResponseJSONSuccess, CommonRawRequestParams, CommonRawResponseParams, SHA256SignedJSONParameters } from '../types/api';
|
|
2
|
+
export declare const sha256VerifyJSONResponse: (merchantKey: string, response: ResponseJSONSuccess, responseParams: CommonRawResponseParams) => void;
|
|
3
|
+
export declare const sha256SignJSONRequest: (merchantKey: string, serializedParams: string, requestParams: CommonRawRequestParams) => SHA256SignedJSONParameters;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ResponseJSONSuccess, CommonRawRequestParams, CommonRawResponseParams, SHA256SignedJSONParameters } from '../types/api';
|
|
2
|
+
export declare const deserializeAndVerifyJSONResponse: <ResponseParams extends CommonRawResponseParams>(merchantKey: string, response: ResponseJSONSuccess) => ResponseParams;
|
|
3
|
+
export declare const serializeAndSignJSONRequest: <RequestParams extends CommonRawRequestParams>(merchantKey: string, requestParams: RequestParams) => SHA256SignedJSONParameters;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { CommonRawRequestParams, CommonRawResponseParams } from '../types/api';
|
|
2
|
+
export declare const jsonRequest: <RequestParams extends CommonRawRequestParams, ResponseParams extends CommonRawResponseParams>(url: string, merchantKey: string, rawRequestParams: RequestParams) => Promise<ResponseParams>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ParsedSoapNotifiation, SoapNotificationResponse } from '../types/api';
|
|
2
|
+
export declare const serializeSoapNotificationResponse: ({ allow: allowOperation }: SoapNotificationResponse) => string;
|
|
3
|
+
export declare const deserializeSoapNotification: (xml: string) => ParsedSoapNotifiation['Message'];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ParsedSoapNotifiation, SoapNotificationResponse } from '../types/api';
|
|
2
|
+
export declare const verifySoapNotification: (merchantKey: string, xml: string, msg: ParsedSoapNotifiation['Message']) => void;
|
|
3
|
+
export declare const signSoapNotificationResponse: (merchantKey: string, serializedResponse: string, response: SoapNotificationResponse) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SoapNotificationResponse } from '../types/api';
|
|
2
|
+
import type { SoapNotificationOutputParams } from '../types/output-params';
|
|
3
|
+
export declare const serializeAndSignSoapNotificationResponse: (merchantKey: string, response: SoapNotificationResponse) => string;
|
|
4
|
+
export declare const deserializeAndVerifySoapNotification: (merchantKey: string, xml: string) => SoapNotificationOutputParams;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const unescapeXML: (str: string) => string;
|
|
2
|
+
export declare const escapeXML: (str: string) => string;
|
|
3
|
+
declare type SoapRequest = {
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
body?: string;
|
|
6
|
+
} | {
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
body: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Detects the soap version of a HTTP request
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare const detectSoapVersion: (req: SoapRequest) => "1.2" | "1.1";
|
|
16
|
+
/**
|
|
17
|
+
* Extracts the body of a SOAP notification from the body of the HTTP request
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* It does not understand SOAP or use WSDL, the implementation is a little bit hacky
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare const mimicSoapNotificationReceiver: (xml: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Creates the body of a HTTP response as SOAP 1.1 from the body of a SOAP notification response
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* It does not understand SOAP or use WSDL, the implementation is a little bit hacky
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare const mimicSoap11NotificationResponse: (answer: string) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Creates the body of a HTTP response as SOAP 1.2 from the body of a SOAP notification response
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* It does not understand SOAP or use WSDL, the implementation is a little bit hacky
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export declare const mimicSoap12NotificationResponse: (answer: string) => string;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
export interface ThreeDSPhone {
|
|
2
|
+
/** Country prefix number */
|
|
3
|
+
cc: string;
|
|
4
|
+
/** Phone number */
|
|
5
|
+
subscriber: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ThreeDSRequestorAuthenticationInfo {
|
|
8
|
+
/** Authentication Data */
|
|
9
|
+
threeDSReqAuthData: string;
|
|
10
|
+
/** Authentication method code */
|
|
11
|
+
threeDSReqAuthMethod: string;
|
|
12
|
+
/** Authentication timestamp, yyyymmddHHMM */
|
|
13
|
+
threeDSReqAuthTimestamp: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ThreeDSRequestorPriorAuthenticationInfo {
|
|
16
|
+
/** Reference */
|
|
17
|
+
threeDSReqPriorRef?: string;
|
|
18
|
+
/** Authentication method code */
|
|
19
|
+
threeDSReqPriorAuthMethod?: string;
|
|
20
|
+
/** Authentication timestamp, yyyymmddHHMM */
|
|
21
|
+
threeDSReqPriorAuthTimestamp?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface BaseThreeDSAuthenticationDataParams {
|
|
24
|
+
/** 3DSecure protocol version */
|
|
25
|
+
protocolVersion: '1.0.2' | '2.1.0' | '2.2.0';
|
|
26
|
+
/** 3DSecure information type */
|
|
27
|
+
threeDSInfo: 'AuthenticationData';
|
|
28
|
+
/** Challenge notification URL */
|
|
29
|
+
notificationURL: string;
|
|
30
|
+
/** 3DSecure Method result indicator */
|
|
31
|
+
threeDSCompInd: 'Y' | 'N' | 'U';
|
|
32
|
+
/** 3DSecure transaction identifier */
|
|
33
|
+
threeDSServerTransID: string;
|
|
34
|
+
/**
|
|
35
|
+
* Browser Screen Color Depth
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* `screen.colorDepth.toString()` or `'1'` if javascript is disabled
|
|
39
|
+
*/
|
|
40
|
+
browserColorDepth: string;
|
|
41
|
+
/**
|
|
42
|
+
* Browser Java Enabled
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* `navigator.javaEnabled()` or `false` if javascript is disabled
|
|
46
|
+
*/
|
|
47
|
+
browserJavaEnabled: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Browser Language
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* `navigator.language`
|
|
53
|
+
*/
|
|
54
|
+
browserLanguage: string;
|
|
55
|
+
/**
|
|
56
|
+
* Browser Screen Height
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* `screen.height.toString()` or `'0'` if javascript is disabled
|
|
60
|
+
*/
|
|
61
|
+
browserScreenHeight: string;
|
|
62
|
+
/**
|
|
63
|
+
* Browser Screen Width
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* `screen.width.toString()` or `'0'` if javascript is disabled
|
|
67
|
+
*/
|
|
68
|
+
browserScreenWidth: string;
|
|
69
|
+
/**
|
|
70
|
+
* Browser Time Zone
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* `(new Date()).getTimezoneOffset().toString()` or `'0'` if javascript is disabled
|
|
74
|
+
*/
|
|
75
|
+
browserTZ: string;
|
|
76
|
+
/** Browser JavaScript Enabled */
|
|
77
|
+
browserJavascriptEnabled: boolean;
|
|
78
|
+
/** Browser User-Agent */
|
|
79
|
+
browserUserAgent: string;
|
|
80
|
+
/** Browser Accept Header */
|
|
81
|
+
browserAcceptHeader: string;
|
|
82
|
+
/** Browser IP Address, ipv4 or ipv6 */
|
|
83
|
+
browserIP?: string;
|
|
84
|
+
/** Additional account information, max 64 characters */
|
|
85
|
+
acctID?: string;
|
|
86
|
+
/** Account information, json */
|
|
87
|
+
acctInfo?: {
|
|
88
|
+
/** Account creation ellapsed time code */
|
|
89
|
+
chAccAgeInd?: '01' | '02' | '03' | '04' | '05';
|
|
90
|
+
/** Account modification date, yyyymmdd */
|
|
91
|
+
chAccChange?: string;
|
|
92
|
+
/** Account modification ellapsed time code */
|
|
93
|
+
chAccChangeInd?: '01' | '02' | '03' | '04';
|
|
94
|
+
/** Account creation date, yyyymmdd */
|
|
95
|
+
chAccDate?: string;
|
|
96
|
+
/** Last password change date, yyyymmdd */
|
|
97
|
+
chAccPwChange?: string;
|
|
98
|
+
/** Password change ellapsed time code */
|
|
99
|
+
chAccPwChangeInd?: '01' | '02' | '03' | '04' | '05';
|
|
100
|
+
/** Number of purchases during the last 6 months */
|
|
101
|
+
nbPurchaseAccount?: string;
|
|
102
|
+
/** Attemps to add a card during the last 24 hours */
|
|
103
|
+
provisionAttemptsDay?: string;
|
|
104
|
+
/** Number of transactions attempted during the last 24 hours */
|
|
105
|
+
txnActivityDay?: string;
|
|
106
|
+
/** Number of transactions attempted last year */
|
|
107
|
+
txnActivityYear?: string;
|
|
108
|
+
/** Card registration date, yyyymmdd */
|
|
109
|
+
paymentAccAge?: string;
|
|
110
|
+
/** Card registration ellapsed time code */
|
|
111
|
+
paymentAccInd?: '01' | '02' | '03' | '04' | '05';
|
|
112
|
+
/** First usage of shipping address date, yyyymmdd */
|
|
113
|
+
shipAddressUsage?: string;
|
|
114
|
+
/** First usage of shipping address ellapsed time code */
|
|
115
|
+
shipAddressUsageInd?: '01' | '02' | '03' | '04' | '05';
|
|
116
|
+
/** Cardholder shipping name indicator code */
|
|
117
|
+
shipNameIndicator?: '01' | '02';
|
|
118
|
+
/** Suspicious activity code */
|
|
119
|
+
suspiciousAccActivity?: '01' | '02';
|
|
120
|
+
};
|
|
121
|
+
/** Matching shipping and billing addresses indicator */
|
|
122
|
+
addrMatch?: 'Y' | 'N';
|
|
123
|
+
/** Billing address city */
|
|
124
|
+
billAddrCity?: string;
|
|
125
|
+
/** Billing address line 1 */
|
|
126
|
+
billAddrLine1?: string;
|
|
127
|
+
/** Billing address line 2 */
|
|
128
|
+
billAddrLine2?: string;
|
|
129
|
+
/** Billing address line 3 */
|
|
130
|
+
billAddrLine3?: string;
|
|
131
|
+
/** Billing address postal code */
|
|
132
|
+
billAddrPostCode?: string;
|
|
133
|
+
/** Billing address state code, ISO 3166-2 */
|
|
134
|
+
billAddrState?: string;
|
|
135
|
+
/** Billing address country code, ISO 3166-1 */
|
|
136
|
+
billAddrCountry?: string;
|
|
137
|
+
/** Cardholder name */
|
|
138
|
+
cardholderName?: string;
|
|
139
|
+
/** Challenge window size */
|
|
140
|
+
challengeWindowSize?: string;
|
|
141
|
+
/** Account email address */
|
|
142
|
+
email?: string;
|
|
143
|
+
/** Account landline phone number */
|
|
144
|
+
homePhone?: ThreeDSPhone;
|
|
145
|
+
/** Account mobile phone number */
|
|
146
|
+
mobilePhone?: ThreeDSPhone;
|
|
147
|
+
/** Account work phone number */
|
|
148
|
+
workPhone?: ThreeDSPhone;
|
|
149
|
+
/** Merchant risk indicator, json */
|
|
150
|
+
merchantRiskIndicator?: {
|
|
151
|
+
/** Delivery email address */
|
|
152
|
+
deliveryEmailAddress?: string;
|
|
153
|
+
/** Delivery time code */
|
|
154
|
+
deliveryTimeframe?: '01' | '02' | '03' | '04';
|
|
155
|
+
/** Gift card amount */
|
|
156
|
+
giftCardAmount?: string;
|
|
157
|
+
/** Count of gift cards used */
|
|
158
|
+
giftCardCount?: string;
|
|
159
|
+
/** Gift card currency number, ISO-4217 */
|
|
160
|
+
giftCardCurr?: string;
|
|
161
|
+
/** Preorder availability date, yyyymmdd */
|
|
162
|
+
preOrderDate?: string;
|
|
163
|
+
/** Preorder availability indicator code */
|
|
164
|
+
preOrderPurchaseInd?: '01' | '02';
|
|
165
|
+
/** Reorder indicator code */
|
|
166
|
+
reorderItemsInd?: '01' | '02';
|
|
167
|
+
/** Shipping indicator code */
|
|
168
|
+
shipIndicator?: '01' | '02' | '03' | '04' | '05' | '06' | '07';
|
|
169
|
+
};
|
|
170
|
+
/** Number of purchase installments */
|
|
171
|
+
purchaseInstalData?: string;
|
|
172
|
+
/** Recurring payments expiration date, yyyymmdd */
|
|
173
|
+
recurringExpiry?: string;
|
|
174
|
+
/** Minimum number of days between recurring payments */
|
|
175
|
+
recurringFrequency?: string;
|
|
176
|
+
/** Shipping address city */
|
|
177
|
+
shipAddrCity?: string;
|
|
178
|
+
/** Shipping address line 1 */
|
|
179
|
+
shipAddrLine1?: string;
|
|
180
|
+
/** Shipping address line 2 */
|
|
181
|
+
shipAddrLine2?: string;
|
|
182
|
+
/** Shipping address line 3 */
|
|
183
|
+
shipAddrLine3?: string;
|
|
184
|
+
/** Shipping address postal code */
|
|
185
|
+
shipAddrPostCode?: string;
|
|
186
|
+
/** Shipping address state code, ISO 3166-2 */
|
|
187
|
+
shipAddrState?: string;
|
|
188
|
+
/** Shipping address country code, ISO 3166-1 */
|
|
189
|
+
shipAddrCountry?: string;
|
|
190
|
+
/** Authentication information, json */
|
|
191
|
+
threeDSRequestorAuthenticationInfo?: ThreeDSRequestorAuthenticationInfo;
|
|
192
|
+
/** Previous authentication information, json */
|
|
193
|
+
threeDSRequestorPriorAuthenticationInfo?: ThreeDSRequestorPriorAuthenticationInfo;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Browser information required by 3DS
|
|
197
|
+
*
|
|
198
|
+
* @remarks
|
|
199
|
+
* The information must be obtained in the browser, for example, wusing the following function.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```
|
|
203
|
+
* const obtain3DSBrowserInfo = (): ThreeDSBrowserClientInfo => {
|
|
204
|
+
* return {
|
|
205
|
+
* browserLanguage: navigator.language,
|
|
206
|
+
* browserColorDepth: screen.colorDepth.toString(),
|
|
207
|
+
* browserScreenHeight: screen.height.toString(),
|
|
208
|
+
* browserScreenWidth: screen.width.toString(),
|
|
209
|
+
* browserTZ: (new Date()).getTimezoneOffset().toString(),
|
|
210
|
+
* browserJavaEnabled: navigator.javaEnabled()
|
|
211
|
+
* };
|
|
212
|
+
* };
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @public
|
|
216
|
+
*/
|
|
217
|
+
export declare type ThreeDSBrowserClientInfo = Pick<BaseThreeDSAuthenticationDataParams, 'browserLanguage' | 'browserColorDepth' | 'browserScreenHeight' | 'browserScreenWidth' | 'browserTZ' | 'browserJavaEnabled'>;
|
|
218
|
+
export interface ThreeDSPreAuthInputParams {
|
|
219
|
+
threeDSInfo: 'CardData';
|
|
220
|
+
}
|
|
221
|
+
export interface ThreeDSv1AuthDataInputParams extends Pick<BaseThreeDSAuthenticationDataParams, 'protocolVersion' | 'threeDSInfo' | 'browserAcceptHeader' | 'browserUserAgent'> {
|
|
222
|
+
protocolVersion: '1.0.2';
|
|
223
|
+
threeDSInfo: 'AuthenticationData';
|
|
224
|
+
}
|
|
225
|
+
export interface ThreeDSv2AuthDataInputParams extends BaseThreeDSAuthenticationDataParams {
|
|
226
|
+
protocolVersion: '2.1.0' | '2.2.0';
|
|
227
|
+
threeDSInfo: 'AuthenticationData';
|
|
228
|
+
}
|
|
229
|
+
export interface ThreeDSv1ChallengeResponseInputParams {
|
|
230
|
+
protocolVersion: '1.0.2';
|
|
231
|
+
threeDSInfo: 'ChallengeResponse';
|
|
232
|
+
PARes: string;
|
|
233
|
+
MD: string;
|
|
234
|
+
}
|
|
235
|
+
export interface ThreeDSv2ChallengeResponseInputParams {
|
|
236
|
+
protocolVersion: '2.1.0' | '2.2.0';
|
|
237
|
+
threeDSInfo: 'ChallengeResponse';
|
|
238
|
+
cres: string;
|
|
239
|
+
}
|
|
240
|
+
/** 3D Secure input parameters */
|
|
241
|
+
export declare type ThreeDSInputParams = ThreeDSPreAuthInputParams | ThreeDSv1AuthDataInputParams | ThreeDSv2AuthDataInputParams | ThreeDSv1ChallengeResponseInputParams | ThreeDSv2ChallengeResponseInputParams;
|
|
242
|
+
export declare type ThreeDSRedirectInputParams = Omit<BaseThreeDSAuthenticationDataParams, 'protocolVersion' | 'threeDSInfo' | 'notificationURL' | 'threeDSCompInd' | 'threeDSServerTransID' | 'browserColorDepth' | 'browserJavaEnabled' | 'browserLanguage' | 'browserScreenHeight' | 'browserScreenWidth' | 'browserTZ' | 'browserJavascriptEnabled' | 'browserUserAgent' | 'browserAcceptHeader' | 'browserIP'>;
|
|
243
|
+
export interface ThreeDSv1PreAuthOutputParams {
|
|
244
|
+
protocolVersion: 'NO_3DS_v2';
|
|
245
|
+
threeDSInfo: 'CardConfiguration';
|
|
246
|
+
}
|
|
247
|
+
export interface ThreeDSv2PreAuthWithoutMethodOutputParams {
|
|
248
|
+
protocolVersion: '2.1.0' | '2.2.0';
|
|
249
|
+
threeDSInfo: 'CardConfiguration';
|
|
250
|
+
threeDSServerTransID: string;
|
|
251
|
+
}
|
|
252
|
+
export interface ThreeDSv2PreAuthWithMethodOutputParams extends ThreeDSv2PreAuthWithoutMethodOutputParams {
|
|
253
|
+
threeDSMethodURL: string;
|
|
254
|
+
}
|
|
255
|
+
export declare type ThreeDSv2PreAuthOutputParams = ThreeDSv2PreAuthWithoutMethodOutputParams | ThreeDSv2PreAuthWithMethodOutputParams;
|
|
256
|
+
export interface ThreeDSv1ChallengeOutputParams {
|
|
257
|
+
protocolVersion: '1.0.2';
|
|
258
|
+
threeDSInfo: 'ChallengeRequest';
|
|
259
|
+
acsURL: string;
|
|
260
|
+
MD: string;
|
|
261
|
+
PAReq: string;
|
|
262
|
+
}
|
|
263
|
+
export interface ThreeDSv2ChallengeOutputParams {
|
|
264
|
+
protocolVersion: '2.1.0' | '2.2.0';
|
|
265
|
+
threeDSInfo: 'ChallengeRequest';
|
|
266
|
+
acsURL: string;
|
|
267
|
+
creq: string;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* 3D Secure output parameters
|
|
271
|
+
*/
|
|
272
|
+
export declare type ThreeDSOutputParams = ThreeDSv1PreAuthOutputParams | ThreeDSv2PreAuthOutputParams | ThreeDSv1ChallengeOutputParams | ThreeDSv2ChallengeOutputParams;
|
|
273
|
+
/**
|
|
274
|
+
* 3D Secure v2 challenge solution parameters
|
|
275
|
+
*/
|
|
276
|
+
export interface ThreeDSv2ChallengeSolutionNotificationOutputParams {
|
|
277
|
+
cres: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* 3D Secure v1 challenge solution parameters
|
|
281
|
+
*/
|
|
282
|
+
export interface ThreeDSv1ChallengeSolutionNotificationOutputParams {
|
|
283
|
+
MD: string;
|
|
284
|
+
PaRes: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* 3DS v2 method data
|
|
288
|
+
*
|
|
289
|
+
* @public
|
|
290
|
+
*/
|
|
291
|
+
export interface ThreeDSMethodData {
|
|
292
|
+
threeDSServerTransID: string;
|
|
293
|
+
threeDSMethodNotificationURL: string;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* 3DS v2 method form
|
|
297
|
+
*
|
|
298
|
+
* @public
|
|
299
|
+
*/
|
|
300
|
+
export interface ThreeDSMethodForm {
|
|
301
|
+
url: string;
|
|
302
|
+
body: {
|
|
303
|
+
threeDSMethodData: string;
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* 3DS v1 challenge form
|
|
308
|
+
*
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
311
|
+
export interface ThreeDSv1ChallengeForm {
|
|
312
|
+
url: string;
|
|
313
|
+
body: {
|
|
314
|
+
/** Payment authentication Request, XML that is gzip compressed and base64 encoded */
|
|
315
|
+
PaReq: string;
|
|
316
|
+
/** Merchant data, random generated identifier hex encoded? */
|
|
317
|
+
MD: string;
|
|
318
|
+
/** Post challenge redirect URL */
|
|
319
|
+
TermUrl: string;
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* 3DS v2 challenge form
|
|
324
|
+
*
|
|
325
|
+
* @public
|
|
326
|
+
*/
|
|
327
|
+
export interface ThreeDSv2ChallengeForm {
|
|
328
|
+
url: string;
|
|
329
|
+
body: {
|
|
330
|
+
/** Challenge request, JSON that is base64 encoded */
|
|
331
|
+
creq: string;
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Contents of the `cres` field of a 3DS v2 challenge
|
|
336
|
+
*
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
export interface ThreeDSCres {
|
|
340
|
+
messageVersion: '2.1.0' | '2.2.0';
|
|
341
|
+
threeDSServerTransID: string;
|
|
342
|
+
acsTransID: string;
|
|
343
|
+
messageType: 'CRes';
|
|
344
|
+
transStatus: 'Y' | 'N';
|
|
345
|
+
}
|
package/lib/types/api.d.ts
CHANGED
|
@@ -1,89 +1,80 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { Language } from '../assets/lang-codes';
|
|
6
|
-
export declare type RawResponseParams = Record<string, string>;
|
|
7
|
-
export declare type RawRequestParams = Record<string, string>;
|
|
1
|
+
import type { BaseInputParams } from './input-params';
|
|
2
|
+
import type { BaseOutputParams, SoapNotificationOutputParams } from './output-params';
|
|
3
|
+
export declare type CommonRawResponseParams = Pick<BaseOutputParams, 'Ds_Order'>;
|
|
4
|
+
export declare type CommonRawRequestParams = Pick<BaseInputParams, 'DS_MERCHANT_ORDER'>;
|
|
8
5
|
export interface ParsedSoapNotifiation {
|
|
9
6
|
Message: {
|
|
10
7
|
Signature: string;
|
|
11
|
-
Request:
|
|
8
|
+
Request: SoapNotificationOutputParams;
|
|
12
9
|
};
|
|
13
10
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
terminal?: string;
|
|
25
|
-
merchantData?: string;
|
|
26
|
-
securePayment?: boolean;
|
|
27
|
-
transactionType?: string;
|
|
28
|
-
identifier?: string;
|
|
29
|
-
merchantGroup?: string;
|
|
30
|
-
expiryYear?: string;
|
|
31
|
-
expiryMonth?: string;
|
|
32
|
-
expiryDate?: string;
|
|
33
|
-
cardNumber?: string;
|
|
34
|
-
cardType?: string;
|
|
35
|
-
authorisationCode?: string;
|
|
36
|
-
lang?: Language;
|
|
37
|
-
cardCountry?: Country;
|
|
38
|
-
cardBrand?: CardBrand;
|
|
39
|
-
payURL?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Body of a 3DS v1 challenge completion notification
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export interface ThreeDSv1ChallengeNotificationBody {
|
|
17
|
+
/** Payment authentication Request, XML that is gzip compressed and base64 encoded */
|
|
18
|
+
PaRes: string;
|
|
19
|
+
/** Merchant data, random generated identifier hex encoded? */
|
|
20
|
+
MD: string;
|
|
40
21
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
expiryMonth?: string;
|
|
49
|
-
expiryDate?: string;
|
|
50
|
-
terminal?: string;
|
|
51
|
-
cvv?: string;
|
|
52
|
-
merchantName?: string;
|
|
53
|
-
merchantURL?: string;
|
|
54
|
-
merchantSignature?: string;
|
|
55
|
-
successURL?: string;
|
|
56
|
-
errorURL?: string;
|
|
57
|
-
dateFrequency?: string;
|
|
58
|
-
chargeExpiryDate?: string;
|
|
59
|
-
sumTotal?: string;
|
|
60
|
-
directPayment?: string;
|
|
61
|
-
identifier?: string;
|
|
62
|
-
group?: string;
|
|
63
|
-
pan?: string;
|
|
64
|
-
cardCountry?: Country;
|
|
65
|
-
lang?: Language;
|
|
66
|
-
merchantData?: string;
|
|
67
|
-
clientIp?: string;
|
|
68
|
-
operationId?: string;
|
|
69
|
-
payMethods?: string;
|
|
70
|
-
productDescription?: string;
|
|
71
|
-
taxReference?: string;
|
|
72
|
-
transactionDate?: string;
|
|
73
|
-
merchantDescriptor?: string;
|
|
74
|
-
customerMobile?: string;
|
|
75
|
-
customerMail?: string;
|
|
76
|
-
cardHolder?: string;
|
|
77
|
-
smsTemplate?: string;
|
|
78
|
-
raw?: RawRequestParams;
|
|
22
|
+
/**
|
|
23
|
+
* Body of a 3DS v2 method completion notification
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export interface ThreeDSv2MethodNotificationBody {
|
|
28
|
+
threeDSMethodData: string;
|
|
79
29
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Body of a 3DS v2 challenge completion notification
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export interface ThreeDSv2ChallengeNotificationBody {
|
|
36
|
+
/** Challenge response, JSON that is base64 encoded */
|
|
37
|
+
cres: string;
|
|
38
|
+
threeDSSessionData: string;
|
|
85
39
|
}
|
|
86
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Body of a successful redsys JSON HTTP response or notification
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export interface ResponseJSONSuccess {
|
|
46
|
+
Ds_SignatureVersion: string;
|
|
87
47
|
Ds_Signature: string;
|
|
88
48
|
Ds_MerchantParameters: string;
|
|
89
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Body of a failed redsys JSON HTTP response
|
|
52
|
+
*/
|
|
53
|
+
export interface ResponseJSONError {
|
|
54
|
+
errorCode: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Body of a redsys JSON HTTP response
|
|
58
|
+
*/
|
|
59
|
+
export declare type ResponseJSON = ResponseJSONSuccess | ResponseJSONError;
|
|
60
|
+
/**
|
|
61
|
+
* SHA256 signed JSON request parameters
|
|
62
|
+
*/
|
|
63
|
+
export interface SHA256SignedJSONParameters {
|
|
64
|
+
Ds_SignatureVersion: 'HMAC_SHA256_V1';
|
|
65
|
+
Ds_MerchantParameters: string;
|
|
66
|
+
Ds_Signature: string;
|
|
67
|
+
}
|
|
68
|
+
export interface SoapNotificationResponse {
|
|
69
|
+
order: string;
|
|
70
|
+
allow: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Redirect form
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
export interface RedirectForm {
|
|
78
|
+
url: string;
|
|
79
|
+
body: SHA256SignedJSONParameters;
|
|
80
|
+
}
|