Closed bharatkumaremani closed 4 years ago
I have called this PHP to hash generation and the sdk throws (some error occuered ) toast. hash generation used by me. https://gist.github.com/mayur19/26417eeba02f5e5ced8138f4d9040d6a
RequestQueue requestQueue = Volley.newRequestQueue(this); String URL = "https://www.myappdemo.com/payumoney/payUmoneyHashGenerator.php"; StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, new com.android.volley.Response.Listener<String>() { @Override public void onResponse(String response) { Log.e("VOLLEY", response); try { JSONObject result = new JSONObject(response.toString()); String merchantHash=result.getString("result"); payNowButton.setEnabled(true); if (merchantHash.isEmpty() || merchantHash.equals("")) { Toast.makeText(MainActivity.this, "Could not generate hash", Toast.LENGTH_SHORT).show(); } else { mPaymentParams.setMerchantHash(merchantHash); if (AppPreference.selectedTheme != -1) { PayUmoneyFlowManager.startPayUMoneyFlow(mPaymentParams, MainActivity.this, AppPreference.selectedTheme, mAppPreference.isOverrideResultScreen()); } else { PayUmoneyFlowManager.startPayUMoneyFlow(mPaymentParams, MainActivity.this, R.style.AppTheme_default, mAppPreference.isOverrideResultScreen()); } } } catch (JSONException e) { e.printStackTrace(); } } }, new com.android.volley.Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { AppEnvironment appEnvironment = ((BaseApplication) getApplication()).getAppEnvironment(); Map<String, String> params = new HashMap<String, String>(); params.put("key",appEnvironment.merchant_Key() ); params.put("txnId", txnId); params.put("amount", String.valueOf(amount)); params.put("productInfo",productName); params.put("firstName", firstName); params.put("email", email); params.put("udf1",""); params.put("udf2",""); params.put("udf3",""); params.put("udf4",""); params.put("udf5",""); return params; } @Override protected com.android.volley.Response<String> parseNetworkResponse(NetworkResponse response) { String parsed; try { parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers)); } catch (UnsupportedEncodingException e) { parsed = new String(response.data); } return com.android.volley.Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response)); } }; requestQueue.add(stringRequest);
this is my code
Better dont prefer String.valueOf(amount) while giving params,better convert before and put
I have called this PHP to hash generation and the sdk throws (some error occuered ) toast. hash generation used by me. https://gist.github.com/mayur19/26417eeba02f5e5ced8138f4d9040d6a
this is my code