#zishaansunderji-android

1 messages · Page 1 of 1 (latest)

rich flare
vital hazel
#
    fun createPayment(options: ReadableMap?) {
        val currActivity = reactApplicationContext.currentActivity
        val paymentIntentCallback: PaymentIntentCallback = object : PaymentIntentCallback {
            override fun onSuccess(@Nonnull paymentIntent: PaymentIntent) {
                pendingCreatePaymentIntent = Terminal.getInstance().collectPaymentMethod(paymentIntent, object : PaymentIntentCallback {
                    override fun onSuccess(@Nonnull collectedIntent: PaymentIntent) {
                        // If it's processing the transaction then processPayment
                        pendingCreatePaymentIntent = null
                        Terminal.getInstance().processPayment(collectedIntent, object : PaymentIntentCallback {
                            override fun onSuccess(@Nonnull confirmedIntent: PaymentIntent) {
                                  ...
                                }
                            }

                            override fun onFailure(@Nonnull e: TerminalException) {
                              ...
                              
                        })
                    }

                    override fun onFailure(@Nonnull e: TerminalException) {
                      ...
                    }
                })
            }

            override fun onFailure(@Nonnull e: TerminalException) {
                val paymentCreationMap = Arguments.createMap()
                paymentCreationMap.putString(constants.ERROR, e.errorMessage)
                paymentCreationMap.putInt(constants.CODE, e.errorCode.ordinal)
                sendEvent(constants.EVENT_PAYMENT_CREATION, paymentCreationMap)
            }
        }

        var paymentIntent: String? = null
        if (options!!.hasKey(constants.PAYMENT_INTENT)) paymentIntent = options.getString(constants.PAYMENT_INTENT) {
          ...
        }  else {
        ...
    }
#

For reference this is the code it just by-passes in test mode

#

We have no use-case to be fancy in the pre-auth and capture steps so in live mode we just let the sequence run - apologies for the sendEvent - the frontend is react native and we have a manager to make sense of the bridge - but treat the sendEvent function as just a return for us.

unreal jewel
#

Hello! Stepping in and catching up....

unreal jewel
#

Hmm I think the simulated reader is .... simulating everything, so it also simulates collecting card information without actually prompting anything

#

I think you would want to test on a real device