【问题标题】:How to hide PayPal logo in adroid devices using card.io plug-in for Cordova如何使用 Cordova 的 card.io 插件在 android 设备中隐藏 PayPal 徽标
【发布时间】:2020-01-27 19:21:22
【问题描述】:

根据插件文档,似乎没有配置选项可以在卡详细信息操作栏中隐藏 PayPal 徽标。然而,适用于 android 的 card.io SDK 可以选择:

https://card-io.github.io/card.io-Android-SDK/io/card/payment/CardIOActivity.html#EXTRA_USE_PAYPAL_ACTIONBAR_ICON

有没有办法隐藏这个标志?

【问题讨论】:

    标签: cordova ionic-framework cordova-plugins ionic4 card.io


    【解决方案1】:

    是的,有办法。

    首先,你必须移除 android 平台才能从头开始下载所有依赖项:

    ionic cordova platform remove Android
    

    然后,添加 card.io cordova 插件:

    ionic cordova plugin add card.io.cordova.mobilesdk
    

    taht 之后,在“plugins/card.io.cordova.mobilesdk/src/android”中,您必须对 2 个文件进行更改:

    build.gradle 替换

    dependencies {
      compile 'io.card:android-sdk:5.4.0'
    }
    

    通过这个:

    dependencies {
      compile 'io.card:android-sdk:5.5.1'
    }
    

    在文件 CardIOCordovaPlugin.java 中,您必须添加新的配置选项 EXTRA_USE_PAYPAL_ACTIONBAR_ICON:

      private void scan(JSONArray args) throws JSONException {
            Intent scanIntent = new Intent(this.activity, CardIOActivity.class);
            JSONObject configurations = args.getJSONObject(0);
            // customize these values to suit your needs.
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, this.getConfiguration(configurations, "requireExpiry", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, this.getConfiguration(configurations, "requireCVV", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, this.getConfiguration(configurations, "requirePostalCode", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, this.getConfiguration(configurations, "suppressManual", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_RESTRICT_POSTAL_CODE_TO_NUMERIC_ONLY, this.getConfiguration(configurations, "restrictPostalCodeToNumericOnly", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, this.getConfiguration(configurations, "keepApplicationTheme", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CARDHOLDER_NAME, this.getConfiguration(configurations, "requireCardholderName", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_USE_CARDIO_LOGO, this.getConfiguration(configurations, "useCardIOLogo", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_SCAN_INSTRUCTIONS, this.getConfiguration(configurations, "scanInstructions", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_NO_CAMERA, this.getConfiguration(configurations, "noCamera", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_SCAN_EXPIRY, this.getConfiguration(configurations, "scanExpiry", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_LANGUAGE_OR_LOCALE, this.getConfiguration(configurations, "languageOrLocale", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_GUIDE_COLOR, this.getConfiguration(configurations, "guideColor", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_CONFIRMATION, this.getConfiguration(configurations, "suppressConfirmation", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_HIDE_CARDIO_LOGO, this.getConfiguration(configurations, "hideCardIOLogo", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_SCAN, this.getConfiguration(configurations, "suppressScan", false)); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_USE_PAYPAL_ACTIONBAR_ICON, false); // THIS IS THE NEW OPTION
            this.cordova.startActivityForResult(this, scanIntent, REQUEST_CARD_SCAN);
        }
    

    在这种情况下,我将这个新选项硬编码为 false,但您可以实现 getConfiguration() 方法从您的 ionic 页面设置此选项。

    完成这 2 项更改后,再次将您的 android 平台添加到您的项目中(以下载最新的 SDK v5.5.1):

    ionic cordova platfrom add android
    

    就是这样,PayPal 标志不见了!

    【讨论】:

      猜你喜欢
      • 2013-12-05
      • 2013-11-11
      • 2014-08-09
      • 2020-08-15
      • 1970-01-01
      • 2022-05-10
      • 1970-01-01
      • 2014-06-30
      • 2016-06-01
      相关资源
      最近更新 更多