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!");
}
}
}