@akinon/pz-masterpass-rest 2.0.0-beta.12 → 2.0.0-beta.14
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/CHANGELOG.md +23 -0
- package/README.md +11 -1
- package/assets/masterpass-javascript-sdk-web.min.js +1 -0
- package/docs/USAGE.md +1176 -0
- package/package.json +3 -3
- package/src/components/credit-card-form.tsx +1 -1
- package/src/components/information-modal.tsx +139 -0
- package/src/components/otp-modal.tsx +94 -12
- package/src/hooks/useMasterpassAccount.ts +77 -37
- package/src/hooks/useMasterpassPayment.ts +248 -123
- package/src/hooks/useMasterpassToken.ts +61 -16
- package/src/redux/api.ts +16 -7
- package/src/redux/reducer.ts +14 -0
- package/src/services/account.ts +73 -64
- package/src/services/payment.ts +131 -93
- package/src/services/verify.ts +44 -44
- package/src/types/custom-render.types.ts +22 -2
- package/src/types/payment.types.ts +14 -0
- package/src/utils/payment-constants.ts +3 -3
- package/src/utils/payment-utils.ts +20 -4
- package/src/utils/response-handler.ts +35 -6
- package/src/utils/session-handler.ts +60 -0
- package/src/utils/validation-schemas.ts +1 -1
- package/src/views/masterpass-rest-option.tsx +55 -30
package/src/services/account.ts
CHANGED
|
@@ -8,102 +8,111 @@ import {
|
|
|
8
8
|
AddCardResponse
|
|
9
9
|
} from '../types/account.types';
|
|
10
10
|
import { store } from 'redux/store';
|
|
11
|
+
import { createSessionExpiredResponse, withUnhandledRejectionHandler } from '../utils/session-handler';
|
|
11
12
|
|
|
12
13
|
export class AccountService {
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
private get merchantId(): string {
|
|
18
|
-
return store.getState().masterpassRest.tokenData?.MerchantId || '';
|
|
19
|
-
}
|
|
14
|
+
private _token: string;
|
|
15
|
+
private _merchantId: string;
|
|
20
16
|
|
|
21
|
-
constructor() {
|
|
17
|
+
constructor(token?: string, merchantId?: string) {
|
|
18
|
+
this._token = token || store.getState().masterpassRest.token || '';
|
|
19
|
+
this._merchantId = merchantId || store.getState().masterpassRest.tokenData?.MerchantId || '';
|
|
22
20
|
this.initialize();
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
private initialize(): void {
|
|
26
24
|
if (!window.Masterpass) {
|
|
27
|
-
console.error('window.Masterpass not available in AccountService');
|
|
28
25
|
return;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
if (window.Masterpass.setToken) {
|
|
32
|
-
window.Masterpass.setToken(this.
|
|
29
|
+
window.Masterpass.setToken(this._token);
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
if (window.Masterpass.setMerchantId) {
|
|
36
|
-
window.Masterpass.setMerchantId(this.
|
|
33
|
+
window.Masterpass.setMerchantId(this._merchantId);
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
accountAccess(request: AccountAccessRequest): Promise<AccountAccessResponse> {
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
return withUnhandledRejectionHandler(
|
|
39
|
+
() => new Promise((resolve, reject) => {
|
|
40
|
+
try {
|
|
41
|
+
this.initialize();
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
window.Masterpass.accountService.accountAccess(
|
|
44
|
+
request,
|
|
45
|
+
(statusCode: number, response: AccountAccessResponse) => {
|
|
46
|
+
resolve(response);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.error('AccountAccess error:', error);
|
|
51
|
+
reject(error);
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
createSessionExpiredResponse<AccountAccessResponse>()
|
|
55
|
+
);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
linkToMerchant(request: {
|
|
59
59
|
accountKey: string;
|
|
60
60
|
}): Promise<LinkToMerchantResponseType> {
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
return withUnhandledRejectionHandler(
|
|
62
|
+
() => new Promise((resolve, reject) => {
|
|
63
|
+
try {
|
|
64
|
+
this.initialize();
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
window.Masterpass.accountService.linkToMerchant(
|
|
67
|
+
request,
|
|
68
|
+
(statusCode: number, response: LinkToMerchantResponseType) => {
|
|
69
|
+
resolve(response);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
reject(error);
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
createSessionExpiredResponse<LinkToMerchantResponseType>()
|
|
77
|
+
);
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
removeCard(req: RemoveCardRequest): Promise<RemoveCardServiceResponse> {
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
return withUnhandledRejectionHandler(
|
|
82
|
+
() => new Promise((resolve, reject) => {
|
|
83
|
+
try {
|
|
84
|
+
this.initialize();
|
|
85
|
+
window.Masterpass.accountService.removeCard(
|
|
86
|
+
req,
|
|
87
|
+
(statusCode: number, response: RemoveCardServiceResponse) => {
|
|
88
|
+
resolve(response);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
reject(error);
|
|
93
|
+
}
|
|
94
|
+
}),
|
|
95
|
+
createSessionExpiredResponse<RemoveCardServiceResponse>()
|
|
96
|
+
);
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
addCard(request: AddCardRequest): Promise<AddCardResponse> {
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
return withUnhandledRejectionHandler(
|
|
101
|
+
() => new Promise((resolve, reject) => {
|
|
102
|
+
try {
|
|
103
|
+
this.initialize();
|
|
97
104
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
window.Masterpass.accountService.addCard(
|
|
106
|
+
request,
|
|
107
|
+
(statusCode: number, response: AddCardResponse) => {
|
|
108
|
+
resolve(response);
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
reject(error);
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
createSessionExpiredResponse<AddCardResponse>()
|
|
116
|
+
);
|
|
108
117
|
}
|
|
109
118
|
}
|
package/src/services/payment.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
MPResponse,
|
|
6
6
|
type PaymentProcessRequest
|
|
7
7
|
} from '../types/payment.types';
|
|
8
|
+
import { withUnhandledRejectionHandler } from '../utils/session-handler';
|
|
8
9
|
|
|
9
10
|
export interface PaymentResponse {
|
|
10
11
|
success: boolean;
|
|
@@ -13,119 +14,156 @@ export interface PaymentResponse {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export class PaymentService {
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
private get merchantId(): string {
|
|
21
|
-
return store.getState().masterpassRest.tokenData?.MerchantId || '';
|
|
22
|
-
}
|
|
17
|
+
private _token: string;
|
|
18
|
+
private _merchantId: string;
|
|
23
19
|
|
|
24
|
-
constructor() {
|
|
20
|
+
constructor(token?: string, merchantId?: string) {
|
|
21
|
+
this._token = token || store.getState().masterpassRest.token || '';
|
|
22
|
+
this._merchantId =
|
|
23
|
+
merchantId || store.getState().masterpassRest.tokenData?.MerchantId || '';
|
|
25
24
|
this.initialize();
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
private initialize(): void {
|
|
29
|
-
window.Masterpass.setToken(this.
|
|
30
|
-
window.Masterpass.setMerchantId(this.
|
|
28
|
+
window.Masterpass.setToken(this._token);
|
|
29
|
+
window.Masterpass.setMerchantId(this._merchantId);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private extractErrorMessage(error: unknown, fallback: string): string {
|
|
33
|
+
if (error instanceof Error) return error.message;
|
|
34
|
+
if (typeof error === 'string') return error;
|
|
35
|
+
return fallback;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
async processPayment(
|
|
34
39
|
paymentData: PaymentProcessRequest
|
|
35
40
|
): Promise<PaymentResponse> {
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
return withUnhandledRejectionHandler(
|
|
42
|
+
() =>
|
|
43
|
+
new Promise((resolve) => {
|
|
44
|
+
try {
|
|
45
|
+
this.initialize();
|
|
39
46
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
47
|
+
window.Masterpass.paymentService.payment(
|
|
48
|
+
{
|
|
49
|
+
requestReferenceNo: paymentData.requestReferenceNo,
|
|
50
|
+
cvc: paymentData.cvc,
|
|
51
|
+
cardAlias: paymentData.cardAlias,
|
|
52
|
+
accountKey: paymentData.accountKey,
|
|
53
|
+
amount: paymentData.amount,
|
|
54
|
+
orderNo: paymentData.orderNo,
|
|
55
|
+
currencyCode: paymentData.currencyCode,
|
|
56
|
+
paymentType: paymentData.paymentType,
|
|
57
|
+
acquirerIcaNumber: paymentData.acquirerIcaNumber,
|
|
58
|
+
installmentCount: paymentData.installmentCount,
|
|
59
|
+
authenticationMethod: paymentData.authenticationMethod,
|
|
60
|
+
secure3DModel: paymentData.secure3DModel,
|
|
61
|
+
terminalGroupId: paymentData.terminalGroupId,
|
|
62
|
+
...(paymentData.additionalFields || {})
|
|
63
|
+
},
|
|
64
|
+
(statusCode, response) => {
|
|
65
|
+
if (response && response.statusCode === 200) {
|
|
66
|
+
resolve({
|
|
67
|
+
success: true,
|
|
68
|
+
data: response
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
resolve({
|
|
72
|
+
success: false,
|
|
73
|
+
error: response?.description || 'Payment failed',
|
|
74
|
+
data: response
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
resolve({
|
|
81
|
+
success: false,
|
|
82
|
+
error: this.extractErrorMessage(error, 'Payment service initialization failed')
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
{
|
|
87
|
+
success: false,
|
|
88
|
+
error: 'Session has expired',
|
|
89
|
+
data: {
|
|
90
|
+
statusCode: 401,
|
|
91
|
+
exception: {
|
|
92
|
+
code: 'TOKEN_HAS_EXPIRED',
|
|
93
|
+
message: 'Session has expired'
|
|
69
94
|
}
|
|
70
|
-
|
|
71
|
-
} catch (error) {
|
|
72
|
-
resolve({
|
|
73
|
-
success: false,
|
|
74
|
-
error: 'Payment service initialization failed'
|
|
75
|
-
});
|
|
95
|
+
}
|
|
76
96
|
}
|
|
77
|
-
|
|
97
|
+
);
|
|
78
98
|
}
|
|
79
99
|
|
|
80
100
|
async directPayment(
|
|
81
101
|
paymentData: DirectPaymentRequest
|
|
82
102
|
): Promise<PaymentResponse> {
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
103
|
+
return withUnhandledRejectionHandler(
|
|
104
|
+
() =>
|
|
105
|
+
new Promise((resolve) => {
|
|
106
|
+
try {
|
|
107
|
+
this.initialize();
|
|
86
108
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
window.Masterpass.paymentService.directPayment(
|
|
110
|
+
{
|
|
111
|
+
requestReferenceNo: paymentData.requestReferenceNo,
|
|
112
|
+
cvc: paymentData.cvc,
|
|
113
|
+
cardNumber: paymentData.cardNumber,
|
|
114
|
+
cardHolderName: paymentData.cardHolderName,
|
|
115
|
+
expiryDate: paymentData.expiryDate,
|
|
116
|
+
accountKey: paymentData.accountKey,
|
|
117
|
+
amount: paymentData.amount,
|
|
118
|
+
orderNo: paymentData.orderNo,
|
|
119
|
+
currencyCode: paymentData.currencyCode,
|
|
120
|
+
paymentType: paymentData.paymentType,
|
|
121
|
+
acquirerIcaNumber: paymentData.acquirerIcaNumber,
|
|
122
|
+
installmentCount: paymentData.installmentCount,
|
|
123
|
+
authenticationMethod: paymentData.authenticationMethod,
|
|
124
|
+
secure3DModel: paymentData.secure3DModel,
|
|
125
|
+
terminalGroupId: paymentData.terminalGroupId,
|
|
126
|
+
...(paymentData.additionalFields || {})
|
|
127
|
+
},
|
|
128
|
+
(
|
|
129
|
+
statusCode: number,
|
|
130
|
+
response: MPResponse<DirectPaymentResponse>
|
|
131
|
+
) => {
|
|
132
|
+
if (response && response.statusCode === 200) {
|
|
133
|
+
resolve({
|
|
134
|
+
success: true,
|
|
135
|
+
data: response
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
resolve({
|
|
139
|
+
success: false,
|
|
140
|
+
error:
|
|
141
|
+
response?.result?.responseDescription ||
|
|
142
|
+
response?.exception?.message ||
|
|
143
|
+
'Direct payment failed',
|
|
144
|
+
data: response
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
resolve({
|
|
151
|
+
success: false,
|
|
152
|
+
error: this.extractErrorMessage(error, 'Direct payment service initialization failed')
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}),
|
|
156
|
+
{
|
|
157
|
+
success: false,
|
|
158
|
+
error: 'Session has expired',
|
|
159
|
+
data: {
|
|
160
|
+
statusCode: 401,
|
|
161
|
+
exception: {
|
|
162
|
+
code: 'TOKEN_HAS_EXPIRED',
|
|
163
|
+
message: 'Session has expired'
|
|
121
164
|
}
|
|
122
|
-
|
|
123
|
-
} catch (error) {
|
|
124
|
-
resolve({
|
|
125
|
-
success: false,
|
|
126
|
-
error: 'Direct payment service initialization failed'
|
|
127
|
-
});
|
|
165
|
+
}
|
|
128
166
|
}
|
|
129
|
-
|
|
167
|
+
);
|
|
130
168
|
}
|
|
131
169
|
}
|
package/src/services/verify.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
1
|
import { MPResponse } from '../types/payment.types';
|
|
2
2
|
import { VerifyRequest, VerifyResponse } from '../types/verify.types';
|
|
3
3
|
import { store } from 'redux/store';
|
|
4
|
+
import { createSessionExpiredResponse, withUnhandledRejectionHandler } from '../utils/session-handler';
|
|
4
5
|
|
|
5
6
|
export class VerifyService {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
7
|
+
private _token: string;
|
|
8
|
+
private _merchantId: string;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
private get decodedToken(): any {
|
|
15
|
-
return store.getState().masterpassRest.tokenData || '';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private get merchantId(): string {
|
|
19
|
-
return store.getState().masterpassRest.tokenData?.MerchantId || '';
|
|
10
|
+
constructor(token?: string, merchantId?: string) {
|
|
11
|
+
this._token = token || store.getState().masterpassRest.token || '';
|
|
12
|
+
this._merchantId = merchantId || store.getState().masterpassRest.tokenData?.MerchantId || '';
|
|
13
|
+
this.initialize();
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
private initialize(): void {
|
|
23
|
-
window.Masterpass.setToken(this.
|
|
24
|
-
window.Masterpass.setMerchantId(this.
|
|
17
|
+
window.Masterpass.setToken(this._token);
|
|
18
|
+
window.Masterpass.setMerchantId(this._merchantId);
|
|
25
19
|
}
|
|
26
20
|
|
|
27
21
|
verifyOtp(request: VerifyRequest): Promise<MPResponse<VerifyResponse>> {
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
return withUnhandledRejectionHandler(
|
|
23
|
+
() => new Promise((resolve, reject) => {
|
|
24
|
+
try {
|
|
25
|
+
this.initialize();
|
|
26
|
+
|
|
27
|
+
window.Masterpass.verifyService.verifyOtp(
|
|
28
|
+
request,
|
|
29
|
+
(statusCode, response) => {
|
|
30
|
+
resolve(response);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
reject(error);
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
createSessionExpiredResponse<MPResponse<VerifyResponse>>()
|
|
38
|
+
);
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
resendOtp(): Promise<MPResponse<VerifyResponse>> {
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
resendOtp(otpToken?: string): Promise<MPResponse<VerifyResponse>> {
|
|
42
|
+
return withUnhandledRejectionHandler(
|
|
43
|
+
() => new Promise((resolve, reject) => {
|
|
44
|
+
try {
|
|
45
|
+
this.initialize();
|
|
46
|
+
|
|
47
|
+
window.Masterpass.verifyService.resendOtp(
|
|
48
|
+
{ token: otpToken || this._token },
|
|
49
|
+
(statusCode, response) => {
|
|
50
|
+
resolve(response);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
reject(error);
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
createSessionExpiredResponse<MPResponse<VerifyResponse>>()
|
|
58
|
+
);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -51,8 +51,9 @@ export type LinkModalProps = {
|
|
|
51
51
|
export type OTPModalProps = {
|
|
52
52
|
open: boolean;
|
|
53
53
|
onClose: () => void;
|
|
54
|
-
onSubmit: (otp: string) => Promise<{ success: boolean; message?: string }>;
|
|
54
|
+
onSubmit: (otp: string) => Promise<{ success: boolean; requiresOTP?: boolean; message?: string }>;
|
|
55
55
|
type: 'RTA' | 'OTP' | 'CVV';
|
|
56
|
+
responseCode?: string;
|
|
56
57
|
description?: string;
|
|
57
58
|
texts: MasterpassRestOptionTexts;
|
|
58
59
|
};
|
|
@@ -91,6 +92,7 @@ export type MasterpassRestOptionRenderProps = {
|
|
|
91
92
|
hasStoredCards: boolean;
|
|
92
93
|
shouldShowDirectForm: boolean;
|
|
93
94
|
cvc: string;
|
|
95
|
+
error: any;
|
|
94
96
|
|
|
95
97
|
accountData: any;
|
|
96
98
|
accountStatus: any;
|
|
@@ -249,12 +251,30 @@ export type MasterpassRestOptionTexts = {
|
|
|
249
251
|
whatIsMasterpassLink?: string;
|
|
250
252
|
|
|
251
253
|
rtaVerificationTitle?: string;
|
|
252
|
-
cvvVerificationTitle?: string;
|
|
253
254
|
rtaVerificationDescription?: string;
|
|
255
|
+
rtaVerificationPlaceholder?: string;
|
|
256
|
+
|
|
257
|
+
bankOtpVerificationTitle?: string;
|
|
258
|
+
bankOtpVerificationDescription?: string;
|
|
259
|
+
bankOtpVerificationPlaceholder?: string;
|
|
260
|
+
|
|
261
|
+
phoneVerificationTitle?: string;
|
|
262
|
+
phoneVerificationDescription?: string;
|
|
263
|
+
phoneVerificationPlaceholder?: string;
|
|
264
|
+
|
|
265
|
+
cvvVerificationTitle?: string;
|
|
254
266
|
cvvVerificationDescription?: string;
|
|
267
|
+
cvvVerificationPlaceholder?: string;
|
|
268
|
+
cvvVerificationHelperText?: string;
|
|
269
|
+
|
|
255
270
|
otpVerificationDescription?: string;
|
|
256
271
|
verifyButton?: string;
|
|
257
272
|
otpModalCancelButton?: string;
|
|
258
273
|
otpModalErrorText?: string;
|
|
259
274
|
otpModalResendOtpButton?: string;
|
|
275
|
+
|
|
276
|
+
sessionExpiredTitle?: string;
|
|
277
|
+
sessionExpiredMessage?: string;
|
|
278
|
+
sessionExpiredSecondaryMessage?: string;
|
|
279
|
+
sessionExpiredButton?: string;
|
|
260
280
|
};
|
|
@@ -28,6 +28,7 @@ export interface PaymentProcessRequest {
|
|
|
28
28
|
authenticationMethod: string;
|
|
29
29
|
secure3DModel: string;
|
|
30
30
|
terminalGroupId: string;
|
|
31
|
+
additionalFields?: any;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export interface OrderData {
|
|
@@ -79,10 +80,22 @@ export interface PaymentState {
|
|
|
79
80
|
useThreeD: boolean;
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
export type InformationModalType = 'warning' | 'error' | 'success' | 'info';
|
|
84
|
+
|
|
85
|
+
export interface InformationModalData {
|
|
86
|
+
type: InformationModalType;
|
|
87
|
+
title: string;
|
|
88
|
+
message: string;
|
|
89
|
+
secondaryMessage?: string;
|
|
90
|
+
buttonText: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
82
93
|
export interface ModalState {
|
|
83
94
|
showLinkModal: boolean;
|
|
84
95
|
showOTPModal: boolean;
|
|
85
96
|
show3DSecureModal: boolean;
|
|
97
|
+
showInformationModal: boolean;
|
|
98
|
+
informationModalData: InformationModalData | null;
|
|
86
99
|
otpType: OTPType;
|
|
87
100
|
verificationData: any | null;
|
|
88
101
|
cardToDelete: any | null;
|
|
@@ -105,6 +118,7 @@ export interface DirectPaymentRequest {
|
|
|
105
118
|
authenticationMethod: string;
|
|
106
119
|
secure3DModel: string;
|
|
107
120
|
terminalGroupId: string;
|
|
121
|
+
additionalFields?: any;
|
|
108
122
|
}
|
|
109
123
|
|
|
110
124
|
export interface DirectPaymentResponse {
|
|
@@ -10,11 +10,11 @@ export const PAYMENT_CONSTANTS = {
|
|
|
10
10
|
|
|
11
11
|
EXCEPTION_CODES: {
|
|
12
12
|
ACCOUNT_NOT_FOUND: 'ACCOUNT_NOT_FOUND',
|
|
13
|
-
ACCOUNT_NOT_LINKED_TO_MERCHANT: 'ACCOUNT_NOT_LINKED_TO_MERCHANT'
|
|
13
|
+
ACCOUNT_NOT_LINKED_TO_MERCHANT: 'ACCOUNT_NOT_LINKED_TO_MERCHANT',
|
|
14
|
+
TOKEN_HAS_EXPIRED: 'TOKEN_HAS_EXPIRED'
|
|
14
15
|
},
|
|
15
16
|
|
|
16
17
|
PAYMENT_CONFIG: {
|
|
17
|
-
ACQUIRER_ICA_NUMBER: '2030',
|
|
18
18
|
PAYMENT_TYPE: 'Sale'
|
|
19
19
|
},
|
|
20
20
|
|
|
@@ -27,5 +27,5 @@ export const PAYMENT_CONSTANTS = {
|
|
|
27
27
|
} as const;
|
|
28
28
|
|
|
29
29
|
export const CALLBACK_PATHS = {
|
|
30
|
-
RETURN: '/orders/
|
|
30
|
+
RETURN: '/orders/checkout/?page=MasterpassRestCompletePage&three_d_secure=true'
|
|
31
31
|
} as const;
|