"Произошла какая-то ошибка" - сообщение о тосте при интеграции платежного шлюза payu в приложение для Android

Я следовал за документацией с сайта документации PayU.

Я проверил это с помощью ключей отладки, а затем попытался установить setIsDebug() в true (LIVE) и передал действительные учетные данные, но все еще получает ту же ошибку. Мой код:

Основная деятельность:

package com.example.itachi.com.payutest;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.payu.india.Extras.PayUChecksum;
import com.payu.india.Model.PaymentParams;
import com.payu.india.Model.PayuConfig;
import com.payu.india.Payu.Payu;
import com.payumoney.core.PayUmoneySdkInitializer;
import com.payumoney.sdkui.ui.utils.PayUmoneyFlowManager;

public class MainActivity extends AppCompatActivity {    

    private String merchantKey, userCredentials;

    // These will hold all the payment parameters
    private PaymentParams mPaymentParams;

    // This sets the configuration
    private PayuConfig payuConfig;

    private PayUChecksum checksum;    

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Payu.setInstance(this);    
    }

    public void navigateToBaseActivity(View view) {

        PayuUtils mm = new PayuUtils();
        PayuUtils.PayuHash m = new PayuUtils.PayuHash();

        m.setKey("your merchant key");
        m.setAmount("12.23");
        m.setEmail("john@gmail.com");
        m.setTxnid("1323");
        m.setFirstname("John");
        m.setProductinfo("Mobile");
        m.setPhone("9999999999");

        mm.setHash(m);

        PayUmoneySdkInitializer.PaymentParam.Builder builder = mm.init();
        //declare paymentParam object
        PayUmoneySdkInitializer.PaymentParam paymentParam = builder.build();
//set the hash

        paymentParam.setMerchantHash(mm.gernerateMyHash(this));

        PayUmoneyFlowManager.startPayUMoneyFlow(paymentParam,
                this, R.style.AppTheme_default, false);
    }  
}

PayuUtils:

package com.example.itachi.com.payutest;

import android.content.Context;

import com.payumoney.core.PayUmoneySdkInitializer;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Created by ITACHI on 11-02-2018.
 */

public class PayuUtils {
    public PayuHash hash;    

    public PayuHash getHash() {
        return hash;
    }

    public void setHash(PayuHash hash) {
        this.hash = hash;
    }

    public static class PayuHash {
        private String key;
        private String txnid;
        private String amount;
        private String productinfo;
        private String firstname;
        private String email;
        private String phone;

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getTxnid() {
            return txnid;
        }

        public void setTxnid(String txnid) {
            this.txnid = txnid;
        }

        public String getAmount() {
            return amount;
        }

        public void setAmount(String amount) {
            this.amount = amount;
        }

        public String getProductinfo() {
            return productinfo;
        }

        public void setProductinfo(String productinfo) {
            this.productinfo = productinfo;
        }

        public String getFirstname() {
            return firstname;
        }

        public void setFirstname(String firstname) {
            this.firstname = firstname;
        }

        public String getEmail() {
            return email;
        }

        public void setEmail(String email) {
            this.email = email;
        }

        public String getPhone() {
            return phone;
        }

        public void setPhone(String phone) {
            this.phone = phone;
        }
    }

    public String gernerateMyHash(Context context) {
//        String hashSequence = key|txnid|amount|productinfo|firstname|email| + salt;
// key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||salt

        String hashSequence = hash.key + "|" + hash.txnid + "|" + hash.amount + "|" + hash.productinfo + "|" + hash.firstname + "|" + hash.email + "|||||||||||"+" salt";
        String serverCalculatedHash = hashCal("SHA-512", hashSequence);

        return serverCalculatedHash;
    }

