@bloonio/lokotro-pay 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +585 -0
- package/fesm2022/bloonio-lokotro-pay.mjs +5387 -0
- package/fesm2022/bloonio-lokotro-pay.mjs.map +1 -0
- package/index.d.ts +1640 -0
- package/package.json +41 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,1640 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, OnDestroy, EventEmitter, ModuleWithProviders, InjectionToken } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import * as i2 from '@angular/common/http';
|
|
5
|
+
import { HttpClient } from '@angular/common/http';
|
|
6
|
+
import * as i3 from '@angular/forms';
|
|
7
|
+
import { FormGroup, FormBuilder, ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
8
|
+
import { Observable } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Lokotro Pay - Enums
|
|
12
|
+
* Angular version of the Flutter Lokotro Pay plugin enums
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Payment channel types supported by Lokotro Pay
|
|
16
|
+
*/
|
|
17
|
+
declare enum LokotroPayChannel {
|
|
18
|
+
None = "none",
|
|
19
|
+
All = "all",
|
|
20
|
+
EFlash = "eflash",
|
|
21
|
+
EWallet = "ewallet",
|
|
22
|
+
Card = "card",
|
|
23
|
+
MobileMoney = "mobileMoney",
|
|
24
|
+
EWalletOtp = "ewalletOtp",
|
|
25
|
+
LokotroWallet = "lokotroWallet",
|
|
26
|
+
VirtualCard = "virtualCard",
|
|
27
|
+
BankTransfer = "bankTransfer"
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Payment channel display names and icons
|
|
31
|
+
*/
|
|
32
|
+
declare const LokotroPayChannelInfo: Record<LokotroPayChannel, {
|
|
33
|
+
displayName: string;
|
|
34
|
+
iconPath: string;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Form filling information status
|
|
38
|
+
*/
|
|
39
|
+
declare enum LokotroPayFillingInfo {
|
|
40
|
+
None = "none",
|
|
41
|
+
Full = "full",
|
|
42
|
+
Partial = "partial"
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Local screen navigation states for enhanced UI flow
|
|
46
|
+
*/
|
|
47
|
+
declare enum LokotroPayScreenNavigation {
|
|
48
|
+
DefaultScreen = "defaultScreen",
|
|
49
|
+
LoadingScreen = "loadingScreen",
|
|
50
|
+
PaymentMethodSelectionScreen = "paymentMethodSelectionScreen",
|
|
51
|
+
PaymentFormScreen = "paymentFormScreen",
|
|
52
|
+
EWalletFormScreen = "ewalletFormScreen",
|
|
53
|
+
MobileMoneyFormScreen = "mobilemoneyFormScreen",
|
|
54
|
+
CardFormScreen = "cardFormScreen",
|
|
55
|
+
BankTransferFormScreen = "bankTransferFormScreen",
|
|
56
|
+
FlashFormScreen = "flashFormScreen",
|
|
57
|
+
PaymentConfirmationScreen = "paymentConfirmationScreen",
|
|
58
|
+
ProcessingScreen = "processingScreen",
|
|
59
|
+
MobileMoneyProcessingScreen = "mobileMoneyProcessingScreen",
|
|
60
|
+
EWalletOtpScreen = "ewalletOtpScreen",
|
|
61
|
+
SuccessScreen = "successScreen",
|
|
62
|
+
ErrorScreen = "errorScreen",
|
|
63
|
+
WarningScreen = "warningScreen",
|
|
64
|
+
InfoScreen = "infoScreen"
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Screen navigation display names
|
|
68
|
+
*/
|
|
69
|
+
declare const LokotroPayScreenNavigationInfo: Record<LokotroPayScreenNavigation, string>;
|
|
70
|
+
/**
|
|
71
|
+
* API result processing screen types
|
|
72
|
+
*/
|
|
73
|
+
declare enum LokotroPayResultScreen {
|
|
74
|
+
SuccessScreen = "successScreen",
|
|
75
|
+
ErrorScreen = "errorScreen",
|
|
76
|
+
WarningScreen = "warningScreen",
|
|
77
|
+
InfoScreen = "infoScreen"
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Payment status enumeration
|
|
81
|
+
*/
|
|
82
|
+
declare enum LokotroPaymentStatus {
|
|
83
|
+
Pending = "pending",
|
|
84
|
+
Processing = "processing",
|
|
85
|
+
Approved = "approved",
|
|
86
|
+
Declined = "declined",
|
|
87
|
+
Failed = "failed",
|
|
88
|
+
Cancelled = "cancelled",
|
|
89
|
+
Expired = "expired",
|
|
90
|
+
Refunded = "refunded",
|
|
91
|
+
PendingBankProofUpload = "pending_bank_proof_upload"
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* API response status codes
|
|
95
|
+
*/
|
|
96
|
+
declare enum LokotroPayApiResponseCode {
|
|
97
|
+
LOK000 = "LOK000",// Success
|
|
98
|
+
LOK001 = "LOK001",// General error
|
|
99
|
+
LOK002 = "LOK002",// Invalid parameters
|
|
100
|
+
LOK003 = "LOK003",// Authentication failed
|
|
101
|
+
LOK004 = "LOK004",// Payment method not available
|
|
102
|
+
LOK005 = "LOK005",// Insufficient funds
|
|
103
|
+
LOK006 = "LOK006",// Transaction limit exceeded
|
|
104
|
+
LOK007 = "LOK007",// Network error
|
|
105
|
+
LOK008 = "LOK008",// Timeout
|
|
106
|
+
LOK009 = "LOK009"
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* API response code helper functions
|
|
110
|
+
*/
|
|
111
|
+
declare const LokotroPayApiResponseCodeInfo: {
|
|
112
|
+
getMessage(code: LokotroPayApiResponseCode): string;
|
|
113
|
+
isSuccess(code: LokotroPayApiResponseCode): boolean;
|
|
114
|
+
fromString(code: string): LokotroPayApiResponseCode;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Supported languages for Lokotro Pay
|
|
118
|
+
*/
|
|
119
|
+
declare enum LokotroPayLanguage {
|
|
120
|
+
English = "en",
|
|
121
|
+
French = "fr",
|
|
122
|
+
German = "de",
|
|
123
|
+
Spanish = "es",
|
|
124
|
+
Italian = "it",
|
|
125
|
+
Russian = "ru",
|
|
126
|
+
Hindi = "hi",
|
|
127
|
+
Japanese = "ja",
|
|
128
|
+
Chinese = "zh",
|
|
129
|
+
Lingala = "ln"
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Language info with display names and flag assets
|
|
133
|
+
*/
|
|
134
|
+
declare const LokotroPayLanguageInfo: Record<LokotroPayLanguage, {
|
|
135
|
+
displayName: string;
|
|
136
|
+
nativeName: string;
|
|
137
|
+
flagAsset: string;
|
|
138
|
+
}>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Lokotro Pay - Country Models
|
|
142
|
+
* Models for country data and phone number validation
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* Phone number prefix model
|
|
146
|
+
*/
|
|
147
|
+
interface LokotroPhonePrefix {
|
|
148
|
+
id: string;
|
|
149
|
+
prefix: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Country code model
|
|
153
|
+
*/
|
|
154
|
+
interface LokotroCountryCode {
|
|
155
|
+
id: string;
|
|
156
|
+
countryCode: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Reference country model with flag and phone constraints
|
|
160
|
+
*/
|
|
161
|
+
interface LokotroRefCountry {
|
|
162
|
+
id: string;
|
|
163
|
+
name: string;
|
|
164
|
+
countryFlag: string;
|
|
165
|
+
minPhoneNumberChars: number;
|
|
166
|
+
maxPhoneNumberChars: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Complete country model with all related data
|
|
170
|
+
*/
|
|
171
|
+
interface LokotroCountry {
|
|
172
|
+
refCountry: LokotroRefCountry;
|
|
173
|
+
countryCodes: LokotroCountryCode[];
|
|
174
|
+
phoneNumberPrefixes: LokotroPhonePrefix[];
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Country helper utilities
|
|
178
|
+
*/
|
|
179
|
+
declare class LokotroCountryUtils {
|
|
180
|
+
/**
|
|
181
|
+
* Get the primary country code (first in the list)
|
|
182
|
+
*/
|
|
183
|
+
static getPrimaryCountryCode(country: LokotroCountry): string;
|
|
184
|
+
/**
|
|
185
|
+
* Get the country flag emoji
|
|
186
|
+
*/
|
|
187
|
+
static getFlag(country: LokotroCountry): string;
|
|
188
|
+
/**
|
|
189
|
+
* Get all valid phone prefixes as strings
|
|
190
|
+
*/
|
|
191
|
+
static getValidPrefixes(country: LokotroCountry): string[];
|
|
192
|
+
/**
|
|
193
|
+
* Get min phone chars
|
|
194
|
+
*/
|
|
195
|
+
static getMinPhoneChars(country: LokotroCountry): number;
|
|
196
|
+
/**
|
|
197
|
+
* Get max phone chars
|
|
198
|
+
*/
|
|
199
|
+
static getMaxPhoneChars(country: LokotroCountry): number;
|
|
200
|
+
/**
|
|
201
|
+
* Check if a phone number has a valid prefix for this country
|
|
202
|
+
*/
|
|
203
|
+
static hasValidPrefix(country: LokotroCountry, phoneNumber: string): boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Check if phone number length is valid
|
|
206
|
+
*/
|
|
207
|
+
static isValidPhoneLength(country: LokotroCountry, phoneNumber: string): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Validate phone number completely
|
|
210
|
+
*/
|
|
211
|
+
static validatePhoneNumber(country: LokotroCountry, phoneNumber: string): {
|
|
212
|
+
isValid: boolean;
|
|
213
|
+
errorType?: 'empty' | 'invalidPrefix' | 'tooShort' | 'tooLong';
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Parse country from API response
|
|
217
|
+
*/
|
|
218
|
+
static fromJson(json: Record<string, unknown>): LokotroCountry;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Bank entity (city) model
|
|
223
|
+
*/
|
|
224
|
+
interface LokotroBankEntity {
|
|
225
|
+
id: string;
|
|
226
|
+
name: string;
|
|
227
|
+
countryFlag?: string;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Bank currency model
|
|
231
|
+
*/
|
|
232
|
+
interface LokotroBankCurrency {
|
|
233
|
+
id: string;
|
|
234
|
+
name: string;
|
|
235
|
+
code: string;
|
|
236
|
+
symbol?: string;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Bank account model
|
|
240
|
+
*/
|
|
241
|
+
interface LokotroBankAccount {
|
|
242
|
+
id: string;
|
|
243
|
+
identifier: string;
|
|
244
|
+
accountNumber: string;
|
|
245
|
+
accountLabel: string;
|
|
246
|
+
createdAt?: string;
|
|
247
|
+
refBank?: LokotroBank;
|
|
248
|
+
refCurrency?: LokotroBankCurrency;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Bank model
|
|
252
|
+
*/
|
|
253
|
+
interface LokotroBank {
|
|
254
|
+
id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
abreviation: string;
|
|
257
|
+
bankLogoUrl: string;
|
|
258
|
+
hasRibNomenclatureConstraint: boolean;
|
|
259
|
+
ribAccountNumberFormatStr: string;
|
|
260
|
+
bankAccounts: LokotroBankAccount[];
|
|
261
|
+
entityAvailables: LokotroBankEntity[];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Lokotro Pay - Core Models and Interfaces
|
|
266
|
+
* Angular version of the Flutter Lokotro Pay plugin
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Configuration for Lokotro Pay
|
|
271
|
+
*/
|
|
272
|
+
interface LokotroPayConfig {
|
|
273
|
+
/** API authentication token (app-key) */
|
|
274
|
+
token: string;
|
|
275
|
+
/** Whether to use production environment */
|
|
276
|
+
isProduction?: boolean;
|
|
277
|
+
/** Custom API URL (optional) */
|
|
278
|
+
customApiUrl?: string;
|
|
279
|
+
/** Request timeout in milliseconds */
|
|
280
|
+
timeout?: number;
|
|
281
|
+
/** Accept-Language header for API requests */
|
|
282
|
+
acceptLanguage?: string;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Payment body for Lokotro Pay - All-in-one request
|
|
286
|
+
*/
|
|
287
|
+
interface LokotroPaymentBody {
|
|
288
|
+
customerReference: string;
|
|
289
|
+
amount: string;
|
|
290
|
+
currency: string;
|
|
291
|
+
paymentMethod?: string;
|
|
292
|
+
userInfo?: 'full' | 'partial' | 'none';
|
|
293
|
+
paymentMethodInfo?: 'full' | 'partial' | 'none';
|
|
294
|
+
feeCoveredBy?: 'buyer' | 'seller';
|
|
295
|
+
deliveryBehaviour?: 'direct_delivery' | 'escrow';
|
|
296
|
+
notifyUrl?: string;
|
|
297
|
+
successRedirectUrl?: string;
|
|
298
|
+
failRedirectUrl?: string;
|
|
299
|
+
firstName?: string;
|
|
300
|
+
lastName?: string;
|
|
301
|
+
phoneNumber?: string;
|
|
302
|
+
email?: string;
|
|
303
|
+
walletNumber?: string;
|
|
304
|
+
walletPin?: string;
|
|
305
|
+
mobileMoneyPhoneNumber?: string;
|
|
306
|
+
flashNumber?: string;
|
|
307
|
+
flashPin?: string;
|
|
308
|
+
cardNumber?: string;
|
|
309
|
+
cardExpiryDate?: string;
|
|
310
|
+
cardCvv?: string;
|
|
311
|
+
cardHolderName?: string;
|
|
312
|
+
merchant?: LokotroMerchantInfo;
|
|
313
|
+
mastercardPaymentMethod?: 'HOSTED_SESSION' | 'DIRECT_CAPTURE';
|
|
314
|
+
metadata?: Record<string, unknown>;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Merchant information
|
|
318
|
+
*/
|
|
319
|
+
interface LokotroMerchantInfo {
|
|
320
|
+
id: string;
|
|
321
|
+
name: string;
|
|
322
|
+
logoUrl?: string;
|
|
323
|
+
website?: string;
|
|
324
|
+
description?: string;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Main payment response model
|
|
328
|
+
*/
|
|
329
|
+
interface LokotroPayResponse {
|
|
330
|
+
message: string;
|
|
331
|
+
title: string;
|
|
332
|
+
customRef: string;
|
|
333
|
+
amount: number;
|
|
334
|
+
apiResponseCode: LokotroPayApiResponseCode;
|
|
335
|
+
currency: string;
|
|
336
|
+
paymentStatus: LokotroPaymentStatus;
|
|
337
|
+
systemRef: string;
|
|
338
|
+
transactionId?: string;
|
|
339
|
+
identifier?: string;
|
|
340
|
+
successRedirectUrl?: string;
|
|
341
|
+
failRedirectUrl?: string;
|
|
342
|
+
timestamp?: Date;
|
|
343
|
+
metadata?: Record<string, unknown>;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Error response model
|
|
347
|
+
*/
|
|
348
|
+
interface LokotroPayError {
|
|
349
|
+
message: string;
|
|
350
|
+
title: string;
|
|
351
|
+
errorCode?: LokotroPayApiResponseCode;
|
|
352
|
+
details?: string;
|
|
353
|
+
successRedirectUrl?: string;
|
|
354
|
+
failRedirectUrl?: string;
|
|
355
|
+
timestamp: Date;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Payment information model
|
|
359
|
+
*/
|
|
360
|
+
interface LokotroPaymentInfo {
|
|
361
|
+
id: string;
|
|
362
|
+
amount: number;
|
|
363
|
+
currency: string;
|
|
364
|
+
description: string;
|
|
365
|
+
merchantName: string;
|
|
366
|
+
merchantId: string;
|
|
367
|
+
availablePaymentMethods: LokotroPaymentMethod[];
|
|
368
|
+
createdAt: Date;
|
|
369
|
+
expiresAt?: Date;
|
|
370
|
+
metadata?: Record<string, unknown>;
|
|
371
|
+
paymentUrl?: string;
|
|
372
|
+
showUserInfoForm: boolean;
|
|
373
|
+
showPaymentMethodForm: boolean;
|
|
374
|
+
fillingInfo?: string;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Payment method model
|
|
378
|
+
*/
|
|
379
|
+
interface LokotroPaymentMethod {
|
|
380
|
+
id: string;
|
|
381
|
+
name: string;
|
|
382
|
+
displayName: string;
|
|
383
|
+
channel: LokotroPayChannel;
|
|
384
|
+
iconUrl: string;
|
|
385
|
+
isEnabled: boolean;
|
|
386
|
+
configuration?: Record<string, unknown>;
|
|
387
|
+
supportedCurrencies?: string[];
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Payment method list item for UI display
|
|
391
|
+
*/
|
|
392
|
+
interface LokotroPaymentMethodListItem {
|
|
393
|
+
id: string;
|
|
394
|
+
name: string;
|
|
395
|
+
displayName: string;
|
|
396
|
+
channel: LokotroPayChannel;
|
|
397
|
+
iconUrl: string;
|
|
398
|
+
isEnabled: boolean;
|
|
399
|
+
isSelected: boolean;
|
|
400
|
+
configuration?: Record<string, unknown>;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Payment form data model
|
|
404
|
+
*/
|
|
405
|
+
interface LokotroPaymentFormData {
|
|
406
|
+
paymentMethodId: string;
|
|
407
|
+
channel: LokotroPayChannel;
|
|
408
|
+
formData: Record<string, unknown>;
|
|
409
|
+
timestamp: Date;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Response callback for successful payments
|
|
413
|
+
*/
|
|
414
|
+
interface LokotroPayOnResponse {
|
|
415
|
+
message: string;
|
|
416
|
+
title: string;
|
|
417
|
+
customRef: string;
|
|
418
|
+
customerReference?: string;
|
|
419
|
+
amount: number;
|
|
420
|
+
apiResponseCode: LokotroPayApiResponseCode;
|
|
421
|
+
currency: string;
|
|
422
|
+
paymentStatus: LokotroPaymentStatus;
|
|
423
|
+
systemRef: string;
|
|
424
|
+
transactionId?: string;
|
|
425
|
+
identifier?: string;
|
|
426
|
+
successRedirectUrl?: string;
|
|
427
|
+
failRedirectUrl?: string;
|
|
428
|
+
timestamp: Date;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Error callback for failed payments
|
|
432
|
+
*/
|
|
433
|
+
interface LokotroPayOnError {
|
|
434
|
+
message: string;
|
|
435
|
+
title: string;
|
|
436
|
+
errorCode?: LokotroPayApiResponseCode;
|
|
437
|
+
identifier?: string;
|
|
438
|
+
customerReference?: string;
|
|
439
|
+
systemReference?: string;
|
|
440
|
+
amount?: number;
|
|
441
|
+
currency?: string;
|
|
442
|
+
successRedirectUrl?: string;
|
|
443
|
+
failRedirectUrl?: string;
|
|
444
|
+
timestamp: Date;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* HTTP Response wrapper
|
|
448
|
+
*/
|
|
449
|
+
interface LokotroHttpResponse<T> {
|
|
450
|
+
data?: T;
|
|
451
|
+
message: string;
|
|
452
|
+
statusCode: number;
|
|
453
|
+
isSuccess: boolean;
|
|
454
|
+
apiResponseCode?: LokotroPayApiResponseCode;
|
|
455
|
+
timestamp: Date;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Transaction details model
|
|
459
|
+
*/
|
|
460
|
+
interface LokotroTransactionDetails {
|
|
461
|
+
transactionId: string;
|
|
462
|
+
amount: number;
|
|
463
|
+
currency: string;
|
|
464
|
+
status: LokotroPaymentStatus;
|
|
465
|
+
paymentMethod: string;
|
|
466
|
+
customerReference: string;
|
|
467
|
+
systemReference: string;
|
|
468
|
+
createdAt: Date;
|
|
469
|
+
updatedAt?: Date;
|
|
470
|
+
metadata?: Record<string, unknown>;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Payment submit request
|
|
474
|
+
*/
|
|
475
|
+
interface LokotroPaymentSubmitRequest {
|
|
476
|
+
transactionId: string;
|
|
477
|
+
paymentMethod: string;
|
|
478
|
+
walletNumber?: string;
|
|
479
|
+
walletPin?: string;
|
|
480
|
+
mobileMoneyPhoneNumber?: string;
|
|
481
|
+
flashNumber?: string;
|
|
482
|
+
flashPin?: string;
|
|
483
|
+
cardNumber?: string;
|
|
484
|
+
cardExpiryDate?: string;
|
|
485
|
+
cardCvv?: string;
|
|
486
|
+
cardHolderName?: string;
|
|
487
|
+
bankTransferAccountId?: string;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Payment submit response
|
|
491
|
+
*/
|
|
492
|
+
interface LokotroPaymentSubmitResponse {
|
|
493
|
+
success: boolean;
|
|
494
|
+
message: string;
|
|
495
|
+
transactionId: string;
|
|
496
|
+
status: LokotroPaymentStatus;
|
|
497
|
+
requiresOtp: boolean;
|
|
498
|
+
otpDestination?: string;
|
|
499
|
+
redirectUrl?: string;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* OTP verification request
|
|
503
|
+
*/
|
|
504
|
+
interface LokotroOtpVerifyRequest {
|
|
505
|
+
transactionId: string;
|
|
506
|
+
otp: string;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* OTP verification response
|
|
510
|
+
*/
|
|
511
|
+
interface LokotroOtpVerifyResponse {
|
|
512
|
+
success: boolean;
|
|
513
|
+
message: string;
|
|
514
|
+
transactionId: string;
|
|
515
|
+
status: LokotroPaymentStatus;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* OTP resend request
|
|
519
|
+
*/
|
|
520
|
+
interface LokotroOtpResendRequest {
|
|
521
|
+
transactionId: string;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Theme configuration
|
|
525
|
+
*/
|
|
526
|
+
interface LokotroPayThemeConfig {
|
|
527
|
+
primaryColor?: string;
|
|
528
|
+
secondaryColor?: string;
|
|
529
|
+
accentColor?: string;
|
|
530
|
+
backgroundColor?: string;
|
|
531
|
+
textColor?: string;
|
|
532
|
+
errorColor?: string;
|
|
533
|
+
successColor?: string;
|
|
534
|
+
warningColor?: string;
|
|
535
|
+
borderRadius?: string;
|
|
536
|
+
fontFamily?: string;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Checkout component input configuration
|
|
540
|
+
*/
|
|
541
|
+
interface LokotroCheckoutConfig {
|
|
542
|
+
title?: string;
|
|
543
|
+
titleStyle?: Record<string, string>;
|
|
544
|
+
titleBackgroundColor?: string;
|
|
545
|
+
configs: LokotroPayConfig;
|
|
546
|
+
paymentBody: LokotroPaymentBody;
|
|
547
|
+
enableHapticFeedback?: boolean;
|
|
548
|
+
backgroundColor?: string;
|
|
549
|
+
padding?: string;
|
|
550
|
+
themeConfig?: LokotroPayThemeConfig;
|
|
551
|
+
language?: string;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* HTTP Client configuration
|
|
556
|
+
*/
|
|
557
|
+
interface LokotroHttpClientConfig {
|
|
558
|
+
appKey?: string;
|
|
559
|
+
acceptLanguage?: string;
|
|
560
|
+
customHeaders?: Record<string, string>;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Enhanced HTTP client for Lokotro Pay with modern error handling and logging
|
|
564
|
+
*/
|
|
565
|
+
declare class LokotroHttpClientService {
|
|
566
|
+
private http;
|
|
567
|
+
private appKey?;
|
|
568
|
+
private acceptLanguage;
|
|
569
|
+
private customHeaders;
|
|
570
|
+
constructor(http: HttpClient);
|
|
571
|
+
/**
|
|
572
|
+
* Configure the HTTP client
|
|
573
|
+
*/
|
|
574
|
+
configure(config: LokotroHttpClientConfig): void;
|
|
575
|
+
/**
|
|
576
|
+
* Set app-key for Lokotro Gateway authentication
|
|
577
|
+
*/
|
|
578
|
+
setAppKey(appKey: string): void;
|
|
579
|
+
/**
|
|
580
|
+
* Remove app-key
|
|
581
|
+
*/
|
|
582
|
+
clearAppKey(): void;
|
|
583
|
+
/**
|
|
584
|
+
* Set accept-language header
|
|
585
|
+
*/
|
|
586
|
+
setAcceptLanguage(language: string): void;
|
|
587
|
+
/**
|
|
588
|
+
* Clear accept-language header
|
|
589
|
+
*/
|
|
590
|
+
clearAcceptLanguage(): void;
|
|
591
|
+
/**
|
|
592
|
+
* Build request headers
|
|
593
|
+
*/
|
|
594
|
+
private buildHeaders;
|
|
595
|
+
/**
|
|
596
|
+
* Build full URL
|
|
597
|
+
*/
|
|
598
|
+
private buildUrl;
|
|
599
|
+
/**
|
|
600
|
+
* GET request with enhanced error handling
|
|
601
|
+
*/
|
|
602
|
+
get<T>(path: string, queryParams?: Record<string, string>): Observable<LokotroHttpResponse<T>>;
|
|
603
|
+
/**
|
|
604
|
+
* POST request with enhanced error handling
|
|
605
|
+
*/
|
|
606
|
+
post<T>(path: string, data?: unknown, queryParams?: Record<string, string>): Observable<LokotroHttpResponse<T>>;
|
|
607
|
+
/**
|
|
608
|
+
* PUT request with enhanced error handling
|
|
609
|
+
*/
|
|
610
|
+
put<T>(path: string, data?: unknown, queryParams?: Record<string, string>): Observable<LokotroHttpResponse<T>>;
|
|
611
|
+
/**
|
|
612
|
+
* DELETE request with enhanced error handling
|
|
613
|
+
*/
|
|
614
|
+
delete<T>(path: string, queryParams?: Record<string, string>): Observable<LokotroHttpResponse<T>>;
|
|
615
|
+
/**
|
|
616
|
+
* Handle successful response
|
|
617
|
+
*/
|
|
618
|
+
private handleSuccess;
|
|
619
|
+
/**
|
|
620
|
+
* Handle error response
|
|
621
|
+
*/
|
|
622
|
+
private handleError;
|
|
623
|
+
/**
|
|
624
|
+
* Map HTTP status code to API response code
|
|
625
|
+
*/
|
|
626
|
+
private getApiResponseCodeFromStatus;
|
|
627
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroHttpClientService, never>;
|
|
628
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LokotroHttpClientService>;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Payment state for reactive updates
|
|
633
|
+
*/
|
|
634
|
+
interface LokotroPaymentState {
|
|
635
|
+
isLoading: boolean;
|
|
636
|
+
currentScreen: LokotroPayScreenNavigation;
|
|
637
|
+
transactionId?: string;
|
|
638
|
+
paymentInfo?: LokotroPaymentInfo;
|
|
639
|
+
selectedPaymentMethod?: LokotroPaymentMethod;
|
|
640
|
+
error?: LokotroPayError;
|
|
641
|
+
response?: LokotroPayResponse;
|
|
642
|
+
}
|
|
643
|
+
declare class LokotroPaymentService {
|
|
644
|
+
private httpClient;
|
|
645
|
+
private stateSubject;
|
|
646
|
+
state$: Observable<LokotroPaymentState>;
|
|
647
|
+
constructor(httpClient: LokotroHttpClientService);
|
|
648
|
+
/**
|
|
649
|
+
* Get current state
|
|
650
|
+
*/
|
|
651
|
+
get currentState(): LokotroPaymentState;
|
|
652
|
+
/**
|
|
653
|
+
* Update state
|
|
654
|
+
*/
|
|
655
|
+
private updateState;
|
|
656
|
+
/**
|
|
657
|
+
* Reset state to initial
|
|
658
|
+
*/
|
|
659
|
+
resetState(): void;
|
|
660
|
+
/**
|
|
661
|
+
* Set app-key for authentication
|
|
662
|
+
*/
|
|
663
|
+
setAppKey(appKey: string): void;
|
|
664
|
+
/**
|
|
665
|
+
* Set accept language
|
|
666
|
+
*/
|
|
667
|
+
setAcceptLanguage(language: string): void;
|
|
668
|
+
/**
|
|
669
|
+
* Step 1: Create payment transaction
|
|
670
|
+
* POST /payments/collect
|
|
671
|
+
*/
|
|
672
|
+
createPayment(paymentBody: LokotroPaymentBody): Observable<LokotroHttpResponse<CreatePaymentResponse>>;
|
|
673
|
+
/**
|
|
674
|
+
* Step 2: Get transaction details
|
|
675
|
+
* GET /payments/transaction/{transaction_id}
|
|
676
|
+
*/
|
|
677
|
+
getTransactionDetails(transactionId: string): Observable<LokotroHttpResponse<TransactionDetailsResponse>>;
|
|
678
|
+
/**
|
|
679
|
+
* Step 3: Submit payment details
|
|
680
|
+
* POST /payments/submit
|
|
681
|
+
*/
|
|
682
|
+
submitPaymentDetails(request: LokotroPaymentSubmitRequest): Observable<LokotroHttpResponse<PaymentSubmitResponse>>;
|
|
683
|
+
/**
|
|
684
|
+
* Step 4: Verify OTP (for e-wallet and flash payments)
|
|
685
|
+
* POST /payments/verify-otp
|
|
686
|
+
*/
|
|
687
|
+
verifyOtp(request: LokotroOtpVerifyRequest): Observable<LokotroHttpResponse<OtpVerifyResponse>>;
|
|
688
|
+
/**
|
|
689
|
+
* Step 5: Resend OTP (if needed)
|
|
690
|
+
* POST /payments/resend-otp
|
|
691
|
+
*/
|
|
692
|
+
resendOtp(request: LokotroOtpResendRequest): Observable<LokotroHttpResponse<OtpResendResponse>>;
|
|
693
|
+
/**
|
|
694
|
+
* Fetch available banks configuration
|
|
695
|
+
* GET /payments/get-config-bank
|
|
696
|
+
*/
|
|
697
|
+
fetchAvailableBanks(): Observable<LokotroHttpResponse<LokotroBank[]>>;
|
|
698
|
+
/**
|
|
699
|
+
* Select payment method
|
|
700
|
+
*/
|
|
701
|
+
selectPaymentMethod(method: LokotroPaymentMethod): void;
|
|
702
|
+
/**
|
|
703
|
+
* Navigate to screen
|
|
704
|
+
*/
|
|
705
|
+
navigateToScreen(screen: LokotroPayScreenNavigation): void;
|
|
706
|
+
/**
|
|
707
|
+
* Handle payment success
|
|
708
|
+
*/
|
|
709
|
+
private handlePaymentSuccess;
|
|
710
|
+
/**
|
|
711
|
+
* Handle payment failure
|
|
712
|
+
*/
|
|
713
|
+
private handlePaymentFailure;
|
|
714
|
+
/**
|
|
715
|
+
* Get form screen for payment channel
|
|
716
|
+
*/
|
|
717
|
+
private getFormScreenForChannel;
|
|
718
|
+
/**
|
|
719
|
+
* Convert payment body to API request format
|
|
720
|
+
*/
|
|
721
|
+
private convertPaymentBodyToRequest;
|
|
722
|
+
/**
|
|
723
|
+
* Convert submit request to API format
|
|
724
|
+
*/
|
|
725
|
+
private convertSubmitRequestToData;
|
|
726
|
+
/**
|
|
727
|
+
* Parse payment info from API response
|
|
728
|
+
*/
|
|
729
|
+
private parsePaymentInfo;
|
|
730
|
+
/**
|
|
731
|
+
* Parse payment method from API response
|
|
732
|
+
*/
|
|
733
|
+
private parsePaymentMethod;
|
|
734
|
+
/**
|
|
735
|
+
* Parse submit response from API
|
|
736
|
+
*/
|
|
737
|
+
private parseSubmitResponse;
|
|
738
|
+
/**
|
|
739
|
+
* Parse bank from API response
|
|
740
|
+
*/
|
|
741
|
+
private parseBank;
|
|
742
|
+
/**
|
|
743
|
+
* Parse bank account
|
|
744
|
+
*/
|
|
745
|
+
private parseBankAccount;
|
|
746
|
+
/**
|
|
747
|
+
* Parse bank entity
|
|
748
|
+
*/
|
|
749
|
+
private parseBankEntity;
|
|
750
|
+
/**
|
|
751
|
+
* Parse bank currency
|
|
752
|
+
*/
|
|
753
|
+
private parseBankCurrency;
|
|
754
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroPaymentService, never>;
|
|
755
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LokotroPaymentService>;
|
|
756
|
+
}
|
|
757
|
+
interface CreatePaymentResponse {
|
|
758
|
+
transaction_id?: string;
|
|
759
|
+
amount?: string;
|
|
760
|
+
currency?: string;
|
|
761
|
+
description?: string;
|
|
762
|
+
merchant_name?: string;
|
|
763
|
+
merchant_id?: string;
|
|
764
|
+
available_payment_methods?: Record<string, unknown>[];
|
|
765
|
+
created_at?: string;
|
|
766
|
+
expires_at?: string;
|
|
767
|
+
metadata?: Record<string, unknown>;
|
|
768
|
+
payment_url?: string;
|
|
769
|
+
show_user_info_form?: boolean;
|
|
770
|
+
show_payment_method_form?: boolean;
|
|
771
|
+
filling_info?: string;
|
|
772
|
+
}
|
|
773
|
+
interface TransactionDetailsResponse {
|
|
774
|
+
identifier?: string;
|
|
775
|
+
transaction_id?: string;
|
|
776
|
+
amount?: number | string;
|
|
777
|
+
currency_str?: string;
|
|
778
|
+
currency?: string;
|
|
779
|
+
status?: string;
|
|
780
|
+
payment_method?: string;
|
|
781
|
+
customer_reference?: string;
|
|
782
|
+
system_reference?: string;
|
|
783
|
+
created_at?: string;
|
|
784
|
+
updated_at?: string;
|
|
785
|
+
metadata?: Record<string, unknown>;
|
|
786
|
+
}
|
|
787
|
+
interface PaymentSubmitResponse {
|
|
788
|
+
success?: boolean;
|
|
789
|
+
message?: string;
|
|
790
|
+
transaction_id?: string;
|
|
791
|
+
status?: string;
|
|
792
|
+
requires_otp?: boolean;
|
|
793
|
+
otp_destination?: string;
|
|
794
|
+
redirect_url?: string;
|
|
795
|
+
[key: string]: unknown;
|
|
796
|
+
}
|
|
797
|
+
interface OtpVerifyResponse {
|
|
798
|
+
success?: boolean;
|
|
799
|
+
message?: string;
|
|
800
|
+
transaction_id?: string;
|
|
801
|
+
status?: string;
|
|
802
|
+
[key: string]: unknown;
|
|
803
|
+
}
|
|
804
|
+
interface OtpResendResponse {
|
|
805
|
+
success?: boolean;
|
|
806
|
+
message?: string;
|
|
807
|
+
otp_destination?: string;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Translation keys interface
|
|
812
|
+
*/
|
|
813
|
+
interface LokotroTranslations {
|
|
814
|
+
loading: string;
|
|
815
|
+
error: string;
|
|
816
|
+
success: string;
|
|
817
|
+
cancel: string;
|
|
818
|
+
confirm: string;
|
|
819
|
+
continue: string;
|
|
820
|
+
back: string;
|
|
821
|
+
close: string;
|
|
822
|
+
retry: string;
|
|
823
|
+
done: string;
|
|
824
|
+
selectPaymentMethod: string;
|
|
825
|
+
paymentDetails: string;
|
|
826
|
+
confirmPayment: string;
|
|
827
|
+
processing: string;
|
|
828
|
+
paymentSuccessful: string;
|
|
829
|
+
paymentFailed: string;
|
|
830
|
+
card: string;
|
|
831
|
+
mobileMoneyPayment: string;
|
|
832
|
+
eWallet: string;
|
|
833
|
+
lokotroWallet: string;
|
|
834
|
+
bankTransfer: string;
|
|
835
|
+
eFlash: string;
|
|
836
|
+
virtualCard: string;
|
|
837
|
+
cardNumber: string;
|
|
838
|
+
cardHolderName: string;
|
|
839
|
+
expiryDate: string;
|
|
840
|
+
cvv: string;
|
|
841
|
+
phoneNumber: string;
|
|
842
|
+
walletNumber: string;
|
|
843
|
+
pin: string;
|
|
844
|
+
email: string;
|
|
845
|
+
firstName: string;
|
|
846
|
+
lastName: string;
|
|
847
|
+
required: string;
|
|
848
|
+
invalidCardNumber: string;
|
|
849
|
+
invalidExpiryDate: string;
|
|
850
|
+
invalidCvv: string;
|
|
851
|
+
invalidPhoneNumber: string;
|
|
852
|
+
invalidEmail: string;
|
|
853
|
+
enterOtp: string;
|
|
854
|
+
otpSentTo: string;
|
|
855
|
+
resendOtp: string;
|
|
856
|
+
verifyOtp: string;
|
|
857
|
+
otpVerificationFailed: string;
|
|
858
|
+
paymentPending: string;
|
|
859
|
+
paymentProcessing: string;
|
|
860
|
+
paymentApproved: string;
|
|
861
|
+
paymentDeclined: string;
|
|
862
|
+
paymentCancelled: string;
|
|
863
|
+
paymentExpired: string;
|
|
864
|
+
paymentStatus: string;
|
|
865
|
+
checkingPaymentStatus: string;
|
|
866
|
+
paymentPendingMessage: string;
|
|
867
|
+
paymentSuccessMessage: string;
|
|
868
|
+
paymentFailedMessage: string;
|
|
869
|
+
paymentCancelledMessage: string;
|
|
870
|
+
paymentExpiredMessage: string;
|
|
871
|
+
checkingForUpdates: string;
|
|
872
|
+
paymentId: string;
|
|
873
|
+
networkError: string;
|
|
874
|
+
timeoutError: string;
|
|
875
|
+
serverError: string;
|
|
876
|
+
paymentNotFound: string;
|
|
877
|
+
authenticationError: string;
|
|
878
|
+
invalidRequest: string;
|
|
879
|
+
amount: string;
|
|
880
|
+
fee: string;
|
|
881
|
+
total: string;
|
|
882
|
+
currency: string;
|
|
883
|
+
selectCountry: string;
|
|
884
|
+
invalidPhonePrefix: string;
|
|
885
|
+
phoneTooShort: string;
|
|
886
|
+
phoneTooLong: string;
|
|
887
|
+
validPrefixes: string;
|
|
888
|
+
more: string;
|
|
889
|
+
personalInfo: string;
|
|
890
|
+
personalPhone: string;
|
|
891
|
+
mobileMoneyPhone: string;
|
|
892
|
+
mobileMoneyDetails: string;
|
|
893
|
+
bankDetails: string;
|
|
894
|
+
selectCity: string;
|
|
895
|
+
selectBank: string;
|
|
896
|
+
selectBankAccount: string;
|
|
897
|
+
bankAccountSummary: string;
|
|
898
|
+
accountLabel: string;
|
|
899
|
+
bankTransferProofInstructions: string;
|
|
900
|
+
confirmBankTransfer: string;
|
|
901
|
+
}
|
|
902
|
+
declare class LokotroLocalizationService {
|
|
903
|
+
private currentLanguageSubject;
|
|
904
|
+
private translationsSubject;
|
|
905
|
+
/**
|
|
906
|
+
* Current language observable
|
|
907
|
+
*/
|
|
908
|
+
currentLanguage$: Observable<LokotroPayLanguage>;
|
|
909
|
+
/**
|
|
910
|
+
* Current translations observable
|
|
911
|
+
*/
|
|
912
|
+
translations$: Observable<LokotroTranslations>;
|
|
913
|
+
/**
|
|
914
|
+
* Get current language
|
|
915
|
+
*/
|
|
916
|
+
get currentLanguage(): LokotroPayLanguage;
|
|
917
|
+
/**
|
|
918
|
+
* Get current translations
|
|
919
|
+
*/
|
|
920
|
+
get translations(): LokotroTranslations;
|
|
921
|
+
/**
|
|
922
|
+
* Set language
|
|
923
|
+
*/
|
|
924
|
+
setLanguage(language: LokotroPayLanguage): void;
|
|
925
|
+
/**
|
|
926
|
+
* Set language by code
|
|
927
|
+
*/
|
|
928
|
+
setLanguageByCode(code: string): void;
|
|
929
|
+
/**
|
|
930
|
+
* Get translation by key
|
|
931
|
+
*/
|
|
932
|
+
translate(key: keyof LokotroTranslations): string;
|
|
933
|
+
/**
|
|
934
|
+
* Get all supported languages
|
|
935
|
+
*/
|
|
936
|
+
getSupportedLanguages(): Array<{
|
|
937
|
+
code: LokotroPayLanguage;
|
|
938
|
+
name: string;
|
|
939
|
+
nativeName: string;
|
|
940
|
+
}>;
|
|
941
|
+
/**
|
|
942
|
+
* Detect browser language and set if supported
|
|
943
|
+
*/
|
|
944
|
+
detectAndSetLanguage(): void;
|
|
945
|
+
/**
|
|
946
|
+
* Add custom translations
|
|
947
|
+
*/
|
|
948
|
+
addTranslations(language: LokotroPayLanguage, translations: Partial<LokotroTranslations>): void;
|
|
949
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroLocalizationService, never>;
|
|
950
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LokotroLocalizationService>;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* Lokotro Pay - Checkout Component
|
|
955
|
+
* Main checkout widget with clean, theme-based design
|
|
956
|
+
*/
|
|
957
|
+
|
|
958
|
+
declare class LokotroPayCheckoutComponent implements OnInit, OnDestroy {
|
|
959
|
+
private paymentService;
|
|
960
|
+
localization: LokotroLocalizationService;
|
|
961
|
+
title?: string;
|
|
962
|
+
titleStyle?: Record<string, string>;
|
|
963
|
+
titleBackgroundColor?: string;
|
|
964
|
+
configs: LokotroPayConfig;
|
|
965
|
+
paymentBody: LokotroPaymentBody;
|
|
966
|
+
enableHapticFeedback: boolean;
|
|
967
|
+
backgroundColor?: string;
|
|
968
|
+
padding?: string;
|
|
969
|
+
themeConfig?: LokotroPayThemeConfig;
|
|
970
|
+
language?: string;
|
|
971
|
+
response: EventEmitter<LokotroPayOnResponse>;
|
|
972
|
+
error: EventEmitter<LokotroPayOnError>;
|
|
973
|
+
closed: EventEmitter<void>;
|
|
974
|
+
state?: LokotroPaymentState;
|
|
975
|
+
isDarkTheme: boolean;
|
|
976
|
+
private stateSubscription?;
|
|
977
|
+
constructor(paymentService: LokotroPaymentService, localization: LokotroLocalizationService);
|
|
978
|
+
ngOnInit(): void;
|
|
979
|
+
ngOnDestroy(): void;
|
|
980
|
+
private initializeEnvironment;
|
|
981
|
+
private initializeLocalization;
|
|
982
|
+
private subscribeToState;
|
|
983
|
+
private initializePayment;
|
|
984
|
+
get currentScreen(): string;
|
|
985
|
+
get isPaymentFormScreen(): boolean;
|
|
986
|
+
get isProcessingScreen(): boolean;
|
|
987
|
+
get canGoBack(): boolean;
|
|
988
|
+
get containerStyle(): string;
|
|
989
|
+
get titleStyleString(): string;
|
|
990
|
+
private camelToKebab;
|
|
991
|
+
onPaymentMethodSelected(method: any): void;
|
|
992
|
+
onFormSubmitted(formData: any): void;
|
|
993
|
+
onOtpVerified(otp: string): void;
|
|
994
|
+
onResendOtp(): void;
|
|
995
|
+
onBack(): void;
|
|
996
|
+
onCancel(): void;
|
|
997
|
+
onClose(): void;
|
|
998
|
+
onRetry(): void;
|
|
999
|
+
onDone(): void;
|
|
1000
|
+
onContinue(): void;
|
|
1001
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroPayCheckoutComponent, never>;
|
|
1002
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroPayCheckoutComponent, "lokotro-pay-checkout", never, { "title": { "alias": "title"; "required": false; }; "titleStyle": { "alias": "titleStyle"; "required": false; }; "titleBackgroundColor": { "alias": "titleBackgroundColor"; "required": false; }; "configs": { "alias": "configs"; "required": false; }; "paymentBody": { "alias": "paymentBody"; "required": false; }; "enableHapticFeedback": { "alias": "enableHapticFeedback"; "required": false; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; }; "padding": { "alias": "padding"; "required": false; }; "themeConfig": { "alias": "themeConfig"; "required": false; }; "language": { "alias": "language"; "required": false; }; }, { "response": "response"; "error": "error"; "closed": "closed"; }, never, never, true, never>;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Lokotro Pay - Payment Method Selection Component
|
|
1007
|
+
*/
|
|
1008
|
+
|
|
1009
|
+
declare class LokotroPaymentMethodSelectionComponent {
|
|
1010
|
+
localization: LokotroLocalizationService;
|
|
1011
|
+
paymentMethods: LokotroPaymentMethod[];
|
|
1012
|
+
selectedMethod?: LokotroPaymentMethod;
|
|
1013
|
+
methodSelected: EventEmitter<LokotroPaymentMethod>;
|
|
1014
|
+
constructor(localization: LokotroLocalizationService);
|
|
1015
|
+
selectMethod(method: LokotroPaymentMethod): void;
|
|
1016
|
+
onContinue(): void;
|
|
1017
|
+
getMethodIcon(channel: LokotroPayChannel): string;
|
|
1018
|
+
getMethodDescription(channel: LokotroPayChannel): string;
|
|
1019
|
+
onImageError(event: Event, channel: LokotroPayChannel): void;
|
|
1020
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroPaymentMethodSelectionComponent, never>;
|
|
1021
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroPaymentMethodSelectionComponent, "lokotro-payment-method-selection", never, { "paymentMethods": { "alias": "paymentMethods"; "required": false; }; "selectedMethod": { "alias": "selectedMethod"; "required": false; }; }, { "methodSelected": "methodSelected"; }, never, never, true, never>;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Lokotro Pay - Payment Form Component
|
|
1026
|
+
* Handles different payment form types based on channel
|
|
1027
|
+
*/
|
|
1028
|
+
|
|
1029
|
+
declare class LokotroPaymentFormComponent implements OnInit {
|
|
1030
|
+
private fb;
|
|
1031
|
+
localization: LokotroLocalizationService;
|
|
1032
|
+
channel?: LokotroPayChannel;
|
|
1033
|
+
transactionId?: string;
|
|
1034
|
+
showUserInfoForm: boolean;
|
|
1035
|
+
formSubmitted: EventEmitter<Record<string, unknown>>;
|
|
1036
|
+
cancel: EventEmitter<void>;
|
|
1037
|
+
ewalletForm: FormGroup;
|
|
1038
|
+
mobileMoneyForm: FormGroup;
|
|
1039
|
+
cardForm: FormGroup;
|
|
1040
|
+
flashForm: FormGroup;
|
|
1041
|
+
selectedMobileMoneyCountry?: LokotroCountry;
|
|
1042
|
+
fullMobileMoneyPhoneNumber: string;
|
|
1043
|
+
constructor(fb: FormBuilder, localization: LokotroLocalizationService);
|
|
1044
|
+
ngOnInit(): void;
|
|
1045
|
+
private initializeForms;
|
|
1046
|
+
get isEWalletForm(): boolean;
|
|
1047
|
+
get isMobileMoneyForm(): boolean;
|
|
1048
|
+
get isCardForm(): boolean;
|
|
1049
|
+
get isFlashForm(): boolean;
|
|
1050
|
+
formatCardNumber(event: Event): void;
|
|
1051
|
+
formatExpiryDate(event: Event): void;
|
|
1052
|
+
submitEWalletForm(): void;
|
|
1053
|
+
submitMobileMoneyForm(): void;
|
|
1054
|
+
onCountryChanged(country: LokotroCountry): void;
|
|
1055
|
+
onPhoneChanged(event: {
|
|
1056
|
+
phoneNumber: string;
|
|
1057
|
+
fullNumber: string;
|
|
1058
|
+
country: LokotroCountry | null;
|
|
1059
|
+
}): void;
|
|
1060
|
+
submitCardForm(): void;
|
|
1061
|
+
submitFlashForm(): void;
|
|
1062
|
+
onCancel(): void;
|
|
1063
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroPaymentFormComponent, never>;
|
|
1064
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroPaymentFormComponent, "lokotro-payment-form", never, { "channel": { "alias": "channel"; "required": false; }; "transactionId": { "alias": "transactionId"; "required": false; }; "showUserInfoForm": { "alias": "showUserInfoForm"; "required": false; }; }, { "formSubmitted": "formSubmitted"; "cancel": "cancel"; }, never, never, true, never>;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Lokotro Pay - OTP Verification Component
|
|
1069
|
+
*/
|
|
1070
|
+
|
|
1071
|
+
declare class LokotroOtpVerificationComponent implements OnInit, OnDestroy {
|
|
1072
|
+
localization: LokotroLocalizationService;
|
|
1073
|
+
transactionId?: string;
|
|
1074
|
+
otpDestination?: string;
|
|
1075
|
+
otpLength: number;
|
|
1076
|
+
otpVerified: EventEmitter<string>;
|
|
1077
|
+
resendOtp: EventEmitter<void>;
|
|
1078
|
+
cancel: EventEmitter<void>;
|
|
1079
|
+
otpDigits: string[];
|
|
1080
|
+
resendTimer: number;
|
|
1081
|
+
private timerInterval?;
|
|
1082
|
+
constructor(localization: LokotroLocalizationService);
|
|
1083
|
+
ngOnInit(): void;
|
|
1084
|
+
ngOnDestroy(): void;
|
|
1085
|
+
get isOtpComplete(): boolean;
|
|
1086
|
+
get otpValue(): string;
|
|
1087
|
+
private startResendTimer;
|
|
1088
|
+
onOtpInput(event: Event, index: number): void;
|
|
1089
|
+
onOtpKeydown(event: KeyboardEvent, index: number): void;
|
|
1090
|
+
onOtpPaste(event: ClipboardEvent): void;
|
|
1091
|
+
onVerify(): void;
|
|
1092
|
+
onResend(): void;
|
|
1093
|
+
onCancelClick(): void;
|
|
1094
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroOtpVerificationComponent, never>;
|
|
1095
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroOtpVerificationComponent, "lokotro-otp-verification", never, { "transactionId": { "alias": "transactionId"; "required": false; }; "otpDestination": { "alias": "otpDestination"; "required": false; }; "otpLength": { "alias": "otpLength"; "required": false; }; }, { "otpVerified": "otpVerified"; "resendOtp": "resendOtp"; "cancel": "cancel"; }, never, never, true, never>;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
declare class LokotroProcessingComponent {
|
|
1099
|
+
localization: LokotroLocalizationService;
|
|
1100
|
+
type: 'default' | 'mobileMoney';
|
|
1101
|
+
message?: string;
|
|
1102
|
+
currentStep: number;
|
|
1103
|
+
constructor(localization: LokotroLocalizationService);
|
|
1104
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroProcessingComponent, never>;
|
|
1105
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroProcessingComponent, "lokotro-processing", never, { "type": { "alias": "type"; "required": false; }; "message": { "alias": "message"; "required": false; }; }, {}, never, never, true, never>;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* Lokotro Pay - Result Component
|
|
1110
|
+
* Success, Error, Warning, Info screens
|
|
1111
|
+
*/
|
|
1112
|
+
|
|
1113
|
+
type ResultType = 'success' | 'error' | 'warning' | 'info';
|
|
1114
|
+
declare class LokotroResultComponent {
|
|
1115
|
+
localization: LokotroLocalizationService;
|
|
1116
|
+
type: ResultType;
|
|
1117
|
+
title: string;
|
|
1118
|
+
message?: string;
|
|
1119
|
+
amount?: number;
|
|
1120
|
+
currency?: string;
|
|
1121
|
+
transactionId?: string;
|
|
1122
|
+
primaryActionLabel?: string;
|
|
1123
|
+
secondaryActionLabel?: string;
|
|
1124
|
+
primaryAction: EventEmitter<void>;
|
|
1125
|
+
secondaryAction: EventEmitter<void>;
|
|
1126
|
+
constructor(localization: LokotroLocalizationService);
|
|
1127
|
+
formatAmount(amount: number, currency?: string): string;
|
|
1128
|
+
onPrimaryClick(): void;
|
|
1129
|
+
onSecondaryClick(): void;
|
|
1130
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroResultComponent, never>;
|
|
1131
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroResultComponent, "lokotro-result", never, { "type": { "alias": "type"; "required": false; }; "title": { "alias": "title"; "required": false; }; "message": { "alias": "message"; "required": false; }; "amount": { "alias": "amount"; "required": false; }; "currency": { "alias": "currency"; "required": false; }; "transactionId": { "alias": "transactionId"; "required": false; }; "primaryActionLabel": { "alias": "primaryActionLabel"; "required": false; }; "secondaryActionLabel": { "alias": "secondaryActionLabel"; "required": false; }; }, { "primaryAction": "primaryAction"; "secondaryAction": "secondaryAction"; }, never, never, true, never>;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
declare class LokotroLoadingComponent {
|
|
1135
|
+
message?: string;
|
|
1136
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroLoadingComponent, never>;
|
|
1137
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroLoadingComponent, "lokotro-loading", never, { "message": { "alias": "message"; "required": false; }; }, {}, never, never, true, never>;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Service for fetching and caching country data
|
|
1142
|
+
*/
|
|
1143
|
+
declare class LokotroCountryService {
|
|
1144
|
+
private httpClient;
|
|
1145
|
+
private countriesCache?;
|
|
1146
|
+
private countriesSubject;
|
|
1147
|
+
private loadingRequest?;
|
|
1148
|
+
/** Cache validity duration: 30 minutes */
|
|
1149
|
+
private readonly cacheValidityMs;
|
|
1150
|
+
/** Observable of countries list */
|
|
1151
|
+
countries$: Observable<LokotroCountry[]>;
|
|
1152
|
+
constructor(httpClient: LokotroHttpClientService);
|
|
1153
|
+
/**
|
|
1154
|
+
* Fetch countries from API with caching
|
|
1155
|
+
*/
|
|
1156
|
+
fetchCountries(forceRefresh?: boolean): Observable<LokotroCountry[]>;
|
|
1157
|
+
/**
|
|
1158
|
+
* Check if cache is still valid
|
|
1159
|
+
*/
|
|
1160
|
+
private isCacheValid;
|
|
1161
|
+
/**
|
|
1162
|
+
* Get cached countries synchronously
|
|
1163
|
+
*/
|
|
1164
|
+
getCachedCountries(): LokotroCountry[];
|
|
1165
|
+
/**
|
|
1166
|
+
* Get country by country code (e.g., "243")
|
|
1167
|
+
*/
|
|
1168
|
+
getCountryByCode(countryCode: string): LokotroCountry | undefined;
|
|
1169
|
+
/**
|
|
1170
|
+
* Get country by ID
|
|
1171
|
+
*/
|
|
1172
|
+
getCountryById(id: string): LokotroCountry | undefined;
|
|
1173
|
+
/**
|
|
1174
|
+
* Get default country (DRC or first available)
|
|
1175
|
+
*/
|
|
1176
|
+
getDefaultCountry(): LokotroCountry | undefined;
|
|
1177
|
+
/**
|
|
1178
|
+
* Clear the cache
|
|
1179
|
+
*/
|
|
1180
|
+
clearCache(): void;
|
|
1181
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroCountryService, never>;
|
|
1182
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LokotroCountryService>;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Lokotro Pay - Mobile Money Phone Input Component
|
|
1187
|
+
* Phone input with country code selector and prefix validation
|
|
1188
|
+
*/
|
|
1189
|
+
|
|
1190
|
+
declare class LokotroMobileMoneyPhoneInputComponent implements OnInit, OnDestroy, ControlValueAccessor, Validator {
|
|
1191
|
+
private countryService;
|
|
1192
|
+
localization: LokotroLocalizationService;
|
|
1193
|
+
label?: string;
|
|
1194
|
+
placeholder: string;
|
|
1195
|
+
initialCountryCode: string;
|
|
1196
|
+
showPrefixHints: boolean;
|
|
1197
|
+
disabled: boolean;
|
|
1198
|
+
countryChanged: EventEmitter<LokotroCountry>;
|
|
1199
|
+
phoneChanged: EventEmitter<{
|
|
1200
|
+
phoneNumber: string;
|
|
1201
|
+
fullNumber: string;
|
|
1202
|
+
country: LokotroCountry | null;
|
|
1203
|
+
}>;
|
|
1204
|
+
countries: LokotroCountry[];
|
|
1205
|
+
selectedCountry?: LokotroCountry;
|
|
1206
|
+
phoneNumber: string;
|
|
1207
|
+
isLoading: boolean;
|
|
1208
|
+
showCountryPicker: boolean;
|
|
1209
|
+
prefixError?: string;
|
|
1210
|
+
hasError: boolean;
|
|
1211
|
+
private subscription?;
|
|
1212
|
+
private onChange;
|
|
1213
|
+
onTouched: () => void;
|
|
1214
|
+
constructor(countryService: LokotroCountryService, localization: LokotroLocalizationService);
|
|
1215
|
+
ngOnInit(): void;
|
|
1216
|
+
ngOnDestroy(): void;
|
|
1217
|
+
private loadCountries;
|
|
1218
|
+
getFlag(country: LokotroCountry): string;
|
|
1219
|
+
getPrimaryCode(country: LokotroCountry): string;
|
|
1220
|
+
getValidPrefixes(country: LokotroCountry): string[];
|
|
1221
|
+
getVisiblePrefixes(country: LokotroCountry): string[];
|
|
1222
|
+
getMaxChars(country: LokotroCountry): number;
|
|
1223
|
+
toggleCountryPicker(): void;
|
|
1224
|
+
closeCountryPicker(): void;
|
|
1225
|
+
selectCountry(country: LokotroCountry, emitChange?: boolean): void;
|
|
1226
|
+
onPhoneInput(event: Event): void;
|
|
1227
|
+
private validatePhoneNumber;
|
|
1228
|
+
private emitPhoneChange;
|
|
1229
|
+
getFullPhoneNumber(): string;
|
|
1230
|
+
writeValue(value: string): void;
|
|
1231
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
1232
|
+
registerOnTouched(fn: () => void): void;
|
|
1233
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1234
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
1235
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroMobileMoneyPhoneInputComponent, never>;
|
|
1236
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroMobileMoneyPhoneInputComponent, "lokotro-mobile-money-phone-input", never, { "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "initialCountryCode": { "alias": "initialCountryCode"; "required": false; }; "showPrefixHints": { "alias": "showPrefixHints"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "countryChanged": "countryChanged"; "phoneChanged": "phoneChanged"; }, never, never, true, never>;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Lokotro Pay - Bank Transfer Form Component
|
|
1241
|
+
*/
|
|
1242
|
+
|
|
1243
|
+
declare class LokotroBankTransferFormComponent implements OnInit {
|
|
1244
|
+
private fb;
|
|
1245
|
+
localization: LokotroLocalizationService;
|
|
1246
|
+
private paymentService;
|
|
1247
|
+
showUserInfoForm: boolean;
|
|
1248
|
+
formSubmitted: EventEmitter<Record<string, unknown>>;
|
|
1249
|
+
cancel: EventEmitter<void>;
|
|
1250
|
+
bankTransferForm: FormGroup;
|
|
1251
|
+
isLoading: boolean;
|
|
1252
|
+
allBanks: LokotroBank[];
|
|
1253
|
+
cities: LokotroBankEntity[];
|
|
1254
|
+
filteredBanks: LokotroBank[];
|
|
1255
|
+
accounts: LokotroBankAccount[];
|
|
1256
|
+
selectedCity: LokotroBankEntity | null;
|
|
1257
|
+
selectedBank: LokotroBank | null;
|
|
1258
|
+
selectedAccount: LokotroBankAccount | null;
|
|
1259
|
+
constructor(fb: FormBuilder, localization: LokotroLocalizationService, paymentService: LokotroPaymentService);
|
|
1260
|
+
ngOnInit(): void;
|
|
1261
|
+
private initForm;
|
|
1262
|
+
private fetchBanks;
|
|
1263
|
+
private extractCities;
|
|
1264
|
+
onCityChange(): void;
|
|
1265
|
+
onBankChange(): void;
|
|
1266
|
+
onAccountChange(): void;
|
|
1267
|
+
onSubmit(): void;
|
|
1268
|
+
onCancel(): void;
|
|
1269
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroBankTransferFormComponent, never>;
|
|
1270
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroBankTransferFormComponent, "lokotro-bank-transfer-form", never, { "showUserInfoForm": { "alias": "showUserInfoForm"; "required": false; }; }, { "formSubmitted": "formSubmitted"; "cancel": "cancel"; }, never, never, true, never>;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* Environment configuration interface
|
|
1275
|
+
*/
|
|
1276
|
+
interface LokotroEnvConfig {
|
|
1277
|
+
baseUrl: string;
|
|
1278
|
+
appKey: string;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Configuration tokens for Lokotro Pay
|
|
1282
|
+
*/
|
|
1283
|
+
declare const LOKOTRO_PAY_CONFIG: InjectionToken<LokotroPayConfig>;
|
|
1284
|
+
declare const LOKOTRO_ENV_CONFIG: InjectionToken<LokotroEnvConfig>;
|
|
1285
|
+
/**
|
|
1286
|
+
* LokotroPayModule - Main module for the Lokotro Pay Angular library
|
|
1287
|
+
*
|
|
1288
|
+
* This module can be used in two ways:
|
|
1289
|
+
*
|
|
1290
|
+
* 1. Import individual standalone components directly in your components
|
|
1291
|
+
* 2. Import this module in your app module for non-standalone applications
|
|
1292
|
+
*
|
|
1293
|
+
* @example
|
|
1294
|
+
* // Using standalone components (recommended for Angular 17+)
|
|
1295
|
+
* import { LokotroCheckoutComponent } from '@lokotro/pay';
|
|
1296
|
+
*
|
|
1297
|
+
* @Component({
|
|
1298
|
+
* standalone: true,
|
|
1299
|
+
* imports: [LokotroCheckoutComponent],
|
|
1300
|
+
* template: `<lokotro-checkout [config]="config" (paymentComplete)="onComplete($event)" />`
|
|
1301
|
+
* })
|
|
1302
|
+
* export class MyComponent {}
|
|
1303
|
+
*
|
|
1304
|
+
* @example
|
|
1305
|
+
* // Using module import
|
|
1306
|
+
* import { LokotroPayModule } from '@lokotro/pay';
|
|
1307
|
+
*
|
|
1308
|
+
* @NgModule({
|
|
1309
|
+
* imports: [LokotroPayModule.forRoot({
|
|
1310
|
+
* env: { baseUrl: 'https://api.lokotro.com', appKey: 'your-key' }
|
|
1311
|
+
* })]
|
|
1312
|
+
* })
|
|
1313
|
+
* export class AppModule {}
|
|
1314
|
+
*/
|
|
1315
|
+
declare class LokotroPayModule {
|
|
1316
|
+
/**
|
|
1317
|
+
* Configure the Lokotro Pay module with environment and default settings
|
|
1318
|
+
*
|
|
1319
|
+
* @param config - Configuration object containing environment settings
|
|
1320
|
+
* @returns ModuleWithProviders for the configured module
|
|
1321
|
+
*/
|
|
1322
|
+
static forRoot(config?: Partial<{
|
|
1323
|
+
env: LokotroEnvConfig;
|
|
1324
|
+
defaultConfig: Partial<LokotroPayConfig>;
|
|
1325
|
+
}>): ModuleWithProviders<LokotroPayModule>;
|
|
1326
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroPayModule, never>;
|
|
1327
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LokotroPayModule, never, [typeof i1.CommonModule, typeof i2.HttpClientModule, typeof i3.ReactiveFormsModule, typeof i3.FormsModule, typeof LokotroPayCheckoutComponent, typeof LokotroPaymentMethodSelectionComponent, typeof LokotroPaymentFormComponent, typeof LokotroOtpVerificationComponent, typeof LokotroProcessingComponent, typeof LokotroResultComponent, typeof LokotroLoadingComponent, typeof LokotroMobileMoneyPhoneInputComponent, typeof LokotroBankTransferFormComponent], [typeof LokotroPayCheckoutComponent, typeof LokotroPaymentMethodSelectionComponent, typeof LokotroPaymentFormComponent, typeof LokotroOtpVerificationComponent, typeof LokotroProcessingComponent, typeof LokotroResultComponent, typeof LokotroLoadingComponent, typeof LokotroMobileMoneyPhoneInputComponent, typeof LokotroBankTransferFormComponent]>;
|
|
1328
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<LokotroPayModule>;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* Lokotro Pay - Color Constants
|
|
1333
|
+
* Angular version of the Flutter Lokotro Pay plugin colors
|
|
1334
|
+
*/
|
|
1335
|
+
/**
|
|
1336
|
+
* Color scheme for Lokotro Pay - matching Lokotroo App design
|
|
1337
|
+
*/
|
|
1338
|
+
declare const LokotroPayColors: {
|
|
1339
|
+
primary: string;
|
|
1340
|
+
primaryDark: string;
|
|
1341
|
+
primaryLight: string;
|
|
1342
|
+
primaryVariant: string;
|
|
1343
|
+
secondary: string;
|
|
1344
|
+
secondaryDark: string;
|
|
1345
|
+
secondaryLight: string;
|
|
1346
|
+
secondaryVariant: string;
|
|
1347
|
+
accent: string;
|
|
1348
|
+
accentDark: string;
|
|
1349
|
+
accentLight: string;
|
|
1350
|
+
success: string;
|
|
1351
|
+
successDark: string;
|
|
1352
|
+
successLight: string;
|
|
1353
|
+
error: string;
|
|
1354
|
+
errorDark: string;
|
|
1355
|
+
errorLight: string;
|
|
1356
|
+
warning: string;
|
|
1357
|
+
warningDark: string;
|
|
1358
|
+
warningLight: string;
|
|
1359
|
+
info: string;
|
|
1360
|
+
infoDark: string;
|
|
1361
|
+
infoLight: string;
|
|
1362
|
+
white: string;
|
|
1363
|
+
black: string;
|
|
1364
|
+
grey: string;
|
|
1365
|
+
greyLight: string;
|
|
1366
|
+
greyDark: string;
|
|
1367
|
+
textPrimaryLight: string;
|
|
1368
|
+
textSecondaryLight: string;
|
|
1369
|
+
textTertiaryLight: string;
|
|
1370
|
+
textDisabledLight: string;
|
|
1371
|
+
textPrimaryDark: string;
|
|
1372
|
+
textSecondaryDark: string;
|
|
1373
|
+
textTertiaryDark: string;
|
|
1374
|
+
textDisabledDark: string;
|
|
1375
|
+
backgroundLight: string;
|
|
1376
|
+
surfaceLight: string;
|
|
1377
|
+
cardLight: string;
|
|
1378
|
+
backgroundDark: string;
|
|
1379
|
+
surfaceDark: string;
|
|
1380
|
+
cardDark: string;
|
|
1381
|
+
glassLight: string;
|
|
1382
|
+
glassDark: string;
|
|
1383
|
+
glassBlur: string;
|
|
1384
|
+
borderLight: string;
|
|
1385
|
+
borderDark: string;
|
|
1386
|
+
dividerLight: string;
|
|
1387
|
+
dividerDark: string;
|
|
1388
|
+
shadowLight: string;
|
|
1389
|
+
shadowMedium: string;
|
|
1390
|
+
shadowDark: string;
|
|
1391
|
+
overlayLight: string;
|
|
1392
|
+
overlayDark: string;
|
|
1393
|
+
transactionSent: string;
|
|
1394
|
+
transactionReceived: string;
|
|
1395
|
+
transactionPending: string;
|
|
1396
|
+
transactionFailed: string;
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* Environment configuration helper
|
|
1401
|
+
*/
|
|
1402
|
+
declare class LokotroPayEnv {
|
|
1403
|
+
private static _config;
|
|
1404
|
+
private static _isInitialized;
|
|
1405
|
+
private static _customApiUrl?;
|
|
1406
|
+
/**
|
|
1407
|
+
* Initialize the environment configuration
|
|
1408
|
+
*/
|
|
1409
|
+
static initialize(isProduction?: boolean, customApiUrl?: string): void;
|
|
1410
|
+
/**
|
|
1411
|
+
* Get current environment
|
|
1412
|
+
*/
|
|
1413
|
+
static get environment(): string;
|
|
1414
|
+
/**
|
|
1415
|
+
* Check if running in production
|
|
1416
|
+
*/
|
|
1417
|
+
static get isProduction(): boolean;
|
|
1418
|
+
/**
|
|
1419
|
+
* Check if running in development
|
|
1420
|
+
*/
|
|
1421
|
+
static get isDevelopment(): boolean;
|
|
1422
|
+
/**
|
|
1423
|
+
* Get API base URL
|
|
1424
|
+
*/
|
|
1425
|
+
static get apiBaseUrl(): string;
|
|
1426
|
+
/**
|
|
1427
|
+
* Get payment API version
|
|
1428
|
+
*/
|
|
1429
|
+
static get paymentApiVersion(): string;
|
|
1430
|
+
/**
|
|
1431
|
+
* Get full payment API URL
|
|
1432
|
+
*/
|
|
1433
|
+
static get paymentApiUrl(): string;
|
|
1434
|
+
/**
|
|
1435
|
+
* Check if debug mode is enabled
|
|
1436
|
+
*/
|
|
1437
|
+
static get debugMode(): boolean;
|
|
1438
|
+
/**
|
|
1439
|
+
* Get log level
|
|
1440
|
+
*/
|
|
1441
|
+
static get logLevel(): string;
|
|
1442
|
+
/**
|
|
1443
|
+
* Get request timeout in seconds
|
|
1444
|
+
*/
|
|
1445
|
+
static get timeoutSeconds(): number;
|
|
1446
|
+
/**
|
|
1447
|
+
* Get request timeout in milliseconds
|
|
1448
|
+
*/
|
|
1449
|
+
static get timeoutMs(): number;
|
|
1450
|
+
/**
|
|
1451
|
+
* API endpoints
|
|
1452
|
+
*/
|
|
1453
|
+
static get endpoints(): {
|
|
1454
|
+
collect: string;
|
|
1455
|
+
transaction: string;
|
|
1456
|
+
submit: string;
|
|
1457
|
+
verifyOtp: string;
|
|
1458
|
+
resendOtp: string;
|
|
1459
|
+
fetchPaymentInfo: string;
|
|
1460
|
+
processPayment: string;
|
|
1461
|
+
verifyPayment: string;
|
|
1462
|
+
cancelPayment: string;
|
|
1463
|
+
};
|
|
1464
|
+
/**
|
|
1465
|
+
* Build full endpoint URL
|
|
1466
|
+
*/
|
|
1467
|
+
static buildEndpoint(endpoint: string): string;
|
|
1468
|
+
/**
|
|
1469
|
+
* Default headers for API requests
|
|
1470
|
+
*/
|
|
1471
|
+
static get defaultHeaders(): Record<string, string>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Build headers with authorization token
|
|
1474
|
+
*/
|
|
1475
|
+
static buildAuthHeaders(token: string): Record<string, string>;
|
|
1476
|
+
/**
|
|
1477
|
+
* Validate environment configuration
|
|
1478
|
+
*/
|
|
1479
|
+
static validateConfiguration(): boolean;
|
|
1480
|
+
/**
|
|
1481
|
+
* Get configuration summary for debugging
|
|
1482
|
+
*/
|
|
1483
|
+
static getConfigSummary(): Record<string, unknown>;
|
|
1484
|
+
/**
|
|
1485
|
+
* Reset configuration
|
|
1486
|
+
*/
|
|
1487
|
+
static reset(): void;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
/**
|
|
1491
|
+
* Lokotro Pay - Payment Status Component
|
|
1492
|
+
* Entry point for tracking payment status by payment ID only
|
|
1493
|
+
* This component is used when payment was already initiated and we need to track its status
|
|
1494
|
+
*/
|
|
1495
|
+
|
|
1496
|
+
/**
|
|
1497
|
+
* Configuration for payment status tracking
|
|
1498
|
+
*/
|
|
1499
|
+
interface LokotroPaymentStatusConfig {
|
|
1500
|
+
/** Payment ID to track */
|
|
1501
|
+
paymentId: string;
|
|
1502
|
+
/** API configuration */
|
|
1503
|
+
config: LokotroPayConfig;
|
|
1504
|
+
/** Polling interval in milliseconds (default: 5000) */
|
|
1505
|
+
pollingInterval?: number;
|
|
1506
|
+
/** Maximum polling attempts (default: 60 = 5 minutes with 5s interval) */
|
|
1507
|
+
maxPollingAttempts?: number;
|
|
1508
|
+
/** Language for translations */
|
|
1509
|
+
language?: LokotroPayLanguage;
|
|
1510
|
+
/** Auto-start polling on init (default: true) */
|
|
1511
|
+
autoStart?: boolean;
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Payment status response from API
|
|
1515
|
+
*/
|
|
1516
|
+
interface LokotroPaymentStatusResponse {
|
|
1517
|
+
code: number;
|
|
1518
|
+
message: string;
|
|
1519
|
+
paymentId: string;
|
|
1520
|
+
transactionId?: string;
|
|
1521
|
+
status: LokotroPaymentStatus;
|
|
1522
|
+
amount?: number;
|
|
1523
|
+
currency?: string;
|
|
1524
|
+
merchantReference?: string;
|
|
1525
|
+
customerReference?: string;
|
|
1526
|
+
completedAt?: string;
|
|
1527
|
+
createdAt?: string;
|
|
1528
|
+
metadata?: Record<string, unknown>;
|
|
1529
|
+
successRedirectUrl?: string;
|
|
1530
|
+
failRedirectUrl?: string;
|
|
1531
|
+
notifyUrl?: string;
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Internal screen states
|
|
1535
|
+
*/
|
|
1536
|
+
type PaymentStatusScreen = 'loading' | 'pending' | 'processing' | 'otp' | 'success' | 'error' | 'cancelled' | 'expired';
|
|
1537
|
+
declare class LokotroPaymentStatusComponent implements OnInit, OnDestroy {
|
|
1538
|
+
private paymentService;
|
|
1539
|
+
localization: LokotroLocalizationService;
|
|
1540
|
+
private httpClient;
|
|
1541
|
+
/**
|
|
1542
|
+
* Payment status configuration
|
|
1543
|
+
*/
|
|
1544
|
+
statusConfig: LokotroPaymentStatusConfig;
|
|
1545
|
+
/**
|
|
1546
|
+
* Show header with title
|
|
1547
|
+
*/
|
|
1548
|
+
showHeader: boolean;
|
|
1549
|
+
/**
|
|
1550
|
+
* Show close button in header
|
|
1551
|
+
*/
|
|
1552
|
+
showCloseButton: boolean;
|
|
1553
|
+
/**
|
|
1554
|
+
* Emitted when payment status changes
|
|
1555
|
+
*/
|
|
1556
|
+
statusChange: EventEmitter<LokotroPaymentStatusResponse>;
|
|
1557
|
+
/**
|
|
1558
|
+
* Emitted when payment is completed successfully
|
|
1559
|
+
*/
|
|
1560
|
+
paymentComplete: EventEmitter<LokotroPaymentStatusResponse>;
|
|
1561
|
+
/**
|
|
1562
|
+
* Emitted when payment fails
|
|
1563
|
+
*/
|
|
1564
|
+
paymentFailed: EventEmitter<LokotroPaymentStatusResponse>;
|
|
1565
|
+
/**
|
|
1566
|
+
* Emitted when close button is clicked or done is pressed
|
|
1567
|
+
*/
|
|
1568
|
+
onClose: EventEmitter<void>;
|
|
1569
|
+
/**
|
|
1570
|
+
* Emitted when user clicks done after successful payment
|
|
1571
|
+
*/
|
|
1572
|
+
onDoneEvent: EventEmitter<LokotroPaymentStatusResponse>;
|
|
1573
|
+
currentScreen: PaymentStatusScreen;
|
|
1574
|
+
paymentDetails: LokotroPaymentStatusResponse | null;
|
|
1575
|
+
errorMessage: string;
|
|
1576
|
+
/** OTP verification state */
|
|
1577
|
+
otpDestination: string;
|
|
1578
|
+
rawStatus: string;
|
|
1579
|
+
isVerifyingOtp: boolean;
|
|
1580
|
+
private destroy$;
|
|
1581
|
+
private pollingSubscription?;
|
|
1582
|
+
private pollingAttempts;
|
|
1583
|
+
constructor(paymentService: LokotroPaymentService, localization: LokotroLocalizationService, httpClient: LokotroHttpClientService);
|
|
1584
|
+
ngOnInit(): void;
|
|
1585
|
+
ngOnDestroy(): void;
|
|
1586
|
+
/**
|
|
1587
|
+
* Initialize the service with configuration
|
|
1588
|
+
*/
|
|
1589
|
+
private initializeService;
|
|
1590
|
+
/**
|
|
1591
|
+
* Start checking payment status
|
|
1592
|
+
*/
|
|
1593
|
+
startStatusCheck(): void;
|
|
1594
|
+
/**
|
|
1595
|
+
* Stop polling
|
|
1596
|
+
*/
|
|
1597
|
+
stopPolling(): void;
|
|
1598
|
+
/**
|
|
1599
|
+
* Check payment status via API
|
|
1600
|
+
*/
|
|
1601
|
+
private checkPaymentStatus;
|
|
1602
|
+
/**
|
|
1603
|
+
* Sanitize error message to not expose sensitive information
|
|
1604
|
+
* like URLs, internal codes, or technical details
|
|
1605
|
+
*/
|
|
1606
|
+
private getSanitizedErrorMessage;
|
|
1607
|
+
/**
|
|
1608
|
+
* Handle status response from API
|
|
1609
|
+
*/
|
|
1610
|
+
private handleStatusResponse;
|
|
1611
|
+
/**
|
|
1612
|
+
* Handle max polling attempts reached
|
|
1613
|
+
*/
|
|
1614
|
+
private handleMaxAttemptsReached;
|
|
1615
|
+
/**
|
|
1616
|
+
* Retry checking status
|
|
1617
|
+
*/
|
|
1618
|
+
retryCheck(): void;
|
|
1619
|
+
/**
|
|
1620
|
+
* Handle done button click
|
|
1621
|
+
*/
|
|
1622
|
+
onDone(): void;
|
|
1623
|
+
/**
|
|
1624
|
+
* Handle OTP verification
|
|
1625
|
+
*/
|
|
1626
|
+
onOtpVerified(otp: string): void;
|
|
1627
|
+
/**
|
|
1628
|
+
* Handle OTP resend
|
|
1629
|
+
*/
|
|
1630
|
+
onResendOtp(): void;
|
|
1631
|
+
/**
|
|
1632
|
+
* Handle OTP cancellation
|
|
1633
|
+
*/
|
|
1634
|
+
onOtpCancel(): void;
|
|
1635
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LokotroPaymentStatusComponent, never>;
|
|
1636
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LokotroPaymentStatusComponent, "lokotro-payment-status", never, { "statusConfig": { "alias": "statusConfig"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "showCloseButton": { "alias": "showCloseButton"; "required": false; }; }, { "statusChange": "statusChange"; "paymentComplete": "paymentComplete"; "paymentFailed": "paymentFailed"; "onClose": "onClose"; "onDoneEvent": "onDoneEvent"; }, never, never, true, never>;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
export { LOKOTRO_ENV_CONFIG, LOKOTRO_PAY_CONFIG, LokotroBankTransferFormComponent, LokotroCountryService, LokotroCountryUtils, LokotroHttpClientService, LokotroLoadingComponent, LokotroLocalizationService, LokotroMobileMoneyPhoneInputComponent, LokotroOtpVerificationComponent, LokotroPayApiResponseCode, LokotroPayApiResponseCodeInfo, LokotroPayChannel, LokotroPayChannelInfo, LokotroPayCheckoutComponent, LokotroPayColors, LokotroPayEnv, LokotroPayFillingInfo, LokotroPayLanguage, LokotroPayLanguageInfo, LokotroPayModule, LokotroPayResultScreen, LokotroPayScreenNavigation, LokotroPayScreenNavigationInfo, LokotroPaymentFormComponent, LokotroPaymentMethodSelectionComponent, LokotroPaymentService, LokotroPaymentStatus, LokotroPaymentStatusComponent, LokotroProcessingComponent, LokotroResultComponent };
|
|
1640
|
+
export type { LokotroCheckoutConfig, LokotroCountry, LokotroCountryCode, LokotroHttpResponse, LokotroMerchantInfo, LokotroOtpVerifyRequest, LokotroOtpVerifyResponse, LokotroPayConfig, LokotroPayError, LokotroPayOnError, LokotroPayOnResponse, LokotroPayResponse, LokotroPayThemeConfig, LokotroPaymentBody, LokotroPaymentFormData, LokotroPaymentInfo, LokotroPaymentMethod, LokotroPaymentMethodListItem, LokotroPaymentStatusConfig, LokotroPaymentStatusResponse, LokotroPaymentSubmitRequest, LokotroPaymentSubmitResponse, LokotroPhonePrefix, LokotroRefCountry, LokotroTransactionDetails };
|