-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
309 lines (258 loc) · 7.4 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/**
* Initial communication
*/
type UIMessageType =
| AcquirePageErrorType
| BankWithoutAutomatonType
| PaymentFinishedType
| PaymentIdType
| PaymentIsRunningType
| UIExperimentsConfigurationUpdated
| PaymentCancelType
| OpenAppType
interface TypedMessage {
serial?: number
type: UIMessageType
}
/**
* Payment initialization
*/
type PaymentIdType = | 'PAYMENT_ID_QUESTION' | 'PAYMENT_ID_RESPONSE'
type PaymentCancelType = | 'CANCEL_PAYMENT' | 'CANCEL_PAYMENT_COMPLETE'
type OpenAppType = 'OPEN_APP'
interface PaymentIdQuestionMessage extends TypedMessage {
type: 'PAYMENT_ID_QUESTION',
uiMessages?: UiMessages
}
interface PaymentCancelMessage extends TypedMessage {
type: 'CANCEL_PAYMENT',
uiMessages?: UiMessages
}
interface PaymentCancelCompleteMessage extends TypedMessage {
type: 'CANCEL_PAYMENT_COMPLETE',
uiMessages?: UiMessages
}
interface PaymentIdResponseMessage extends TypedMessage {
type: 'PAYMENT_ID_RESPONSE',
paymentId: string,
sessionCookieName: string | undefined,
sessionCookieValue: string | undefined,
stfp: any | undefined,
}
type PaymentInitializationMessagesType =
| PaymentIdQuestionMessage
| PaymentIdResponseMessage
| PaymentCancelMessage
| PaymentCancelCompleteMessage
/**
* Payment process
*/
type PaymentIsRunningType =
| 'AMOUNT_UPDATED'
| 'BANK_ACCOUNT_NUMBER_UPDATED'
| 'BANK_UPDATED'
| 'BILL_INFO'
| 'BRAND_COLOR_UPDATED'
| 'FORM'
| 'OPERATION_INFO'
| 'PERSONAL_IDENTIFIER_UPDATED'
| 'PROGRESS_START'
| 'PROGRESS_STOP'
| 'TECHNOLOGY_INSIDE_IMAGE_URL_UPDATED'
| 'USER_RESPONSE'
| 'PRE_AUTHORIZATION_STARTED'
| 'PRE_AUTHORIZATION_CANCELED'
type PaymentFinishedType = 'OPERATION_SUCCESS' | 'OPERATION_WARNING' | 'OPERATION_FAILURE'
type UIExperimentsConfigurationUpdated = 'UI_EXPERIMENTS_CONFIGURATION_UPDATED'
type BankWithoutAutomatonType = 'BANK_WITHOUT_AUTOMATON'
type AcquirePageErrorType = 'ACQUIRE_PAGE_ERROR'
interface BaseMessage {
title: string
}
type PaymentProcessMessageType =
| AcquirePageErrorMessage
| AmountUpdatedMessage
| BankAccountNumberUpdatedMessage
| BankUpdatedMessage
| BankWithoutAutomatonMessage
| BillInfoMessage
| BrandColorUpdatedMessage
| FailureMessage
| FormMessage
| InfoMessage
| PersonalIdentifierUpdatedMessage
| ProgressStartMessage
| ProgressStopMessage
| SuccessMessage
| TechnologyInsideImageUrlUpdatedMessage
| UIExperimentsConfigurationUpdatedMessage
| UIResponseMessage
| WarningMessage
| PreAutorizationCanceledMessage
| PreAutorizationStartedMessage
| OpenAppMessage
type UiMessage = PaymentInitializationMessagesType | PaymentProcessMessageType
type QuestionType = 'email' | 'rut' | 'input' | 'list' | 'imageList' | 'coordinates' | 'imageChallenge'
interface Choice {
value: string
name: string
}
interface Question {
fieldType: QuestionType
name: string
message: string
placeholder?: string
mask?: string
hint?: string
minLength?: number
maxLength?: number
minValue?: any
maxValue?: any
default?: any
format?: string
prefix?: string
choices?: Choice[] | Array<any> | any
tagsOrder?: string
imageData?: string
secure?: boolean
number?: boolean
}
type TitleIconType = 'secure' | 'user-shield'
interface FormMessage extends BaseMessage, TypedMessage {
id: string
titleIcon?: TitleIconType
info?: string
pageTitle?: string
continueLabel?: string
currentStep?: number
totalSteps?: number
errorMessage?: string
questions: Question[]
termsUrl?: string
timeout: number
rememberValues: boolean
type: 'FORM'
}
interface UIAnswer {
id: string
fieldType: QuestionType
value: string
multiple: boolean
}
interface UIResponseMessage extends TypedMessage {
type: 'USER_RESPONSE'
id: string
answers: UIAnswer[]
}
interface InfoMessage extends BaseMessage, TypedMessage {
type: 'OPERATION_INFO'
}
interface SuccessMessage extends ExitMessage, TypedMessage {
type: 'OPERATION_SUCCESS'
}
type ReasonExecutionFailed = 'TASK_EXECUTION_ERROR' | 'TASK_DOWNLOAD_ERROR' | 'INVALID_OPERATION_ID' | 'SERVER_DISCONNECTED' | 'SUCCEEDED_DELAYED_NOT_ALLOWED' | 'REAL_TIMEOUT'
type ReasonFinishedType = 'NO_BACKEND_AVAILABLE' | 'TASK_FINISHED' | 'TASK_DUMPED'
type ReasonInteractionType = 'FORM_TIMEOUT' | 'USER_CANCELED'
type ReasonNotificationType = 'TASK_NOTIFICATION_ERROR'
type OperationFailedReason = ReasonExecutionFailed | ReasonFinishedType | ReasonInteractionType | ReasonNotificationType
interface WarningMessage extends ExitMessage, TypedMessage {
failureReason?: OperationFailedReason
type: 'OPERATION_WARNING'
}
interface FailureMessage extends ExitMessage, TypedMessage {
failureReason: OperationFailedReason
type: 'OPERATION_FAILURE'
}
interface ExitMessage extends BaseMessage {
body?: string
operationId: string
resultMessage?: string
exitUrl?: string
summaryRowsLabels?: SummaryRowsLabels
}
interface ProgressStartMessage extends ProgressMessage, TypedMessage {
type: 'PROGRESS_START'
}
interface ProgressStopMessage extends ProgressMessage, TypedMessage {
type: 'PROGRESS_STOP'
}
interface ProgressMessage {
title?: string
}
interface SummaryRowsLabels {
operationCode: string,
error: string,
merchant: string,
bank: string,
personalIdentifier: string,
amount: string,
subject: string,
}
interface UiMessages {
[id: string] : string
}
interface BillInfoMessage extends TypedMessage {
type: 'BILL_INFO'
merchantName: string
merchantLogoUrl: string
paymentId: string
amount: string
subject?: string
body?: string
imageUrl?: string
cancelUrl: string
returnUrl: string
changePaymentMethodUrl: string
fallbackUrl: string
attachmentUrls?: string[]
}
interface BankUpdatedMessage extends TypedMessage {
type: 'BANK_UPDATED'
bankName: string
}
interface TechnologyInsideImageUrlUpdatedMessage extends TypedMessage {
type: 'TECHNOLOGY_INSIDE_IMAGE_URL_UPDATED'
url: string
}
interface BankAccountNumberUpdatedMessage extends TypedMessage {
type: 'BANK_ACCOUNT_NUMBER_UPDATED'
accountNumber: string
}
interface AmountUpdatedMessage extends TypedMessage {
type: 'AMOUNT_UPDATED'
amount: string
}
interface BrandColorUpdatedMessage extends TypedMessage {
type: 'BRAND_COLOR_UPDATED'
brandColor: string
}
interface PersonalIdentifierUpdatedMessage extends TypedMessage {
type: 'PERSONAL_IDENTIFIER_UPDATED',
value: string
}
interface PreAutorizationStartedMessage extends TypedMessage {
type: 'PRE_AUTHORIZATION_STARTED'
}
interface OpenAppMessage extends TypedMessage {
type: 'OPEN_APP'
appDefinition: any
}
interface PreAutorizationCanceledMessage extends TypedMessage {
type: 'PRE_AUTHORIZATION_CANCELED'
}
interface UIExperimentsConfigurationUpdatedMessage extends TypedMessage {
type: 'UI_EXPERIMENTS_CONFIGURATION_UPDATED',
value: string
}
interface BankWithoutAutomatonMessage extends TypedMessage {
type: 'BANK_WITHOUT_AUTOMATON',
disabledAutomatonMessage: string
}
interface AcquirePageErrorMessage extends TypedMessage {
type: 'ACQUIRE_PAGE_ERROR',
disabledAutomatonMessage: string
}
interface UIExperimentsConfigurationUpdatedMessage extends TypedMessage {
type: 'UI_EXPERIMENTS_CONFIGURATION_UPDATED',
value: string
}