    private String hashCal(String type, String hashString) {
        StringBuilder hash = new StringBuilder();
        MessageDigest messageDigest = null;
        try {
            messageDigest = MessageDigest.getInstance(type);
            messageDigest.update(hashString.getBytes());
            byte[] mdbytes = messageDigest.digest();
            for (byte hashByte : mdbytes) {
                hash.append(Integer.toString((hashByte & 0xff) + 0x100, 16).substring(1));
            }
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return hash.toString();
    }    

    public PayUmoneySdkInitializer.PaymentParam.Builder init()
    {
//        ransaction. Please use the sample code provided below to setup the SDK initializer.

//        The ‘udf’ fields below stand for ‘user defined field’. These are optional fields to pass custom information about the transaction to PayUmoney. You may pass up to 5 UDF fields.
        PayUmoneySdkInitializer.PaymentParam.Builder builder = new
                PayUmoneySdkInitializer.PaymentParam.Builder();
        builder.setAmount(Double.parseDouble(hash.amount))                          // Payment amount
                .setTxnId(hash.txnid)                                             // Transaction ID
                .setPhone(hash.phone)                                           // User Phone number
                .setProductName(hash.productinfo)                   // Product Name or description
                .setFirstName(hash.firstname)                              // User First name
                .setEmail(hash.email)                                            // User Email ID
                //.setsUrl(appEnvironment.surl())                    // Success URL (surl)
                .setsUrl("http://www.google.com")                    // Success URL (surl)
                //.setfUrl(appEnvironment.furl())                     //Failure URL (furl
                .setfUrl("http://www.facebook.com")                     //Failure URL (furl
                .setIsDebug(true)                              // Integration environment - true (Debug)/ false(Production)
                .setKey(hash.key)                        // Merchant key
                .setMerchantId("1723");  // not  founded what to put

        return builder;
    }
}

Logcat:

02-12 00:20:23.906 16366-16366/? I/art: Late-enabling -Xcheck:jni
02-12 00:20:23.942 16366-16366/com.example.itachi.com.payutest W/System: ClassLoader referenced unknown path: /data/app/com.example.itachi.com.payutest-1/lib/arm
02-12 00:20:23.976 16366-16366/com.example.itachi.com.payutest W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
02-12 00:20:24.101 16366-16389/com.example.itachi.com.payutest I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.3_RB1__release_AU (I741a3d36ca)
                                                                             OpenGL ES Shader Compiler Version: E031.29.00.00
                                                                             Build Date: 04/04/16 Mon
                                                                             Local Branch: mybranch19053788
                                                                             Remote Branch: quic/LA.BF.1.1.3_rb1.12
                                                                             Local Patches: NONE
                                                                             Reconstruct Branch: NOTHING
02-12 00:20:24.104 16366-16389/com.example.itachi.com.payutest I/OpenGLRenderer: Initialized EGL, version 1.4
02-12 00:20:24.104 16366-16389/com.example.itachi.com.payutest D/OpenGLRenderer: Swap behavior 1
02-12 00:20:24.107 16366-16389/com.example.itachi.com.payutest W/Adreno-ES20: <get_gpu_clk:229>: open failed: errno 13
02-12 00:20:31.613 16366-16366/com.example.itachi.com.payutest D/SdkHelper: isvalidEmail : true
02-12 00:20:31.613 16366-16366/com.example.itachi.com.payutest D/SdkHelper: isValidNumber : 9874561230
02-12 00:20:31.613 16366-16366/com.example.itachi.com.payutest D/SdkHelper: isValidNumber : true
02-12 00:20:31.615 16366-16366/com.example.itachi.com.payutest D/hash: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
02-12 00:20:31.615 16366-16366/com.example.itachi.com.payutest D/param :: key - your merchant key
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: merchantId - 1723
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: txnid - 1323
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: amount - 12.23
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: surl - http://www.google.com
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: furl - http://www.facebook.com
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: productInfo - Mobile
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: email - john@gmail.com
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: firstName - John
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: phone - 9874561230
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf1 - 
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf2 - 
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf3 - 
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf4 - 
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf5 - 
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf6 - 
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf7 - 
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf8 - 
02-12 00:20:31.616 16366-16366/com.example.itachi.com.payutest D/param :: udf9 - 
02-12 00:20:31.617 16366-16366/com.example.itachi.com.payutest D/param :: udf10 - 
02-12 00:20:31.629 16366-16366/com.example.itachi.com.payutest W/System: ClassLoader referenced unknown path: /system/app/Chrome/lib/arm
02-12 00:20:31.631 16366-16366/com.example.itachi.com.payutest D/ApplicationLoaders: ignored Vulkan layer search path /system/app/Chrome/lib/arm:/system/app/Chrome/Chrome.apk!/lib/armeabi-v7a:/system/lib:/vendor/lib for namespace 0x82a1a090
02-12 00:20:31.635 16366-16366/com.example.itachi.com.payutest I/WebViewFactory: Loading com.android.chrome version 55.0.2883.91 (code 288309102)
02-12 00:20:31.674 16366-16366/com.example.itachi.com.payutest I/cr_LibraryLoader: Time to load native libraries: 5 ms (timestamps 6596-6601)
02-12 00:20:31.675 16366-16366/com.example.itachi.com.payutest I/cr_LibraryLoader: Expected native library version number "55.0.2883.91", actual native library version number "55.0.2883.91"
02-12 00:20:31.690 16366-16366/com.example.itachi.com.payutest I/cr_LibraryLoader: Expected native library version number "55.0.2883.91", actual native library version number "55.0.2883.91"
02-12 00:20:31.691 16366-16366/com.example.itachi.com.payutest I/chromium: [INFO:library_loader_hooks.cc(163)] Chromium logging enabled: level = 0, default verbosity = 0
02-12 00:20:31.705 16366-16366/com.example.itachi.com.payutest I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
02-12 00:20:31.721 16366-16366/com.example.itachi.com.payutest W/hi.com.payutest: type=1400 audit(0.0:19529): avc: denied { read } for name="gpuclk" dev="sysfs" ino=11414 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
02-12 00:20:31.723 16366-16366/com.example.itachi.com.payutest W/Adreno-ES20: <get_gpu_clk:229>: open failed: errno 13
02-12 00:20:31.831 16366-16366/com.example.itachi.com.payutest D/Clevertap: eventName : SDKInit
02-12 00:20:31.851 16366-16366/com.example.itachi.com.payutest D/Clevertap: eventData : {"ts":1518375031,"identity":"john@gmail.com","type":"event","evtData":{"MID":"1723","d_lang":"English","d_biohw":true,"u_lat":"","sdk_build":"7.1.0","d_scrn_res":"1080 * 1920","uuid":"56579813-8aa0-45fd-a01c-4d28baf81f80","d_osv":"7.1.2","app_name":"PayuTest","env":"DEBUG","d_os":"Android","EventSource":"SDK","d_ccid":"in","Platform":"Android","d_ua":"Mozilla\/5.0 (Linux; Android 7.1.2; ZUK Z1 Build\/NJH47F; wv) AppleWebKit\/537.36 (KHTML, like Gecko) Version\/4.0 Chrome\/55.0.2883.91 Mobile Safari\/537.36","d_nw_type":"4G","d_ss":"0","app_version_name":"1.0","d_make":"ZUK","isUserLoggedIn":false,"d_model":"ZUK Z1","u_lon":"","u_acu":"","app_id":"com.example.itachi.com.payutest","app_version_code":"1","d_mfg":"ZUK","pnp_version":"1.1.0","package_name":"com.example.itachi.com.payutest","device_id":"cd907527cbb8740d","d_rooted":true,"sdk_version":"9","d_locale":"en","ip":"10.38.108.171","d_scrn_sz":"13.766366812144597"},"evtName":"SDKInit"}
02-12 00:20:32.127 16366-16712/com.example.itachi.com.payutest D/NetworkSecurityConfig: No Network Security Config specified, using platform default
02-12 00:20:32.128 16366-16712/com.example.itachi.com.payutest W/System: ClassLoader referenced unknown path: /system/framework/tcmclient.jar
02-12 00:20:32.129 16366-16712/com.example.itachi.com.payutest W/System: Ignoring header UserSessionCookiePageUrl because its value was null.
02-12 00:20:32.325 16366-16389/com.example.itachi.com.payutest D/OpenGLRenderer: endAllActiveAnimators on 0xb39e2e00 (RippleDrawable) with handle 0x6e6393c0
02-12 00:20:34.279 16366-16366/com.example.itachi.com.payutest I/Difference: [ main: SourceFile: 361: onResponse() ] --> URL=/payment/app/v1/addPaymentTime=2184
02-12 00:20:38.349 16366-16948/com.example.itachi.com.payutest D/Clevertap: Response : { "status" : "success" , "processed" : 1 , "unprocessed" : [ ]}
02-12 00:20:38.351 16366-16948/com.example.itachi.com.payutest D/Clevertap: OnClevertapEventsLoggedSuccessful : file deleted

Скриншот:

Скриншот

Может ли кто-нибудь помочь, пожалуйста?

0 ответов

Другие вопросы по тегам