Response
Import the following classes into your Activity.
import com.ccpp.my2c2psdk.cores.My2c2pResponse;
Once the library process is completed and returned to your activity, onActivityResult()be called. You'll need to override onActivityResult() to received the intent result.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_SDK) {
//You can check the result based on the resultCode
if(resultCode == RESULT_CANCELED){
Log.d(TAG, "Transaction is canceled");
}else if(resultCode == RESULT_OK){
My2c2pResponse response = data.getExtras().getParcelable(My2c2pResponse.RESPONSE);
Log.d(TAG, "res code: " +response.getRespCode());
Log.d(TAG, "res status: "+response.getStatus());
}
//Alternatively, you can directly check the result based on the intent data returned
if(data!=null){
My2c2pResponse response = data.getExtras().getParcelable(My2c2pResponse.RESPONSE);
Log.d(TAG, "res code: " +response.getRespCode());
Log.d(TAG, "res status: "+response.getStatus());
if(response.geRespCode().equals("301")){
Log.d(TAG, "Transaction is canceled");
}
}
}
}
The intent extra data with the key My2c2pResponse.RESPONSE will be returned. The format of the response is My2c2pResponse.
Check the complete response detail and the response code