Unable to find explicit activity class in PayUCheckoutPro Payumoney PaymentGateways Integration

427 Views Asked by At

here is my manifest

   /*Pay-U Money*/
implementation 'in.payu:payu-checkout-pro:1.7.5'
implementation 'in.payu:olamoney:1.1.0'
implementation 'in.payu:phonepe-intent:1.6.1'
implementation 'in.payu:payu-gpay:1.4.0'

this is my on-create function in activity

 override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_offer_redeem_by_me)


    val paymentParams = preparePayUBizParams()
    initUiSdk(paymentParams)
}
fun preparePayUBizParams(): PayUPaymentParams {

    val additionalParamsMap: HashMap<String, Any?> = HashMap()
    additionalParamsMap[PayUCheckoutProConstants.CP_UDF1] = "udf1"
    additionalParamsMap[PayUCheckoutProConstants.CP_UDF2] = "udf2"
    additionalParamsMap[PayUCheckoutProConstants.CP_UDF3] = "udf3"
    additionalParamsMap[PayUCheckoutProConstants.CP_UDF4] = "udf4"
    additionalParamsMap[PayUCheckoutProConstants.CP_UDF5] = "udf5"

    return PayUPaymentParams.Builder().setAmount(amount)
            .setIsProduction(true)
            .setKey(PaymentParams.PRODUCTION_MERCHANT_KEY.toString())
            .setProductInfo("Macbook Pro")
            .setPhone(phone.toString())
            .setTransactionId(System.currentTimeMillis().toString())
            .setFirstName("Abc")
            .setEmail(email)
            .setSurl(surl)
            .setFurl(furl)
            .setUserCredential("f")
            .setAdditionalParams(additionalParamsMap)
            .build()
}

private fun initUiSdk(payUPaymentParams: PayUPaymentParams) {
    PayUCheckoutPro.open(
            this,
            payUPaymentParams,
            object : PayUCheckoutProListener {

                override fun onPaymentSuccess(response: Any) {
                    Log.d("aalkfnaljfna","afasf")
                }

                override fun onPaymentFailure(response: Any) {
                    Log.d("aalkfnaljfna","afasf")
                }

                override fun onPaymentCancel(isTxnInitiated: Boolean) {
                    Log.d("aalkfnaljfna","asfasf")
                }

                override fun onError(errorResponse: ErrorResponse) {

                    val errorMessage: String
                    if (errorResponse != null && errorResponse.errorMessage != null && errorResponse.errorMessage!!.isNotEmpty())
                        errorMessage = errorResponse.errorMessage!!
                    else
                        errorMessage = resources.getString(R.string.some_error_occurred)

                    Log.d("aalkfnaljfna",errorMessage.toString())

                }

                override fun generateHash(
                        map: HashMap<String, String?>,
                        hashGenerationListener: PayUHashGenerationListener
                ) {
                    if (map.containsKey(PayUCheckoutProConstants.CP_HASH_STRING)
                            && map.containsKey(PayUCheckoutProConstants.CP_HASH_STRING) != null
                            && map.containsKey(PayUCheckoutProConstants.CP_HASH_NAME)
                            && map.containsKey(PayUCheckoutProConstants.CP_HASH_NAME) != null
                    ) {

                        val hashData = map[PayUCheckoutProConstants.CP_HASH_STRING]
                        val hashName = map[PayUCheckoutProConstants.CP_HASH_NAME]

                        var hash: String? = null

                        //Below hash should be calculated only when integrating Multi-currency support. If not integrating MCP
                        // then no need to have this if check.
                        if (hashName.equals(PayUCheckoutProConstants.CP_LOOKUP_API_HASH, ignoreCase = true)){

                            //Calculate HmacSHA1 hash using the hashData and merchant secret key
                            hash = HashGenerationUtils.generateHashFromSDK(
                                    hashData!!,
                                    PaymentParams.PRODUCTION_SALT.toString(),
                                    PaymentParams.PRODUCTION_MERCHANT_ID
                            )
                        } else {
                            //calculate SDH-512 hash using hashData and salt
                            hash = HashGenerationUtils.generateHashFromSDK(
                                    hashData!!,
                                    PaymentParams.PRODUCTION_SALT.toString()
                            )
                        }

                        if (!TextUtils.isEmpty(hash)) {
                            val hashMap: HashMap<String, String?> = HashMap()
                            hashMap[hashName!!] = hash!!
                            hashGenerationListener.onHashGenerated(hashMap)
                        }
                    }
                }

                override fun setWebViewProperties(webView: WebView?, bank: Any?) {
                }
            })
}

i getting this error in log when print onError response in to logcat

2021-10-22 16:19:01.163 16468-16468/com.example.myAppname D/aalkfnaljfna: Unable to find explicit activity class {com.example.myAppname/com.payu.ui.view.activities.CheckoutActivity}; have you declared this activity in your AndroidManifest.xml?

note :- i tried to write these activity in manifest and it opens the payment sceen but then it gives activitynotfound exception for next activity

-if anyone reaquired more information than please comment below

EDIT:

after mension CheckoutActivity in manifest i got this error in run logcat

W/System.err: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.redjinni/com.payu.upisdk.upiintent.PaymentResponseUpiSdkActivity}; have you declared this activity in your AndroidManifest.xml?
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1941)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1620)
        at android.app.Activity.startActivityForResult(Activity.java:4541)
W/System.err:     at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:597)
        at android.app.Activity.startActivityForResult(Activity.java:4499)
        at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:583)
        at android.app.Activity.startActivity(Activity.java:4860)
        at android.app.Activity.startActivity(Activity.java:4828)
        at com.payu.upisdk.Upi.makePayment(SourceFile:174)
        at com.payu.upisdk.UpiWrapper.makePayment(SourceFile:30)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.payu.custombrowser.wrapper.b.a(SourceFile:219)
        at com.payu.custombrowser.CustomBrowser.a(SourceFile:163)
W/System.err:     at com.payu.custombrowser.CustomBrowser.addCustomBrowser(SourceFile:115)
        at com.payu.checkoutpro.utils.f.a(SourceFile:1150)
        at com.payu.checkoutpro.models.k.a(SourceFile:386)
        at com.payu.checkoutpro.models.k.a(SourceFile:85)
        at com.payu.checkoutpro.models.k.onHashGenerated(SourceFile:2)
        at com.payu.ui.viewmodel.j.onHashGenerated(SourceFile:15)
        at com.example.redjinni.Activitys.Offer_redeem_by_me$initUiSdk$1.generateHash(Offer_redeem_by_me.kt:129)
        at com.payu.ui.viewmodel.j.generateHash(SourceFile:3)
        at com.payu.checkoutpro.utils.c.a(SourceFile:573)
        at com.payu.checkoutpro.layers.PayUbizApiLayer.a(SourceFile:10)
W/System.err:     at com.payu.checkoutpro.layers.PayUbizApiLayer.makePayment(SourceFile:32)
        at com.payu.ui.viewmodel.o.c(SourceFile:31)
        at com.payu.ui.view.fragments.y3.onClick(SourceFile:303)
        at android.view.View.performClick(View.java:6310)
        at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
        at android.view.View$PerformClick.run(View.java:24970)
        at android.os.Handler.handleCallback(Handler.java:794)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:176)
        at android.app.ActivityThread.main(ActivityThread.java:6662)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
W/Looper: Slow Frame: doFrame is 434ms late

edited manifest file

<activity
        android:name="com.payu.ui.view.activities.CheckoutActivity"
        android:label="Preferences">
        <intent-filter>
            <action android:name="com.payu.ui.view.activities.CheckoutActivity" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
0

There are 0 best solutions below