代码之家  ›  专栏  ›  技术社区  ›  Ajith

如何在设备屏幕后面的安卓设备上跟踪移动设备上的条纹点击错误?

  •  0
  • Ajith  · 技术社区  · 2 年前

    我一直关注着这方面的发展 github repository 但我只添加了具有NFC支持的真正android设备的点击移动功能。

    使用的终端SDK版本为:

    com.stripe:stripeterminal:2.15.0
    com.stripe:stripeterminal-localmobile:2.15.0
    

    在我的应用程序中,我有一个MainActivity和两个片段(比如Fragment1和Fragment2)。 片段1:从一组值中选择数量,此处没有添加其他值(MainActivity首先加载此片段) 片段2:显示所选金额,并在此片段中添加连接读取器和处理付款

    我的片段2面临的问题已添加,下面添加了处理付款。

    val config = ConnectionConfiguration.LocalMobileConnectionConfiguration("xxxxxxxxxxxxxxx");
    Terminal.getInstance().connectLocalMobileReader(
    firstReader,
    config,
    object : ReaderCallback {
    
        override fun onSuccess(reader: Reader) {
            Log.d("Custom Log", "Connected to mobile device");
            val params = PaymentIntentParameters.Builder()
                                                .setAmount(30)
                                                .setCurrency("gbp")
                                                .build();
    
            Terminal.getInstance().createPaymentIntent(params, object: PaymentIntentCallback {
    
                override fun onSuccess(paymentIntent: PaymentIntent) {
                    // Placeholder for collecting a payment method with paymentIntent
                    val collectConfig = CollectConfiguration.Builder()
                                                            .updatePaymentIntent(true)
                                                            .build();
    
                    val cancelable = Terminal.getInstance().collectPaymentMethod(paymentIntent,
                        object : PaymentIntentCallback {
    
                            override fun onSuccess(paymentIntent: PaymentIntent) {
                            val pm = paymentIntent.paymentMethod
                            val card = pm?.cardPresentDetails ?: pm?.interacPresentDetails
                            // Placeholder for business logic on card before processing paymentIntent
    
                            Terminal.getInstance().processPayment(paymentIntent, object : PaymentIntentCallback {
                                override fun onSuccess(paymentIntent: PaymentIntent) {
                                    // Placeholder for notifying your backend to capture paymentIntent.id
                                    Log.d("Custom Log","Process Payment : "+paymentIntent.id);
    
                                }
    
                                override fun onFailure(exception: TerminalException) {
                                    // Placeholder for handling the exception
                                    Log.d("Custom Log","Error errorMessage : " + exception.errorMessage);
                                }
                            })
    
                            }
    
                            override fun onFailure(exception: TerminalException) {
                            // Placeholder for handling exception
                            }
    
                        })
    
                }
    
                override fun onFailure(exception: TerminalException) {
                    Log.d("Custom Log","Error ReaderCallback : " + exception.errorMessage)
                }
            })
        }
        override fun onFailure(e: TerminalException) {
            Log.d("Custom Log","Error ReaderCallback : " + e.errorMessage)
        }
    });
    

    在上面的代码中,collectPaymentMethod为后面的点击带来了一个白色屏幕,我认为这是一个处理NFC读卡的新系统活动

    q1:是否可以自定义此屏幕视图?

    q2:当用实时卡点击此屏幕时,它会显示绿色屏幕的成功消息,即使该卡对测试付款无效,在错误的情况下我如何自定义

    q3:屏幕自动关闭并转到MainActivity:Fragment1,我如何抓住关闭并移动到fragment2而不是Fragment1。我找不到一个回调函数来处理这种情况

    我的点击屏幕和成功案例屏幕附在下面 enter image description here

    在处理上述代码的过程中,它陷入了onFailure,并出现错误: Your card was declined. Your request was in test mode, but used a non test (live) card. For a list of valid test cards

    如何使用应用程序中的自定义消息或信息处理此错误。

    总之,我需要对上面截图的白色屏幕进行一些定制,但我找不到任何文档或示例。有人请帮我整理一下这些案子

    提前感谢

    0 回复  |  直到 2 年前