@bloonio/lokotro-pay 1.2.2 → 1.4.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloonio/lokotro-pay",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Angular SDK for Lokotro Pay - Clean white-surface payment checkout with themeable brand colors and support for cards, mobile money, e-wallets, and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"url": "https://github.com/bloonio/lokotro-pay-angular.git"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
|
|
22
|
-
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
|
|
23
|
-
"@angular/forms": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
|
|
21
|
+
"@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
22
|
+
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
23
|
+
"@angular/forms": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
24
24
|
"rxjs": "^7.8.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
@@ -192,9 +192,9 @@ interface LokotroPayConfig {
|
|
|
192
192
|
* Payment body for Lokotro Pay - All-in-one request
|
|
193
193
|
*/
|
|
194
194
|
interface LokotroPaymentBody {
|
|
195
|
-
customerReference
|
|
196
|
-
amount
|
|
197
|
-
currency
|
|
195
|
+
customerReference?: string;
|
|
196
|
+
amount?: string;
|
|
197
|
+
currency?: string;
|
|
198
198
|
paymentMethod?: string;
|
|
199
199
|
userInfo?: 'full' | 'partial' | 'none';
|
|
200
200
|
paymentMethodInfo?: 'full' | 'partial' | 'none';
|
|
@@ -285,6 +285,17 @@ interface LokotroPaymentInfo {
|
|
|
285
285
|
fillingInfo?: string;
|
|
286
286
|
channelInfo?: string;
|
|
287
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* PR-3.0 — Payment-method-level discriminator.
|
|
290
|
+
*
|
|
291
|
+
* Mirrors `ELokotroPaymentMethodFlag` in the gateway. SDK consumers use this
|
|
292
|
+
* to brand the UI when multiple providers share a channel (e.g. card payments
|
|
293
|
+
* may route through RAWBANK_CREDIT_CARD or ONAFRIQ_CREDIT_CARD).
|
|
294
|
+
*
|
|
295
|
+
* Wire values are snake_case strings — see
|
|
296
|
+
* `app/modules/enums/lokotro_enum.py:ELokotroPaymentMethodFlag`.
|
|
297
|
+
*/
|
|
298
|
+
type LokotroPaymentMethodFlag = 'none' | 'all' | 'onafriq_mobile_money' | 'onafriq_credit_card' | 'rawbank_credit_card' | 'lokotro_wallet' | 'lokotro_eflash' | 'cash' | 'bank_transfer' | 'google_pay' | 'apple_pay';
|
|
288
299
|
/**
|
|
289
300
|
* Payment method model
|
|
290
301
|
*/
|
|
@@ -293,6 +304,11 @@ interface LokotroPaymentMethod {
|
|
|
293
304
|
name: string;
|
|
294
305
|
displayName: string;
|
|
295
306
|
channel: LokotroPayChannel;
|
|
307
|
+
/**
|
|
308
|
+
* PR-3.0 — provider-level discriminator. Optional for back-compat with
|
|
309
|
+
* legacy gateway responses; new responses always include it.
|
|
310
|
+
*/
|
|
311
|
+
flag?: LokotroPaymentMethodFlag;
|
|
296
312
|
iconUrl: string;
|
|
297
313
|
isEnabled: boolean;
|
|
298
314
|
configuration?: Record<string, unknown>;
|
|
@@ -306,6 +322,8 @@ interface LokotroPaymentMethodListItem {
|
|
|
306
322
|
name: string;
|
|
307
323
|
displayName: string;
|
|
308
324
|
channel: LokotroPayChannel;
|
|
325
|
+
/** PR-3.0 — provider-level discriminator (see LokotroPaymentMethod.flag). */
|
|
326
|
+
flag?: LokotroPaymentMethodFlag;
|
|
309
327
|
iconUrl: string;
|
|
310
328
|
isEnabled: boolean;
|
|
311
329
|
isSelected: boolean;
|
|
@@ -510,12 +528,16 @@ interface LokotroHttpClientConfig {
|
|
|
510
528
|
customHeaders?: Record<string, string>;
|
|
511
529
|
}
|
|
512
530
|
/**
|
|
513
|
-
* Enhanced HTTP client for Lokotro Pay with modern error handling and logging
|
|
531
|
+
* Enhanced HTTP client for Lokotro Pay with modern error handling and logging.
|
|
532
|
+
*
|
|
533
|
+
* PR-1.2 / CRIT-2: previous code emitted six `console.log` calls that
|
|
534
|
+
* truncated and printed the merchant `appKey` to the browser console on every
|
|
535
|
+
* HTTP request. The truncated form ("first 20 chars + ...") is still useful
|
|
536
|
+
* to anyone scraping the console, especially when paired with the response
|
|
537
|
+
* body. All such logs were removed.
|
|
514
538
|
*/
|
|
515
539
|
declare class LokotroHttpClientService {
|
|
516
540
|
private http;
|
|
517
|
-
private static instanceCounter;
|
|
518
|
-
private instanceId;
|
|
519
541
|
private appKey?;
|
|
520
542
|
private acceptLanguage;
|
|
521
543
|
private customHeaders;
|
|
@@ -569,7 +591,13 @@ declare class LokotroHttpClientService {
|
|
|
569
591
|
*/
|
|
570
592
|
private handleSuccess;
|
|
571
593
|
/**
|
|
572
|
-
* Handle error response
|
|
594
|
+
* Handle error response.
|
|
595
|
+
*
|
|
596
|
+
* PR-1.2: previously logged the full `error` object in debug mode, which
|
|
597
|
+
* for an HttpErrorResponse includes `error.error` — i.e. the raw server
|
|
598
|
+
* response body. That body can leak validation echoes of the original
|
|
599
|
+
* request (PAN/PIN/etc.) when the backend is in development mode. Now we
|
|
600
|
+
* log only HTTP status code + url; never the body.
|
|
573
601
|
*/
|
|
574
602
|
private handleError;
|
|
575
603
|
/**
|
|
@@ -664,6 +692,19 @@ declare class LokotroPaymentService {
|
|
|
664
692
|
* Stop mobile money status polling
|
|
665
693
|
*/
|
|
666
694
|
private stopMobileMoneyPolling;
|
|
695
|
+
/**
|
|
696
|
+
* Validate a server-supplied redirect URL before handing the browser tab to
|
|
697
|
+
* it. Defense-in-depth for Angular HIGH-1 — server-side per-merchant
|
|
698
|
+
* allow-list (PR-2.0) is the real fix.
|
|
699
|
+
*
|
|
700
|
+
* Policy:
|
|
701
|
+
* - Reject non-http(s) schemes (blocks `javascript:`, `data:`, `file:`,
|
|
702
|
+
* `intent:`, custom schemes).
|
|
703
|
+
* - Reject http:// in production.
|
|
704
|
+
* - Reject malformed URLs.
|
|
705
|
+
* - SSR safety: skip the redirect when window is unavailable.
|
|
706
|
+
*/
|
|
707
|
+
private redirectIfAllowed;
|
|
667
708
|
/**
|
|
668
709
|
* Handle payment success
|
|
669
710
|
*/
|
|
@@ -704,6 +745,11 @@ declare class LokotroPaymentService {
|
|
|
704
745
|
* Parse payment method from API response.
|
|
705
746
|
*/
|
|
706
747
|
private parsePaymentMethod;
|
|
748
|
+
/**
|
|
749
|
+
* PR-3.0 — narrow an arbitrary string to the LokotroPaymentMethodFlag union.
|
|
750
|
+
* Unknown / empty inputs return undefined so the field stays optional.
|
|
751
|
+
*/
|
|
752
|
+
private parsePaymentMethodFlag;
|
|
707
753
|
/**
|
|
708
754
|
* Parse submit response from API.
|
|
709
755
|
*/
|