PayTM校验和在Android Activity中给出了异常错误,但在主要方法中工作正常

时间:2018-10-19 03:25:00

标签: java android android-studio java-security paytm

我正在尝试将Paytm 与我的android应用程序集成。 当我通过活动生成 paytm校验和时,我遇到了以下异常。

I/System.out: MerchantActivity.java checkSumGenerationOnload-method Starts
I/System.out: ChecksumGeneration.java getCheckSum-method Starts
I/System.out: -----------------------------
    40c19e8b2516d6e057c8027826724fac33d3bf60ac8d697569d422571ae46321fro3
    -----------------------------
W/System.err: java.security.NoSuchProviderException: No such provider: SunJCE
W/System.err:     at javax.crypto.Cipher.getInstance(Cipher.java:466)
        at com.paytm.pg.crypto.AesEncryption.encrypt(AesEncryption.java:34)
        at com.paytm.pg.merchant.CheckSumServiceHelper.genrateCheckSum(CheckSumServiceHelper.java:53)
        at com.example.merchantapp.ChecksumGeneration.getCheckSum(ChecksumGeneration.java:40)
W/System.err:     at com.example.merchantapp.MerchantActivity.checkSumGenerationOnload(MerchantActivity.java:41)

但是当我在主方法中运行该方法时,相同的方法给出正确的结果

日志跟踪:

getCheckSumChecksumGeneration.java getCheckSum-method Starts
checkSum: 3kLAvt33DJwodOF/vAPOqrW4LDN3bPbyEBXX10sjgFdjdp6CIS36H4kFj8lwUBnDHEzpo7J0CZlcmi3RCWZQAzN82zi/pPv7vH86iFf3MKU=
ChecksumGeneration.java getCheckSum-method Ends

代码段: 活动分类-遇到问题

public class ChecksumGeneration {

    //Below parameters provided by Paytm

    private static String MID = "MyLife19xxxxxxx";
    private static String MercahntKey = "WtxzWMOnZIj0ddU_";
    private static String INDUSTRY_TYPE_ID = "Retail";
    private static String CHANNLE_ID = "WAP";
    private static String WEBSITE = "APPSTAGING";
    private static String CALLBACK_URL =  "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=ORDER45676";

    public static void main(String s[]){
        System.out.print("getCheckSum");
        getCheckSum();
    }

    public static String getCheckSum(){

        String checkSum = null;

        TreeMap<String,String> paramMap = new TreeMap<String,String>();
        paramMap.put("MID" , MID);
        paramMap.put("ORDER_ID" , "ORDER45676");
        paramMap.put("CUST_ID" , "CUST02513");
        paramMap.put("INDUSTRY_TYPE_ID" , INDUSTRY_TYPE_ID);
        paramMap.put("CHANNEL_ID" , CHANNLE_ID);
        paramMap.put("TXN_AMOUNT" , "1.00");
        paramMap.put("WEBSITE" , WEBSITE);
        paramMap.put("EMAIL" , "thiruppathi.me@gmail.com");
        paramMap.put("MOBILE_NO" , "99425xxxxx");
        paramMap.put("CALLBACK_URL" , CALLBACK_URL);

        try{
        System.out.println("ChecksumGeneration.java getCheckSum-method Starts");
        checkSum =  CheckSumServiceHelper.getCheckSumServiceHelper().genrateCheckSum(MercahntKey, paramMap);
        System.out.println("checkSum: "+ checkSum);

        paramMap.put("CHECKSUMHASH" , checkSum);

        System.out.println("ChecksumGeneration.java getCheckSum-method Ends");

        }catch(Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return checkSum;
    }
}

0 个答案:

没有答案