Где я могу получить ответ по интеграции платежей Citrus в Android
Я интегрировал шлюз оплаты цитрусовых в приложение для Android. Я не понимаю, где мне получить ответ... если транзакция прошла успешно или не удалась.
Вот мой код... проблема в том, что когда транзакция завершена или успешно завершена, библиотека оплаты цитрусовых отображает экран с соответствующим сообщением, и когда я нажимаю назад, я получаю результат в onActivityResult... Я хочу получить результат сразу после транзакции завершено... Спасибо, что я следующие шаги здесь: http://www.citruspay.com/DevelopersGuide/android/plugandplay.html
if (res.equalsIgnoreCase("true")) {
setupCitrusConfigs();
CitrusFlowManager.startShoppingFlow(CheckOut.this,
User_Email, Txt_Phone.getText().toString(), String.valueOf(Amt_Payable));
}
private void setupCitrusConfigs() {
CitrusFlowManager.initCitrusConfig("kkkkkkk-signup",
"dfdffgfdgfdgffdgdfgdfgdfgdfgfdg", "fgfgfdgfdg-signin",
"fgfdgdfgfdgfgfdgfgdfffd", getResources().getColor(R.color.white),
CheckOut.this, Environment.SANDBOX, "vvvvvvvvd", sandboxBillGeneratorURL,
returnUrlLoadMoney);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
// check if the request code is same as what is passed here it is 2
Log.d("CheckOut","request code " + requestCode + " resultcode " + resultCode);
if(requestCode == Constants.REQUEST_CODE_PAYMENT && resultCode == RESULT_OK && data != null) {
// You will get data here if transaction flow is started through pay options other than wallet
TransactionResponse transactionResponse = data.getParcelableExtra(Constants
.INTENT_EXTRA_TRANSACTION_RESPONSE);
// You will get data here if transaction flow is started through wallet
ResultModel resultModel = data.getParcelableExtra(ResultFragment.ARG_RESULT);
// Check which object is non-null
if(transactionResponse != null && transactionResponse.getJsonResponse() != null) {
try {
JSONObject json = new JSONObject(transactionResponse.getJsonResponse());
String Status = json.getString("TxStatus");
if(Status.equalsIgnoreCase("SUCCESS")){
db.EmptyCart();
Intent i = new Intent(CheckOut.this, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(i);
Log.e("Trans", "Transaction Successfull " + Status);
}else {
Log.e("Trans","Transaction Failed "+Status);
}
} catch (JSONException e1) {
e1.printStackTrace();
}
// Decide what to do with this data
Log.d(TAG, "transaction response" + transactionResponse.getJsonResponse());
} else if(resultModel != null && resultModel.getTransactionResponse() != null){
// Decide what to do with this data
try {
JSONObject json = new JSONObject(resultModel.getTransactionResponse().getJsonResponse());
String Status = json.getString("TxStatus");
if(Status.equalsIgnoreCase("SUCCESS")){
db.EmptyCart();
Intent i = new Intent(CheckOut.this, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(i);
Log.e("Trans", "Transaction Successfull " + Status);
}else {
Log.e("Trans","Transaction Failed "+Status);
}
} catch (JSONException e1) {
e1.printStackTrace();
}
} else {
Log.d(TAG, "Both objects are null!");
}
}
}
1 ответ
Оплатить с помощью дебетовой карты
CitrusClient citrusClient = CitrusClient.getInstance(context); // Activity Context
// No need to call init on CitrusClient if already done.
DebitCardOption debitCardOption = new DebitCardOption("Card Holder Name", "4111111111111111", "123", Month.getMonth("12"), Year.getYear("18"));
Amount amount = new Amount("5");
// Init PaymentType
PaymentType.PGPayment pgPayment = new PaymentType.PGPayment(amount, BILL_URL, debitCardOption, new CitrusUser("developercitrus@gmail.com","9876543210"));
citrusClient.simpliPay(pgPayment, new Callback<TransactionResponse>() {
@Override
public void success(TransactionResponse transactionResponse) { }
@Override
public void error(CitrusError error) { }
});
Оплатить с помощью кредитной карты
CitrusClient citrusClient = CitrusClient.getInstance(context); // Activity Context
// No need to call init on CitrusClient if already done.
CreditCardOption creditCardOption = new CreditCardOption("Card Holder Name", "4111111111111111", "123", Month.getMonth("12"), Year.getYear("18"));
Amount amount = new Amount("5");
// Init PaymentType
PaymentType.PGPayment pgPayment = new PaymentType.PGPayment(amount, BILL_URL, creditCardOption, new CitrusUser("developercitrus@gmail.com","9876543210"));
citrusClient.simpliPay(pgPayment, new Callback<TransactionResponse>() {
@Override
public void success(TransactionResponse transactionResponse) { }
@Override
public void error(CitrusError error) { }
});
Оплатить с помощью опции Net Banking
CitrusClient citrusClient = CitrusClient.getInstance(context); // Activity Context
// No need to call init on CitrusClient if already done.
NetbankingOption netbankingOption = new NetbankingOption("ICICI Bank","CID001");
// Init Net Banking PaymentType
PaymentType.PGPayment pgPayment = new PaymentType.PGPayment(amount, BILL_URL, netbankingOption, new CitrusUser("developercitrus@gmail.com","9876543210"));
citrusClient.simpliPay(pgPayment, new Callback<TransactionResponse>() {
@Override
public void success(TransactionResponse transactionResponse) { }
@Override
public void error(CitrusError error) { }
});