@ -1,12 +0,0 @@ |
|||||||
package com.cst.im30; |
|
||||||
|
|
||||||
import com.cst.im30.activity.MainActivity; |
|
||||||
|
|
||||||
public class ICEchoClient extends EchoClient { |
|
||||||
|
|
||||||
public ICEchoClient(MainActivity context, String host) { |
|
||||||
super(context, host); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,25 +1,185 @@ |
|||||||
package com.cst.im30; |
package com.cst.im30; |
||||||
|
|
||||||
|
import android.annotation.SuppressLint; |
||||||
|
import android.app.AlarmManager; |
||||||
import android.app.Application; |
import android.app.Application; |
||||||
|
import android.app.PendingIntent; |
||||||
|
import android.content.Context; |
||||||
|
import android.content.Intent; |
||||||
|
import android.os.Build; |
||||||
|
import android.os.Handler; |
||||||
|
import android.os.Looper; |
||||||
import android.util.Log; |
import android.util.Log; |
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity; |
||||||
|
|
||||||
|
import com.bugfender.sdk.Bugfender; |
||||||
|
import com.cst.im30.activity.MainActivity; |
||||||
|
import com.cst.im30.model.CancelRequest; |
||||||
|
import com.cst.im30.model.CancelResponse; |
||||||
|
import com.cst.im30.model.EventLogDetailed; |
||||||
|
import com.cst.im30.model.InquiryRequest; |
||||||
|
import com.cst.im30.model.InquiryResponse; |
||||||
|
import com.cst.im30.model.PreAuthRequest; |
||||||
|
import com.cst.im30.model.PreAuthResponse; |
||||||
|
import com.cst.im30.model.SaleCompletionRequest; |
||||||
|
import com.cst.im30.model.SaleCompletionResponse; |
||||||
|
import com.cst.im30.model.SaleRequest; |
||||||
|
import com.cst.im30.model.SaleResponse; |
||||||
|
import com.cst.im30.model.SetDateTimeRequest; |
||||||
|
import com.cst.im30.model.SetDateTimeResponse; |
||||||
|
import com.cst.im30.model.SettlementRequest; |
||||||
|
import com.cst.im30.model.SettlementResponse; |
||||||
|
import com.cst.im30.model.VoidRequest; |
||||||
|
import com.cst.im30.model.VoidResponse; |
||||||
|
import com.cst.im30.utility.CloudWatchLogger; |
||||||
|
import com.cst.im30.utility.Logger; |
||||||
|
|
||||||
public class MainApplication extends Application { |
public class MainApplication extends Application { |
||||||
|
|
||||||
|
public static final int MAX_RETRY = 10; |
||||||
|
public static MainApplication instance; |
||||||
|
public static AppCompatActivity currentActivity; |
||||||
|
public static EchoClient paymentClient; |
||||||
|
public static EchoClient icClient; |
||||||
|
public static boolean paymentIsConnected = false; |
||||||
|
public static boolean icIsConnected = false; |
||||||
|
public static int failCountIC = 0; |
||||||
|
public static int failCountPayment = 0; |
||||||
|
public static boolean working = false; |
||||||
|
public static String incomingCode = null; |
||||||
|
public static String currentCode = null; |
||||||
|
public static EventLogDetailed currentEventLogDetailed = null; |
||||||
|
public static SaleRequest currentSaleRequest = null; |
||||||
|
public static SaleResponse currentSaleResponse = null; |
||||||
|
public static VoidRequest currentVoidRequest = null; |
||||||
|
public static VoidResponse currentVoidResponse = null; |
||||||
|
public static InquiryRequest currentInquiryRequest = null; |
||||||
|
public static InquiryResponse currentInquiryResponse = null; |
||||||
|
public static CancelRequest currentCancelRequest = null; |
||||||
|
public static CancelResponse currentCancelResponse = null; |
||||||
|
public static PreAuthRequest currentPreAuthRequest = null; |
||||||
|
public static PreAuthResponse currentPreAuthResponse = null; |
||||||
|
public static SaleCompletionRequest currentSaleCompletionRequest = null; |
||||||
|
public static SaleCompletionResponse currentSaleCompletionResponse = null; |
||||||
|
public static SettlementRequest currentSettlementRequest = null; |
||||||
|
public static SettlementResponse currentSettlementResponse = null; |
||||||
|
public static SetDateTimeRequest currentSetDateTimeRequest = null; |
||||||
|
public static SetDateTimeResponse currentSetDateTimeResponse = null; |
||||||
|
public static String code; |
||||||
|
public static String status; |
||||||
|
private CloudWatchLogger cloudWatchLogger; |
||||||
|
|
||||||
|
public static MainApplication getInstance() { |
||||||
|
return instance; |
||||||
|
} |
||||||
|
|
||||||
|
public static void reset() { |
||||||
|
working = false; |
||||||
|
incomingCode = null; |
||||||
|
currentCode = null; |
||||||
|
currentEventLogDetailed = null; |
||||||
|
currentSaleRequest = null; |
||||||
|
currentSaleResponse = null; |
||||||
|
currentVoidRequest = null; |
||||||
|
currentVoidResponse = null; |
||||||
|
currentInquiryRequest = null; |
||||||
|
currentInquiryResponse = null; |
||||||
|
currentCancelRequest = null; |
||||||
|
currentCancelResponse = null; |
||||||
|
currentPreAuthRequest = null; |
||||||
|
currentPreAuthResponse = null; |
||||||
|
currentSaleCompletionRequest = null; |
||||||
|
currentSaleCompletionResponse = null; |
||||||
|
currentSettlementRequest = null; |
||||||
|
currentSettlementResponse = null; |
||||||
|
currentSetDateTimeRequest = null; |
||||||
|
currentSetDateTimeResponse = null; |
||||||
|
code = null; |
||||||
|
status = null; |
||||||
|
|
||||||
|
//Logger.logD("RESET");
|
||||||
|
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void onCreate() { |
public void onCreate() { |
||||||
super.onCreate(); |
super.onCreate(); |
||||||
|
instance = this; |
||||||
|
|
||||||
|
this.cloudWatchLogger = new CloudWatchLogger(); |
||||||
|
|
||||||
|
initializeBugfender(); |
||||||
|
|
||||||
initializeCrashHandler(); |
initializeCrashHandler(); |
||||||
} |
} |
||||||
|
|
||||||
|
public void log(String logStreamName, String message) { |
||||||
|
this.cloudWatchLogger.log(BuildConfig.LOG_GROUP_NAME, logStreamName, message); |
||||||
|
} |
||||||
|
|
||||||
|
public void logICScan(String message) { |
||||||
|
this.cloudWatchLogger.log(BuildConfig.LOG_GROUP_NAME, "IcScanLog", message); |
||||||
|
} |
||||||
|
|
||||||
|
public void logPayment(String message) { |
||||||
|
this.cloudWatchLogger.log(BuildConfig.LOG_GROUP_NAME, "Payment", message); |
||||||
|
} |
||||||
|
|
||||||
|
public void logError(String message) { |
||||||
|
this.cloudWatchLogger.log(BuildConfig.LOG_GROUP_NAME, "Error", message); |
||||||
|
} |
||||||
|
|
||||||
|
@SuppressLint("MissingPermission") |
||||||
|
private void initializeBugfender() { |
||||||
|
Bugfender.init(this, BuildConfig.BUGFENDER_TOKEN, BuildConfig.DEBUG); |
||||||
|
|
||||||
|
String serialNumber; |
||||||
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
||||||
|
serialNumber = android.os.Build.getSerial(); |
||||||
|
} else { |
||||||
|
serialNumber = android.os.Build.SERIAL; |
||||||
|
} |
||||||
|
Bugfender.setDeviceString("Stage", BuildConfig.FLAVOR); |
||||||
|
Bugfender.setDeviceString("S/N", serialNumber); |
||||||
|
Bugfender.setDeviceString("Kiosk Code", BuildConfig.KIOSK_CODE); |
||||||
|
Bugfender.setDeviceString("Echo Server", BuildConfig.ECHO_SERVER_URL + ":" + BuildConfig.ECHO_SERVER_PORT); |
||||||
|
|
||||||
|
Bugfender.enableCrashReporting(); |
||||||
|
|
||||||
|
//Bugfender.enableLogcatLogging();
|
||||||
|
} |
||||||
|
|
||||||
private void initializeCrashHandler() { |
private void initializeCrashHandler() { |
||||||
Thread.setDefaultUncaughtExceptionHandler(this::handleUncaughtException); |
Thread.setDefaultUncaughtExceptionHandler(this::handleUncaughtException); |
||||||
|
|
||||||
|
//Logger.logV("Crash Handler Attached");
|
||||||
} |
} |
||||||
|
|
||||||
public void handleUncaughtException(Thread thread, Throwable e) { |
public void handleUncaughtException(Thread thread, Throwable e) { |
||||||
if (e instanceof Exception) { |
if (e instanceof Exception) { |
||||||
Log.e("CST-DBG", "Exception: " + Log.getStackTraceString(e)); |
Log.e(Logger.TAG, "Exception: " + Log.getStackTraceString(e)); |
||||||
System.out.println(); |
logError("Exception: " + Log.getStackTraceString(e)); |
||||||
|
Bugfender.sendIssue(e.getMessage(), Log.getStackTraceString(e)); |
||||||
|
} |
||||||
|
if (isUIThread()) { // exception occurred from UI thread
|
||||||
|
restartApp(); |
||||||
|
} else { //handle non UI thread throw uncaught exception
|
||||||
|
new Handler(Looper.getMainLooper()).post(this::restartApp); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
|
private boolean isUIThread() { |
||||||
|
return Looper.getMainLooper().getThread() == Thread.currentThread(); |
||||||
|
} |
||||||
|
|
||||||
|
@SuppressLint("UnspecifiedImmutableFlag") |
||||||
|
private void restartApp() { |
||||||
|
Intent intent = new Intent(getApplicationContext(), MainActivity.class); |
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); |
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(MainApplication.getInstance().getApplicationContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); |
||||||
|
AlarmManager mgr = (AlarmManager) MainApplication.getInstance().getApplicationContext().getSystemService(Context.ALARM_SERVICE); |
||||||
|
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, pendingIntent); |
||||||
|
System.exit(2); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -0,0 +1,522 @@ |
|||||||
|
package com.cst.im30; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.content.Intent; |
||||||
|
import android.os.Bundle; |
||||||
|
import android.widget.Toast; |
||||||
|
|
||||||
|
import com.cst.im30.common.Constants; |
||||||
|
import com.cst.im30.model.CancelRequest; |
||||||
|
import com.cst.im30.model.CancelResponse; |
||||||
|
import com.cst.im30.model.EventLogDetailed; |
||||||
|
import com.cst.im30.model.InquiryRequest; |
||||||
|
import com.cst.im30.model.InquiryResponse; |
||||||
|
import com.cst.im30.model.PreAuthRequest; |
||||||
|
import com.cst.im30.model.PreAuthResponse; |
||||||
|
import com.cst.im30.model.SaleCompletionRequest; |
||||||
|
import com.cst.im30.model.SaleCompletionResponse; |
||||||
|
import com.cst.im30.model.SaleRequest; |
||||||
|
import com.cst.im30.model.SaleResponse; |
||||||
|
import com.cst.im30.model.SetDateTimeRequest; |
||||||
|
import com.cst.im30.model.SetDateTimeResponse; |
||||||
|
import com.cst.im30.model.SettlementRequest; |
||||||
|
import com.cst.im30.model.SettlementResponse; |
||||||
|
import com.cst.im30.model.VoidRequest; |
||||||
|
import com.cst.im30.model.VoidResponse; |
||||||
|
import com.cst.im30.utility.Logger; |
||||||
|
import com.cst.im30.utility.PaymentUtils; |
||||||
|
|
||||||
|
public class PaymentHandler { |
||||||
|
|
||||||
|
private final Context context; |
||||||
|
|
||||||
|
public PaymentHandler(Context context) { |
||||||
|
this.context = context; |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionSale(EventLogDetailed eventLogDetailed) { |
||||||
|
SaleRequest request = PaymentUtils.createSaleRequest(eventLogDetailed); |
||||||
|
if (PaymentUtils.validateSaleRequest(request)) { |
||||||
|
MainApplication.getInstance().logPayment("[SALE]" + " Confirmation Number:" + eventLogDetailed.getConfirmationNumber() + " Reference Number:" + eventLogDetailed.getReferenceNumber() + " Amount:" + eventLogDetailed.getPayableAmount() + " Remark:" + eventLogDetailed.getRemark()); |
||||||
|
initSalePayment(request); |
||||||
|
} else { |
||||||
|
Toast.makeText(context, "Invalid Sale Request", Toast.LENGTH_SHORT).show(); |
||||||
|
Logger.logW("Invalid Sale Request: " + request.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionVoid(EventLogDetailed eventLogDetailed) { |
||||||
|
VoidRequest request = PaymentUtils.createVoidRequest(eventLogDetailed); |
||||||
|
if (PaymentUtils.validateVoidRequest(request)) { |
||||||
|
MainApplication.getInstance().logPayment("[VOID]" + " Confirmation Number:" + eventLogDetailed.getConfirmationNumber() + " Reference Number:" + eventLogDetailed.getReferenceNumber() + " Amount:" + eventLogDetailed.getPayableAmount() + " Remark:" + eventLogDetailed.getRemark()); |
||||||
|
initVoid(request); |
||||||
|
} else { |
||||||
|
Toast.makeText(context, "Invalid Void Request", Toast.LENGTH_SHORT).show(); |
||||||
|
Logger.logW("Invalid Void Request: " + request.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionInquiry(EventLogDetailed eventLogDetailed) { |
||||||
|
InquiryRequest request = PaymentUtils.createInquiryRequest(eventLogDetailed); |
||||||
|
if (PaymentUtils.validateInquiryRequest(request)) { |
||||||
|
MainApplication.getInstance().logPayment("[INQUIRY]" + " Confirmation Number:" + eventLogDetailed.getConfirmationNumber() + " Reference Number:" + eventLogDetailed.getReferenceNumber() + " Amount:" + eventLogDetailed.getPayableAmount() + " Remark:" + eventLogDetailed.getRemark()); |
||||||
|
initInquiry(request); |
||||||
|
} else { |
||||||
|
Toast.makeText(context, "Invalid Inquiry Request", Toast.LENGTH_SHORT).show(); |
||||||
|
Logger.logW("Invalid Inquiry Request: " + request.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionCancel() { |
||||||
|
CancelRequest request = new CancelRequest(); |
||||||
|
initCancel(request); |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionPreAuth(EventLogDetailed eventLogDetailed) { |
||||||
|
PreAuthRequest request = PaymentUtils.createPreAuthRequest(eventLogDetailed); |
||||||
|
if (PaymentUtils.validatePreAuthRequest(request)) { |
||||||
|
MainApplication.getInstance().logPayment("[PRE-AUTH]" + " Confirmation Number:" + eventLogDetailed.getConfirmationNumber() + " Reference Number:" + eventLogDetailed.getReferenceNumber() + " Amount:" + eventLogDetailed.getPayableAmount() + " Remark:" + eventLogDetailed.getRemark()); |
||||||
|
initPreAuth(request); |
||||||
|
} else { |
||||||
|
Toast.makeText(context, "Invalid Pre Auth Request", Toast.LENGTH_SHORT).show(); |
||||||
|
Logger.logW("Invalid Pre Auth Request: " + request.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionSaleCompletion(EventLogDetailed eventLogDetailed) { |
||||||
|
SaleCompletionRequest request = PaymentUtils.createSaleCompletionRequest(eventLogDetailed); |
||||||
|
if (PaymentUtils.validateSaleCompletionRequest(request)) { |
||||||
|
MainApplication.getInstance().logPayment("[SALE_COMPLETION]" + " Confirmation Number:" + eventLogDetailed.getConfirmationNumber() + " Reference Number:" + eventLogDetailed.getReferenceNumber() + " Amount:" + eventLogDetailed.getPayableAmount() + " Remark:" + eventLogDetailed.getRemark()); |
||||||
|
initSaleCompletion(request); |
||||||
|
} else { |
||||||
|
Toast.makeText(context, "Invalid Sale Completion Request", Toast.LENGTH_SHORT).show(); |
||||||
|
Logger.logW("Invalid Sale Completion Request: " + request.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionSettlement(EventLogDetailed eventLogDetailed) { |
||||||
|
SettlementRequest request = PaymentUtils.createSettlementRequest(eventLogDetailed); |
||||||
|
if (PaymentUtils.validateSettlementRequest(request)) { |
||||||
|
MainApplication.getInstance().logPayment("[SETTLEMENT]" + " Confirmation Number:" + eventLogDetailed.getConfirmationNumber() + " Reference Number:" + eventLogDetailed.getReferenceNumber() + " Amount:" + eventLogDetailed.getPayableAmount() + " Remark:" + eventLogDetailed.getRemark()); |
||||||
|
initSettlement(request); |
||||||
|
} else { |
||||||
|
Toast.makeText(context, "Invalid Settlement Request", Toast.LENGTH_SHORT).show(); |
||||||
|
Logger.logW("Invalid Settlement Request: " + request.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionSetDateTime(EventLogDetailed eventLogDetailed) { |
||||||
|
SetDateTimeRequest request = PaymentUtils.createSetDateTimeRequest(eventLogDetailed); |
||||||
|
if (PaymentUtils.validateSetDateTimeRequest(request)) { |
||||||
|
MainApplication.getInstance().logPayment("[SET DATE TIME]" + " Confirmation Number:" + eventLogDetailed.getConfirmationNumber() + " Reference Number:" + eventLogDetailed.getReferenceNumber() + " Amount:" + eventLogDetailed.getPayableAmount() + " Remark:" + eventLogDetailed.getRemark()); |
||||||
|
initSetDateTime(request); |
||||||
|
} else { |
||||||
|
Toast.makeText(context, "Invalid Set Date Time Request", Toast.LENGTH_SHORT).show(); |
||||||
|
Logger.logW("Invalid Set Date Time Request: " + request.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void initSalePayment(SaleRequest request) { |
||||||
|
Logger.logD("Direct Payment: " + request.toString()); |
||||||
|
MainApplication.getInstance().logPayment(request.toString()); |
||||||
|
|
||||||
|
Bundle extra = new Bundle(); |
||||||
|
extra.putString("pay_function", request.getPayFunction()); |
||||||
|
extra.putString("pay_amount", String.valueOf(request.getPayAmount())); |
||||||
|
extra.putString("pay_type", request.getPayType()); |
||||||
|
|
||||||
|
String payCameraMode = request.getPayCameraMode(); |
||||||
|
if (payCameraMode != null && !payCameraMode.isEmpty()) { |
||||||
|
extra.putString("pay_camera_mode", payCameraMode); |
||||||
|
} |
||||||
|
|
||||||
|
String payPosTxnId = request.getPayPosTxnId(); |
||||||
|
if (payPosTxnId != null && !payPosTxnId.isEmpty()) { |
||||||
|
extra.putString("pay_pos_txn_id", payPosTxnId); |
||||||
|
} |
||||||
|
|
||||||
|
extra.putString("pay_print_receipt_id", request.getPayPrintReceiptId()); |
||||||
|
|
||||||
|
MainApplication.currentSaleRequest = request; |
||||||
|
|
||||||
|
app2app(extra); |
||||||
|
} |
||||||
|
|
||||||
|
public void initVoid(VoidRequest request) { |
||||||
|
Logger.logD("Void Payment: " + request.toString()); |
||||||
|
MainApplication.getInstance().logPayment(request.toString()); |
||||||
|
|
||||||
|
Bundle extra = new Bundle(); |
||||||
|
|
||||||
|
extra.putString("pay_function", request.getPayFunction()); |
||||||
|
extra.putString("pay_amount", String.valueOf(request.getPayAmount())); |
||||||
|
extra.putString("pay_print_receipt_id", request.getPayPrintReceiptId()); |
||||||
|
extra.putString("pay_trace_no", request.getPayTraceNo()); |
||||||
|
extra.putString("pay_invoice_no", request.getPayInvoiceNo()); |
||||||
|
|
||||||
|
String payPosTxnId = request.getPayPosTxnId(); |
||||||
|
if (payPosTxnId != null && !payPosTxnId.isEmpty()) { |
||||||
|
extra.putString("pay_pos_txn_id", payPosTxnId); |
||||||
|
} |
||||||
|
|
||||||
|
MainApplication.currentVoidRequest = request; |
||||||
|
|
||||||
|
app2app(extra); |
||||||
|
} |
||||||
|
|
||||||
|
public void initCancel(CancelRequest request) { |
||||||
|
Logger.logD(request.toString()); |
||||||
|
MainApplication.getInstance().logPayment(request.toString()); |
||||||
|
|
||||||
|
Bundle extra = new Bundle(); |
||||||
|
extra.putString("pay_function", request.getPayFunction()); |
||||||
|
|
||||||
|
MainApplication.currentCancelRequest = request; |
||||||
|
|
||||||
|
app2app(extra); |
||||||
|
} |
||||||
|
|
||||||
|
public void initInquiry(InquiryRequest request) { |
||||||
|
Logger.logD(request.toString()); |
||||||
|
MainApplication.getInstance().logPayment(request.toString()); |
||||||
|
|
||||||
|
Bundle extra = new Bundle(); |
||||||
|
extra.putString("pay_function", request.getPayFunction()); |
||||||
|
extra.putString("pay_amount", request.getPayAmount()); |
||||||
|
extra.putString("pay_print_receipt_id", request.getPayPrintReceiptId()); |
||||||
|
extra.putString("pay_trace_no", request.getPayTraceNo()); |
||||||
|
extra.putString("pay_invoice_no", request.getPayInvoiceNo()); |
||||||
|
|
||||||
|
MainApplication.currentInquiryRequest = request; |
||||||
|
|
||||||
|
app2app(extra); |
||||||
|
} |
||||||
|
|
||||||
|
public void initPreAuth(PreAuthRequest request) { |
||||||
|
Logger.logD(request.toString()); |
||||||
|
MainApplication.getInstance().logPayment(request.toString()); |
||||||
|
|
||||||
|
Bundle extra = new Bundle(); |
||||||
|
extra.putString("pay_function", request.getPayFunction()); |
||||||
|
extra.putString("pay_amount", String.valueOf(request.getPayAmount())); |
||||||
|
|
||||||
|
String payPosTxnId = request.getPayPosTxnId(); |
||||||
|
if (payPosTxnId != null && !payPosTxnId.isEmpty()) { |
||||||
|
extra.putString("pay_pos_txn_id", payPosTxnId); |
||||||
|
} |
||||||
|
|
||||||
|
extra.putString("pay_print_receipt_id", request.getPayPrintReceiptId()); |
||||||
|
|
||||||
|
MainApplication.currentPreAuthRequest = request; |
||||||
|
|
||||||
|
app2app(extra); |
||||||
|
} |
||||||
|
|
||||||
|
public void initSaleCompletion(SaleCompletionRequest request) { |
||||||
|
Logger.logD(request.toString()); |
||||||
|
MainApplication.getInstance().logPayment(request.toString()); |
||||||
|
|
||||||
|
Bundle extra = new Bundle(); |
||||||
|
extra.putString("pay_function", request.getPayFunction()); |
||||||
|
extra.putString("pay_amount", String.valueOf(request.getPayAmount())); |
||||||
|
extra.putString("pay_auth_code", request.getPayAuthCode()); |
||||||
|
extra.putString("pay_ref_num", request.getPayRefNum()); |
||||||
|
|
||||||
|
String payPosTxnId = request.getPayPosTxnId(); |
||||||
|
if (payPosTxnId != null && !payPosTxnId.isEmpty()) { |
||||||
|
extra.putString("pay_pos_txn_id", payPosTxnId); |
||||||
|
} |
||||||
|
|
||||||
|
extra.putString("pay_print_receipt_id", request.getPayPrintReceiptId()); |
||||||
|
extra.putString("token", request.getToken()); |
||||||
|
|
||||||
|
MainApplication.currentSaleCompletionRequest = request; |
||||||
|
|
||||||
|
app2app(extra); |
||||||
|
} |
||||||
|
|
||||||
|
private void initSettlement(SettlementRequest request) { |
||||||
|
Logger.logD(request.toString()); |
||||||
|
MainApplication.getInstance().logPayment(request.toString()); |
||||||
|
|
||||||
|
Bundle extra = new Bundle(); |
||||||
|
extra.putString("pay_function", request.getPayFunction()); |
||||||
|
|
||||||
|
String payPosTxnId = request.getPayPosTxnId(); |
||||||
|
if (payPosTxnId != null && !payPosTxnId.isEmpty()) { |
||||||
|
extra.putString("pay_pos_txn_id", payPosTxnId); |
||||||
|
} |
||||||
|
|
||||||
|
extra.putString("pay_print_receipt_id", request.getPayPrintReceiptId()); |
||||||
|
|
||||||
|
MainApplication.currentSettlementRequest = request; |
||||||
|
|
||||||
|
app2app(extra); |
||||||
|
} |
||||||
|
|
||||||
|
private void initSetDateTime(SetDateTimeRequest request) { |
||||||
|
Logger.logD(request.toString()); |
||||||
|
MainApplication.getInstance().logPayment(request.toString()); |
||||||
|
|
||||||
|
Bundle extra = new Bundle(); |
||||||
|
extra.putString("pay_function", request.getPayFunction()); |
||||||
|
extra.putString("pay_pos_txn_date", request.getPayPosTxnDate()); |
||||||
|
extra.putString("pay_pos_txn_time", request.getPayPosTxnTime()); |
||||||
|
|
||||||
|
MainApplication.currentSetDateTimeRequest = request; |
||||||
|
|
||||||
|
app2app(extra); |
||||||
|
} |
||||||
|
|
||||||
|
private void app2app(Bundle bundle) { |
||||||
|
Intent intent = new Intent(Constants.APP_2_APP); |
||||||
|
intent.putExtras(bundle); |
||||||
|
|
||||||
|
Logger.logD("App2App Call to: " + Constants.APP_2_APP); |
||||||
|
MainApplication.getInstance().logPayment("App2App Call to: " + Constants.APP_2_APP); |
||||||
|
|
||||||
|
context.startActivity(intent); |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionSaleResponse(Bundle extra) { |
||||||
|
SaleResponse response = new SaleResponse(); |
||||||
|
|
||||||
|
response.setPayAmount(extra.getString("pay_amount")); |
||||||
|
response.setPayFunction(extra.getString("pay_function")); |
||||||
|
response.setPayType(extra.getString("pay_type")); |
||||||
|
response.setPayCameraMode(extra.getString("pay_camera_mode")); |
||||||
|
response.setPayPrintReceiptId(extra.getString("pay_print_receipt_id")); |
||||||
|
response.setPayRespTxnDate(extra.getString("pay_resp_txn_date")); |
||||||
|
response.setPayRespTxnTime(extra.getString("pay_resp_txn_time")); |
||||||
|
response.setPayRespInvoiceNo(extra.getString("pay_resp_invoice_no")); |
||||||
|
response.setPayRespTraceNo(extra.getString("pay_resp_trace_no")); |
||||||
|
response.setPayRespBatchNo(extra.getString("pay_resp_batch_no")); |
||||||
|
response.setPayRespScheme(extra.getString("pay_resp_scheme")); |
||||||
|
response.setPayRespTid(extra.getString("pay_resp_tid")); |
||||||
|
response.setPayRespMid(extra.getString("pay_resp_mid")); |
||||||
|
response.setPayRespCardAuthCode(extra.getString("pay_resp_card_auth_code")); |
||||||
|
response.setPayRespCardRefNum(extra.getString("pay_resp_card_ref_num")); |
||||||
|
response.setPayRespCardNo(extra.getString("pay_resp_card_no")); |
||||||
|
response.setPayRespIssuerId(extra.getString("pay_resp_issuer_id")); |
||||||
|
response.setPayRespCardAid(extra.getString("pay_resp_card_aid")); |
||||||
|
response.setPayRespCardAppCryptogram(extra.getString("pay_resp_card_app_cryptogram")); |
||||||
|
response.setPayRespQrTxnId(extra.getString("pay_resp_qr_txn_id")); |
||||||
|
response.setPayRespQrWalletId(extra.getString("pay_resp_qr_wallet_id")); |
||||||
|
response.setPayRespCustomerId(extra.getString("pay_resp_customer_id")); |
||||||
|
response.setPayRespCode(extra.getString("pay_resp_code")); |
||||||
|
response.setPayRespErrorDesc(extra.getString("pay_resp_error_desc")); |
||||||
|
response.setPayRespMerchInfo(extra.getString("pay_resp_merch_info")); |
||||||
|
response.setPayRespTvr(extra.getString("pay_resp_tvr")); |
||||||
|
response.setPayRespCvmDesc(extra.getString("pay_resp_cvm_desc")); |
||||||
|
response.setPayRespAppLabel(extra.getString("pay_resp_app_label")); |
||||||
|
response.setPayRespHashPan(extra.getString("pay_resp_hash_pan")); |
||||||
|
|
||||||
|
Logger.logD(response.toString()); |
||||||
|
MainApplication.getInstance().logPayment(response.toString()); |
||||||
|
|
||||||
|
MainApplication.currentSaleResponse = response; |
||||||
|
|
||||||
|
MainApplication.code = response.getPayRespCode(); |
||||||
|
MainApplication.status = response.getPayRespErrorDesc(); |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionVoidResponse(Bundle extra) { |
||||||
|
VoidResponse response = new VoidResponse(); |
||||||
|
|
||||||
|
response.setPayAmount(extra.getString("pay_amount")); |
||||||
|
response.setPayFunction(extra.getString("pay_function")); |
||||||
|
response.setPayType(extra.getString("pay_type")); |
||||||
|
response.setPayPrintReceiptId(extra.getString("pay_print_receipt_id")); |
||||||
|
response.setPayRespTxnDate(extra.getString("pay_resp_txn_date")); |
||||||
|
response.setPayRespTxnTime(extra.getString("pay_resp_txn_time")); |
||||||
|
response.setPayRespInvoiceNo(extra.getString("pay_resp_invoice_no")); |
||||||
|
response.setPayRespTraceNo(extra.getString("pay_resp_trace_no")); |
||||||
|
response.setPayRespBatchNo(extra.getString("pay_resp_batch_no")); |
||||||
|
response.setPayRespScheme(extra.getString("pay_resp_scheme")); |
||||||
|
response.setPayRespTid(extra.getString("pay_resp_tid")); |
||||||
|
response.setPayRespMid(extra.getString("pay_resp_mid")); |
||||||
|
response.setPayRespCardAuthCode(extra.getString("pay_resp_card_auth_code")); |
||||||
|
response.setPayRespCardRefNum(extra.getString("pay_resp_card_ref_num")); |
||||||
|
response.setPayRespQrTxnId(extra.getString("pay_resp_qr_txn_id")); |
||||||
|
response.setPayRespQrWalletId(extra.getString("pay_resp_qr_wallet_id")); |
||||||
|
response.setPayRespCardNo(extra.getString("pay_resp_card_no")); |
||||||
|
response.setPayRespIssuerId(extra.getString("pay_resp_issuer_id")); |
||||||
|
response.setPayRespCustomerId(extra.getString("pay_resp_customer_id")); |
||||||
|
response.setPayRespCardAppCryptogram(extra.getString("pay_resp_card_app_cryptogram")); |
||||||
|
response.setPayRespCode(extra.getString("pay_resp_code")); |
||||||
|
response.setPayRespErrorDesc(extra.getString("pay_resp_error_desc")); |
||||||
|
response.setPayRespMerchInfo(extra.getString("pay_resp_merch_info")); |
||||||
|
response.setPayRespTvr(extra.getString("pay_resp_tvr")); |
||||||
|
response.setPayRespCvmDesc(extra.getString("pay_resp_cvm_desc")); |
||||||
|
response.setPayRespAppLabel(extra.getString("pay_resp_app_label")); |
||||||
|
|
||||||
|
Logger.logD(response.toString()); |
||||||
|
MainApplication.getInstance().logPayment(response.toString()); |
||||||
|
|
||||||
|
MainApplication.currentVoidResponse = response; |
||||||
|
|
||||||
|
MainApplication.code = response.getPayRespCode(); |
||||||
|
MainApplication.status = response.getPayRespErrorDesc(); |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionInquiryResponse(Bundle extra) { |
||||||
|
InquiryResponse response = new InquiryResponse(); |
||||||
|
|
||||||
|
response.setPayAmount(extra.getString("pay_amount")); |
||||||
|
response.setPayFunction(extra.getString("pay_function")); |
||||||
|
response.setPayPrintReceiptId(extra.getString("pay_print_receipt_id")); |
||||||
|
response.setPayRespTxnDate(extra.getString("pay_resp_txn_date")); |
||||||
|
response.setPayRespTxnTime(extra.getString("pay_resp_txn_time")); |
||||||
|
response.setPayRespInvoiceNo(extra.getString("pay_resp_invoice_no")); |
||||||
|
response.setPayRespTraceNo(extra.getString("pay_resp_trace_no")); |
||||||
|
response.setPayRespBatchNo(extra.getString("pay_resp_batch_no")); |
||||||
|
response.setPayRespScheme(extra.getString("pay_resp_scheme")); |
||||||
|
response.setPayRespTid(extra.getString("pay_resp_tid")); |
||||||
|
response.setPayRespMid(extra.getString("pay_resp_mid")); |
||||||
|
response.setPayRespQrTxnId(extra.getString("pay_resp_qr_txn_id")); |
||||||
|
response.setPayRespQrWalletId(extra.getString("pay_resp_qr_wallet_id")); |
||||||
|
response.setPayRespCustomerId(extra.getString("pay_resp_customer_id")); |
||||||
|
response.setPayRespCode(extra.getString("pay_resp_code")); |
||||||
|
response.setPayRespErrorDesc(extra.getString("pay_resp_error_desc")); |
||||||
|
response.setPayRespMerchInfo(extra.getString("pay_resp_merch_info")); |
||||||
|
response.setPayRespIssuerId(extra.getString("pay_resp_issuer_id")); |
||||||
|
|
||||||
|
Logger.logD(response.toString()); |
||||||
|
MainApplication.getInstance().logPayment(response.toString()); |
||||||
|
|
||||||
|
MainApplication.currentInquiryResponse = response; |
||||||
|
|
||||||
|
MainApplication.code = response.getPayRespCode(); |
||||||
|
MainApplication.status = response.getPayRespErrorDesc(); |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionCancelResponse(Bundle extra) { |
||||||
|
CancelResponse response = new CancelResponse(); |
||||||
|
|
||||||
|
response.setPayFunction(extra.getString("pay_function")); |
||||||
|
response.setPayRespCode(extra.getString("pay_resp_code")); |
||||||
|
|
||||||
|
Logger.logD(response.toString()); |
||||||
|
MainApplication.getInstance().logPayment(response.toString()); |
||||||
|
|
||||||
|
MainApplication.currentCancelResponse = response; |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionPreAuthResponse(Bundle extra) { |
||||||
|
PreAuthResponse response = new PreAuthResponse(); |
||||||
|
|
||||||
|
response.setPayAmount(extra.getString("pay_amount")); |
||||||
|
response.setPayFunction(extra.getString("pay_function")); |
||||||
|
response.setPayType(extra.getString("pay_type")); |
||||||
|
response.setPayPrintReceiptId(extra.getString("pay_print_receipt_id")); |
||||||
|
response.setPayRespTxnDate(extra.getString("pay_resp_txn_date")); |
||||||
|
response.setPayRespTxnTime(extra.getString("pay_resp_txn_time")); |
||||||
|
response.setPayRespInvoiceNo(extra.getString("pay_resp_invoice_no")); |
||||||
|
response.setPayRespTraceNo(extra.getString("pay_resp_trace_no")); |
||||||
|
response.setPayRespBatchNo(extra.getString("pay_resp_batch_no")); |
||||||
|
response.setPayRespScheme(extra.getString("pay_resp_scheme")); |
||||||
|
response.setPayRespTid(extra.getString("pay_resp_tid")); |
||||||
|
response.setPayRespMid(extra.getString("pay_resp_mid")); |
||||||
|
response.setPayRespCardAuthCode(extra.getString("pay_resp_card_auth_code")); |
||||||
|
response.setPayRespCardRefNum(extra.getString("pay_resp_card_ref_num")); |
||||||
|
response.setPayRespCardNo(extra.getString("pay_resp_card_no")); |
||||||
|
response.setPayRespIssuerId(extra.getString("pay_resp_issuer_id")); |
||||||
|
response.setPayRespCardAid(extra.getString("pay_resp_card_aid")); |
||||||
|
response.setPayRespCardAppCryptogram(extra.getString("pay_resp_card_app_cryptogram")); |
||||||
|
response.setPayRespCode(extra.getString("pay_resp_code")); |
||||||
|
response.setPayRespErrorDesc(extra.getString("pay_resp_error_desc")); |
||||||
|
response.setPayRespMerchInfo(extra.getString("pay_resp_merch_info")); |
||||||
|
response.setPayRespTvr(extra.getString("pay_resp_tvr")); |
||||||
|
response.setPayRespCvmDesc(extra.getString("pay_resp_cvm_desc")); |
||||||
|
response.setPayRespAppLabel(extra.getString("pay_resp_app_label")); |
||||||
|
response.setPayRespHashPan(extra.getString("pay_resp_hash_pan")); |
||||||
|
response.setToken(extra.getString("token")); |
||||||
|
|
||||||
|
Logger.logD(response.toString()); |
||||||
|
MainApplication.getInstance().logPayment(response.toString()); |
||||||
|
|
||||||
|
MainApplication.code = response.getPayRespCode(); |
||||||
|
MainApplication.status = response.getPayRespErrorDesc(); |
||||||
|
|
||||||
|
MainApplication.currentPreAuthResponse = response; |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionSaleCompletionResponse(Bundle extra) { |
||||||
|
SaleCompletionResponse response = new SaleCompletionResponse(); |
||||||
|
|
||||||
|
response.setPayAmount(extra.getString("pay_amount")); |
||||||
|
response.setPayFunction(extra.getString("pay_function")); |
||||||
|
response.setPayType(extra.getString("pay_type")); |
||||||
|
response.setPayPrintReceiptId(extra.getString("pay_print_receipt_id")); |
||||||
|
response.setPayRespTxnDate(extra.getString("pay_resp_txn_date")); |
||||||
|
response.setPayRespTxnTime(extra.getString("pay_resp_txn_time")); |
||||||
|
response.setPayRespInvoiceNo(extra.getString("pay_resp_invoice_no")); |
||||||
|
response.setPayRespTraceNo(extra.getString("pay_resp_trace_no")); |
||||||
|
response.setPayRespBatchNo(extra.getString("pay_resp_batch_no")); |
||||||
|
response.setPayRespScheme(extra.getString("pay_resp_scheme")); |
||||||
|
response.setPayRespTid(extra.getString("pay_resp_tid")); |
||||||
|
response.setPayRespMid(extra.getString("pay_resp_mid")); |
||||||
|
response.setPayRespCardAuthCode(extra.getString("pay_resp_card_auth_code")); |
||||||
|
response.setPayRespCardRefNum(extra.getString("pay_resp_card_ref_num")); |
||||||
|
response.setPayRespCardNo(extra.getString("pay_resp_card_no")); |
||||||
|
response.setPayRespIssuerId(extra.getString("pay_resp_issuer_id")); |
||||||
|
response.setPayRespCardAid(extra.getString("pay_resp_card_aid")); |
||||||
|
response.setPayRespCardAppCryptogram(extra.getString("pay_resp_card_app_cryptogram")); |
||||||
|
response.setPayRespCode(extra.getString("pay_resp_code")); |
||||||
|
response.setPayRespErrorDesc(extra.getString("pay_resp_error_desc")); |
||||||
|
response.setPayRespMerchInfo(extra.getString("pay_resp_merch_info")); |
||||||
|
response.setPayRespTvr(extra.getString("pay_resp_tvr")); |
||||||
|
response.setPayRespCvmDesc(extra.getString("pay_resp_cvm_desc")); |
||||||
|
response.setPayRespAppLabel(extra.getString("pay_resp_app_label")); |
||||||
|
response.setPayRespHashPan(extra.getString("pay_resp_hash_pan")); |
||||||
|
|
||||||
|
Logger.logD(response.toString()); |
||||||
|
MainApplication.getInstance().logPayment(response.toString()); |
||||||
|
|
||||||
|
MainApplication.code = response.getPayRespCode(); |
||||||
|
MainApplication.status = response.getPayRespErrorDesc(); |
||||||
|
|
||||||
|
MainApplication.currentSaleCompletionResponse = response; |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionSettlementResponse(Bundle extra) { |
||||||
|
SettlementResponse response = new SettlementResponse(); |
||||||
|
|
||||||
|
response.setPayFunction(extra.getString("pay_function")); |
||||||
|
response.setPayPrintReceiptId(extra.getString("pay_print_receipt_id")); |
||||||
|
response.setPayRespTxnDate(extra.getString("pay_resp_txn_date")); |
||||||
|
response.setPayRespTxnTime(extra.getString("pay_resp_txn_time")); |
||||||
|
response.setPayRespBatchNo(extra.getString("pay_resp_batch_no")); |
||||||
|
response.setPayRespTid(extra.getString("pay_resp_tid")); |
||||||
|
response.setPayRespMid(extra.getString("pay_resp_mid")); |
||||||
|
response.setPayRespCode(extra.getString("pay_resp_code")); |
||||||
|
response.setPayRespErrorDesc(extra.getString("pay_resp_error_desc")); |
||||||
|
response.setPayRespMerchInfo(extra.getString("pay_resp_merch_info")); |
||||||
|
|
||||||
|
Logger.logD(response.toString()); |
||||||
|
MainApplication.getInstance().logPayment(response.toString()); |
||||||
|
|
||||||
|
MainApplication.currentSettlementResponse = response; |
||||||
|
|
||||||
|
MainApplication.code = response.getPayRespCode(); |
||||||
|
MainApplication.status = response.getPayRespErrorDesc(); |
||||||
|
} |
||||||
|
|
||||||
|
public void handlePayFunctionSetDateTimeResponse(Bundle extra) { |
||||||
|
SetDateTimeResponse response = new SetDateTimeResponse(); |
||||||
|
|
||||||
|
response.setPayFunction(extra.getString("pay_function")); |
||||||
|
response.setPayRespTxnDate(extra.getString("pay_resp_txn_date")); |
||||||
|
response.setPayRespTxnTime(extra.getString("pay_resp_txn_time")); |
||||||
|
response.setPayRespCode(extra.getString("pay_resp_code")); |
||||||
|
response.setPayRespErrorDesc(extra.getString("pay_resp_error_desc")); |
||||||
|
|
||||||
|
Logger.logD(response.toString()); |
||||||
|
MainApplication.getInstance().logPayment(response.toString()); |
||||||
|
|
||||||
|
MainApplication.currentSetDateTimeResponse = response; |
||||||
|
|
||||||
|
MainApplication.code = response.getPayRespCode(); |
||||||
|
MainApplication.status = response.getPayRespErrorDesc(); |
||||||
|
} |
||||||
|
} |
@ -1,624 +0,0 @@ |
|||||||
package com.cst.im30.activity; |
|
||||||
|
|
||||||
import android.app.Activity; |
|
||||||
import android.app.AlertDialog; |
|
||||||
import android.content.Context; |
|
||||||
import android.content.Intent; |
|
||||||
import android.graphics.Color; |
|
||||||
import android.graphics.drawable.ColorDrawable; |
|
||||||
import android.os.Bundle; |
|
||||||
import android.os.Handler; |
|
||||||
import android.os.Looper; |
|
||||||
import android.view.LayoutInflater; |
|
||||||
import android.view.View; |
|
||||||
import android.widget.Button; |
|
||||||
import android.widget.ImageView; |
|
||||||
import android.widget.TextView; |
|
||||||
import android.widget.Toast; |
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity; |
|
||||||
|
|
||||||
import com.bumptech.glide.Glide; |
|
||||||
import com.cst.im30.R; |
|
||||||
import com.cst.im30.entity.Transaction; |
|
||||||
import com.cst.im30.retrofit.RetrofitAPICollection; |
|
||||||
import com.cst.im30.retrofit.RetrofitClient; |
|
||||||
|
|
||||||
import org.json.JSONException; |
|
||||||
import org.json.JSONObject; |
|
||||||
|
|
||||||
import java.math.BigInteger; |
|
||||||
import java.security.MessageDigest; |
|
||||||
import java.security.NoSuchAlgorithmException; |
|
||||||
|
|
||||||
import retrofit2.Call; |
|
||||||
import retrofit2.Callback; |
|
||||||
import retrofit2.Response; |
|
||||||
import retrofit2.Retrofit; |
|
||||||
import retrofit2.converter.gson.GsonConverterFactory; |
|
||||||
|
|
||||||
public class StatusActivity extends AppCompatActivity { |
|
||||||
|
|
||||||
//Set value to get temp value-RefNum
|
|
||||||
private static String vRefNum; |
|
||||||
//Set value to get temp value-Status
|
|
||||||
private static String vStatus; |
|
||||||
//Set value to get temp value-Amount
|
|
||||||
private static String vAmount; |
|
||||||
private Transaction transaction; |
|
||||||
private Button buttonDonationSuccess, buttonRetry, buttonNoRetry; |
|
||||||
//private Transaction transaction;
|
|
||||||
private TextView textStatus, textInfo, textAmount; |
|
||||||
private ImageView imageStatus; |
|
||||||
private String status, responseCode, responseDesc, referenceNum, amountTransaction; |
|
||||||
|
|
||||||
public static String getRefNum() { |
|
||||||
return vRefNum; |
|
||||||
} |
|
||||||
|
|
||||||
public static String getStatus() { |
|
||||||
return vStatus; |
|
||||||
} |
|
||||||
|
|
||||||
public static String getAmount() { |
|
||||||
return vAmount; |
|
||||||
} |
|
||||||
|
|
||||||
public static void showFinishMessage(final Context context, String title, String message) { |
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context); |
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
|
||||||
View dialogView = inflater.inflate(R.layout.pop_up_message_no_option, null); |
|
||||||
|
|
||||||
TextView textTitle = dialogView.findViewById(R.id.text_title_pop_up_message_no_option); |
|
||||||
TextView textMessage = dialogView.findViewById(R.id.text_message_pop_up_message_no_option); |
|
||||||
Button buttonOk = dialogView.findViewById(R.id.button_ok_pop_up_message_no_option); |
|
||||||
|
|
||||||
textTitle.setText(title); |
|
||||||
textMessage.setText(message); |
|
||||||
|
|
||||||
dialogBuilder.setCancelable(false); |
|
||||||
dialogBuilder.setView(dialogView); |
|
||||||
|
|
||||||
final AlertDialog alertDialogFinishMessage = dialogBuilder.create(); |
|
||||||
alertDialogFinishMessage.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); |
|
||||||
alertDialogFinishMessage.show(); |
|
||||||
|
|
||||||
buttonOk.setOnClickListener(new View.OnClickListener() { |
|
||||||
@Override |
|
||||||
public void onClick(View v) { |
|
||||||
alertDialogFinishMessage.dismiss(); |
|
||||||
((Activity) context).finish(); |
|
||||||
|
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
private static String encrytThisString(String input) { |
|
||||||
|
|
||||||
try { |
|
||||||
// getInstance() method is called with algorithm SHA-512
|
|
||||||
MessageDigest md = MessageDigest.getInstance("SHA-512"); |
|
||||||
|
|
||||||
// digest() method is called
|
|
||||||
// to calculate message digest of the input string
|
|
||||||
// returned as array of byte
|
|
||||||
byte[] messageDigest = md.digest(input.getBytes()); |
|
||||||
|
|
||||||
// Convert byte array into signum representation
|
|
||||||
BigInteger no = new BigInteger(1, messageDigest); |
|
||||||
|
|
||||||
// Convert message digest into hex value
|
|
||||||
String hashtext = no.toString(16); |
|
||||||
|
|
||||||
// Add preceding 0s to make it 32 bit
|
|
||||||
while (hashtext.length() < 32) { |
|
||||||
hashtext = "0" + hashtext; |
|
||||||
} |
|
||||||
|
|
||||||
// return the HashText
|
|
||||||
return hashtext; |
|
||||||
} // For specifying wrong message digest algorithms
|
|
||||||
catch (NoSuchAlgorithmException e) { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void onCreate(Bundle savedInstanceState) { |
|
||||||
super.onCreate(savedInstanceState); |
|
||||||
setContentView(R.layout.activity_status); |
|
||||||
|
|
||||||
/*try { |
|
||||||
transaction = (Transaction) getIntent().getSerializableExtra("transaction"); |
|
||||||
} catch (Exception e) { |
|
||||||
//Bugsnag.notify(e);
|
|
||||||
}*/ |
|
||||||
|
|
||||||
buttonDonationSuccess = findViewById(R.id.button_ok_donation_sta); |
|
||||||
buttonRetry = findViewById(R.id.button_pay_again_sta); |
|
||||||
buttonNoRetry = findViewById(R.id.button_no_pay_again_sta); |
|
||||||
textStatus = findViewById(R.id.text_status_sta); |
|
||||||
textInfo = findViewById(R.id.text_info_sta); |
|
||||||
textAmount = findViewById(R.id.text_info_amount_sta); |
|
||||||
imageStatus = findViewById(R.id.image_status_sta); |
|
||||||
|
|
||||||
//Get data from StatusActivty - refNum & amount only
|
|
||||||
String referenceNumber = ResponseActivity.getRefNum(); |
|
||||||
//get and set again
|
|
||||||
vRefNum = referenceNumber; |
|
||||||
String statusTemp = ResponseActivity.getStatus(); |
|
||||||
vStatus = statusTemp; |
|
||||||
String amount = ResponseActivity.getAmount(); |
|
||||||
vAmount = amount; |
|
||||||
|
|
||||||
|
|
||||||
//Get status from Response Screen
|
|
||||||
Intent intentRefNum = getIntent(); |
|
||||||
Bundle refNumGet = intentRefNum.getExtras(); |
|
||||||
if (refNumGet != null) { |
|
||||||
String refNumSet = (String) refNumGet.get("referenceNumTransaction"); |
|
||||||
referenceNum = refNumSet; |
|
||||||
} |
|
||||||
|
|
||||||
/*Intent intentSign = getIntent(); |
|
||||||
Bundle signGet = intentSign.getExtras(); |
|
||||||
String */ |
|
||||||
|
|
||||||
Intent intentStatus = getIntent(); |
|
||||||
Bundle statusGet = intentStatus.getExtras(); |
|
||||||
if (statusGet != null) { |
|
||||||
String statusSet = (String) statusGet.get("statusTransaction"); |
|
||||||
status = statusSet; |
|
||||||
} |
|
||||||
|
|
||||||
Intent intentAmount = getIntent(); |
|
||||||
Bundle amountGet = intentAmount.getExtras(); |
|
||||||
if (amountGet != null) { |
|
||||||
String amountSet = (String) amountGet.get("amountTransaction"); |
|
||||||
amountTransaction = amountSet; |
|
||||||
} |
|
||||||
|
|
||||||
//Get HLB response from Response Activity
|
|
||||||
Intent intentResponse = getIntent(); |
|
||||||
Bundle extra = intentResponse.getExtras(); |
|
||||||
String payRespCodeTransaction = extra.getString("payRespCodeTransaction"); |
|
||||||
//transaction.setResponseCode(payRespCodeTransaction);
|
|
||||||
//all HLB response
|
|
||||||
String getAllHLBresponse = extra.getString("hlbResponse"); |
|
||||||
//String payResponseCode = transaction.getResponseCode();
|
|
||||||
String payRespErrorDescTransaction = extra.getString("payRespErrorDescTransaction"); |
|
||||||
String payRespIssuerIdTransaction = extra.getString("payRespIssuerIdTransaction"); |
|
||||||
String payFunctionTransaction = extra.getString("payFunctionTransaction"); |
|
||||||
//String payFunction = transaction.setFunction(payFunctionTransaction);
|
|
||||||
String payRespQrTxnIdTransaction = extra.getString("payRespQrTxnIdTransaction"); |
|
||||||
String payRespInvoiceNoTransaction = extra.getString("payRespInvoiceNoTransaction"); |
|
||||||
String payRespSchemeTransaction = extra.getString("payRespSchemeTransaction"); |
|
||||||
String payRespBatchNoTransaction = extra.getString("payRespBatchNoTransaction"); |
|
||||||
String payRespTxnDateTransaction = extra.getString("payRespTxnDateTransaction"); |
|
||||||
String payRespTxnTimeTransaction = extra.getString("payRespTxnTimeTransaction"); |
|
||||||
String payPrintReceiptIdTransaction = extra.getString("payPrintReceiptIdTransaction"); |
|
||||||
String payRespQrWalletIdTransaction = extra.getString("payRespQrWalletIdTransaction"); |
|
||||||
String payRespCardAppCryptogramTransaction = extra.getString("payRespCardAppCryptogramTransaction"); |
|
||||||
String payRespAppLabelTransaction = extra.getString("payRespAppLabelTransaction"); |
|
||||||
String payRespCardRefNumTransaction = extra.getString("payRespCardRefNumTransaction"); |
|
||||||
String payCameraModeTransaction = extra.getString("payCameraModeTransaction"); |
|
||||||
//String payCameraMode = transaction.setCameraMode(payCameraModeTransaction);
|
|
||||||
String payRespCardAuthCodeTransaction = extra.getString("payRespCardAuthCodeTransaction"); |
|
||||||
String payRespCardAidTransaction = extra.getString("payRespCardAidTransaction"); |
|
||||||
String payRespHashPanTransaction = extra.getString("payRespHashPanTransaction"); |
|
||||||
String payRespMerchInfoTransaction = extra.getString("payRespMerchInfoTransaction"); |
|
||||||
String payRespMidTransaction = extra.getString("payRespMidTransaction"); |
|
||||||
String payRespTidTransaction = extra.getString("payRespTidTransaction"); |
|
||||||
String payRespTvrTransaction = extra.getString("payRespTvrTransaction"); |
|
||||||
String payRespCustomerIdTransaction = extra.getString("payRespCustomerIdTransaction"); |
|
||||||
String payTypeTransaction = extra.getString("payTypeTransaction"); |
|
||||||
//String payType = transaction.setType(payTypeTransaction);
|
|
||||||
String payRespTraceNoTransaction = extra.getString("payRespTraceNoTransaction"); |
|
||||||
String payRespCvmDescTransaction = extra.getString("payRespCvmDescTransaction"); |
|
||||||
String payAddAmountTransaction = extra.getString("payAddAmountTransaction"); |
|
||||||
String payRespCardNoTransaction = extra.getString("payRespCardNoTransaction"); |
|
||||||
String payAmountTransaction = extra.getString("payAmountTransaction"); |
|
||||||
|
|
||||||
String merchanCode = "MER0001"; |
|
||||||
//String terminalCode = transaction.getTid();
|
|
||||||
String secretKey = "Uthos^eY5pfO"; |
|
||||||
//Signature=merchant_code+secret_key_reference_number+amount+payment_type ->23/08/2021-requery
|
|
||||||
//String encryptedSign = merchanCode + secretKey + referenceNum + amount + payTypeTransaction;
|
|
||||||
//String encryptedSignValueRequery = encrytThisString(encryptedSign);
|
|
||||||
//Signature = merchant_code+secret_key+reference_number+amount+response_code ->23/08/2021-update
|
|
||||||
//String encryptedSigns = merchanCode + secretKey + referenceNum + amount + payRespCodeTransaction;
|
|
||||||
//String encryptedSignValueUpdate = encrytThisString(encryptedSigns);
|
|
||||||
//String paramsResponse = "{\"id\":13,\"merchant_code\":\"MER0001\"}";
|
|
||||||
//String paramsResponse = {"id":13,"merchant_code":"MER0001","terminal_code":"TER001","reference_number":"PAY0021","response_code":"00","payment_type":"01","amount":"1.00","payment_function":"01","payment_camera_mode":null,"status":"success","created_at":"2021-08-23T03:19:30.000000Z","updated_at":"2021-08-23T06:29:40.000000Z"};
|
|
||||||
String paramsResponse = getAllHLBresponse; |
|
||||||
|
|
||||||
|
|
||||||
//if (status.toLowerCase().trim().equals("success") && transaction.getType().toLowerCase().contains("sale")) {
|
|
||||||
if (status.toLowerCase().trim().equals("success")) { |
|
||||||
textStatus.setText(getResources().getString(R.string.txt_success_status)); |
|
||||||
textInfo.setText(getResources().getString(R.string.txt_info_status)); |
|
||||||
textAmount.setText("Donation Amount: " + "RM " + amount); |
|
||||||
Glide.with(StatusActivity.this).asBitmap().load(R.drawable.ic_status_success_fancy).into(imageStatus); |
|
||||||
|
|
||||||
/*//direct update the status to server
|
|
||||||
String refNum = referenceNum; |
|
||||||
String finalResultPayRespCodeStatus = status; |
|
||||||
String finalAmount = amountTransaction; |
|
||||||
//String paymentTypeTransaction = payTypeTransaction;
|
|
||||||
//String paymentFunctionTransaction = payFunctionTransaction;
|
|
||||||
//String paymentCameraMode = payCameraModeTransaction;
|
|
||||||
//TODO: change this hardcoded value later
|
|
||||||
//String signValue = "testSignature";
|
|
||||||
//String paramResponse = "HLB params here..";
|
|
||||||
//JSONObject obj = ((Parcel) ((Bundle) getArguments()).getSerializable("events")).getObj();
|
|
||||||
//String paramResponse = obj.toString();
|
|
||||||
|
|
||||||
String merchanCode = "MER0001"; |
|
||||||
//String terminalCode = transaction.getTid();
|
|
||||||
String secretKey = "Uthos^eY5pfO"; |
|
||||||
//String finalStatus = "fail";
|
|
||||||
//String amount = realAmount;
|
|
||||||
//String responseCode = transaction.getResponseCode();
|
|
||||||
//Signature = merchant_code+secret_key+reference_number+amount+response_code ->23/08/2021-update
|
|
||||||
String encryptedSign = merchanCode + secretKey + refNum + amount + payRespCodeTransaction; |
|
||||||
String encryptedSignValueUpdate = encrytThisString(encryptedSign); |
|
||||||
String paramsResponse = "{\"id\":13,\"merchant_code\":\"MER0001\"}";*/ |
|
||||||
|
|
||||||
//Signature = merchant_code+secret_key+reference_number+amount+response_code ->23/08/2021-update
|
|
||||||
String encryptedSigns = merchanCode + secretKey + referenceNum + amount + payRespCodeTransaction; |
|
||||||
String encryptedSignValueUpdate = encrytThisString(encryptedSigns); |
|
||||||
|
|
||||||
//hide button so user won't need to interact with it
|
|
||||||
//buttonDonationSuccess.setVisibility(View.VISIBLE);
|
|
||||||
buttonDonationSuccess.setVisibility(View.GONE); |
|
||||||
buttonRetry.setVisibility(View.GONE); |
|
||||||
buttonNoRetry.setVisibility(View.GONE); |
|
||||||
|
|
||||||
//hold the info from UDC kiosk donation received for 5 second then proceed to HLB app
|
|
||||||
final Handler handler = new Handler(Looper.getMainLooper()); |
|
||||||
handler.postDelayed(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
//Do something after 5000ms = 5 seconds
|
|
||||||
//update Status success to server
|
|
||||||
//updateResponseToApi(String referenceNumber, String status, String merchantCode, String amount, String responseCode,
|
|
||||||
// String encryptedSignValueUpdate, String paramsResponse)
|
|
||||||
updateResponseFromhlb(referenceNum, status, merchanCode, amountTransaction, payRespCodeTransaction, |
|
||||||
encryptedSignValueUpdate, paramsResponse); |
|
||||||
//updateResponseFromhlb(payment);
|
|
||||||
|
|
||||||
/*{ //current jSON at API side -UPDATE
|
|
||||||
"id": 11, |
|
||||||
"reference_number": "PAY001", |
|
||||||
"payment_type": null, |
|
||||||
"payment_function": null, |
|
||||||
"payment_camera_mode": null, |
|
||||||
"signature": null, |
|
||||||
"amount": "1.00", |
|
||||||
"status": "success", |
|
||||||
"params_response": null, |
|
||||||
"created_at": "2021-06-20T13:32:40.000000Z", |
|
||||||
"updated_at": "2021-08-19T00:32:17.000000Z" |
|
||||||
}*/ |
|
||||||
|
|
||||||
Intent i = new Intent(StatusActivity.this, MainActivity.class); |
|
||||||
i.putExtra("statusCurrent", status); |
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); |
|
||||||
startActivity(i); |
|
||||||
} |
|
||||||
}, 5000); |
|
||||||
|
|
||||||
} else { |
|
||||||
textStatus.setText(getResources().getString(R.string.txt_fail_status)); |
|
||||||
textInfo.setText(getResources().getString(R.string.txt_fail_info_status)); |
|
||||||
textAmount.setText("Donation Amount: " + "RM " + amount); |
|
||||||
Glide.with(StatusActivity.this).asBitmap().load(R.drawable.ic_status_fail_fancy).into(imageStatus); |
|
||||||
|
|
||||||
buttonDonationSuccess.setVisibility(View.GONE); |
|
||||||
buttonRetry.setVisibility(View.VISIBLE); |
|
||||||
buttonNoRetry.setVisibility(View.VISIBLE); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
//button ok ->hide because useless/ no need user to press
|
|
||||||
/*buttonDonationSuccess.setOnClickListener(view -> { |
|
||||||
|
|
||||||
String refNum = referenceNum; |
|
||||||
String finalResultPayRespCodeStatus = status; |
|
||||||
String finalAmount = amountTransaction; |
|
||||||
|
|
||||||
//update Status to server
|
|
||||||
updateResponseFromhlb(refNum, finalResultPayRespCodeStatus, finalAmount); |
|
||||||
|
|
||||||
|
|
||||||
Intent i = new Intent(StatusActivity.this, MainActivity.class); |
|
||||||
i.putExtra("statusCurrent", finalResultPayRespCodeStatus); |
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); |
|
||||||
startActivity(i); |
|
||||||
});*/ |
|
||||||
|
|
||||||
//button no retry pay again
|
|
||||||
buttonNoRetry.setOnClickListener(view -> { |
|
||||||
|
|
||||||
String refNum = referenceNum; |
|
||||||
String finalResultPayRespCodeStatus = status; |
|
||||||
String finalAmount = amountTransaction; |
|
||||||
String paymentTypeTransaction = payTypeTransaction; |
|
||||||
String paymentFunctionTransaction = payFunctionTransaction; |
|
||||||
String paymentCameraMode = payCameraModeTransaction; |
|
||||||
|
|
||||||
//Signature = merchant_code+secret_key+reference_number+amount+response_code ->23/08/2021-update
|
|
||||||
String encryptedSigns = merchanCode + secretKey + referenceNum + amount + payRespCodeTransaction; |
|
||||||
String encryptedSignValueUpdate = encrytThisString(encryptedSigns); |
|
||||||
|
|
||||||
//updateResponseToApi(String referenceNumber, String status, String merchantCode, String amount, String responseCode,
|
|
||||||
// String encryptedSignValueUpdate, String paramsResponse)
|
|
||||||
//update Status = FAIL to server
|
|
||||||
//updateResponseToApi(String referenceNumber, String status, String merchantCode, String amount, String responseCode,
|
|
||||||
// String encryptedSignValueUpdate, String paramsResponse)
|
|
||||||
updateResponseFromhlb(referenceNum, finalResultPayRespCodeStatus, merchanCode, finalAmount, payRespCodeTransaction, |
|
||||||
encryptedSignValueUpdate, paramsResponse); |
|
||||||
|
|
||||||
/*updateResponseFromhlb(refNum, paymentTypeTransaction, paymentFunctionTransaction, |
|
||||||
paymentCameraMode, signValue, finalAmount, finalResultPayRespCodeStatus, paramResponse);*/ |
|
||||||
|
|
||||||
Intent intent = new Intent(StatusActivity.this, MainActivity.class); |
|
||||||
intent.putExtra("statusCurrent", finalResultPayRespCodeStatus); |
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); |
|
||||||
startActivity(intent); |
|
||||||
|
|
||||||
}); |
|
||||||
|
|
||||||
//button retry
|
|
||||||
//buttonRetry.setOnClickListener(view -> buttonRetryPayment(status));
|
|
||||||
buttonRetry.setOnClickListener(view -> { |
|
||||||
|
|
||||||
String refNum = referenceNum; |
|
||||||
String finalResultPayRespCodeStatus = "pending"; |
|
||||||
vStatus = finalResultPayRespCodeStatus; |
|
||||||
String finalAmount = amountTransaction; |
|
||||||
|
|
||||||
//Signature=merchant_code+secret_key_reference_number+amount+payment_type ->23/08/2021-requery
|
|
||||||
String encryptedSign = merchanCode + secretKey + referenceNum + amount + payTypeTransaction; |
|
||||||
String encryptedSignValueRequery = encrytThisString(encryptedSign); |
|
||||||
|
|
||||||
//Signature = merchant_code+secret_key+reference_number+amount+response_code ->23/08/2021-update
|
|
||||||
String encryptedSigns = merchanCode + secretKey + referenceNum + amount + payRespCodeTransaction; |
|
||||||
String encryptedSignValueUpdate = encrytThisString(encryptedSigns); |
|
||||||
|
|
||||||
|
|
||||||
//update Status to server ->no need to update 1st, just retry the payment
|
|
||||||
//updateResponseFromhlb(refNum, finalResultPayRespCodeStatus, finalAmount);
|
|
||||||
|
|
||||||
//check the status from server 1st, if pending proceed, if fail sho success show something
|
|
||||||
//requery + update API
|
|
||||||
checkStatusPayment(refNum, merchanCode, payTypeTransaction, finalAmount, encryptedSignValueRequery, |
|
||||||
paramsResponse, payRespCodeTransaction, encryptedSignValueUpdate); |
|
||||||
|
|
||||||
/*//String transactionStatus = status; ->pending
|
|
||||||
String transactionReference = refNum; |
|
||||||
String transactionStatus = finalResultPayRespCodeStatus; |
|
||||||
String transactionAmount = finalAmount; |
|
||||||
|
|
||||||
retryPayment(finalAmount);*/ |
|
||||||
|
|
||||||
/*Intent intents = new Intent(StatusActivity.this, MainActivity.class); |
|
||||||
intents.putExtra("referenceCurrent", transactionReference); |
|
||||||
intents.putExtra("statusCurrent", transactionStatus); |
|
||||||
intents.putExtra("amountCurrent", transactionAmount); |
|
||||||
intents.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); |
|
||||||
startActivity(intents);*/ |
|
||||||
|
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
//refNum, merchanCode, payTypeTransaction, finalAmount, encryptedSignValueRequery
|
|
||||||
private void checkStatusPayment(String referenceNumber, String merchanCode, String payType, String amount, String encryptedSignValueRequery, |
|
||||||
String paramResponse, String payRespCode, String encryptedSignValueUpdate) { |
|
||||||
|
|
||||||
//TODO: Please cleanup and fix afterwards
|
|
||||||
String tempHostUrl = "http://udcsys-api-build.testpigeon.net"; |
|
||||||
String buildToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiOTA2ZTNkN2VmNmZkNmNhZjVjYTVkNWEzYjI5ZDRiMWYxZjlmYTc4ZDcxYzYyNGE0N2FmMTYwMGQzZWY3ZGU5OGE5MGY2NzJlNzE4NmVmZGIiLCJpYXQiOjE2MDg1MzYyMTMsIm5iZiI6MTYwODUzNjIxMywiZXhwIjoxNjQwMDcyMjEzLCJzdWIiOiIxMSIsInNjb3BlcyI6W119.i2jDd1Zux2UkoLhzif762ghsJFhQ32Gk6g0Z2pXDRHKWVoK4kHv__Fnxb4XhdJncfzSmMibZGguOEVPNuRotMjhC7a-lgHKItqeamOSxQNONuhea601R3k8QVDA92mnRKBsDiQw6-mcCw-K5t49I1TkkwauQ1EYQU5GI4vttxbdO_irZfQgINfyCmAkqo_IWgc8498pCuI5lMA2vI9X3BETtNt8WS451hU59fy7K_sjiojFG6mvwu7C-z0ZPcqKQ8F7c2JfZq0qphslMrqj0nZh0skGf0Qf6ZmRrftkNONcO9j9jh5eJfEHIEmGqNhDeO9ftQq5BuWfm6FhYVIW1YnBKrNk6lLkk38fuKjk8FevNwH6knVZjb3Q27Kr7K2cbbvlPEp846VrJrwIdJjfpDuAoorjMQAw-yVJQYOrb_v8F1jhnoMC_Qdu5Qc1AjbDrHggrZtkG9f7pw60reoNk01OCVsOD5ecldm05PfJ2NqhdZn1oXXxFOXc8lcBWpYkfhrOzw0fpxH4hFk4j8HSvy4n0EkB5ZfctDYx6JxXfoCsW7zYgm52ZCZISV5Kchkhlk6W2C1pUs8YjtxAU2I8A6wVbJwGVbwsDudgPXMuNH_PVk3YkljWU-zkPbMLWMOc-DNyioE-dAoq1VWPXoNuhaOqMDR4RCiZPhvJg0yxfA68"; |
|
||||||
|
|
||||||
//String paymentType = "01"; //01=Card Payment
|
|
||||||
|
|
||||||
//Get REQUERY Payment from UDC Laravel Echo Listener Server
|
|
||||||
RetrofitAPICollection service = RetrofitClient.getRetrofitClient(tempHostUrl).create(RetrofitAPICollection.class); |
|
||||||
/*Retrofit retrofit = new Retrofit.Builder() |
|
||||||
.baseUrl("http://udcsys-api-build.testpigeon.net") |
|
||||||
.addConverterFactory(GsonConverterFactory.create()) |
|
||||||
.build();*/ |
|
||||||
|
|
||||||
Call<String> callCardPayStatus = service.requeryCardPayment("Bearer " + buildToken, |
|
||||||
referenceNumber, |
|
||||||
merchanCode, |
|
||||||
payType, |
|
||||||
amount, |
|
||||||
encryptedSignValueRequery); |
|
||||||
|
|
||||||
callCardPayStatus.enqueue(new Callback<String>() { |
|
||||||
@Override |
|
||||||
public void onResponse(Call<String> call, Response<String> response) { |
|
||||||
|
|
||||||
/*Toast.makeText(StatusActivity.this,"\n" + |
|
||||||
"Update data process completed!",Toast.LENGTH_SHORT).show();*/ |
|
||||||
if (response.isSuccessful()) { |
|
||||||
try { |
|
||||||
JSONObject responseJSON = new JSONObject(response.body()); |
|
||||||
|
|
||||||
String responseStatus = responseJSON.getString("status"); |
|
||||||
|
|
||||||
if (responseStatus.toLowerCase().trim().equals("fail")) { |
|
||||||
//set the fail info
|
|
||||||
String refNum = referenceNum; |
|
||||||
String finalResultPayRespCodeStatus = status; |
|
||||||
String finalAmount = amountTransaction; |
|
||||||
String payRespCodeTransaction = payRespCode; |
|
||||||
String encryptedSignUpdate = encryptedSignValueUpdate; |
|
||||||
//String paymentTypeTransaction = transaction.getType();
|
|
||||||
//String paymentFunctionTransaction = transaction.getFunction();
|
|
||||||
//String paymentCameraMode = transaction.getCameraMode();
|
|
||||||
//TODO: change this hardcoded value later
|
|
||||||
//String signValue = "testSignature";
|
|
||||||
//String paramResponse = "HLB params here..";
|
|
||||||
/*updateResponseFromhlb(refNum, payTypeTransaction, payFunctionTransaction, |
|
||||||
payCameraModeTransaction, signValue, finalAmount, finalResultPayRespCodeStatus, paramResponse);*/ |
|
||||||
|
|
||||||
//updateResponseToApi(String referenceNumber, String status, String merchantCode, String amount, String responseCode,
|
|
||||||
// String encryptedSignValueUpdate, String paramsResponse)
|
|
||||||
//update Status = FAIL to server
|
|
||||||
//updateResponseToApi(String referenceNumber, String status, String merchantCode, String amount, String responseCode,
|
|
||||||
// String encryptedSignValueUpdate, String paramsResponse)
|
|
||||||
updateResponseFromhlb(referenceNum, finalResultPayRespCodeStatus, merchanCode, finalAmount, payRespCodeTransaction, |
|
||||||
encryptedSignUpdate, paramResponse); |
|
||||||
|
|
||||||
/*updateResponseFromhlb(refNum, paymentTypeTransaction, paymentFunctionTransaction, paymentCameraMode, |
|
||||||
signValue, finalAmount, finalResultPayRespCodeStatus, paramResponse);*/ |
|
||||||
|
|
||||||
//show screen/info about cannot retry
|
|
||||||
setResult(RESULT_OK); |
|
||||||
StatusActivity.showFinishMessage(StatusActivity.this, "Payment Fail!", "Payment status : " + responseStatus); |
|
||||||
|
|
||||||
//hold the info from UDC kiosk donation received for 5 second then proceed to HLB app
|
|
||||||
final Handler handler = new Handler(Looper.getMainLooper()); |
|
||||||
handler.postDelayed(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
//Do something after 5000ms = 5 seconds
|
|
||||||
//direct user to main screen
|
|
||||||
|
|
||||||
Intent intent = new Intent(StatusActivity.this, MainActivity.class); |
|
||||||
intent.putExtra("statusCurrent", finalResultPayRespCodeStatus); |
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); |
|
||||||
startActivity(intent); |
|
||||||
} |
|
||||||
}, 5000); |
|
||||||
|
|
||||||
|
|
||||||
} else if (responseStatus.toLowerCase().trim().equals("pending")) { |
|
||||||
//if status not fail, proceed the retry payment process
|
|
||||||
String refNum = referenceNum; |
|
||||||
String finalResultPayRespCodeStatus = "pending"; |
|
||||||
vStatus = finalResultPayRespCodeStatus; |
|
||||||
String finalAmount = amountTransaction; |
|
||||||
|
|
||||||
//String transactionStatus = status; ->pending
|
|
||||||
String transactionReference = refNum; |
|
||||||
String transactionStatus = finalResultPayRespCodeStatus; |
|
||||||
String transactionAmount = finalAmount; |
|
||||||
|
|
||||||
retryPayment(transactionAmount); |
|
||||||
} |
|
||||||
|
|
||||||
} catch (JSONException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} |
|
||||||
} //if response is NoSuccessful
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onFailure(Call<String> call, Throwable t) { |
|
||||||
Toast.makeText(StatusActivity.this, "Unsuccessfully update data!\n", Toast.LENGTH_SHORT).show(); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private void retryPayment(String finalAmount) { |
|
||||||
|
|
||||||
String amount = finalAmount; |
|
||||||
//Get the amount from current screen
|
|
||||||
String payAmount = amount; |
|
||||||
|
|
||||||
//Convert double value of amount from UDC kiosk app to integer 1st
|
|
||||||
double doubleValue = Double.parseDouble(payAmount); |
|
||||||
|
|
||||||
//Convert amount to time 100 for HLB to process
|
|
||||||
int correctAmount = (int) Math.round(doubleValue * 100); |
|
||||||
|
|
||||||
String pay_amount = ""; |
|
||||||
|
|
||||||
Bundle extra = new Bundle(); |
|
||||||
String pay_function = "01"; //Sale Payment Function
|
|
||||||
pay_amount = pay_amount.valueOf(correctAmount); |
|
||||||
String pay_type = "01"; //Card Payment
|
|
||||||
String pay_camera_mode = "01"; //Internal Device Back Camera
|
|
||||||
String pay_print_receipt_id = "N"; //Set Requirement
|
|
||||||
String pay_resp_code = ""; |
|
||||||
|
|
||||||
//Pack Request Message
|
|
||||||
extra.putString("pay_function", pay_function); |
|
||||||
extra.putString("pay_amount", pay_amount); |
|
||||||
extra.putString("pay_type", pay_type); |
|
||||||
extra.putString("pay_camera_mode", pay_camera_mode); |
|
||||||
extra.putString("pay_print_receipt_id", pay_print_receipt_id); |
|
||||||
extra.putString("pay_resp_code", pay_resp_code); |
|
||||||
|
|
||||||
//API to call Payment App
|
|
||||||
Intent intent = new Intent("com.revenue.edc.hlb.pro.app2app"); |
|
||||||
intent.putExtras(extra); |
|
||||||
|
|
||||||
startActivity(intent); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
//updateResponseToApi(String referenceNumber, String status, String merchantCode, String amount, String responseCode,
|
|
||||||
// String encryptedSignValueUpdate, String paramsResponse)
|
|
||||||
//Signature = merchant_code+secret_key+reference_number+amount+response_code ->23/08/2021-update
|
|
||||||
private void updateResponseFromhlb(String referenceNumber, String status, String merchantCode, String amount, String responseCode, |
|
||||||
String encryptedSignValueUpdate, String paramsResponse) { |
|
||||||
String buildToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiOTA2ZTNkN2VmNmZkNmNhZjVjYTVkNWEzYjI5ZDRiMWYxZjlmYTc4ZDcxYzYyNGE0N2FmMTYwMGQzZWY3ZGU5OGE5MGY2NzJlNzE4NmVmZGIiLCJpYXQiOjE2MDg1MzYyMTMsIm5iZiI6MTYwODUzNjIxMywiZXhwIjoxNjQwMDcyMjEzLCJzdWIiOiIxMSIsInNjb3BlcyI6W119.i2jDd1Zux2UkoLhzif762ghsJFhQ32Gk6g0Z2pXDRHKWVoK4kHv__Fnxb4XhdJncfzSmMibZGguOEVPNuRotMjhC7a-lgHKItqeamOSxQNONuhea601R3k8QVDA92mnRKBsDiQw6-mcCw-K5t49I1TkkwauQ1EYQU5GI4vttxbdO_irZfQgINfyCmAkqo_IWgc8498pCuI5lMA2vI9X3BETtNt8WS451hU59fy7K_sjiojFG6mvwu7C-z0ZPcqKQ8F7c2JfZq0qphslMrqj0nZh0skGf0Qf6ZmRrftkNONcO9j9jh5eJfEHIEmGqNhDeO9ftQq5BuWfm6FhYVIW1YnBKrNk6lLkk38fuKjk8FevNwH6knVZjb3Q27Kr7K2cbbvlPEp846VrJrwIdJjfpDuAoorjMQAw-yVJQYOrb_v8F1jhnoMC_Qdu5Qc1AjbDrHggrZtkG9f7pw60reoNk01OCVsOD5ecldm05PfJ2NqhdZn1oXXxFOXc8lcBWpYkfhrOzw0fpxH4hFk4j8HSvy4n0EkB5ZfctDYx6JxXfoCsW7zYgm52ZCZISV5Kchkhlk6W2C1pUs8YjtxAU2I8A6wVbJwGVbwsDudgPXMuNH_PVk3YkljWU-zkPbMLWMOc-DNyioE-dAoq1VWPXoNuhaOqMDR4RCiZPhvJg0yxfA68"; |
|
||||||
|
|
||||||
//Get REQUERY Payment from UDC Laravel Echo Listener Server
|
|
||||||
Retrofit retrofit = new Retrofit.Builder() |
|
||||||
.baseUrl("http://udcsys-api-build.testpigeon.net") |
|
||||||
.addConverterFactory(GsonConverterFactory.create()) |
|
||||||
.build(); |
|
||||||
|
|
||||||
RetrofitAPICollection retrofitAPICollection = retrofit.create(RetrofitAPICollection.class); |
|
||||||
Call<String> call = retrofitAPICollection.updateStatusCardPayment("Bearer " + buildToken, |
|
||||||
referenceNumber, |
|
||||||
status, |
|
||||||
merchantCode, |
|
||||||
amount, |
|
||||||
responseCode, |
|
||||||
encryptedSignValueUpdate, |
|
||||||
paramsResponse); |
|
||||||
|
|
||||||
call.enqueue(new Callback<String>() { |
|
||||||
@Override |
|
||||||
public void onResponse(Call<String> call, Response<String> response) { |
|
||||||
//txtStatus.setText(response.body().getReferenceNumber()+ " ".concat(response.body().getStatus()+ " "));
|
|
||||||
|
|
||||||
Toast.makeText(StatusActivity.this, "\n" + |
|
||||||
"Update data process completed!", Toast.LENGTH_SHORT).show(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onFailure(Call<String> call, Throwable t) { |
|
||||||
Toast.makeText(StatusActivity.this, "Unsuccessfully update data!\n", Toast.LENGTH_SHORT).show(); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private void buttonRetryPayment(String transactionStatus) { |
|
||||||
|
|
||||||
//Get status from Response Screen , send to MainActivity for retry process
|
|
||||||
Intent intent = new Intent(StatusActivity.this, MainActivity.class); |
|
||||||
//intent.putExtra("transaction", transaction);
|
|
||||||
intent.putExtra("status", transactionStatus); |
|
||||||
startActivity(intent); |
|
||||||
//setResult(RESULT_OK);
|
|
||||||
//finish();
|
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,49 @@ |
|||||||
|
package com.cst.im30.api; |
||||||
|
|
||||||
|
import retrofit2.Call; |
||||||
|
import retrofit2.http.Body; |
||||||
|
import retrofit2.http.GET; |
||||||
|
import retrofit2.http.Header; |
||||||
|
import retrofit2.http.Headers; |
||||||
|
import retrofit2.http.POST; |
||||||
|
import retrofit2.http.PUT; |
||||||
|
import retrofit2.http.Path; |
||||||
|
|
||||||
|
@SuppressWarnings({"unused"}) |
||||||
|
public interface RetrofitAPICollection { |
||||||
|
|
||||||
|
@Headers({ |
||||||
|
"Accept: application/json", |
||||||
|
"Content-Type: application/json" |
||||||
|
}) |
||||||
|
@GET("api/v1/kiosk/broadcast-event-log/{eventCode}") |
||||||
|
Call<String> getBroadcastEventLogDetails( |
||||||
|
@Header("Client-Id") String clientId, |
||||||
|
@Header("Client-Secret") String clientSecret, |
||||||
|
@Path("eventCode") String referenceNumber |
||||||
|
); |
||||||
|
|
||||||
|
@Headers({ |
||||||
|
"Accept: application/json", |
||||||
|
"Content-Type: application/json" |
||||||
|
}) |
||||||
|
@PUT("api/v1/kiosk/broadcast-event-log/{eventCode}") |
||||||
|
Call<String> updateBroadcastEventLogDetails( |
||||||
|
@Header("Client-Id") String clientId, |
||||||
|
@Header("Client-Secret") String clientSecret, |
||||||
|
@Body String body, |
||||||
|
@Path("eventCode") String referenceNumber |
||||||
|
); |
||||||
|
|
||||||
|
@Headers({ |
||||||
|
"Accept: application/json", |
||||||
|
"Content-Type: application/json", |
||||||
|
}) |
||||||
|
@POST("api/v1/kiosk/booking/upload-terminal-revpay-transaction") |
||||||
|
Call<String> uploadRevPayTransaction( |
||||||
|
@Header("Client-Id") String clientId, |
||||||
|
@Header("Client-Secret") String clientSecret, |
||||||
|
@Body String body |
||||||
|
); |
||||||
|
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.cst.im30.retrofit; |
package com.cst.im30.api; |
||||||
|
|
||||||
import java.util.concurrent.TimeUnit; |
import java.util.concurrent.TimeUnit; |
||||||
|
|
@ -1,28 +1,34 @@ |
|||||||
package com.cst.im30.common; |
package com.cst.im30.common; |
||||||
|
|
||||||
|
@SuppressWarnings({"unused"}) |
||||||
public class Constants { |
public class Constants { |
||||||
|
|
||||||
//change to gradle properties
|
public static final String APP_2_APP = "com.revenue.edc.hlb.pro.app2app"; |
||||||
|
public static final String INTENT_ACTION = "com.posapp.payactivity"; |
||||||
public static final String SERVER_URL = "http://hello-booking-api-build.testpigeon.net"; |
public static final String INTENT_REFRESH = "refresh"; |
||||||
public static final String CLIENT_ID = "3"; |
public static final String INTENT_RESET = "reset"; |
||||||
public static final String CLIENT_SECRET = "w5RJ7bMF6NH39aDVyJJV0M1gOg0nZQcO2atVcXyF"; |
|
||||||
|
public static final String IC_FUNCTION_VERIFY = "verify"; |
||||||
public static final String ECHO_SERVER_URL = "http://hello-booking-api-build.testpigeon.net"; |
public static final String IC_FUNCTION_CANCEL = "cancel"; |
||||||
public static final String ECHO_SERVER_PORT = "6001"; |
|
||||||
|
public static final String PAY_FUNCTION_SALE = "01"; |
||||||
public static final String KIOSK_CODE = "KIOSK002"; |
public static final String PAY_FUNCTION_VOID = "02"; |
||||||
|
public static final String PAY_FUNCTION_INQUIRY = "03"; |
||||||
public static final String SOCKET_PREFIX = "HelloBookingApi_"; |
public static final String PAY_FUNCTION_SALE_CASH = "04"; |
||||||
|
public static final String PAY_FUNCTION_PING = "05"; |
||||||
public static final String PAYMENT_CHANNEL_ID = "payment#"; |
public static final String PAY_FUNCTION_STATUS = "06"; |
||||||
public static final String PAYMENT_EVENT_TYPE = ".makepayment"; |
public static final String PAY_FUNCTION_CANCEL = "07"; |
||||||
|
public static final String PAY_FUNCTION_INSTALLMENT = "08"; |
||||||
public static final String IC_CHANNEL_ID = "verification#"; |
public static final String PAY_FUNCTION_PRE_AUTH = "09"; |
||||||
public static final String IC_EVENT_TYPE = ".guestverification"; |
public static final String PAY_FUNCTION_SALE_COMPLETION = "10"; |
||||||
|
public static final String PAY_FUNCTION_SETTLEMENT = "11"; |
||||||
//trigger
|
public static final String PAY_FUNCTION_SET_DATE_TIME = "12"; |
||||||
//public static final String LAUNCH_URL = "http://laravel-echo-server.testpigeon.net";
|
public static final String PAY_FUNCTION_READ_CARD_INFORMATION = "13"; |
||||||
//public static final String LAUNCH_URL = "http://udcsys-api-build.testpigeon.net";
|
|
||||||
|
|
||||||
|
public static final String STATUS_SUCCESS = "success"; |
||||||
|
public static final String STATUS_FAIL = "fail"; |
||||||
|
public static final String STATUS_CANCELLED = "cancelled"; |
||||||
|
public static final String STATUS_REJECT = "reject"; |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,21 +0,0 @@ |
|||||||
package com.cst.im30.common; |
|
||||||
|
|
||||||
import org.json.JSONObject; |
|
||||||
|
|
||||||
import java.io.Serializable; |
|
||||||
|
|
||||||
public class Parcel implements Serializable { |
|
||||||
private JSONObject obj; |
|
||||||
|
|
||||||
public Parcel(JSONObject obj) { |
|
||||||
this.obj = obj; |
|
||||||
} |
|
||||||
|
|
||||||
public Parcel(String toString) { |
|
||||||
} |
|
||||||
|
|
||||||
public JSONObject getObj() { |
|
||||||
return obj; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,107 +0,0 @@ |
|||||||
package com.cst.im30.common; |
|
||||||
|
|
||||||
import com.google.gson.annotations.Expose; |
|
||||||
import com.google.gson.annotations.SerializedName; |
|
||||||
|
|
||||||
public class Payment { |
|
||||||
@SerializedName("reference_number") |
|
||||||
@Expose |
|
||||||
private String referenceNumber; |
|
||||||
|
|
||||||
/*@Field("reference_number") String referenceNumber, |
|
||||||
@Field("payment_type") String paymentType, |
|
||||||
@Field("payment_function") String paymentFunction, |
|
||||||
@Field("payment_camera_mode") String paymentCameraMode, |
|
||||||
@Field("signature") String signature, |
|
||||||
@Field("amount") String amount, |
|
||||||
@Field("status") String status, |
|
||||||
@Field("params_response") String paramsResponse);*/ |
|
||||||
|
|
||||||
@SerializedName("payment_type") |
|
||||||
@Expose |
|
||||||
private String paymentType; |
|
||||||
|
|
||||||
@SerializedName("payment_function") |
|
||||||
@Expose |
|
||||||
private String paymentFunction; |
|
||||||
|
|
||||||
@SerializedName("payment_camera_mode") |
|
||||||
@Expose |
|
||||||
private String paymentCameraMode; |
|
||||||
|
|
||||||
@SerializedName("signature") |
|
||||||
@Expose |
|
||||||
private String signature; |
|
||||||
|
|
||||||
@SerializedName("amount") |
|
||||||
@Expose |
|
||||||
private String amount; |
|
||||||
|
|
||||||
@SerializedName("status") |
|
||||||
@Expose |
|
||||||
private String status; |
|
||||||
|
|
||||||
@SerializedName("params_response") |
|
||||||
@Expose |
|
||||||
private String[] params; |
|
||||||
|
|
||||||
public Payment(String referenceNumber, String paymentType, String paymentFunction, String paymentCameraMode, String signature, |
|
||||||
String amount, String status, String[] params) { |
|
||||||
this.referenceNumber = referenceNumber; |
|
||||||
this.paymentType = paymentType; |
|
||||||
this.paymentFunction = paymentFunction; |
|
||||||
this.paymentCameraMode = paymentCameraMode; |
|
||||||
this.signature = signature; |
|
||||||
this.amount = amount; |
|
||||||
this.status = status; |
|
||||||
this.params = params; |
|
||||||
} |
|
||||||
|
|
||||||
//GETTER
|
|
||||||
public String getReferenceNumber() { |
|
||||||
return referenceNumber; |
|
||||||
} |
|
||||||
|
|
||||||
public void setReferenceNumber(String referenceNumber) { |
|
||||||
this.referenceNumber = referenceNumber; |
|
||||||
} |
|
||||||
|
|
||||||
public String getPaymentType() { |
|
||||||
return paymentType; |
|
||||||
} |
|
||||||
|
|
||||||
public String getPaymentFunction() { |
|
||||||
return paymentFunction; |
|
||||||
} |
|
||||||
|
|
||||||
public String getPaymentCameraMode() { |
|
||||||
return paymentCameraMode; |
|
||||||
} |
|
||||||
|
|
||||||
public String getSignature() { |
|
||||||
return signature; |
|
||||||
} |
|
||||||
|
|
||||||
public String getAmount() { |
|
||||||
return amount; |
|
||||||
} |
|
||||||
|
|
||||||
public void setAmount(String amount) { |
|
||||||
this.amount = amount; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
//SETTER
|
|
||||||
|
|
||||||
public String getStatus() { |
|
||||||
return status; |
|
||||||
} |
|
||||||
|
|
||||||
public void setStatus(String status) { |
|
||||||
this.status = status; |
|
||||||
} |
|
||||||
|
|
||||||
public String[] getParams() { |
|
||||||
return params; |
|
||||||
} |
|
||||||
} |
|
@ -1,400 +0,0 @@ |
|||||||
package com.cst.im30.entity; |
|
||||||
|
|
||||||
import androidx.room.ColumnInfo; |
|
||||||
import androidx.room.Entity; |
|
||||||
import androidx.room.PrimaryKey; |
|
||||||
|
|
||||||
import java.io.Serializable; |
|
||||||
|
|
||||||
@Entity(tableName = Transaction.TABLE_NAME) |
|
||||||
public class Transaction implements Serializable { |
|
||||||
|
|
||||||
public static final String TABLE_NAME = "transactions"; |
|
||||||
public static final String COLUMN_ID = "id"; |
|
||||||
public static final String COLUMN_TYPE = "type"; |
|
||||||
public static final String COLUMN_KEY_INDEX = "key_index"; |
|
||||||
public static final String COLUMN_SIGNATURE = "signature"; |
|
||||||
public static final String COLUMN_SIGNATURE_METHOD = "signature_method"; |
|
||||||
public static final String COLUMN_AMOUNT = "amount"; |
|
||||||
public static final String COLUMN_CAMERA_MODE = "camera_mode"; |
|
||||||
public static final String COLUMN_BANK_REF_NUM = "bank_ref_num"; |
|
||||||
public static final String COLUMN_BATCH_NO = "batch_no"; |
|
||||||
public static final String COLUMN_RESPONSE_CODE = "response_code"; |
|
||||||
public static final String COLUMN_RESPONSE_CODE_DESC = "response_code_desc"; |
|
||||||
public static final String COLUMN_CURRENCY = "currency"; |
|
||||||
public static final String COLUMN_CUSTOMER_ID = "customer_id"; |
|
||||||
public static final String COLUMN_DISPLAY_MID = "display_mid"; |
|
||||||
public static final String COLUMN_DISPLAY_TID = "display_tid"; |
|
||||||
public static final String COLUMN_ENTRY_MODE = "entry_mode"; |
|
||||||
public static final String COLUMN_FUNCTION = "function"; |
|
||||||
public static final String COLUMN_INVOICE_NO = "invoice_no"; |
|
||||||
public static final String COLUMN_MID = "mid"; |
|
||||||
public static final String COLUMN_QR_CODE = "qr_code"; |
|
||||||
public static final String COLUMN_SCHEME = "scheme"; |
|
||||||
public static final String COLUMN_TID = "tid"; |
|
||||||
public static final String COLUMN_TRACE_NO = "trace_no"; |
|
||||||
public static final String COLUMN_TXN_DESC = "txn_desc"; |
|
||||||
public static final String COLUMN_TXN_DT = "txn_dt"; |
|
||||||
public static final String COLUMN_TXN_ID = "txn_id"; |
|
||||||
public static final String COLUMN_STATUS = "status"; |
|
||||||
public static final String COLUMN_ORI_INVOICE_NO = "ori_invoice_no"; |
|
||||||
public static final String COLUMN_VOIDED_AT = "voided_at"; |
|
||||||
public static final String COLUMN_SETTLED_AT = "settled_at"; |
|
||||||
public static final String COLUMN_CREATED_AT = "created_at"; |
|
||||||
public static final String COLUMN_UPDATED_AT = "updated_at"; |
|
||||||
|
|
||||||
@PrimaryKey(autoGenerate = true) |
|
||||||
private int id; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_TYPE) |
|
||||||
private String type; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_KEY_INDEX) |
|
||||||
private String keyIndex; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_SIGNATURE) |
|
||||||
private String signature; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_SIGNATURE_METHOD) |
|
||||||
private String signatureMethod; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_AMOUNT) |
|
||||||
private String amount; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_CAMERA_MODE) |
|
||||||
private String cameraMode; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_BANK_REF_NUM) |
|
||||||
private String bankRefNum; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_BATCH_NO) |
|
||||||
private String batchNo; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_RESPONSE_CODE) |
|
||||||
private String responseCode; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_RESPONSE_CODE_DESC) |
|
||||||
private String responseCodeDesc; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_CURRENCY) |
|
||||||
private String currency; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_CUSTOMER_ID) |
|
||||||
private String customerId; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_DISPLAY_MID) |
|
||||||
private String displayMid; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_DISPLAY_TID) |
|
||||||
private String displayTid; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_ENTRY_MODE) |
|
||||||
private String entryMode; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_FUNCTION) |
|
||||||
private String function; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_INVOICE_NO) |
|
||||||
private String invoiceNo; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_MID) |
|
||||||
private String mid; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_QR_CODE) |
|
||||||
private String qrCode; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_SCHEME) |
|
||||||
private String scheme; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_TID) |
|
||||||
private String tid; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_TRACE_NO) |
|
||||||
private String traceNo; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_TXN_DESC) |
|
||||||
private String transactionDesc; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_TXN_DT) |
|
||||||
private String transactionDt; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_TXN_ID) |
|
||||||
private String transactionId; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_STATUS) |
|
||||||
private String status; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_ORI_INVOICE_NO) |
|
||||||
private String oriInvoiceNo; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_VOIDED_AT) |
|
||||||
private String voidedAt; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_SETTLED_AT) |
|
||||||
private String settledAt; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_CREATED_AT) |
|
||||||
private String createdAt; |
|
||||||
|
|
||||||
@ColumnInfo(name = COLUMN_UPDATED_AT) |
|
||||||
private String updatedAt; |
|
||||||
|
|
||||||
public Transaction() { |
|
||||||
} |
|
||||||
|
|
||||||
public int getId() { |
|
||||||
return id; |
|
||||||
} |
|
||||||
|
|
||||||
public void setId(int id) { |
|
||||||
this.id = id; |
|
||||||
} |
|
||||||
|
|
||||||
public String getType() { |
|
||||||
return type == null ? "" : type; |
|
||||||
} |
|
||||||
|
|
||||||
public void setType(String type) { |
|
||||||
this.type = type; |
|
||||||
} |
|
||||||
|
|
||||||
public String getKeyIndex() { |
|
||||||
return keyIndex == null ? "" : keyIndex; |
|
||||||
} |
|
||||||
|
|
||||||
public void setKeyIndex(String keyIndex) { |
|
||||||
this.keyIndex = keyIndex; |
|
||||||
} |
|
||||||
|
|
||||||
public String getSignature() { |
|
||||||
return signature == null ? "" : signature; |
|
||||||
} |
|
||||||
|
|
||||||
public void setSignature(String signature) { |
|
||||||
this.signature = signature; |
|
||||||
} |
|
||||||
|
|
||||||
public String getSignatureMethod() { |
|
||||||
return signatureMethod == null ? "" : signatureMethod; |
|
||||||
} |
|
||||||
|
|
||||||
public void setSignatureMethod(String signatureMethod) { |
|
||||||
this.signatureMethod = signatureMethod; |
|
||||||
} |
|
||||||
|
|
||||||
public String getAmount() { |
|
||||||
return amount == null ? "" : amount; |
|
||||||
} |
|
||||||
|
|
||||||
public void setAmount(String amount) { |
|
||||||
this.amount = amount; |
|
||||||
} |
|
||||||
|
|
||||||
public String getCameraMode() { |
|
||||||
return cameraMode == null ? "" : cameraMode; |
|
||||||
} |
|
||||||
|
|
||||||
public void setCameraMode(String cameraMode) { |
|
||||||
this.cameraMode = cameraMode; |
|
||||||
} |
|
||||||
|
|
||||||
public String getBankRefNum() { |
|
||||||
return bankRefNum == null ? "" : bankRefNum; |
|
||||||
} |
|
||||||
|
|
||||||
public void setBankRefNum(String bankRefNum) { |
|
||||||
this.bankRefNum = bankRefNum; |
|
||||||
} |
|
||||||
|
|
||||||
public String getBatchNo() { |
|
||||||
return batchNo == null ? "" : batchNo; |
|
||||||
} |
|
||||||
|
|
||||||
public void setBatchNo(String batchNo) { |
|
||||||
this.batchNo = batchNo; |
|
||||||
} |
|
||||||
|
|
||||||
public String getResponseCode() { |
|
||||||
return responseCode == null ? "" : responseCode; |
|
||||||
} |
|
||||||
|
|
||||||
public void setResponseCode(String responseCode) { |
|
||||||
this.responseCode = responseCode; |
|
||||||
} |
|
||||||
|
|
||||||
public String getResponseCodeDesc() { |
|
||||||
return responseCodeDesc == null ? "" : responseCodeDesc; |
|
||||||
} |
|
||||||
|
|
||||||
public void setResponseCodeDesc(String responseCodeDesc) { |
|
||||||
this.responseCodeDesc = responseCodeDesc; |
|
||||||
} |
|
||||||
|
|
||||||
public String getCurrency() { |
|
||||||
return currency == null ? "" : currency; |
|
||||||
} |
|
||||||
|
|
||||||
public void setCurrency(String currency) { |
|
||||||
this.currency = currency; |
|
||||||
} |
|
||||||
|
|
||||||
public String getCustomerId() { |
|
||||||
return customerId == null ? "" : customerId; |
|
||||||
} |
|
||||||
|
|
||||||
public void setCustomerId(String customerId) { |
|
||||||
this.customerId = customerId; |
|
||||||
} |
|
||||||
|
|
||||||
public String getDisplayMid() { |
|
||||||
return displayMid == null ? "" : displayMid; |
|
||||||
} |
|
||||||
|
|
||||||
public void setDisplayMid(String displayMid) { |
|
||||||
this.displayMid = displayMid; |
|
||||||
} |
|
||||||
|
|
||||||
public String getDisplayTid() { |
|
||||||
return displayTid == null ? "" : displayTid; |
|
||||||
} |
|
||||||
|
|
||||||
public void setDisplayTid(String displayTid) { |
|
||||||
this.displayTid = displayTid; |
|
||||||
} |
|
||||||
|
|
||||||
public String getEntryMode() { |
|
||||||
return entryMode == null ? "" : entryMode; |
|
||||||
} |
|
||||||
|
|
||||||
public void setEntryMode(String entryMode) { |
|
||||||
this.entryMode = entryMode; |
|
||||||
} |
|
||||||
|
|
||||||
public String getFunction() { |
|
||||||
return function == null ? "" : function; |
|
||||||
} |
|
||||||
|
|
||||||
public void setFunction(String function) { |
|
||||||
this.function = function; |
|
||||||
} |
|
||||||
|
|
||||||
public String getInvoiceNo() { |
|
||||||
return invoiceNo == null ? "" : invoiceNo; |
|
||||||
} |
|
||||||
|
|
||||||
public void setInvoiceNo(String invoiceNo) { |
|
||||||
this.invoiceNo = invoiceNo; |
|
||||||
} |
|
||||||
|
|
||||||
public String getMid() { |
|
||||||
return mid == null ? "" : mid; |
|
||||||
} |
|
||||||
|
|
||||||
public void setMid(String mid) { |
|
||||||
this.mid = mid; |
|
||||||
} |
|
||||||
|
|
||||||
public String getQrCode() { |
|
||||||
return qrCode == null ? "" : qrCode; |
|
||||||
} |
|
||||||
|
|
||||||
public void setQrCode(String qrCode) { |
|
||||||
this.qrCode = qrCode; |
|
||||||
} |
|
||||||
|
|
||||||
public String getScheme() { |
|
||||||
return scheme == null ? "" : scheme; |
|
||||||
} |
|
||||||
|
|
||||||
public void setScheme(String scheme) { |
|
||||||
this.scheme = scheme; |
|
||||||
} |
|
||||||
|
|
||||||
public String getTid() { |
|
||||||
return tid == null ? "" : tid; |
|
||||||
} |
|
||||||
|
|
||||||
public void setTid(String tid) { |
|
||||||
this.tid = tid; |
|
||||||
} |
|
||||||
|
|
||||||
public String getTraceNo() { |
|
||||||
return traceNo == null ? "" : traceNo; |
|
||||||
} |
|
||||||
|
|
||||||
public void setTraceNo(String traceNo) { |
|
||||||
this.traceNo = traceNo; |
|
||||||
} |
|
||||||
|
|
||||||
public String getTransactionDesc() { |
|
||||||
return transactionDesc == null ? "" : transactionDesc; |
|
||||||
} |
|
||||||
|
|
||||||
public void setTransactionDesc(String transactionDesc) { |
|
||||||
this.transactionDesc = transactionDesc; |
|
||||||
} |
|
||||||
|
|
||||||
public String getTransactionDt() { |
|
||||||
return transactionDt == null ? "" : transactionDt; |
|
||||||
} |
|
||||||
|
|
||||||
public void setTransactionDt(String transactionDt) { |
|
||||||
this.transactionDt = transactionDt; |
|
||||||
} |
|
||||||
|
|
||||||
public String getTransactionId() { |
|
||||||
return transactionId == null ? "" : transactionId; |
|
||||||
} |
|
||||||
|
|
||||||
public void setTransactionId(String transactionId) { |
|
||||||
this.transactionId = transactionId; |
|
||||||
} |
|
||||||
|
|
||||||
public String getStatus() { |
|
||||||
return status == null ? "" : status; |
|
||||||
} |
|
||||||
|
|
||||||
public void setStatus(String status) { |
|
||||||
this.status = status; |
|
||||||
} |
|
||||||
|
|
||||||
public String getOriInvoiceNo() { |
|
||||||
return oriInvoiceNo == null ? "" : oriInvoiceNo; |
|
||||||
} |
|
||||||
|
|
||||||
public void setOriInvoiceNo(String oriInvoiceNo) { |
|
||||||
this.oriInvoiceNo = oriInvoiceNo; |
|
||||||
} |
|
||||||
|
|
||||||
public String getVoidedAt() { |
|
||||||
return voidedAt == null ? "" : voidedAt; |
|
||||||
} |
|
||||||
|
|
||||||
public void setVoidedAt(String voidedAt) { |
|
||||||
this.voidedAt = voidedAt; |
|
||||||
} |
|
||||||
|
|
||||||
public String getSettledAt() { |
|
||||||
return settledAt == null ? "" : settledAt; |
|
||||||
} |
|
||||||
|
|
||||||
public void setSettledAt(String settledAt) { |
|
||||||
this.settledAt = settledAt; |
|
||||||
} |
|
||||||
|
|
||||||
public String getCreatedAt() { |
|
||||||
return createdAt == null ? "" : createdAt; |
|
||||||
} |
|
||||||
|
|
||||||
public void setCreatedAt(String createdAt) { |
|
||||||
this.createdAt = createdAt; |
|
||||||
} |
|
||||||
|
|
||||||
public String getUpdatedAt() { |
|
||||||
return updatedAt == null ? "" : updatedAt; |
|
||||||
} |
|
||||||
|
|
||||||
public void setUpdatedAt(String updatedAt) { |
|
||||||
this.updatedAt = updatedAt; |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,15 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class CancelRequest implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 07 - Cancel |
||||||
|
**/ |
||||||
|
private String payFunction = "07"; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class CancelResponse implements Serializable { |
||||||
|
|
||||||
|
private String payFunction; |
||||||
|
private String payRespCode; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class InquiryRequest implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 03 - Inquiry |
||||||
|
**/ |
||||||
|
private String payFunction = "03"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 12 - Original amount in cents (RM5.00 is "500") |
||||||
|
**/ |
||||||
|
private String payAmount; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 1 - Y or N for Print Receipt or Not |
||||||
|
**/ |
||||||
|
private String payPrintReceiptId = "N"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Conditional 6 - Original Trace Number |
||||||
|
**/ |
||||||
|
private String payTraceNo; |
||||||
|
|
||||||
|
/** |
||||||
|
* Conditional 6 - Original Invoice Number |
||||||
|
**/ |
||||||
|
private String payInvoiceNo; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class InquiryResponse implements Serializable { |
||||||
|
|
||||||
|
private String payAmount; |
||||||
|
private String payFunction; |
||||||
|
private String payPrintReceiptId; |
||||||
|
private String payRespTxnDate; |
||||||
|
private String payRespTxnTime; |
||||||
|
private String payRespInvoiceNo; |
||||||
|
private String payRespTraceNo; |
||||||
|
private String payRespBatchNo; |
||||||
|
private String payRespScheme; |
||||||
|
private String payRespTid; |
||||||
|
private String payRespMid; |
||||||
|
private String payRespQrTxnId; |
||||||
|
private String payRespQrWalletId; |
||||||
|
private String payRespCustomerId; |
||||||
|
private String payRespCode; |
||||||
|
private String payRespErrorDesc; |
||||||
|
private String payRespMerchInfo; |
||||||
|
private String payRespIssuerId; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class PreAuthRequest implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 09 - Pre Auth |
||||||
|
**/ |
||||||
|
private String payFunction = "09"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 12 - Amount in cents (RM5.00 is "500" |
||||||
|
**/ |
||||||
|
private String payAmount; //
|
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 50 |
||||||
|
**/ |
||||||
|
private String payPosTxnId; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 1 - Y or N for Print Receipt or Not |
||||||
|
**/ |
||||||
|
private String payPrintReceiptId = "N"; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class PreAuthResponse implements Serializable { |
||||||
|
|
||||||
|
private String payAmount; |
||||||
|
private String payFunction; |
||||||
|
private String payType; |
||||||
|
private String payPrintReceiptId; |
||||||
|
private String payRespTxnDate; |
||||||
|
private String payRespTxnTime; |
||||||
|
private String payRespInvoiceNo; |
||||||
|
private String payRespTraceNo; |
||||||
|
private String payRespBatchNo; |
||||||
|
private String payRespScheme; |
||||||
|
private String payRespTid; |
||||||
|
private String payRespMid; |
||||||
|
private String payRespCardAuthCode; |
||||||
|
private String payRespCardRefNum; |
||||||
|
private String payRespCardNo; |
||||||
|
private String payRespIssuerId; |
||||||
|
private String payRespCardAid; |
||||||
|
private String payRespCardAppCryptogram; |
||||||
|
private String payRespCode; |
||||||
|
private String payRespErrorDesc; |
||||||
|
private String payRespMerchInfo; |
||||||
|
private String payRespTvr; |
||||||
|
private String payRespCvmDesc; |
||||||
|
private String payRespAppLabel; |
||||||
|
private String payRespHashPan; |
||||||
|
private String token; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SaleCompletionRequest implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 10 - Sale Completion |
||||||
|
**/ |
||||||
|
private String payFunction = "10"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 12 - Amount in cents (RM5.00 is "500" |
||||||
|
**/ |
||||||
|
private String payAmount; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 6 - Pre Auth Transaction Approval Code |
||||||
|
**/ |
||||||
|
private String payAuthCode; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 12 - Pre Auth Transaction Reference Number |
||||||
|
**/ |
||||||
|
private String payRefNum; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 50 |
||||||
|
**/ |
||||||
|
private String payPosTxnId; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 1 - Y or N for Print Receipt or Not |
||||||
|
**/ |
||||||
|
private String payPrintReceiptId = "N"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 50 - Pre Auth Card Token (Token + AuthCode + RefNum must be sent together) |
||||||
|
**/ |
||||||
|
private String token; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SaleCompletionResponse implements Serializable { |
||||||
|
|
||||||
|
private String payAmount; |
||||||
|
private String payFunction; |
||||||
|
private String payType; |
||||||
|
private String payPrintReceiptId; |
||||||
|
private String payRespTxnDate; |
||||||
|
private String payRespTxnTime; |
||||||
|
private String payRespInvoiceNo; |
||||||
|
private String payRespTraceNo; |
||||||
|
private String payRespBatchNo; |
||||||
|
private String payRespScheme; |
||||||
|
private String payRespTid; |
||||||
|
private String payRespMid; |
||||||
|
private String payRespCardAuthCode; |
||||||
|
private String payRespCardRefNum; |
||||||
|
private String payRespCardNo; |
||||||
|
private String payRespIssuerId; |
||||||
|
private String payRespCardAid; |
||||||
|
private String payRespCardAppCryptogram; |
||||||
|
private String payRespCode; |
||||||
|
private String payRespErrorDesc; |
||||||
|
private String payRespMerchInfo; |
||||||
|
private String payRespTvr; |
||||||
|
private String payRespCvmDesc; |
||||||
|
private String payRespAppLabel; |
||||||
|
private String payRespHashPan; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SaleRequest implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 01 - Sale |
||||||
|
**/ |
||||||
|
private String payFunction = "01"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 12 - Amount in cents (RM5.00 is "500") |
||||||
|
**/ |
||||||
|
private String payAmount; //
|
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 01 Card / 02 QR / 03 DuitNow QR |
||||||
|
**/ |
||||||
|
private String payType = "01"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Conditional 2 - 01 Back / 02 Front |
||||||
|
**/ |
||||||
|
private String payCameraMode = "01"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 50 |
||||||
|
**/ |
||||||
|
private String payPosTxnId; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 1 - Y or N for Print Receipt or Not |
||||||
|
**/ |
||||||
|
private String payPrintReceiptId = "N"; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SaleResponse implements Serializable { |
||||||
|
|
||||||
|
private String payAmount; |
||||||
|
private String payFunction; |
||||||
|
private String payType; |
||||||
|
private String payCameraMode; |
||||||
|
private String payPrintReceiptId; |
||||||
|
private String payRespTxnDate; |
||||||
|
private String payRespTxnTime; |
||||||
|
private String payRespInvoiceNo; |
||||||
|
private String payRespTraceNo; |
||||||
|
private String payRespBatchNo; |
||||||
|
private String payRespScheme; |
||||||
|
private String payRespTid; |
||||||
|
private String payRespMid; |
||||||
|
private String payRespCardAuthCode; |
||||||
|
private String payRespCardRefNum; |
||||||
|
private String payRespCardNo; |
||||||
|
private String payRespIssuerId; |
||||||
|
private String payRespCardAid; |
||||||
|
private String payRespCardAppCryptogram; |
||||||
|
private String payRespQrTxnId; |
||||||
|
private String payRespQrWalletId; |
||||||
|
private String payRespCustomerId; |
||||||
|
private String payRespCode; |
||||||
|
private String payRespErrorDesc; |
||||||
|
private String payRespMerchInfo; |
||||||
|
private String payRespTvr; |
||||||
|
private String payRespCvmDesc; |
||||||
|
private String payRespAppLabel; |
||||||
|
private String payRespHashPan; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SetDateTimeRequest implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 12 - Set Date Time |
||||||
|
**/ |
||||||
|
private String payFunction = "12"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 8 - YYYYMMDD |
||||||
|
**/ |
||||||
|
private String payPosTxnDate; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 6 - HHMMSS |
||||||
|
**/ |
||||||
|
private String payPosTxnTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SetDateTimeResponse implements Serializable { |
||||||
|
|
||||||
|
private String payFunction; |
||||||
|
private String payRespTxnDate; |
||||||
|
private String payRespTxnTime; |
||||||
|
private String payRespCode; |
||||||
|
private String payRespErrorDesc; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SettlementRequest implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 11 - Settlement |
||||||
|
**/ |
||||||
|
private String payFunction = "11"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 1 - Y or N for Print Receipt or Not |
||||||
|
**/ |
||||||
|
private String payPrintReceiptId = "N"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 50 |
||||||
|
**/ |
||||||
|
private String payPosTxnId; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SettlementResponse implements Serializable { |
||||||
|
|
||||||
|
private String payFunction; |
||||||
|
private String payPrintReceiptId; |
||||||
|
private String payRespTxnDate; |
||||||
|
private String payRespTxnTime; |
||||||
|
private String payRespBatchNo; |
||||||
|
private String payRespTid; |
||||||
|
private String payRespMid; |
||||||
|
private String payRespCode; |
||||||
|
private String payRespErrorDesc; |
||||||
|
private String payRespMerchInfo; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class VoidRequest implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* Mandatory 2 - 02 - Void |
||||||
|
**/ |
||||||
|
private String payFunction = "02"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 12 - Original amount in cents (RM5.00 is "500") |
||||||
|
**/ |
||||||
|
private String payAmount; //
|
||||||
|
|
||||||
|
/** |
||||||
|
* Optional 1 - Y or N for Print Receipt or Not |
||||||
|
**/ |
||||||
|
private String payPrintReceiptId = "N"; |
||||||
|
|
||||||
|
/** |
||||||
|
* Conditional 6 - Original Trace Number |
||||||
|
**/ |
||||||
|
private String payTraceNo; |
||||||
|
|
||||||
|
/** |
||||||
|
* Conditional 6 - Original Invoice Number |
||||||
|
**/ |
||||||
|
private String payInvoiceNo; |
||||||
|
|
||||||
|
/** |
||||||
|
* Conditional 50 |
||||||
|
**/ |
||||||
|
private String payPosTxnId; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.cst.im30.model; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class VoidResponse implements Serializable { |
||||||
|
|
||||||
|
private String payAmount; |
||||||
|
private String payFunction; |
||||||
|
private String payType; |
||||||
|
private String payPrintReceiptId; |
||||||
|
private String payRespTxnDate; |
||||||
|
private String payRespTxnTime; |
||||||
|
private String payRespInvoiceNo; |
||||||
|
private String payRespTraceNo; |
||||||
|
private String payRespBatchNo; |
||||||
|
private String payRespScheme; |
||||||
|
private String payRespTid; |
||||||
|
private String payRespMid; |
||||||
|
private String payRespCardAuthCode; |
||||||
|
private String payRespCardRefNum; |
||||||
|
private String payRespQrTxnId; |
||||||
|
private String payRespQrWalletId; |
||||||
|
private String payRespCardNo; |
||||||
|
private String payRespIssuerId; |
||||||
|
private String payRespCustomerId; |
||||||
|
private String payRespCardAppCryptogram; |
||||||
|
private String payRespCode; |
||||||
|
private String payRespErrorDesc; |
||||||
|
private String payRespMerchInfo; |
||||||
|
private String payRespTvr; |
||||||
|
private String payRespCvmDesc; |
||||||
|
private String payRespAppLabel; |
||||||
|
|
||||||
|
} |
@ -1,86 +0,0 @@ |
|||||||
package com.cst.im30.retrofit; |
|
||||||
|
|
||||||
import com.cst.im30.common.Payment; |
|
||||||
|
|
||||||
import retrofit2.Call; |
|
||||||
import retrofit2.http.Body; |
|
||||||
import retrofit2.http.Field; |
|
||||||
import retrofit2.http.FormUrlEncoded; |
|
||||||
import retrofit2.http.GET; |
|
||||||
import retrofit2.http.Header; |
|
||||||
import retrofit2.http.Headers; |
|
||||||
import retrofit2.http.PUT; |
|
||||||
import retrofit2.http.Path; |
|
||||||
import retrofit2.http.Query; |
|
||||||
|
|
||||||
public interface RetrofitAPICollection { |
|
||||||
|
|
||||||
@GET("launch") |
|
||||||
Call<String> getLaunch(); |
|
||||||
|
|
||||||
//Get data from Laravel Echo Server
|
|
||||||
@GET("/payment-request") |
|
||||||
Call<Payment> getData(); |
|
||||||
|
|
||||||
|
|
||||||
@Headers({ |
|
||||||
"Accept: application/json", |
|
||||||
"Content-Type: application/json" |
|
||||||
}) |
|
||||||
@GET("api/v1/kiosk/broadcast-event-log/{eventCode}") |
|
||||||
Call<String> getBroadcastEventLogDetails( |
|
||||||
@Header("Client-Id") String clientId, |
|
||||||
@Header("Client-Secret") String clientSecret, |
|
||||||
@Path("eventCode") String referenceNumber |
|
||||||
); |
|
||||||
|
|
||||||
@Headers({ |
|
||||||
"Accept: application/json", |
|
||||||
"Content-Type: application/json" |
|
||||||
}) |
|
||||||
@PUT("api/v1/kiosk/broadcast-event-log/{eventCode}") |
|
||||||
Call<String> updateBroadcastEventLogDetails( |
|
||||||
@Header("Client-Id") String clientId, |
|
||||||
@Header("Client-Secret") String clientSecret, |
|
||||||
@Body String body, |
|
||||||
@Path("eventCode") String referenceNumber |
|
||||||
); |
|
||||||
|
|
||||||
|
|
||||||
@Headers({ |
|
||||||
"Accept: application/json" |
|
||||||
}) |
|
||||||
@GET("api/intentpayment/requery") |
|
||||||
Call<String> requeryCardPayment(@Header("Authorization") String token, |
|
||||||
@Query("reference_number") String referenceNumberQuery, |
|
||||||
@Query("merchant_code") String merchantCode, |
|
||||||
@Query("payment_type") String paymentType, |
|
||||||
@Query("amount") String amount, |
|
||||||
@Query("signature") String signature); |
|
||||||
|
|
||||||
@Headers({ |
|
||||||
"Accept: application/json", |
|
||||||
"Content-Type: application/x-www-form-urlencoded" |
|
||||||
}) |
|
||||||
@FormUrlEncoded |
|
||||||
@PUT("api/intentpayment/update-status") |
|
||||||
Call<String> updateStatusCardPayment(@Header("Authorization") String token, |
|
||||||
@Field("reference_number") String referenceNumber, |
|
||||||
@Field("status") String status, |
|
||||||
@Field("merchant_code") String merchantCode, |
|
||||||
@Field("amount") String amount, |
|
||||||
@Field("response_code") String response_code, |
|
||||||
@Field("signature") String signature, |
|
||||||
@Field("params_response") String params_response); |
|
||||||
|
|
||||||
/*Call<Payment> updateStatusCardPayment(@Header("Authorization") String token, |
|
||||||
@Field("reference_number") String referenceNumber, |
|
||||||
@Field("payment_type") String paymentType, |
|
||||||
@Field("payment_function") String paymentFunction, |
|
||||||
@Field("payment_camera_mode") String paymentCameraMode, |
|
||||||
@Field("signature") String signature, |
|
||||||
@Field("amount") String amount, |
|
||||||
@Field("status") String status, |
|
||||||
@Field("params_response") String paramsResponse);*/ |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,208 @@ |
|||||||
|
package com.cst.im30.service; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
|
||||||
|
import com.cst.im30.BuildConfig; |
||||||
|
import com.cst.im30.api.RetrofitAPICollection; |
||||||
|
import com.cst.im30.api.RetrofitClient; |
||||||
|
import com.cst.im30.common.CallableInterface; |
||||||
|
import com.cst.im30.common.Constants; |
||||||
|
import com.cst.im30.model.EventLogDetailed; |
||||||
|
import com.cst.im30.utility.JsonUtils; |
||||||
|
import com.cst.im30.utility.Logger; |
||||||
|
|
||||||
|
import org.json.JSONException; |
||||||
|
import org.json.JSONObject; |
||||||
|
|
||||||
|
import retrofit2.Call; |
||||||
|
import retrofit2.Callback; |
||||||
|
import retrofit2.Response; |
||||||
|
|
||||||
|
@SuppressWarnings({"unused"}) |
||||||
|
public class PaymentService { |
||||||
|
public static final String TAG = "PaymentSaleService."; |
||||||
|
|
||||||
|
public static final String SUCCESS_GET_EVENT_LOG = TAG + "SUCCESS_GET_EVENT_LOG"; |
||||||
|
public static final String FAIL_GET_EVENT_LOG = TAG + "FAIL_GET_EVENT_LOG"; |
||||||
|
public static final String SUCCESS_UPDATE_EVENT_LOG = TAG + "SUCCESS_UPDATE_EVENT_LOG"; |
||||||
|
public static final String FAIL_UPDATE_EVENT_LOG = TAG + "FAIL_UPDATE_EVENT_LOG"; |
||||||
|
|
||||||
|
public static final String REJECT_EVENT_LOG = "REJECT"; |
||||||
|
|
||||||
|
private final CallableInterface callback; |
||||||
|
|
||||||
|
private final String hostUrl; |
||||||
|
private final String clientId; |
||||||
|
private final String clientSecret; |
||||||
|
|
||||||
|
private String code; |
||||||
|
private String status; |
||||||
|
|
||||||
|
public PaymentService(CallableInterface callback) { |
||||||
|
this.callback = callback; |
||||||
|
|
||||||
|
this.hostUrl = BuildConfig.SERVER_URL; |
||||||
|
this.clientId = BuildConfig.CLIENT_ID; |
||||||
|
this.clientSecret = BuildConfig.CLIENT_SECRET; |
||||||
|
} |
||||||
|
|
||||||
|
public void getEventLog(String code) { |
||||||
|
RetrofitAPICollection service = RetrofitClient.getRetrofitClient(hostUrl).create(RetrofitAPICollection.class); |
||||||
|
Call<String> call = service.getBroadcastEventLogDetails(clientId, clientSecret, code); |
||||||
|
|
||||||
|
Logger.logAPI(code); |
||||||
|
|
||||||
|
call.enqueue(new Callback<String>() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { |
||||||
|
onResponseGetEventLog(response); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { |
||||||
|
onFailureGetEventLog(t); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void onResponseGetEventLog(Response<String> response) { |
||||||
|
try { |
||||||
|
if (!response.isSuccessful()) { |
||||||
|
JSONObject responseJSON = null; |
||||||
|
if (response.errorBody() != null) { |
||||||
|
responseJSON = new JSONObject(response.errorBody().string()); |
||||||
|
Logger.logAPI(responseJSON.toString()); |
||||||
|
} |
||||||
|
callback.callBack(FAIL_GET_EVENT_LOG, responseJSON); |
||||||
|
} else { |
||||||
|
JSONObject responseJSON = new JSONObject(response.body()); |
||||||
|
Logger.logAPI(responseJSON.toString()); |
||||||
|
EventLogDetailed eventLogDetailed = this.parseGetEventLogResponse(responseJSON); |
||||||
|
callback.callBack(SUCCESS_GET_EVENT_LOG, eventLogDetailed); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void onFailureGetEventLog(Throwable t) { |
||||||
|
if (t instanceof Exception) { |
||||||
|
Logger.logE(t.getMessage()); |
||||||
|
t.printStackTrace(); |
||||||
|
} |
||||||
|
callback.callBack(FAIL_GET_EVENT_LOG, t.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
private void updateBroadcastEventLogDetail(String code, String status) { |
||||||
|
this.code = code; |
||||||
|
this.status = status; |
||||||
|
|
||||||
|
JSONObject payload = new JSONObject(); |
||||||
|
try { |
||||||
|
payload.put("status", status); |
||||||
|
} catch (JSONException e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
RetrofitAPICollection service = RetrofitClient.getRetrofitClient(hostUrl).create(RetrofitAPICollection.class); |
||||||
|
Call<String> call = service.updateBroadcastEventLogDetails(clientId, clientSecret, payload.toString(), code); |
||||||
|
|
||||||
|
Logger.logAPI("Update: " + code + ":" + payload.toString()); |
||||||
|
|
||||||
|
call.enqueue(new Callback<String>() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { |
||||||
|
onResponseUpdateBroadcastEventLogDetails(response); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { |
||||||
|
onFailureUpdateBroadcastEventLogDetails(t); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void onResponseUpdateBroadcastEventLogDetails(Response<String> response) { |
||||||
|
try { |
||||||
|
if (!response.isSuccessful()) { |
||||||
|
JSONObject responseJSON = null; |
||||||
|
if (response.errorBody() != null) { |
||||||
|
responseJSON = new JSONObject(response.errorBody().string()); |
||||||
|
Logger.logAPI(responseJSON.toString()); |
||||||
|
} |
||||||
|
callback.callBack(FAIL_UPDATE_EVENT_LOG, responseJSON); |
||||||
|
} else { |
||||||
|
JSONObject responseJSON = new JSONObject(response.body()); |
||||||
|
|
||||||
|
Logger.logAPI(responseJSON.toString()); |
||||||
|
|
||||||
|
if (Constants.STATUS_REJECT.equalsIgnoreCase(status)) { |
||||||
|
callback.callBack(REJECT_EVENT_LOG, code); |
||||||
|
} else { |
||||||
|
callback.callBack(SUCCESS_UPDATE_EVENT_LOG, responseJSON); |
||||||
|
} |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void onFailureUpdateBroadcastEventLogDetails(Throwable t) { |
||||||
|
if (t instanceof Exception) { |
||||||
|
Logger.logE(t.getMessage()); |
||||||
|
t.printStackTrace(); |
||||||
|
} |
||||||
|
callback.callBack(FAIL_UPDATE_EVENT_LOG, t.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
public void verifySuccess(String code) { |
||||||
|
updateBroadcastEventLogDetail(code, Constants.STATUS_SUCCESS); |
||||||
|
} |
||||||
|
|
||||||
|
public void verifyFail(String code) { |
||||||
|
updateBroadcastEventLogDetail(code, Constants.STATUS_FAIL); |
||||||
|
} |
||||||
|
|
||||||
|
public void verifyCancel(String code) { |
||||||
|
updateBroadcastEventLogDetail(code, Constants.STATUS_CANCELLED); |
||||||
|
} |
||||||
|
|
||||||
|
public void verifyReject(String code) { |
||||||
|
updateBroadcastEventLogDetail(code, Constants.STATUS_REJECT); |
||||||
|
} |
||||||
|
|
||||||
|
private EventLogDetailed parseGetEventLogResponse(JSONObject jsonObject) { |
||||||
|
if (jsonObject.has("data")) { |
||||||
|
try { |
||||||
|
JSONObject dataJSON = jsonObject.getJSONObject("data"); |
||||||
|
JSONObject contentJSON = dataJSON.getJSONObject("content"); |
||||||
|
|
||||||
|
EventLogDetailed eventLogDetailed = new EventLogDetailed(); |
||||||
|
eventLogDetailed.setId(JsonUtils.extractJsonInteger(dataJSON, "id")); |
||||||
|
eventLogDetailed.setType(JsonUtils.extractJsonString(dataJSON, "type")); |
||||||
|
eventLogDetailed.setStatus(JsonUtils.extractJsonString(dataJSON, "status")); |
||||||
|
eventLogDetailed.setRemark(JsonUtils.extractJsonString(dataJSON, "remark")); |
||||||
|
eventLogDetailed.setPayableAmount(JsonUtils.extractJsonString(dataJSON, "payable_amount")); |
||||||
|
eventLogDetailed.setPayFunction(JsonUtils.extractJsonString(dataJSON, "pay_function")); |
||||||
|
eventLogDetailed.setConfirmationNumber(JsonUtils.extractJsonString(contentJSON, "confirmation_number")); |
||||||
|
eventLogDetailed.setReferenceNumber(JsonUtils.extractJsonString(contentJSON, "reference_number")); |
||||||
|
eventLogDetailed.setPayAuthCode(JsonUtils.extractJsonString(dataJSON, "pay_auth_code")); |
||||||
|
eventLogDetailed.setPayRefNum(JsonUtils.extractJsonString(dataJSON, "pay_ref_num")); |
||||||
|
eventLogDetailed.setToken(JsonUtils.extractJsonString(dataJSON, "token")); |
||||||
|
|
||||||
|
return eventLogDetailed; |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,154 @@ |
|||||||
|
package com.cst.im30.service; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
|
||||||
|
import com.cst.im30.BuildConfig; |
||||||
|
import com.cst.im30.api.RetrofitAPICollection; |
||||||
|
import com.cst.im30.api.RetrofitClient; |
||||||
|
import com.cst.im30.common.CallableInterface; |
||||||
|
import com.cst.im30.model.EventLogDetailed; |
||||||
|
import com.cst.im30.model.PreAuthRequest; |
||||||
|
import com.cst.im30.model.PreAuthResponse; |
||||||
|
import com.cst.im30.utility.Logger; |
||||||
|
|
||||||
|
import org.json.JSONObject; |
||||||
|
|
||||||
|
import retrofit2.Call; |
||||||
|
import retrofit2.Callback; |
||||||
|
import retrofit2.Response; |
||||||
|
|
||||||
|
public class UploadTransactionPreAuthPaymentService { |
||||||
|
public static final String TAG = "UploadTransactionPreAuthPaymentService."; |
||||||
|
|
||||||
|
public static final String SUCCESS = TAG + "SUCCESS"; |
||||||
|
public static final String FAIL = TAG + "FAIL"; |
||||||
|
|
||||||
|
private final CallableInterface callback; |
||||||
|
|
||||||
|
private final String hostUrl; |
||||||
|
private final String clientId; |
||||||
|
private final String clientSecret; |
||||||
|
|
||||||
|
public UploadTransactionPreAuthPaymentService(CallableInterface callback) { |
||||||
|
this.callback = callback; |
||||||
|
|
||||||
|
this.hostUrl = BuildConfig.SERVER_URL; |
||||||
|
this.clientId = BuildConfig.CLIENT_ID; |
||||||
|
this.clientSecret = BuildConfig.CLIENT_SECRET; |
||||||
|
} |
||||||
|
|
||||||
|
public void call(EventLogDetailed eventLogDetailed, PreAuthRequest request, PreAuthResponse response) { |
||||||
|
JSONObject payload = new JSONObject(); |
||||||
|
try { |
||||||
|
payload.put("revpay_request", createPreAuthRequestJSONObject(eventLogDetailed, request)); |
||||||
|
payload.put("revpay_response", createPreAuthResponseJSONObject(eventLogDetailed, response)); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
RetrofitAPICollection service = RetrofitClient.getRetrofitClient(hostUrl).create(RetrofitAPICollection.class); |
||||||
|
Call<String> call = service.uploadRevPayTransaction(clientId, clientSecret, payload.toString()); |
||||||
|
|
||||||
|
Logger.logAPI(payload.toString()); |
||||||
|
|
||||||
|
call.enqueue(new Callback<String>() { |
||||||
|
@Override |
||||||
|
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { |
||||||
|
onResponseHandler(response); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { |
||||||
|
onFailureHandler(t); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void onResponseHandler(Response<String> response) { |
||||||
|
try { |
||||||
|
if (!response.isSuccessful()) { |
||||||
|
JSONObject responseJSON = null; |
||||||
|
if (response.errorBody() != null) { |
||||||
|
responseJSON = new JSONObject(response.errorBody().string()); |
||||||
|
} |
||||||
|
callback.callBack(FAIL, responseJSON); |
||||||
|
} else { |
||||||
|
JSONObject responseJSON = new JSONObject(response.body()); |
||||||
|
callback.callBack(SUCCESS, responseJSON); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void onFailureHandler(Throwable t) { |
||||||
|
if (t instanceof Exception) { |
||||||
|
Logger.logE(t.getMessage()); |
||||||
|
t.printStackTrace(); |
||||||
|
} |
||||||
|
callback.callBack(FAIL, t.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
private JSONObject createPreAuthRequestJSONObject(EventLogDetailed eventLogDetailed, PreAuthRequest request) { |
||||||
|
JSONObject requestJSON = new JSONObject(); |
||||||
|
try { |
||||||
|
requestJSON.put("confirmation_number", eventLogDetailed.getConfirmationNumber()); |
||||||
|
requestJSON.put("reference_number", eventLogDetailed.getReferenceNumber()); |
||||||
|
|
||||||
|
requestJSON.put("pay_function", request.getPayFunction()); |
||||||
|
requestJSON.put("pay_amount", request.getPayAmount()); |
||||||
|
requestJSON.put("pay_pos_txn_id", request.getPayPosTxnId()); |
||||||
|
requestJSON.put("pay_print_receipt_id", request.getPayPrintReceiptId()); |
||||||
|
|
||||||
|
requestJSON.put("remark", eventLogDetailed.getRemark()); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return requestJSON; |
||||||
|
} |
||||||
|
|
||||||
|
private JSONObject createPreAuthResponseJSONObject(EventLogDetailed eventLogDetailed, PreAuthResponse response) { |
||||||
|
JSONObject requestJSON = new JSONObject(); |
||||||
|
try { |
||||||
|
requestJSON.put("confirmation_number", eventLogDetailed.getConfirmationNumber()); |
||||||
|
requestJSON.put("reference_number", eventLogDetailed.getReferenceNumber()); |
||||||
|
|
||||||
|
requestJSON.put("pay_amount", response.getPayAmount()); |
||||||
|
requestJSON.put("pay_function", response.getPayFunction()); |
||||||
|
requestJSON.put("pay_type", response.getPayType()); |
||||||
|
requestJSON.put("pay_print_receipt_id", response.getPayPrintReceiptId()); |
||||||
|
requestJSON.put("pay_resp_txn_date", response.getPayRespTxnDate()); |
||||||
|
requestJSON.put("pay_resp_txn_time", response.getPayRespTxnTime()); |
||||||
|
requestJSON.put("pay_resp_invoice_no", response.getPayRespInvoiceNo()); |
||||||
|
requestJSON.put("pay_resp_trace_no", response.getPayRespTraceNo()); |
||||||
|
requestJSON.put("pay_resp_batch_no", response.getPayRespBatchNo()); |
||||||
|
requestJSON.put("pay_resp_scheme", response.getPayRespScheme()); |
||||||
|
requestJSON.put("pay_resp_tid", response.getPayRespTid()); |
||||||
|
requestJSON.put("pay_resp_mid", response.getPayRespMid()); |
||||||
|
requestJSON.put("pay_resp_card_auth_code", response.getPayRespCardAuthCode()); |
||||||
|
requestJSON.put("pay_resp_card_ref_num", response.getPayRespCardRefNum()); |
||||||
|
requestJSON.put("pay_resp_card_no", response.getPayRespCardNo()); |
||||||
|
requestJSON.put("pay_resp_issuer_id", response.getPayRespIssuerId()); |
||||||
|
requestJSON.put("pay_resp_card_aid", response.getPayRespCardAid()); |
||||||
|
requestJSON.put("pay_resp_card_app_cryptogram", response.getPayRespCardAppCryptogram()); |
||||||
|
requestJSON.put("pay_resp_code", response.getPayRespCode()); |
||||||
|
requestJSON.put("pay_resp_error_desc", response.getPayRespErrorDesc()); |
||||||
|
requestJSON.put("pay_resp_merch_info", response.getPayRespMerchInfo()); |
||||||
|
requestJSON.put("pay_resp_tvr", response.getPayRespTvr()); |
||||||
|
requestJSON.put("pay_resp_cvm_desc", response.getPayRespCvmDesc()); |
||||||
|
requestJSON.put("pay_resp_app_label", response.getPayRespAppLabel()); |
||||||
|
requestJSON.put("pay_resp_hash_pan", response.getPayRespHashPan()); |
||||||
|
requestJSON.put("token", response.getToken()); |
||||||
|
|
||||||
|
requestJSON.put("remark", eventLogDetailed.getRemark()); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return requestJSON; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,156 @@ |
|||||||
|
package com.cst.im30.service; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
|
||||||
|
import com.cst.im30.BuildConfig; |
||||||
|
import com.cst.im30.api.RetrofitAPICollection; |
||||||
|
import com.cst.im30.api.RetrofitClient; |
||||||
|
import com.cst.im30.common.CallableInterface; |
||||||
|
import com.cst.im30.model.EventLogDetailed; |
||||||
|
import com.cst.im30.model.SaleCompletionRequest; |
||||||
|
import com.cst.im30.model.SaleCompletionResponse; |
||||||
|
import com.cst.im30.utility.Logger; |
||||||
|
|
||||||
|
import org.json.JSONObject; |
||||||
|
|
||||||
|
import retrofit2.Call; |
||||||
|
import retrofit2.Callback; |
||||||
|
import retrofit2.Response; |
||||||
|
|
||||||
|
public class UploadTransactionSaleCompletionPaymentService { |
||||||
|
public static final String TAG = "UploadTransactionSaleCompletionPaymentService."; |
||||||
|
|
||||||
|
public static final String SUCCESS = TAG + "SUCCESS"; |
||||||
|
public static final String FAIL = TAG + "FAIL"; |
||||||
|
|
||||||
|
private final CallableInterface callback; |
||||||
|
|
||||||
|
private final String hostUrl; |
||||||
|
private final String clientId; |
||||||
|
private final String clientSecret; |
||||||
|
|
||||||
|
public UploadTransactionSaleCompletionPaymentService(CallableInterface callback) { |
||||||
|
this.callback = callback; |
||||||
|
|
||||||
|
this.hostUrl = BuildConfig.SERVER_URL; |
||||||
|
this.clientId = BuildConfig.CLIENT_ID; |
||||||
|
this.clientSecret = BuildConfig.CLIENT_SECRET; |
||||||
|
} |
||||||
|
|
||||||
|
public void call(EventLogDetailed eventLogDetailed, SaleCompletionRequest request, SaleCompletionResponse response) { |
||||||
|
JSONObject payload = new JSONObject(); |
||||||
|
try { |
||||||
|
payload.put("revpay_request", createSaleCompletionRequestJSONObject(eventLogDetailed, request)); |
||||||
|
payload.put("revpay_response", createSaleCompletionResponseJSONObject(eventLogDetailed, response)); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
RetrofitAPICollection service = RetrofitClient.getRetrofitClient(hostUrl).create(RetrofitAPICollection.class); |
||||||
|
Call<String> call = service.uploadRevPayTransaction(clientId, clientSecret, payload.toString()); |
||||||
|
|
||||||
|
Logger.logAPI(payload.toString()); |
||||||
|
|
||||||
|
call.enqueue(new Callback<String>() { |
||||||
|
@Override |
||||||
|
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { |
||||||
|
onResponseHandler(response); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { |
||||||
|
onFailureHandler(t); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void onResponseHandler(Response<String> response) { |
||||||
|
try { |
||||||
|
if (!response.isSuccessful()) { |
||||||
|
JSONObject responseJSON = null; |
||||||
|
if (response.errorBody() != null) { |
||||||
|
responseJSON = new JSONObject(response.errorBody().string()); |
||||||
|
} |
||||||
|
callback.callBack(FAIL, responseJSON); |
||||||
|
} else { |
||||||
|
JSONObject responseJSON = new JSONObject(response.body()); |
||||||
|
callback.callBack(SUCCESS, responseJSON); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void onFailureHandler(Throwable t) { |
||||||
|
if (t instanceof Exception) { |
||||||
|
Logger.logE(t.getMessage()); |
||||||
|
t.printStackTrace(); |
||||||
|
} |
||||||
|
callback.callBack(FAIL, t.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
private JSONObject createSaleCompletionRequestJSONObject(EventLogDetailed eventLogDetailed, SaleCompletionRequest request) { |
||||||
|
JSONObject requestJSON = new JSONObject(); |
||||||
|
try { |
||||||
|
requestJSON.put("confirmation_number", eventLogDetailed.getConfirmationNumber()); |
||||||
|
requestJSON.put("reference_number", eventLogDetailed.getReferenceNumber()); |
||||||
|
|
||||||
|
requestJSON.put("pay_function", request.getPayFunction()); |
||||||
|
requestJSON.put("pay_amount", request.getPayAmount()); |
||||||
|
requestJSON.put("pay_auth_code", request.getPayAuthCode()); |
||||||
|
requestJSON.put("pay_ref_num", request.getPayRefNum()); |
||||||
|
requestJSON.put("pay_pos_txn_id", request.getPayPosTxnId()); |
||||||
|
requestJSON.put("pay_print_receipt_id", request.getPayPrintReceiptId()); |
||||||
|
requestJSON.put("token", request.getToken()); |
||||||
|
|
||||||
|
requestJSON.put("remark", eventLogDetailed.getRemark()); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return requestJSON; |
||||||
|
} |
||||||
|
|
||||||
|
private JSONObject createSaleCompletionResponseJSONObject(EventLogDetailed eventLogDetailed, SaleCompletionResponse response) { |
||||||
|
JSONObject requestJSON = new JSONObject(); |
||||||
|
try { |
||||||
|
requestJSON.put("confirmation_number", eventLogDetailed.getConfirmationNumber()); |
||||||
|
requestJSON.put("reference_number", eventLogDetailed.getReferenceNumber()); |
||||||
|
|
||||||
|
requestJSON.put("pay_amount", response.getPayAmount()); |
||||||
|
requestJSON.put("pay_function", response.getPayFunction()); |
||||||
|
requestJSON.put("pay_type", response.getPayType()); |
||||||
|
requestJSON.put("pay_print_receipt_id", response.getPayPrintReceiptId()); |
||||||
|
requestJSON.put("pay_resp_txn_date", response.getPayRespTxnDate()); |
||||||
|
requestJSON.put("pay_resp_txn_time", response.getPayRespTxnTime()); |
||||||
|
requestJSON.put("pay_resp_invoice_no", response.getPayRespInvoiceNo()); |
||||||
|
requestJSON.put("pay_resp_trace_no", response.getPayRespTraceNo()); |
||||||
|
requestJSON.put("pay_resp_batch_no", response.getPayRespBatchNo()); |
||||||
|
requestJSON.put("pay_resp_scheme", response.getPayRespScheme()); |
||||||
|
requestJSON.put("pay_resp_tid", response.getPayRespTid()); |
||||||
|
requestJSON.put("pay_resp_mid", response.getPayRespMid()); |
||||||
|
requestJSON.put("pay_resp_card_auth_code", response.getPayRespCardAuthCode()); |
||||||
|
requestJSON.put("pay_resp_card_ref_num", response.getPayRespCardRefNum()); |
||||||
|
requestJSON.put("pay_resp_card_no", response.getPayRespCardNo()); |
||||||
|
requestJSON.put("pay_resp_issuer_id", response.getPayRespIssuerId()); |
||||||
|
requestJSON.put("pay_resp_card_aid", response.getPayRespCardAid()); |
||||||
|
requestJSON.put("pay_resp_card_app_cryptogram", response.getPayRespCardAppCryptogram()); |
||||||
|
requestJSON.put("pay_resp_code", response.getPayRespCode()); |
||||||
|
requestJSON.put("pay_resp_error_desc", response.getPayRespErrorDesc()); |
||||||
|
requestJSON.put("pay_resp_merch_info", response.getPayRespMerchInfo()); |
||||||
|
requestJSON.put("pay_resp_tvr", response.getPayRespTvr()); |
||||||
|
requestJSON.put("pay_resp_cvm_desc", response.getPayRespCvmDesc()); |
||||||
|
requestJSON.put("pay_resp_app_label", response.getPayRespAppLabel()); |
||||||
|
requestJSON.put("pay_resp_hash_pan", response.getPayRespHashPan()); |
||||||
|
|
||||||
|
requestJSON.put("remark", eventLogDetailed.getRemark()); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return requestJSON; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,159 @@ |
|||||||
|
package com.cst.im30.service; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
|
||||||
|
import com.cst.im30.BuildConfig; |
||||||
|
import com.cst.im30.api.RetrofitAPICollection; |
||||||
|
import com.cst.im30.api.RetrofitClient; |
||||||
|
import com.cst.im30.common.CallableInterface; |
||||||
|
import com.cst.im30.model.EventLogDetailed; |
||||||
|
import com.cst.im30.model.SaleRequest; |
||||||
|
import com.cst.im30.model.SaleResponse; |
||||||
|
import com.cst.im30.utility.Logger; |
||||||
|
|
||||||
|
import org.json.JSONObject; |
||||||
|
|
||||||
|
import retrofit2.Call; |
||||||
|
import retrofit2.Callback; |
||||||
|
import retrofit2.Response; |
||||||
|
|
||||||
|
public class UploadTransactionSalePaymentService { |
||||||
|
public static final String TAG = "UploadTransactionSalePaymentService."; |
||||||
|
|
||||||
|
public static final String SUCCESS = TAG + "SUCCESS"; |
||||||
|
public static final String FAIL = TAG + "FAIL"; |
||||||
|
|
||||||
|
private final CallableInterface callback; |
||||||
|
|
||||||
|
private final String hostUrl; |
||||||
|
private final String clientId; |
||||||
|
private final String clientSecret; |
||||||
|
|
||||||
|
public UploadTransactionSalePaymentService(CallableInterface callback) { |
||||||
|
this.callback = callback; |
||||||
|
|
||||||
|
this.hostUrl = BuildConfig.SERVER_URL; |
||||||
|
this.clientId = BuildConfig.CLIENT_ID; |
||||||
|
this.clientSecret = BuildConfig.CLIENT_SECRET; |
||||||
|
} |
||||||
|
|
||||||
|
public void call(EventLogDetailed eventLogDetailed, SaleRequest saleRequest, SaleResponse saleResponse) { |
||||||
|
JSONObject payload = new JSONObject(); |
||||||
|
try { |
||||||
|
payload.put("revpay_request", createSaleRequestJSONObject(eventLogDetailed, saleRequest)); |
||||||
|
payload.put("revpay_response", createSaleResponseJSONObject(eventLogDetailed, saleResponse)); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
RetrofitAPICollection service = RetrofitClient.getRetrofitClient(hostUrl).create(RetrofitAPICollection.class); |
||||||
|
Call<String> call = service.uploadRevPayTransaction(clientId, clientSecret, payload.toString()); |
||||||
|
|
||||||
|
Logger.logAPI(payload.toString()); |
||||||
|
|
||||||
|
call.enqueue(new Callback<String>() { |
||||||
|
@Override |
||||||
|
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { |
||||||
|
onResponseHandler(response); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { |
||||||
|
onFailureHandler(t); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void onResponseHandler(Response<String> response) { |
||||||
|
try { |
||||||
|
if (!response.isSuccessful()) { |
||||||
|
JSONObject responseJSON = null; |
||||||
|
if (response.errorBody() != null) { |
||||||
|
responseJSON = new JSONObject(response.errorBody().string()); |
||||||
|
} |
||||||
|
callback.callBack(FAIL, responseJSON); |
||||||
|
} else { |
||||||
|
JSONObject responseJSON = new JSONObject(response.body()); |
||||||
|
callback.callBack(SUCCESS, responseJSON); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void onFailureHandler(Throwable t) { |
||||||
|
if (t instanceof Exception) { |
||||||
|
Logger.logE(t.getMessage()); |
||||||
|
t.printStackTrace(); |
||||||
|
} |
||||||
|
callback.callBack(FAIL, t.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
private JSONObject createSaleRequestJSONObject(EventLogDetailed eventLogDetailed, SaleRequest saleRequest) { |
||||||
|
JSONObject request = new JSONObject(); |
||||||
|
try { |
||||||
|
request.put("confirmation_number", eventLogDetailed.getConfirmationNumber()); |
||||||
|
request.put("reference_number", eventLogDetailed.getReferenceNumber()); |
||||||
|
|
||||||
|
request.put("pay_function", saleRequest.getPayFunction()); |
||||||
|
request.put("pay_amount", saleRequest.getPayAmount()); |
||||||
|
request.put("pay_type", saleRequest.getPayType()); |
||||||
|
request.put("pay_camera_mode", saleRequest.getPayCameraMode()); |
||||||
|
request.put("pay_pos_txn_id", saleRequest.getPayPosTxnId()); |
||||||
|
request.put("pay_print_receipt_id", saleRequest.getPayPrintReceiptId()); |
||||||
|
|
||||||
|
request.put("remark", eventLogDetailed.getRemark()); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return request; |
||||||
|
} |
||||||
|
|
||||||
|
private JSONObject createSaleResponseJSONObject(EventLogDetailed eventLogDetailed, SaleResponse saleResponse) { |
||||||
|
JSONObject request = new JSONObject(); |
||||||
|
try { |
||||||
|
request.put("confirmation_number", eventLogDetailed.getConfirmationNumber()); |
||||||
|
request.put("reference_number", eventLogDetailed.getReferenceNumber()); |
||||||
|
|
||||||
|
request.put("pay_amount", saleResponse.getPayAmount()); |
||||||
|
request.put("pay_function", saleResponse.getPayFunction()); |
||||||
|
request.put("pay_type", saleResponse.getPayType()); |
||||||
|
request.put("pay_camera_mode", saleResponse.getPayCameraMode()); |
||||||
|
request.put("pay_print_receipt_id", saleResponse.getPayPrintReceiptId()); |
||||||
|
request.put("pay_resp_txn_date", saleResponse.getPayRespTxnDate()); |
||||||
|
request.put("pay_resp_txn_time", saleResponse.getPayRespTxnTime()); |
||||||
|
request.put("pay_resp_invoice_no", saleResponse.getPayRespInvoiceNo()); |
||||||
|
request.put("pay_resp_trace_no", saleResponse.getPayRespTraceNo()); |
||||||
|
request.put("pay_resp_batch_no", saleResponse.getPayRespBatchNo()); |
||||||
|
request.put("pay_resp_scheme", saleResponse.getPayRespScheme()); |
||||||
|
request.put("pay_resp_tid", saleResponse.getPayRespTid()); |
||||||
|
request.put("pay_resp_mid", saleResponse.getPayRespMid()); |
||||||
|
request.put("pay_resp_card_auth_code", saleResponse.getPayRespCardAuthCode()); |
||||||
|
request.put("pay_resp_card_ref_num", saleResponse.getPayRespCardRefNum()); |
||||||
|
request.put("pay_resp_card_no", saleResponse.getPayRespCardNo()); |
||||||
|
request.put("pay_resp_issuer_id", saleResponse.getPayRespIssuerId()); |
||||||
|
request.put("pay_resp_card_aid", saleResponse.getPayRespCardAid()); |
||||||
|
request.put("pay_resp_card_app_cryptogram", saleResponse.getPayRespCardAppCryptogram()); |
||||||
|
request.put("pay_resp_qr_txn_id", saleResponse.getPayRespQrTxnId()); |
||||||
|
request.put("pay_resp_qr_wallet_id", saleResponse.getPayRespQrWalletId()); |
||||||
|
request.put("pay_resp_customer_id", saleResponse.getPayRespCustomerId()); |
||||||
|
request.put("pay_resp_code", saleResponse.getPayRespCode()); |
||||||
|
request.put("pay_resp_error_desc", saleResponse.getPayRespErrorDesc()); |
||||||
|
request.put("pay_resp_merch_info", saleResponse.getPayRespMerchInfo()); |
||||||
|
request.put("pay_resp_tvr", saleResponse.getPayRespTvr()); |
||||||
|
request.put("pay_resp_cvm_desc", saleResponse.getPayRespCvmDesc()); |
||||||
|
request.put("pay_resp_app_label", saleResponse.getPayRespAppLabel()); |
||||||
|
request.put("pay_resp_hash_pan", saleResponse.getPayRespHashPan()); |
||||||
|
|
||||||
|
request.put("remark", eventLogDetailed.getRemark()); |
||||||
|
} catch (Exception e) { |
||||||
|
Logger.logE(e.getMessage()); |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
return request; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,143 @@ |
|||||||
|
package com.cst.im30.utility; |
||||||
|
|
||||||
|
import com.amazonaws.auth.BasicAWSCredentials; |
||||||
|
import com.amazonaws.regions.Region; |
||||||
|
import com.amazonaws.regions.Regions; |
||||||
|
import com.amazonaws.services.logs.AmazonCloudWatchLogsClient; |
||||||
|
import com.amazonaws.services.logs.model.CreateLogGroupRequest; |
||||||
|
import com.amazonaws.services.logs.model.CreateLogStreamRequest; |
||||||
|
import com.amazonaws.services.logs.model.DescribeLogStreamsRequest; |
||||||
|
import com.amazonaws.services.logs.model.InputLogEvent; |
||||||
|
import com.amazonaws.services.logs.model.LogStream; |
||||||
|
import com.amazonaws.services.logs.model.PutLogEventsRequest; |
||||||
|
import com.amazonaws.services.logs.model.PutLogEventsResult; |
||||||
|
import com.amazonaws.services.logs.model.ResourceAlreadyExistsException; |
||||||
|
import com.cst.im30.BuildConfig; |
||||||
|
|
||||||
|
import java.text.SimpleDateFormat; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Calendar; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Locale; |
||||||
|
|
||||||
|
@SuppressWarnings({"unused"}) |
||||||
|
public class CloudWatchLogger { |
||||||
|
|
||||||
|
private AmazonCloudWatchLogsClient client; |
||||||
|
|
||||||
|
private PutLogEventsResult putLogEventsResult; // if you want to view the results of the put I guess
|
||||||
|
|
||||||
|
public CloudWatchLogger() { |
||||||
|
// Can connect right away if you bundle the credentials in the Application.
|
||||||
|
// If you use another method, just call connect() AFTER you have your credentials.
|
||||||
|
connect(); |
||||||
|
} |
||||||
|
|
||||||
|
private void connect() { |
||||||
|
String accessKey = BuildConfig.AWS_ACCESS_KEY; |
||||||
|
String secretKey = BuildConfig.AWS_SECRET_KEY; |
||||||
|
BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(accessKey, secretKey); |
||||||
|
|
||||||
|
AmazonCloudWatchLogsClient client = new AmazonCloudWatchLogsClient(basicAWSCredentials); |
||||||
|
Regions regions = Regions.AP_SOUTHEAST_1; // Singapore
|
||||||
|
client.setRegion(Region.getRegion(regions)); |
||||||
|
|
||||||
|
this.client = client; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* As you can see, the code is put into a Thread to run in background. |
||||||
|
* The actual calls to CloudWatch have to be run in a background thread unless we turn off the checking. |
||||||
|
*/ |
||||||
|
public void log(String logGroupName, String logStreamName, String message) { |
||||||
|
String fullLogStreamName = getPrefix() + logStreamName; |
||||||
|
try { |
||||||
|
Thread t = new Thread(() -> { |
||||||
|
// Create LogGroup / LogStream (Will ignore if already created)
|
||||||
|
createCloudWatchGroups(logGroupName, fullLogStreamName); |
||||||
|
|
||||||
|
// Prepare the LogMessage that you will send
|
||||||
|
List<InputLogEvent> logEvents = new ArrayList<>(); |
||||||
|
InputLogEvent log = new InputLogEvent(); |
||||||
|
Calendar calendar = Calendar.getInstance(); |
||||||
|
log.setTimestamp(calendar.getTimeInMillis()); |
||||||
|
log.setMessage(message); |
||||||
|
logEvents.add(log); |
||||||
|
|
||||||
|
// Check Cloudwatch for logStream if exist, to get the uploadSequenceToken.
|
||||||
|
// Without this token you can still push events, but cannot push additional events to the an existing logGroup/logStream.
|
||||||
|
// With the token, you can "append" the logStream (which we want).
|
||||||
|
// https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogStreams.html
|
||||||
|
DescribeLogStreamsRequest logStreamsRequest = new DescribeLogStreamsRequest(logGroupName); |
||||||
|
|
||||||
|
logStreamsRequest.withLimit(10); // Up to 50. Increase/Decrease depending on how many different streamNames you maintain
|
||||||
|
|
||||||
|
logStreamsRequest.setLogStreamNamePrefix(getPrefix()); |
||||||
|
|
||||||
|
List<LogStream> logStreamList = client.describeLogStreams(logStreamsRequest).getLogStreams(); |
||||||
|
|
||||||
|
String token = null; |
||||||
|
for (LogStream logStream : logStreamList) { |
||||||
|
if (logStream.getLogStreamName().equalsIgnoreCase(fullLogStreamName)) { |
||||||
|
token = logStream.getUploadSequenceToken(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
PutLogEventsRequest putLogEventsRequest = new PutLogEventsRequest(); |
||||||
|
putLogEventsRequest.setLogGroupName(logGroupName); |
||||||
|
putLogEventsRequest.setLogStreamName(fullLogStreamName); |
||||||
|
putLogEventsRequest.setLogEvents(logEvents); |
||||||
|
|
||||||
|
if (token != null) { |
||||||
|
putLogEventsRequest.setSequenceToken(token); |
||||||
|
} |
||||||
|
|
||||||
|
putLogEventsResult = client.putLogEvents(putLogEventsRequest); |
||||||
|
//Logger.logD("Pushed log to AWS Cloudwatch");
|
||||||
|
}); |
||||||
|
t.start(); |
||||||
|
t.join(); |
||||||
|
} catch (InterruptedException ignored) { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void createCloudWatchGroups(String logGroupName, String logStreamName) { |
||||||
|
try { |
||||||
|
Thread t = new Thread(() -> { |
||||||
|
CreateLogGroupRequest createLogGroupRequest = new CreateLogGroupRequest(logGroupName); |
||||||
|
try { |
||||||
|
client.createLogGroup(createLogGroupRequest); |
||||||
|
} catch (Exception e) { |
||||||
|
if (e instanceof ResourceAlreadyExistsException) { |
||||||
|
assert true; // do nothing
|
||||||
|
} else { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
CreateLogStreamRequest createLogStreamRequest = new CreateLogStreamRequest(logGroupName, logStreamName); |
||||||
|
try { |
||||||
|
client.createLogStream(createLogStreamRequest); |
||||||
|
} catch (Exception e) { |
||||||
|
if (e instanceof ResourceAlreadyExistsException) { |
||||||
|
assert true; // do nothing
|
||||||
|
} else { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
t.start(); |
||||||
|
t.join(); |
||||||
|
} catch (InterruptedException ignored) { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private String getPrefix() { |
||||||
|
String dateString = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH).format(new Date()); |
||||||
|
String kioskCode = BuildConfig.KIOSK_CODE; |
||||||
|
|
||||||
|
return dateString + "_IM30_" + kioskCode + "_" + BuildConfig.FLAVOR + "_"; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package com.cst.im30.utility; |
||||||
|
|
||||||
|
import android.text.TextUtils; |
||||||
|
|
||||||
|
import org.json.JSONObject; |
||||||
|
|
||||||
|
public class JsonUtils { |
||||||
|
|
||||||
|
public static String extractJsonString(JSONObject responseJSON, String name) { |
||||||
|
try { |
||||||
|
if (responseJSON.has(name)) { |
||||||
|
return responseJSON.getString(name); |
||||||
|
} else { |
||||||
|
return ""; // null json will return "";
|
||||||
|
} |
||||||
|
} catch (Exception ignored) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static int extractJsonInteger(JSONObject responseJSON, String name) { |
||||||
|
return extractJsonInteger(responseJSON, name, -1); |
||||||
|
} |
||||||
|
|
||||||
|
public static int extractJsonInteger(JSONObject responseJSON, String name, int defaultValue) { |
||||||
|
try { |
||||||
|
String rv = responseJSON.getString(name).trim(); |
||||||
|
if (rv.isEmpty()) { |
||||||
|
return defaultValue; |
||||||
|
} else { |
||||||
|
if (TextUtils.isDigitsOnly(rv)) { |
||||||
|
return Integer.parseInt(rv); |
||||||
|
} else { |
||||||
|
return defaultValue; |
||||||
|
} |
||||||
|
} |
||||||
|
} catch (Exception ignored) { |
||||||
|
return defaultValue; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,19 +1,121 @@ |
|||||||
package com.cst.im30.utility; |
package com.cst.im30.utility; |
||||||
|
|
||||||
|
import android.os.Environment; |
||||||
import android.util.Log; |
import android.util.Log; |
||||||
|
|
||||||
|
import com.bugfender.sdk.Bugfender; |
||||||
|
import com.cst.im30.MainApplication; |
||||||
|
import com.cst.im30.model.EventLogDetailed; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.io.FileOutputStream; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.OutputStreamWriter; |
||||||
|
import java.text.SimpleDateFormat; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.Locale; |
||||||
|
import java.util.regex.Pattern; |
||||||
|
|
||||||
public class Logger { |
public class Logger { |
||||||
public static final String TAG = "CST"; |
public static final String TAG = "CST"; |
||||||
|
|
||||||
public static void logD(String title, String message) { |
public static void logD(String message) { |
||||||
|
StackTraceElement l = new Exception().getStackTrace()[1]; |
||||||
|
String title = getClassSimpleName(l.getClassName()) + "/" + l.getMethodName() + "():" + l.getLineNumber(); |
||||||
Log.d(TAG, title + " - " + message); |
Log.d(TAG, title + " - " + message); |
||||||
|
Bugfender.d("DEBUG", title + " - " + message); |
||||||
} |
} |
||||||
|
|
||||||
public static void logI(String title, String message) { |
public static void logI(String message) { |
||||||
|
StackTraceElement l = new Exception().getStackTrace()[1]; |
||||||
|
String title = getClassSimpleName(l.getClassName()) + "/" + l.getMethodName() + "():" + l.getLineNumber(); |
||||||
Log.i(TAG, title + " - " + message); |
Log.i(TAG, title + " - " + message); |
||||||
|
Bugfender.i("INFO", title + " - " + message); |
||||||
|
} |
||||||
|
|
||||||
|
public static void logV(String message) { |
||||||
|
StackTraceElement l = new Exception().getStackTrace()[1]; |
||||||
|
String title = getClassSimpleName(l.getClassName()) + "/" + l.getMethodName() + "():" + l.getLineNumber(); |
||||||
|
Log.v(TAG, title + " - " + message); |
||||||
|
Bugfender.t("VERBOSE", title + " - " + message); |
||||||
} |
} |
||||||
|
|
||||||
public static void logV(String title, String message) { |
public static void logAPI(String message) { |
||||||
|
StackTraceElement l = new Exception().getStackTrace()[1]; |
||||||
|
String title = getClassSimpleName(l.getClassName()) + "/" + l.getMethodName() + "():" + l.getLineNumber(); |
||||||
Log.v(TAG, title + " - " + message); |
Log.v(TAG, title + " - " + message); |
||||||
|
Bugfender.t("API", title + " - " + message); |
||||||
|
} |
||||||
|
|
||||||
|
public static void logE(String message) { |
||||||
|
StackTraceElement l = new Exception().getStackTrace()[1]; |
||||||
|
String title = getClassSimpleName(l.getClassName()) + "/" + l.getMethodName() + "():" + l.getLineNumber(); |
||||||
|
Log.e(TAG, title + " - " + message); |
||||||
|
Bugfender.e("ERROR", title + " - " + message); |
||||||
|
MainApplication.getInstance().logError(title + " - " + message); |
||||||
|
Bugfender.sendIssue(title, message); |
||||||
|
} |
||||||
|
|
||||||
|
public static void logW(String message) { |
||||||
|
StackTraceElement l = new Exception().getStackTrace()[1]; |
||||||
|
String title = getClassSimpleName(l.getClassName()) + "/" + l.getMethodName() + "():" + l.getLineNumber(); |
||||||
|
Log.w(TAG, title + " - " + message); |
||||||
|
Bugfender.w("DEBUG", title + " - " + message); |
||||||
|
} |
||||||
|
|
||||||
|
public static void logWTF(String message) { |
||||||
|
StackTraceElement l = new Exception().getStackTrace()[1]; |
||||||
|
String title = getClassSimpleName(l.getClassName()) + "/" + l.getMethodName() + "():" + l.getLineNumber(); |
||||||
|
Log.wtf(TAG, title + " - " + message); |
||||||
|
Bugfender.f("WTF", title + " - " + message); |
||||||
|
} |
||||||
|
|
||||||
|
private static String getClassSimpleName(String className) { |
||||||
|
String[] strs = className.split(Pattern.quote(".")); |
||||||
|
return strs[strs.length - 1]; |
||||||
|
} |
||||||
|
|
||||||
|
public static String getTimeStamp() { |
||||||
|
return new SimpleDateFormat("yyyyMMdd HH:mm:ss", Locale.ENGLISH).format(new Date()); |
||||||
} |
} |
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public static void recordICScan(String data) { |
||||||
|
try { |
||||||
|
String filename = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH).format(new Date()); |
||||||
|
File appDirectory = new File(Environment.getExternalStorageDirectory() + "/CST"); |
||||||
|
File logDirectory = new File(appDirectory + "/icLogs"); |
||||||
|
File logFile = new File(logDirectory, filename + ".txt"); |
||||||
|
|
||||||
|
// create app folder
|
||||||
|
if (!appDirectory.exists()) { |
||||||
|
appDirectory.mkdir(); |
||||||
|
} |
||||||
|
|
||||||
|
// create log folder
|
||||||
|
if (!logDirectory.exists()) { |
||||||
|
logDirectory.mkdir(); |
||||||
|
} |
||||||
|
|
||||||
|
EventLogDetailed eventLogDetailed = MainApplication.currentEventLogDetailed; |
||||||
|
String extra = "ID:" + eventLogDetailed.getId() + ", C/N:" + eventLogDetailed.getConfirmationNumber() + ", OperaID:" + eventLogDetailed.getProfileIdOpera(); |
||||||
|
|
||||||
|
String dataToWrite = "[" + getTimeStamp() + "] - " + data + " - " + extra + "\n"; |
||||||
|
|
||||||
|
FileOutputStream out = new FileOutputStream(logFile, true); |
||||||
|
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(out); |
||||||
|
outputStreamWriter.write(dataToWrite); |
||||||
|
outputStreamWriter.close(); |
||||||
|
|
||||||
|
//Logger.logD("Recorded to " + logFile.getName());
|
||||||
|
|
||||||
|
Bugfender.i("IC SCAN", dataToWrite); |
||||||
|
|
||||||
|
MainApplication.getInstance().logICScan(data + " - " + extra); |
||||||
|
} catch (IOException e) { |
||||||
|
Log.e("Exception", "File write failed: " + e.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
@ -0,0 +1,89 @@ |
|||||||
|
package com.cst.im30.utility; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
|
||||||
|
import java.util.Arrays; |
||||||
|
|
||||||
|
@SuppressWarnings({"unused"}) |
||||||
|
public class NRICApduUtils { |
||||||
|
|
||||||
|
public static byte[] selectAppJPN(Context applicationContext) { |
||||||
|
byte[] selectJpn = new byte[]{(byte) 0x00, (byte) 0xA4, (byte) 0x04, (byte) 0x00, (byte) 0x0A, (byte) 0xA0, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x74, (byte) 0x4A, (byte) 0x50, (byte) 0x4E, (byte) 0x00, (byte) 0x10}; |
||||||
|
|
||||||
|
Logger.logD("Select APP JPN"); |
||||||
|
|
||||||
|
return IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectJpn); |
||||||
|
} |
||||||
|
|
||||||
|
public static String getOriginalName(Context applicationContext) { |
||||||
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x96, (byte) 0x00}; |
||||||
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x96, (byte) 0x00}; |
||||||
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x96}; |
||||||
|
|
||||||
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
||||||
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
||||||
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
||||||
|
|
||||||
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
||||||
|
|
||||||
|
String str = new String(trimmedBytes).trim(); |
||||||
|
|
||||||
|
Logger.logD("JPN_OrgName:" + str); |
||||||
|
|
||||||
|
return str; |
||||||
|
} |
||||||
|
|
||||||
|
public static String getGMPCName(Context applicationContext) { |
||||||
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x50, (byte) 0x00}; |
||||||
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x99, (byte) 0x00, (byte) 0x50, (byte) 0x00}; |
||||||
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x50}; |
||||||
|
|
||||||
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
||||||
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
||||||
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
||||||
|
|
||||||
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
||||||
|
|
||||||
|
String str = new String(trimmedBytes).trim(); |
||||||
|
|
||||||
|
Logger.logD("JPN_GMPCName:" + str); |
||||||
|
|
||||||
|
return str; |
||||||
|
} |
||||||
|
|
||||||
|
public static String getKPTName(Context applicationContext) { |
||||||
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x28, (byte) 0x00}; |
||||||
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0xE9, (byte) 0x00, (byte) 0x28, (byte) 0x00}; |
||||||
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x28}; |
||||||
|
|
||||||
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
||||||
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
||||||
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
||||||
|
|
||||||
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
||||||
|
|
||||||
|
String str = new String(trimmedBytes).trim(); |
||||||
|
|
||||||
|
Logger.logD("JPN_KPTName:" + str); |
||||||
|
|
||||||
|
return str; |
||||||
|
} |
||||||
|
|
||||||
|
public static String getIDNum(Context applicationContext) { |
||||||
|
byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x0D, (byte) 0x00}; |
||||||
|
byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x11, (byte) 0x01, (byte) 0x0D, (byte) 0x00}; |
||||||
|
byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x0D}; |
||||||
|
|
||||||
|
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte); |
||||||
|
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte); |
||||||
|
byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte); |
||||||
|
|
||||||
|
byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3); |
||||||
|
|
||||||
|
String str = new String(trimmedBytes).trim(); |
||||||
|
|
||||||
|
Logger.logD("JPN_IDNum:" + str); |
||||||
|
|
||||||
|
return str; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,206 @@ |
|||||||
|
package com.cst.im30.utility; |
||||||
|
|
||||||
|
import com.cst.im30.model.EventLogDetailed; |
||||||
|
import com.cst.im30.model.InquiryRequest; |
||||||
|
import com.cst.im30.model.PreAuthRequest; |
||||||
|
import com.cst.im30.model.SaleCompletionRequest; |
||||||
|
import com.cst.im30.model.SaleRequest; |
||||||
|
import com.cst.im30.model.SetDateTimeRequest; |
||||||
|
import com.cst.im30.model.SettlementRequest; |
||||||
|
import com.cst.im30.model.VoidRequest; |
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException; |
||||||
|
import java.net.URLDecoder; |
||||||
|
import java.text.DecimalFormat; |
||||||
|
|
||||||
|
public class PaymentUtils { |
||||||
|
|
||||||
|
|
||||||
|
public static SaleRequest createSaleRequest(EventLogDetailed eventLogDetailed) { |
||||||
|
SaleRequest request = new SaleRequest(); |
||||||
|
|
||||||
|
double doubleValue = Double.parseDouble(eventLogDetailed.getPayableAmount()); |
||||||
|
double centValueDouble = doubleValue * 100; |
||||||
|
DecimalFormat df = new DecimalFormat("#"); |
||||||
|
request.setPayAmount(String.valueOf(df.format(centValueDouble))); |
||||||
|
|
||||||
|
request.setPayPosTxnId(eventLogDetailed.getReferenceNumber() + eventLogDetailed.getId()); |
||||||
|
|
||||||
|
return request; |
||||||
|
} |
||||||
|
|
||||||
|
public static VoidRequest createVoidRequest(EventLogDetailed eventLogDetailed) { |
||||||
|
VoidRequest request = new VoidRequest(); |
||||||
|
|
||||||
|
double doubleValue = Double.parseDouble(eventLogDetailed.getPayableAmount()); |
||||||
|
double centValueDouble = doubleValue * 100; |
||||||
|
DecimalFormat df = new DecimalFormat("#"); |
||||||
|
request.setPayAmount(String.valueOf(df.format(centValueDouble))); |
||||||
|
|
||||||
|
request.setPayPosTxnId(eventLogDetailed.getReferenceNumber() + eventLogDetailed.getId()); |
||||||
|
|
||||||
|
request.setPayTraceNo(eventLogDetailed.getPayTraceNo()); |
||||||
|
request.setPayInvoiceNo(eventLogDetailed.getPayInvoiceNo()); |
||||||
|
|
||||||
|
return request; |
||||||
|
} |
||||||
|
|
||||||
|
public static InquiryRequest createInquiryRequest(EventLogDetailed eventLogDetailed) { |
||||||
|
InquiryRequest request = new InquiryRequest(); |
||||||
|
|
||||||
|
double doubleValue = Double.parseDouble(eventLogDetailed.getPayableAmount()); |
||||||
|
double centValueDouble = doubleValue * 100; |
||||||
|
DecimalFormat df = new DecimalFormat("#"); |
||||||
|
request.setPayAmount(String.valueOf(df.format(centValueDouble))); |
||||||
|
|
||||||
|
request.setPayTraceNo(eventLogDetailed.getPayTraceNo()); |
||||||
|
request.setPayInvoiceNo(eventLogDetailed.getPayInvoiceNo()); |
||||||
|
|
||||||
|
return request; |
||||||
|
} |
||||||
|
|
||||||
|
public static PreAuthRequest createPreAuthRequest(EventLogDetailed eventLogDetailed) { |
||||||
|
PreAuthRequest request = new PreAuthRequest(); |
||||||
|
|
||||||
|
double doubleValue = Double.parseDouble(eventLogDetailed.getPayableAmount()); |
||||||
|
double centValueDouble = doubleValue * 100; |
||||||
|
DecimalFormat df = new DecimalFormat("#"); |
||||||
|
request.setPayAmount(String.valueOf(df.format(centValueDouble))); |
||||||
|
|
||||||
|
request.setPayPosTxnId(eventLogDetailed.getReferenceNumber() + eventLogDetailed.getId()); |
||||||
|
|
||||||
|
return request; |
||||||
|
} |
||||||
|
|
||||||
|
public static SaleCompletionRequest createSaleCompletionRequest(EventLogDetailed eventLogDetailed) { |
||||||
|
SaleCompletionRequest request = new SaleCompletionRequest(); |
||||||
|
|
||||||
|
double doubleValue = Double.parseDouble(eventLogDetailed.getPayableAmount()); |
||||||
|
double centValueDouble = doubleValue * 100; |
||||||
|
DecimalFormat df = new DecimalFormat("#"); |
||||||
|
request.setPayAmount(String.valueOf(df.format(centValueDouble))); |
||||||
|
|
||||||
|
request.setPayPosTxnId(eventLogDetailed.getReferenceNumber() + eventLogDetailed.getId()); |
||||||
|
|
||||||
|
request.setPayAuthCode(eventLogDetailed.getPayAuthCode()); |
||||||
|
request.setPayRefNum(eventLogDetailed.getPayRefNum()); |
||||||
|
|
||||||
|
String token = eventLogDetailed.getToken(); |
||||||
|
try { |
||||||
|
token = URLDecoder.decode(token, "UTF-8"); |
||||||
|
} catch (UnsupportedEncodingException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
|
||||||
|
Logger.logV("Token: " + token); |
||||||
|
|
||||||
|
request.setToken(token); |
||||||
|
|
||||||
|
return request; |
||||||
|
} |
||||||
|
|
||||||
|
public static SettlementRequest createSettlementRequest(EventLogDetailed eventLogDetailed) { |
||||||
|
SettlementRequest request = new SettlementRequest(); |
||||||
|
|
||||||
|
request.setPayPosTxnId(eventLogDetailed.getReferenceNumber() + eventLogDetailed.getId()); |
||||||
|
|
||||||
|
return request; |
||||||
|
} |
||||||
|
|
||||||
|
public static SetDateTimeRequest createSetDateTimeRequest(EventLogDetailed eventLogDetailed) { |
||||||
|
SetDateTimeRequest request = new SetDateTimeRequest(); |
||||||
|
|
||||||
|
request.setPayPosTxnDate(eventLogDetailed.getPayPosTxnDate()); |
||||||
|
request.setPayPosTxnTime(eventLogDetailed.getPayPosTxnTime()); |
||||||
|
|
||||||
|
return request; |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean validateSaleRequest(SaleRequest request) { |
||||||
|
boolean valid = true; |
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
|
return valid; |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean validateVoidRequest(VoidRequest request) { |
||||||
|
boolean valid = true; |
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
|
return valid; |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean validateInquiryRequest(InquiryRequest request) { |
||||||
|
boolean valid = true; |
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
|
return valid; |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean validatePreAuthRequest(PreAuthRequest request) { |
||||||
|
boolean valid = true; |
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
|
return valid; |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean validateSaleCompletionRequest(SaleCompletionRequest request) { |
||||||
|
boolean valid = true; |
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
|
return valid; |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean validateSettlementRequest(SettlementRequest request) { |
||||||
|
boolean valid = true; |
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
|
return valid; |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean validateSetDateTimeRequest(SetDateTimeRequest request) { |
||||||
|
boolean valid = true; |
||||||
|
|
||||||
|
//todo
|
||||||
|
|
||||||
|
return valid; |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean validateResponseCodeAndMessage(String code, String status) { |
||||||
|
if (code.equalsIgnoreCase("00") && status.equalsIgnoreCase("approved")) { |
||||||
|
Logger.logD("Transaction Approved"); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
if (code.equalsIgnoreCase("00") && status.equalsIgnoreCase("Offline Approval")) { |
||||||
|
Logger.logD("Offline Approval"); |
||||||
|
return true; |
||||||
|
} else if (code.equalsIgnoreCase("00") && status.equalsIgnoreCase("declined")) { |
||||||
|
Logger.logD("Transaction Approved but Declined ErrorCode"); |
||||||
|
return false; |
||||||
|
} else if (code.equalsIgnoreCase("ND")) { |
||||||
|
Logger.logD("User Cancel or No Host Response"); |
||||||
|
return false; |
||||||
|
} else if (code.equalsIgnoreCase("99")) { |
||||||
|
Logger.logD("Transaction Declined"); |
||||||
|
return false; |
||||||
|
} else if (code.equalsIgnoreCase("CE")) { |
||||||
|
Logger.logD("Transaction Declined"); |
||||||
|
return false; |
||||||
|
} else if (code.equalsIgnoreCase("TO") && status.equalsIgnoreCase("timeout")) { |
||||||
|
Logger.logD("Payment Timeout"); |
||||||
|
return false; |
||||||
|
} else { |
||||||
|
Logger.logD("FAIL: Unsupported Combination: " + code + ":" + status); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,170 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
android:width="108dp" |
|
||||||
android:height="108dp" |
|
||||||
android:viewportWidth="108" |
|
||||||
android:viewportHeight="108"> |
|
||||||
<path |
|
||||||
android:fillColor="#3DDC84" |
|
||||||
android:pathData="M0,0h108v108h-108z" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M9,0L9,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M19,0L19,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M29,0L29,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M39,0L39,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M49,0L49,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M59,0L59,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M69,0L69,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M79,0L79,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M89,0L89,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M99,0L99,108" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,9L108,9" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,19L108,19" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,29L108,29" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,39L108,39" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,49L108,49" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,59L108,59" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,69L108,69" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,79L108,79" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,89L108,89" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M0,99L108,99" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M19,29L89,29" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M19,39L89,39" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M19,49L89,49" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M19,59L89,59" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M19,69L89,69" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M19,79L89,79" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M29,19L29,89" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M39,19L39,89" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M49,19L49,89" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M59,19L59,89" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M69,19L69,89" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
<path |
|
||||||
android:fillColor="#00000000" |
|
||||||
android:pathData="M79,19L79,89" |
|
||||||
android:strokeWidth="0.8" |
|
||||||
android:strokeColor="#33FFFFFF" /> |
|
||||||
</vector> |
|
@ -0,0 +1,10 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:tint="#C60E0E" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="@android:color/white" |
||||||
|
android:pathData="M3,5v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2L5,3c-1.11,0 -2,0.9 -2,2zM15,9c0,1.66 -1.34,3 -3,3s-3,-1.34 -3,-3 1.34,-3 3,-3 3,1.34 3,3zM6,17c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1v1L6,18v-1z" /> |
||||||
|
</vector> |
@ -0,0 +1,10 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:tint="#4DAE37" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="@android:color/white" |
||||||
|
android:pathData="M3,5v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2L5,3c-1.11,0 -2,0.9 -2,2zM15,9c0,1.66 -1.34,3 -3,3s-3,-1.34 -3,-3 1.34,-3 3,-3 3,1.34 3,3zM6,17c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1v1L6,18v-1z" /> |
||||||
|
</vector> |
@ -0,0 +1,10 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:tint="#C60E0E" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="@android:color/white" |
||||||
|
android:pathData="M20,4L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,6c0,-1.11 -0.89,-2 -2,-2zM20,18L4,18v-6h16v6zM20,8L4,8L4,6h16v2z" /> |
||||||
|
</vector> |
@ -0,0 +1,10 @@ |
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:width="24dp" |
||||||
|
android:height="24dp" |
||||||
|
android:tint="#4DAE37" |
||||||
|
android:viewportWidth="24" |
||||||
|
android:viewportHeight="24"> |
||||||
|
<path |
||||||
|
android:fillColor="@android:color/white" |
||||||
|
android:pathData="M20,4L4,4c-1.11,0 -1.99,0.89 -1.99,2L2,18c0,1.11 0.89,2 2,2h16c1.11,0 2,-0.89 2,-2L22,6c0,-1.11 -0.89,-2 -2,-2zM20,18L4,18v-6h16v6zM20,8L4,8L4,6h16v2z" /> |
||||||
|
</vector> |
@ -0,0 +1,13 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<solid android:color="#FFFFFF" /> |
||||||
|
<stroke |
||||||
|
android:width="3dip" |
||||||
|
android:color="#B1BCBE" /> |
||||||
|
<corners android:radius="10dip" /> |
||||||
|
<padding |
||||||
|
android:bottom="0dip" |
||||||
|
android:left="0dip" |
||||||
|
android:right="0dip" |
||||||
|
android:top="0dip" /> |
||||||
|
</shape> |
@ -1,31 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent" |
|
||||||
android:orientation="vertical"> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_top" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="center" |
|
||||||
android:layout_marginTop="300dp" |
|
||||||
android:layout_marginBottom="10dp" |
|
||||||
android:text="Revenue Payment API Spec" |
|
||||||
android:textColor="@color/teal_700" |
|
||||||
android:textSize="20dp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_response" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="center" |
|
||||||
android:layout_marginTop="0dp" |
|
||||||
android:layout_marginBottom="10dp" |
|
||||||
android:text="Response code return here..." |
|
||||||
android:textColor="@color/green" |
|
||||||
android:textSize="20dp" |
|
||||||
android:textStyle="italic" /> |
|
||||||
|
|
||||||
</LinearLayout> |
|
@ -1,262 +1,9 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|
||||||
xmlns:tools="http://schemas.android.com/tools" |
xmlns:tools="http://schemas.android.com/tools" |
||||||
android:layout_width="match_parent" |
android:layout_width="match_parent" |
||||||
android:layout_height="match_parent" |
android:layout_height="match_parent" |
||||||
android:orientation="vertical" |
android:orientation="vertical" |
||||||
tools:context=".activity.ResponseActivity"> |
tools:context=".activity.ResponseActivity"> |
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_top" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="center" |
|
||||||
android:layout_marginTop="30dp" |
|
||||||
android:layout_marginBottom="0dp" |
|
||||||
android:text="Received Payment Response" |
|
||||||
android:textAlignment="center" |
|
||||||
android:textColor="@color/teal_700" |
|
||||||
android:textSize="20dp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_responses_title" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="center" |
|
||||||
android:layout_marginTop="10dp" |
|
||||||
android:text="Response code return here..." |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="10dp" |
|
||||||
android:textStyle="italic" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_responses" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="50dp" |
|
||||||
android:background="@color/teal_700" |
|
||||||
android:gravity="center" |
|
||||||
android:scrollbars="vertical" |
|
||||||
android:text="Response code return here..." |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="15dp" |
|
||||||
app:layout_constraintBottom_toTopOf="@+id/textview_response" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintHorizontal_bias="1.0" |
|
||||||
app:layout_constraintVertical_bias="0.188" /> |
|
||||||
|
|
||||||
<!-- <TextView |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:id="@+id/title_responses" |
|
||||||
android:background="@color/black" |
|
||||||
android:layout_marginBottom="10dp" |
|
||||||
android:layout_gravity="right" |
|
||||||
android:textSize="20dp" |
|
||||||
android:textStyle="italic" |
|
||||||
android:textColor="@color/green" |
|
||||||
android:text="Response code return here..." />--> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_status_title" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="center" |
|
||||||
android:layout_marginTop="20dp" |
|
||||||
android:text="Payment Code Status" |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="10dp" |
|
||||||
android:textStyle="italic" /> |
|
||||||
|
|
||||||
<!--<TextView |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:id="@+id/title_status" |
|
||||||
android:background="@color/black" |
|
||||||
android:layout_marginBottom="10dp" |
|
||||||
android:layout_gravity="right" |
|
||||||
android:textSize="20dp" |
|
||||||
android:textStyle="italic" |
|
||||||
android:textColor="@color/green" |
|
||||||
android:text="Payment Status" />--> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_status" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="50dp" |
|
||||||
android:background="@color/teal_700" |
|
||||||
android:gravity="center" |
|
||||||
android:scrollbars="vertical" |
|
||||||
android:text="Payment Status..." |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="15dp" |
|
||||||
app:layout_constraintBottom_toTopOf="@+id/textview_response" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintHorizontal_bias="1.0" |
|
||||||
app:layout_constraintVertical_bias="0.188" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_reference_number_title" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="center" |
|
||||||
android:layout_marginTop="20dp" |
|
||||||
android:text="Payment Reference No" |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="10dp" |
|
||||||
android:textStyle="italic" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_reference_number" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="50dp" |
|
||||||
android:background="@color/teal_700" |
|
||||||
android:gravity="center" |
|
||||||
android:scrollbars="vertical" |
|
||||||
android:text="Payment Reference No..." |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="15dp" |
|
||||||
app:layout_constraintBottom_toTopOf="@+id/textview_response" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintHorizontal_bias="1.0" |
|
||||||
app:layout_constraintVertical_bias="0.188" /> |
|
||||||
|
|
||||||
<!--<TextView |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:id="@+id/title_reference_number" |
|
||||||
android:background="@color/black" |
|
||||||
android:layout_marginBottom="10dp" |
|
||||||
android:layout_gravity="right" |
|
||||||
android:textSize="20dp" |
|
||||||
android:textStyle="italic" |
|
||||||
android:textColor="@color/green" |
|
||||||
android:text="Payment Reference No" />--> |
|
||||||
|
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_error_title" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="center" |
|
||||||
android:layout_marginTop="20dp" |
|
||||||
android:text="Payment Error Description" |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="10dp" |
|
||||||
android:textStyle="italic" /> |
|
||||||
|
|
||||||
<!--<TextView |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:id="@+id/title_error" |
|
||||||
android:background="@color/black" |
|
||||||
android:layout_marginBottom="10dp" |
|
||||||
android:layout_gravity="right" |
|
||||||
android:textSize="20dp" |
|
||||||
android:textStyle="italic" |
|
||||||
android:textColor="@color/green" |
|
||||||
android:text="Payment Error Description" />--> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_error" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="50dp" |
|
||||||
android:background="@color/teal_700" |
|
||||||
android:gravity="center" |
|
||||||
android:scrollbars="vertical" |
|
||||||
android:text="Payment Error Description..." |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="15dp" |
|
||||||
app:layout_constraintBottom_toTopOf="@+id/textview_response" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintHorizontal_bias="1.0" |
|
||||||
app:layout_constraintVertical_bias="0.188" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_amount_title" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="center" |
|
||||||
android:layout_marginTop="20dp" |
|
||||||
android:text="Payment Amount" |
|
||||||
android:textAlignment="center" |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="10dp" |
|
||||||
android:textStyle="italic" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_amount" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="50dp" |
|
||||||
android:background="@color/teal_700" |
|
||||||
android:gravity="center" |
|
||||||
android:scrollbars="vertical" |
|
||||||
android:text="Payment Amount..." |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="15dp" |
|
||||||
app:layout_constraintBottom_toTopOf="@+id/textview_response" |
|
||||||
app:layout_constraintEnd_toEndOf="parent" |
|
||||||
app:layout_constraintHorizontal_bias="1.0" |
|
||||||
app:layout_constraintVertical_bias="0.188" /> |
|
||||||
|
|
||||||
<!--<TextView |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:id="@+id/title_amount" |
|
||||||
android:background="@color/black" |
|
||||||
android:layout_marginBottom="0dp" |
|
||||||
android:layout_gravity="right" |
|
||||||
android:textSize="20dp" |
|
||||||
android:textStyle="italic" |
|
||||||
android:textColor="@color/green" |
|
||||||
android:text="Payment Amount" />--> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_bottom" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="right" |
|
||||||
android:layout_marginTop="20dp" |
|
||||||
android:layout_marginBottom="0dp" |
|
||||||
android:text="00 = Transaction approved" |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="10dp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_bottoms" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="right" |
|
||||||
android:layout_marginTop="0dp" |
|
||||||
android:layout_marginBottom="0dp" |
|
||||||
android:text="ND = User cancel/no host response etc" |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="10dp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/title_bottomss" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_gravity="right" |
|
||||||
android:layout_marginTop="0dp" |
|
||||||
android:layout_marginBottom="0dp" |
|
||||||
android:text="99 or other code = transaction declined" |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="10dp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/button_ok_ra" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="50dp" |
|
||||||
android:layout_margin="20dp" |
|
||||||
android:background="@drawable/btn_general_enable_bg" |
|
||||||
android:text="@string/btn_back_to_complete" |
|
||||||
android:textAllCaps="false" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="16sp" /> |
|
||||||
|
|
||||||
</LinearLayout> |
</LinearLayout> |
@ -1,189 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
||||||
xmlns:tools="http://schemas.android.com/tools" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="match_parent" |
|
||||||
android:backgroundTint="@color/white" |
|
||||||
android:gravity="center" |
|
||||||
android:orientation="vertical" |
|
||||||
tools:context=".activity.StatusActivity"> |
|
||||||
|
|
||||||
<RelativeLayout |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content"> |
|
||||||
|
|
||||||
<ImageView |
|
||||||
android:id="@+id/image_status_sta" |
|
||||||
android:layout_width="200dp" |
|
||||||
android:layout_height="200dp" |
|
||||||
android:layout_centerHorizontal="true" |
|
||||||
android:contentDescription="@string/txt_image_description" |
|
||||||
android:src="@drawable/ic_status_success" /> |
|
||||||
|
|
||||||
</RelativeLayout> |
|
||||||
|
|
||||||
<RelativeLayout |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content"> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/text_status_sta" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_centerHorizontal="true" |
|
||||||
android:text="@string/txt_success_status" |
|
||||||
android:textColor="#1d504a" |
|
||||||
android:textSize="30sp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/text_info_sta" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_below="@id/text_status_sta" |
|
||||||
android:layout_centerHorizontal="true" |
|
||||||
android:paddingLeft="30dp" |
|
||||||
android:paddingTop="30dp" |
|
||||||
android:paddingRight="30dp" |
|
||||||
android:paddingBottom="20dp" |
|
||||||
android:text="@string/txt_info_status" |
|
||||||
android:textAlignment="center" |
|
||||||
android:textColor="@color/grey_8e98a6" |
|
||||||
android:textSize="20sp" /> |
|
||||||
|
|
||||||
<TextView |
|
||||||
android:id="@+id/text_info_amount_sta" |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_below="@id/text_info_sta" |
|
||||||
android:layout_centerHorizontal="true" |
|
||||||
android:paddingLeft="30dp" |
|
||||||
android:paddingRight="30dp" |
|
||||||
android:text="@string/txt_info_amount_status" |
|
||||||
android:textAlignment="center" |
|
||||||
android:textColor="@color/black" |
|
||||||
android:textSize="20sp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
</RelativeLayout> |
|
||||||
|
|
||||||
<RelativeLayout |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content"> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/button_ok_donation_sta" |
|
||||||
android:layout_width="200dp" |
|
||||||
android:layout_height="70dp" |
|
||||||
android:layout_marginStart="40dp" |
|
||||||
android:layout_marginTop="40dp" |
|
||||||
android:layout_marginEnd="40dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:background="@drawable/btn_general_enable_bg" |
|
||||||
android:gravity="center" |
|
||||||
android:padding="20dp" |
|
||||||
android:text="@string/btn_ok_donation_status" |
|
||||||
android:textAllCaps="false" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="20sp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/button_pay_again_sta" |
|
||||||
android:layout_width="200dp" |
|
||||||
android:layout_height="70dp" |
|
||||||
android:layout_below="@id/button_ok_donation_sta" |
|
||||||
android:layout_marginStart="40dp" |
|
||||||
android:layout_marginTop="40dp" |
|
||||||
android:layout_marginEnd="40dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:background="@drawable/btn_general_enable_bg" |
|
||||||
android:gravity="center" |
|
||||||
android:padding="20dp" |
|
||||||
android:text="@string/btn_pay_again_status" |
|
||||||
android:textAllCaps="false" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="20sp" |
|
||||||
android:textStyle="bold" |
|
||||||
android:visibility="visible" /> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/button_no_pay_again_sta" |
|
||||||
android:layout_width="200dp" |
|
||||||
android:layout_height="70dp" |
|
||||||
android:layout_below="@id/button_pay_again_sta" |
|
||||||
android:layout_marginStart="40dp" |
|
||||||
android:layout_marginTop="20dp" |
|
||||||
android:layout_marginEnd="40dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:background="@drawable/btn_general_disable_bg" |
|
||||||
android:gravity="center" |
|
||||||
android:padding="20dp" |
|
||||||
android:text="@string/btn_no_pay_again_status" |
|
||||||
android:textAllCaps="false" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="20sp" |
|
||||||
android:textStyle="bold" |
|
||||||
android:visibility="visible" /> |
|
||||||
|
|
||||||
</RelativeLayout> |
|
||||||
|
|
||||||
<!--<LinearLayout |
|
||||||
android:layout_width="wrap_content" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:orientation="horizontal"> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/button_ok_donation_sta" |
|
||||||
android:layout_width="match_parent" |
|
||||||
android:layout_height="wrap_content" |
|
||||||
android:layout_marginStart="80dp" |
|
||||||
android:layout_marginTop="40dp" |
|
||||||
android:layout_marginEnd="80dp" |
|
||||||
android:layout_marginBottom="80dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:background="@drawable/btn_general_enable_bg" |
|
||||||
android:padding="20dp" |
|
||||||
android:text="@string/btn_ok_donation_status" |
|
||||||
android:textAllCaps="false" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="20sp" |
|
||||||
android:textStyle="bold" /> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/button_pay_again_sta" |
|
||||||
android:layout_width="200dp" |
|
||||||
android:layout_height="150dp" |
|
||||||
android:layout_marginStart="40dp" |
|
||||||
android:layout_marginTop="40dp" |
|
||||||
android:layout_marginEnd="40dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:background="@drawable/btn_general_enable_bg" |
|
||||||
android:padding="20dp" |
|
||||||
android:text="@string/btn_pay_again_status" |
|
||||||
android:textAllCaps="false" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="20sp" |
|
||||||
android:textStyle="bold" |
|
||||||
android:visibility="visible" /> |
|
||||||
|
|
||||||
<Button |
|
||||||
android:id="@+id/button_no_pay_again_sta" |
|
||||||
android:layout_width="200dp" |
|
||||||
android:layout_height="150dp" |
|
||||||
android:layout_marginStart="40dp" |
|
||||||
android:layout_marginTop="40dp" |
|
||||||
android:layout_marginEnd="40dp" |
|
||||||
android:layout_weight="1" |
|
||||||
android:background="@drawable/btn_general_enable_bg" |
|
||||||
android:padding="20dp" |
|
||||||
android:text="@string/btn_no_pay_again_status" |
|
||||||
android:textAllCaps="false" |
|
||||||
android:textColor="@color/white" |
|
||||||
android:textSize="20sp" |
|
||||||
android:textStyle="bold" |
|
||||||
android:visibility="visible" /> |
|
||||||
|
|
||||||
</LinearLayout>--> |
|
||||||
|
|
||||||
</LinearLayout> |
|
@ -0,0 +1,53 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:background="@drawable/pop_up_bg" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/title" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:background="@drawable/pop_up_round_top_text" |
||||||
|
android:paddingTop="20dp" |
||||||
|
android:paddingBottom="20dp" |
||||||
|
android:text="@string/txt_title" |
||||||
|
android:textAlignment="center" |
||||||
|
android:textColor="@color/white" |
||||||
|
android:textSize="20sp" |
||||||
|
android:textStyle="bold" /> |
||||||
|
|
||||||
|
<RelativeLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical" |
||||||
|
android:paddingStart="20dp" |
||||||
|
android:paddingTop="20dp" |
||||||
|
android:paddingEnd="20dp" |
||||||
|
android:paddingBottom="20dp" |
||||||
|
tools:ignore="UseCompoundDrawables"> |
||||||
|
|
||||||
|
<ImageView |
||||||
|
android:id="@+id/image" |
||||||
|
android:layout_width="200dp" |
||||||
|
android:layout_height="200dp" |
||||||
|
android:layout_centerHorizontal="true" |
||||||
|
android:contentDescription="@string/txt_image_description" |
||||||
|
android:src="@drawable/ic_status_success_fancy" |
||||||
|
android:textAlignment="center" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/message" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_below="@id/image" |
||||||
|
android:layout_marginTop="16dp" |
||||||
|
android:text="@string/txt_message" |
||||||
|
android:textAlignment="center" |
||||||
|
android:textSize="20sp" /> |
||||||
|
|
||||||
|
</RelativeLayout> |
||||||
|
|
||||||
|
</LinearLayout> |
@ -1,5 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> |
|
||||||
<background android:drawable="@drawable/ic_udc_launcher_background" /> |
|
||||||
<foreground android:drawable="@mipmap/ic_udc_launcher_foreground" /> |
|
||||||
</adaptive-icon> |
|
@ -1,5 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> |
|
||||||
<background android:drawable="@drawable/ic_udc_launcher_background" /> |
|
||||||
<foreground android:drawable="@mipmap/ic_udc_launcher_foreground" /> |
|
||||||
</adaptive-icon> |
|
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 16 KiB |