public static AndroidOnPayListener create(AndroidPayApi api, AndroidOrder order, PaySDKHandler handler) { AndroidOnPayListener l = new AndroidOnPayListener(); l.PayOrder = order; l.PayApi = api; l.OnPayListener = handler; return(l); }
private static void payEndFunction(IntPtr jListener, IntPtr jOrder, IntPtr jApi, IntPtr jResult) { object l = GCNativeKeeper.getInstance().unKeep(jListener); AndroidOnPayListener callback = (AndroidOnPayListener)l; AndroidPayResult result = new AndroidPayResult(jResult); AndroidOrder order = callback.PayOrder; AndroidPayApi api = callback.PayApi; PaySDKStatus status = toPayStatus(result.getPayCode()); string ticketId = order.getTicketId(); int channelErrorCode = toInt(result.getPayChannelCode()); string channelErrorDes = result.getPayChannelMessage(); callback.onPayEnd(status, ticketId, channelErrorCode, channelErrorDes); }
private void payInner(AndroidOrder order, AndroidOnPayListener callback) { CxxJavaObject.callJavaStart(); IntPtr jApi = getLocalJavaObject(); IntPtr jApiClazz = CxxJavaObject.getJavaClass(jApi); IntPtr jApiPayMethod = CxxJavaObject.getJavaMethodID(jApiClazz, "pay", "(Lcom/mob/paysdk/Order;Lcom/mob/paysdk/OnPayListener;)V"); IntPtr jorder = order.getLocalJavaObject(); AndroidOnPayListener cxx = callback; IntPtr jListener = cxx.getLocalJavaObject(); IntPtr gRef = cxx.getJavaObject(); GCNativeKeeper.getInstance().keep(gRef, cxx); AndroidJNI.CallVoidMethod(jApi, jApiPayMethod, CxxJavaObject.createJavaParam(jorder, jListener)); CxxJavaObject.callJavaEnd(); }