Coder Social home page Coder Social logo

Comments (3)

krish-saffire avatar krish-saffire commented on September 16, 2024

We have purchased BBPOS Chippier BT 2X from posportal (https://partner.posportal.com/authorizenet/auth/credit-card-readers/anywherecommerce-walker-c2x-for-authorizenet.html). And we would like to integrate this with an Android app. The app is basically going to be used in a Box office kind of setting (to sell tickets), that is our end users are merchants. So as per our understanding, we should be using In-person SDK.
We have gone through the github readme (https://github.com/AuthorizeNet/inperson-sdk-android) as well as the overview doc (https://developer.authorize.net/api/reference/features/in-person.html). However we still have some more questions.

  1. For starters, when we try to create a sample Android application by integrating the emv-anet-sdk as a library module, we are getting into a crash. The crashlog is given below. We use Kotlin, and work on Android studio 3.6.2 . Our app targets API 29 with a minimum supported version of API 26.
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.companyname.bbposintegrator, PID: 7225
    java.lang.NoClassDefFoundError: Failed resolution of: Lorg/spongycastle/util/encoders/Base64;
        at net.authorize.aim.emv.QuickChipActivity.ॱ(:726)
        at net.authorize.aim.emv.QuickChipActivity.onReturnCheckCardResult(:652)
        at net.authorize.aim.emv.І$ǃ.onReturnCheckCardResult(:157)
        at com.bbpos.bbdevice.BBDeviceController$82.run(:3270)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7076)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.spongycastle.util.encoders.Base64" on path: DexPathList[[zip file "/data/app/com.quintetsolutions.bbposintegrator-R5iJPybUY4b3N4RbcgkBkQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.bbposintegrator-R5iJPybUY4b3N4RbcgkBkQ==/lib/arm64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at net.authorize.aim.emv.QuickChipActivity.ॱ(:726) 
        at net.authorize.aim.emv.QuickChipActivity.onReturnCheckCardResult(:652) 
        at net.authorize.aim.emv.І$ǃ.onReturnCheckCardResult(:157) 
        at com.bbpos.bbdevice.BBDeviceController$82.run(:3270) 
        at android.os.Handler.handleCallback(Handler.java:873) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7076) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965) 

And the code is given below. Removed unimportant parts for ease of reading. You can see that we just authenticate using PasswordAuthentication, and on successful authentication, try to search for BBPOS device. If the swiper is found, we will call startQuickChipTransaction. This will open the SDK payment dialog with text "Please swipe card". However, when we swipe any card, the SDK will crash with the error above. 

private fun authenticate() {
        AuthenticationTask().execute()
    }

    inner class AuthenticationTask : AsyncTask<Void, Void, Merchant>() {
        override fun onPostExecute(result: Merchant?) {
            super.onPostExecute(result)
            if (merchant != null) {
                startBTScan()
            }
        }
        override fun doInBackground(vararg params: Void?): Merchant? {
            val deviceID = "Test EMV Android"
            val passAuth = PasswordAuthentication.createMerchantAuthentication(MY_USERNAME, MY_PASSWORD, deviceID)
            merchant = Merchant.createMerchant(environment, passAuth)
            if (merchant != null) {
                val transaction: Transaction = merchant!!.createMobileTransaction(TransactionType.MOBILE_DEVICE_LOGIN)
                val mobileDevice = MobileDevice.createMobileDevice(deviceID,"Device description", "425-555-0000", "Android")
                transaction.mobileDevice = mobileDevice
                val result = merchant?.postTransaction(transaction) as net.authorize.mobile.Result

                if (result.isOk()) {
                    try {
                        val sessionTokenAuthentication = SessionTokenAuthentication.createMerchantAuthentication(merchant!!
                            .getMerchantAuthentication().getName(), result
                            .getSessionToken(), "Test EMV Android")
                        if (result.getSessionToken() != null&& sessionTokenAuthentication != null) {
                            merchant?.setMerchantAuthentication(sessionTokenAuthentication)
                        }
                        return merchant
                    } catch (ex: Exception) {
                        ex.printStackTrace()
                        return null
                    }
                }
            }
            return null
        }
    }

    private fun startBTScan() {
        EMVTransactionManager.setDeviceConnectionType(EMVDeviceConnectionType.BLUETOOTH)
        EMVTransactionManager.setTerminalMode(EMVTransactionManager.TerminalMode.SWIPE_ONLY)
        EMVTransactionManager.startBTScan(this@MainActivity, mListener);
    }

    val mListener = object :EMVTransactionManager.QuickChipTransactionSessionListener {
        override fun onBluetoothDeviceConnected(p0: BluetoothDevice?) {
            appendLog("onBluetoothDeviceConnected " + p0?.name)
            val emvTransaction = EMVTransactionManager.createEMVTransaction(merchant, BigDecimal(0.01))
            emvTransaction.emvTransactionType = EMVTransactionType.PAYMENT
            EMVTransactionManager.startQuickChipTransaction(emvTransaction, this, this@MainActivity)
        }

        override fun onReturnBluetoothDevices(p0: MutableList<BluetoothDevice>?) {
            appendLog("onReturnBluetoothDevices")
            p0?.let { array ->
                for (device in array) {
                    if (isBBPOSSwiper(device)) {
                        EMVTransactionManager.connectBTDevice(this@MainActivity, device, this)
                    }
                }
            }
        }
    }

Let us know if any other information is needed. 

  1. Basically, we are only interested in Swipe transactions for now (not tap or dip). Could you confirm whether we are approaching this right by using startQuickChipTransaction method for non-EMV encrypted swipe transactions, correct?
  2. In the above code (as well as the SDK sample), we need to pass on the merchant username and password. As we already mentioned, our end users are merchant so the app need to get the username and password for all merchants from the server. Is there any other way for authentication (like any transactionKey) so that we don't have to pass the username/password of the merchant to the mobile app?
  3. Is there any other documentation other than that I linked above? Where can we see the documentation of individual methods that I used in the code above?

Let us know.

@iamjayanth , did you get any update on this as i am also looking for the same response in same scenario ?

from inperson-sdk-android.

nathanoertel avatar nathanoertel commented on September 16, 2024

Pretty old issue but you need to add:
implementation 'com.madgag.spongycastle:prov:1.53.0.0'
to your build.gradle file

from inperson-sdk-android.

rockers007 avatar rockers007 commented on September 16, 2024

@iamjayanth : Can you help me for this issue #82 ?

from inperson-sdk-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.