@bloonio/lokotro-pay 1.3.0 → 1.5.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.
|
@@ -17,7 +17,7 @@ import { HttpHeaders, HttpErrorResponse } from '@angular/common/http';
|
|
|
17
17
|
*/
|
|
18
18
|
const LOKOTRO_DEV_ENV = {
|
|
19
19
|
environment: 'development',
|
|
20
|
-
// apiBaseUrl: 'http://192.168.30.
|
|
20
|
+
// apiBaseUrl: 'http://192.168.30.123:6495',
|
|
21
21
|
apiBaseUrl: 'https://app.api.gtwy.lokotro.com',
|
|
22
22
|
paymentApiVersion: 'v1',
|
|
23
23
|
debugMode: true,
|
|
@@ -3341,6 +3341,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
3341
3341
|
type: Input
|
|
3342
3342
|
}] } });
|
|
3343
3343
|
|
|
3344
|
+
/**
|
|
3345
|
+
* Lokotro Pay - Feature Flags
|
|
3346
|
+
*
|
|
3347
|
+
* Compile-time switches for capabilities that are partially wired into the SDK
|
|
3348
|
+
* but not yet ready to expose to end users. Flip a flag to `true` once the
|
|
3349
|
+
* feature is implemented end-to-end.
|
|
3350
|
+
*/
|
|
3351
|
+
const LOKOTRO_PAY_FEATURE_FLAGS = {
|
|
3352
|
+
/**
|
|
3353
|
+
* Native wallet payments — Google Pay and Apple Pay.
|
|
3354
|
+
*
|
|
3355
|
+
* The models and method-flag plumbing already understand these methods, but
|
|
3356
|
+
* the native tokenisation flows are not implemented end-to-end yet. While
|
|
3357
|
+
* this is `false` the SDK hides Google Pay / Apple Pay from the
|
|
3358
|
+
* payment-method selection UI so they can never be shown or selected. Set to
|
|
3359
|
+
* `true` once the native integrations are complete.
|
|
3360
|
+
*/
|
|
3361
|
+
nativeWalletsEnabled: false,
|
|
3362
|
+
};
|
|
3363
|
+
/**
|
|
3364
|
+
* Whether a payment method is a Google Pay / Apple Pay native wallet method.
|
|
3365
|
+
*
|
|
3366
|
+
* Matches the provider flag as well as the raw name / id / channel strings, so
|
|
3367
|
+
* detection holds even when the backend channel does not map onto the enum.
|
|
3368
|
+
*/
|
|
3369
|
+
function isNativeWalletMethod(method) {
|
|
3370
|
+
if (method.flag === 'google_pay' || method.flag === 'apple_pay') {
|
|
3371
|
+
return true;
|
|
3372
|
+
}
|
|
3373
|
+
const looksNative = (value) => {
|
|
3374
|
+
const key = (value ?? '').toLowerCase().replace(/[^a-z]/g, '');
|
|
3375
|
+
return key.includes('googlepay') || key.includes('applepay');
|
|
3376
|
+
};
|
|
3377
|
+
return (looksNative(method.name) ||
|
|
3378
|
+
looksNative(method.displayName) ||
|
|
3379
|
+
looksNative(method.id) ||
|
|
3380
|
+
looksNative(method.channel));
|
|
3381
|
+
}
|
|
3382
|
+
/**
|
|
3383
|
+
* Returns the payment methods that should be visible to the user, dropping any
|
|
3384
|
+
* hidden behind a disabled feature flag (currently Google / Apple Pay). The
|
|
3385
|
+
* list is returned unchanged once the relevant flag is enabled.
|
|
3386
|
+
*/
|
|
3387
|
+
function visiblePaymentMethods(methods) {
|
|
3388
|
+
if (LOKOTRO_PAY_FEATURE_FLAGS.nativeWalletsEnabled) {
|
|
3389
|
+
return methods;
|
|
3390
|
+
}
|
|
3391
|
+
return methods.filter((method) => !isNativeWalletMethod(method));
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3344
3394
|
/**
|
|
3345
3395
|
* Lokotro Pay - Payment Service
|
|
3346
3396
|
* Main payment service that follows the Lokotro Gateway API flow
|
|
@@ -3976,8 +4026,10 @@ class LokotroPaymentService {
|
|
|
3976
4026
|
*/
|
|
3977
4027
|
parsePaymentInfo(data) {
|
|
3978
4028
|
const additionalData = this.asRecord(data['additional_data']);
|
|
3979
|
-
|
|
3980
|
-
|
|
4029
|
+
// Drop feature-flag-hidden methods (e.g. Google/Apple Pay) so they never
|
|
4030
|
+
// enter the payment info model, get rendered, or get auto-selected.
|
|
4031
|
+
const availablePaymentMethods = visiblePaymentMethods(this.getRecordArray(data['available_payment_methods'] || additionalData?.['payment_methods'])
|
|
4032
|
+
.map(method => this.parsePaymentMethod(method)));
|
|
3981
4033
|
const action = this.getString(additionalData?.['action']);
|
|
3982
4034
|
return {
|
|
3983
4035
|
id: this.resolvePaymentId(data),
|
|
@@ -4008,7 +4060,7 @@ class LokotroPaymentService {
|
|
|
4008
4060
|
description: this.getString(data['description']),
|
|
4009
4061
|
merchantName: this.getString(data['merchant_name']),
|
|
4010
4062
|
merchantId: this.getString(data['merchant_id']),
|
|
4011
|
-
availablePaymentMethods: this.getRecordArray(data['payment_methods']).map(method => this.parsePaymentMethod(method)),
|
|
4063
|
+
availablePaymentMethods: visiblePaymentMethods(this.getRecordArray(data['payment_methods']).map(method => this.parsePaymentMethod(method))),
|
|
4012
4064
|
createdAt: new Date(this.getString(data['created_at']) || Date.now()),
|
|
4013
4065
|
metadata: this.asRecord(data['metadata']),
|
|
4014
4066
|
paymentUrl: this.getString(data['payment_url']) || undefined,
|
|
@@ -5580,5 +5632,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
5580
5632
|
* Generated bundle index. Do not edit.
|
|
5581
5633
|
*/
|
|
5582
5634
|
|
|
5583
|
-
export { LOKOTRO_ENV_CONFIG, LOKOTRO_PAY_CONFIG, LokotroHttpClientService, LokotroLoadingComponent, LokotroLocalizationService, LokotroOtpVerificationComponent, LokotroPayApiResponseCode, LokotroPayApiResponseCodeInfo, LokotroPayChannel, LokotroPayChannelInfo, LokotroPayCheckoutComponent, LokotroPayColors, LokotroPayEnv, LokotroPayFillingInfo, LokotroPayLanguage, LokotroPayLanguageInfo, LokotroPayModule, LokotroPayResultScreen, LokotroPayScreenNavigation, LokotroPayScreenNavigationInfo, LokotroPaymentFormComponent, LokotroPaymentMethodSelectionComponent, LokotroPaymentService, LokotroPaymentStatus, LokotroPaymentStatusComponent, LokotroProcessingComponent, LokotroResultComponent };
|
|
5635
|
+
export { LOKOTRO_ENV_CONFIG, LOKOTRO_PAY_CONFIG, LOKOTRO_PAY_FEATURE_FLAGS, LokotroHttpClientService, LokotroLoadingComponent, LokotroLocalizationService, LokotroOtpVerificationComponent, LokotroPayApiResponseCode, LokotroPayApiResponseCodeInfo, LokotroPayChannel, LokotroPayChannelInfo, LokotroPayCheckoutComponent, LokotroPayColors, LokotroPayEnv, LokotroPayFillingInfo, LokotroPayLanguage, LokotroPayLanguageInfo, LokotroPayModule, LokotroPayResultScreen, LokotroPayScreenNavigation, LokotroPayScreenNavigationInfo, LokotroPaymentFormComponent, LokotroPaymentMethodSelectionComponent, LokotroPaymentService, LokotroPaymentStatus, LokotroPaymentStatusComponent, LokotroProcessingComponent, LokotroResultComponent, visiblePaymentMethods };
|
|
5584
5636
|
//# sourceMappingURL=bloonio-lokotro-pay.mjs.map
|