0

我正在使用带有 Nativescript Vue的此设备(在 android 4.4.2 上)开发 POS 应用程序。

我有一个用于设备的 SDK,并创建了一个插件以在我的应用程序中使用它。一切正常,例如打印收据和获取设备信息,但付款活动不起作用。我编写了一个应该打开 Activity 的函数,并且屏幕上必须出现来自设备的支付界面,但没有任何反应。

这是我的功能:

payNative() {
        // Build the payment call

        try {
            let amount = new java.lang.Double('13.87');
            let payment = this.$mypos.MyPOSPayment.builder()
            // Mandatory parameters
                .productAmount(amount)
                .currency(this.$mypos.Currency.EUR)
                // Foreign transaction ID. Maximum length: 128 characters
                .foreignTransactionId(UUID.randomUUID().toString())
                .build();

            let context = application.android.context;
            // Start the transaction
            // this.$mypos.MyPOSAPI.openPaymentActivity(context, payment, 1);

            let MyPOSUtil = this.$mypos.MyPOSUtil;
            let myposIntent;

            if (payment.isMotoTransaction()) {
                console.log('motoo');
                myposIntent = new android.content.Intent(MyPOSUtil.PAYMENT_CORE_ENTRY_POINT_MOTO_INTENT);
                console.log(myposIntent);
            } else if (payment.isGiftCardTransaction()) {
                console.log('giftt');
                myposIntent = new android.content.Intent(MyPOSUtil.PAYMENT_CORE_ENTRY_POINT_GIFTCARD_INTENT);
                console.log(myposIntent);
            } else {
                myposIntent = new android.content.Intent(MyPOSUtil.PAYMENT_CORE_ENTRY_POINT_INTENT);
                console.log('normalll');
                console.log(myposIntent);
            }

            let skipConfirmationScreen = false;

            console.log('*************** ++++++++++++++ ******************');
            console.log('INTENT_TRANSACTION_REQUEST_CODE', MyPOSUtil.TRANSACTION_TYPE_PAYMENT);
            console.log('INTENT_TRANSACTION_AMOUNT', new java.lang.Double(payment.getProductAmount()));
            console.log('INTENT_TRANSACTION_TIP_AMOUNT', new java.lang.Double(payment.getTipAmount()));
            console.log('INTENT_SKIP_CONFIRMATION_SCREEN', skipConfirmationScreen);
            console.log('INTENT_TRANSFER_TIPS_ENABLED', payment.isTippingModeEnabled());
            console.log('INTENT_TRANSACTION_CURRENCY', payment.getCurrency().toString());
            console.log('INTENT_TRANSACTION_FOREIGN_TRANSACTION_ID', payment.getForeignTransactionId());
            console.log('INTENT_PRINT_MERCHANT_RECEIPT', payment.getPrintMerchantReceipt());
            console.log('INTENT_PRINT_CUSTOMER_RECEIPT', payment.getPrintCustomerReceipt());
            console.log('INTENT_OPERATOR_CODE', payment.getOperatorCode());
            console.log('INTENT_REFERENCE_NUMBER', payment.getReferenceNumber());
            console.log('INTENT_REFERENCE_NUMBER_TYPE', payment.getReferenceType());
            console.log('INTENT_MOTO_PASSWORD', payment.getMotoPassword());
            console.log('*************** ++++++++++++++ ******************');

            myposIntent.putExtra(MyPOSUtil.INTENT_TRANSACTION_REQUEST_CODE, MyPOSUtil.TRANSACTION_TYPE_PAYMENT);
            myposIntent.putExtra(MyPOSUtil.INTENT_TRANSACTION_AMOUNT, new java.lang.Double(payment.getProductAmount()));
            myposIntent.putExtra(MyPOSUtil.INTENT_TRANSACTION_TIP_AMOUNT, new java.lang.Double(payment.getTipAmount()));
            myposIntent.putExtra(MyPOSUtil.INTENT_SKIP_CONFIRMATION_SCREEN, skipConfirmationScreen);
            myposIntent.putExtra(MyPOSUtil.INTENT_TRANSFER_TIPS_ENABLED, payment.isTippingModeEnabled());
            myposIntent.putExtra(MyPOSUtil.INTENT_TRANSACTION_CURRENCY, payment.getCurrency().toString());
            myposIntent.putExtra(MyPOSUtil.INTENT_TRANSACTION_FOREIGN_TRANSACTION_ID, payment.getForeignTransactionId());
            myposIntent.putExtra(MyPOSUtil.INTENT_PRINT_MERCHANT_RECEIPT, payment.getPrintMerchantReceipt());
            myposIntent.putExtra(MyPOSUtil.INTENT_PRINT_CUSTOMER_RECEIPT, payment.getPrintCustomerReceipt());
            myposIntent.putExtra(MyPOSUtil.INTENT_OPERATOR_CODE, payment.getOperatorCode());
            myposIntent.putExtra(MyPOSUtil.INTENT_REFERENCE_NUMBER, payment.getReferenceNumber());
            myposIntent.putExtra(MyPOSUtil.INTENT_REFERENCE_NUMBER_TYPE, payment.getReferenceType());
            myposIntent.putExtra(MyPOSUtil.INTENT_MOTO_PASSWORD, payment.getMotoPassword());

            console.log(myposIntent);

            application.android.foregroundActivity.startActivityForResult(myposIntent, 1);
        } catch (e) {
            console.log(e);
        }
    }

当我执行它时,这是来自设备的实时日志(adb logcat)

I/JS      ( 6712): '*************** ++++++++++++++ ******************'
I/JS      ( 6712): 'INTENT_TRANSACTION_REQUEST_CODE' 101
I/JS      ( 6712): 'INTENT_TRANSACTION_AMOUNT' {}
D/alsa_pcm(  144): pcm_open:,sparams.stop_threshold:1540, config->stop_threshold:0
V/audio_hw_primary(  144): do not use out resampler
I/JS      ( 6712): 'INTENT_TRANSACTION_TIP_AMOUNT' {}
I/JS      ( 6712): 'INTENT_SKIP_CONFIRMATION_SCREEN' false
I/JS      ( 6712): 'INTENT_TRANSFER_TIPS_ENABLED' false
I/JS      ( 6712): 'INTENT_TRANSACTION_CURRENCY' 'EUR'
I/JS      ( 6712): 'INTENT_TRANSACTION_FOREIGN_TRANSACTION_ID' '4b3d6780-b87e-4633-bf0f-76a43f963847'
I/JS      ( 6712): 'INTENT_PRINT_MERCHANT_RECEIPT' 0
I/JS      ( 6712): 'INTENT_PRINT_CUSTOMER_RECEIPT' 0
I/JS      ( 6712): 'INTENT_OPERATOR_CODE' null
I/JS      ( 6712): 'INTENT_REFERENCE_NUMBER' null
I/JS      ( 6712): 'INTENT_REFERENCE_NUMBER_TYPE' 0
I/JS      ( 6712): 'INTENT_MOTO_PASSWORD' null
I/JS      ( 6712): '*************** ++++++++++++++ ******************'
I/JS      ( 6712): {}
W/DeviceManager(  488): ++++++++++switch == true
E/DeviceManager(  488): +++switch = true   action=com.mypos.transaction.START_TRANSACTION   packageName=   callingPackage=sellfer.pos   className=
W/PAXDROID/PaxCustomerManager(  488): Runtime: /data/app/com.mypos-2.apk is in the whitelist, no need to verify it at run time.
W/ActivityManager(  488): startActivityMayWait() packageName = com.mypos, appSourcePath = /data/app/com.mypos-2.apk
I/ActivityManager(  488): START u0 {act=com.mypos.transaction.START_TRANSACTION cmp=com.mypos/.ui.activity.PaymentActivity (has extras)} from pid 6712
E/ActivityManager(  488): hbc:home_stack_is_frant_stack = false
E/ActivityManager(  488): hbc:mService.mBooting = false
E/ActivityManager(  488): hbc:home_stack_is_frant_stack = false
E/ActivityManager(  488): hbc:mService.mBooting = false
D/ConnectivityService(  488): onUidRulesChanged(uid=10058, uidRules=0)
D/IPP_IPPS_com.pax.ipp.service.IppStub( 1501): 01-17 03:10:59.065 CLIENT: 6.5
D/IPP_IPPS_com.pax.ipp.service.IppStub( 1501): 01-17 03:10:59.066 SERVICE: 6.6
D/ipps    ( 1600): file>>>/storage/emulated/0/neptune/app.db
D/ipps    ( 1600): insert Db>>>SQLiteDatabase: /storage/emulated/0/neptune/app.db
D/ipps    ( 1600): after insert Db>>>0
D/IPP_IPPS_com.pax.ipp.service.IppStub( 1501): 01-17 03:10:59.110 CLIENT: 6.5
D/IPP_IPPS_com.pax.ipp.service.IppStub( 1501): 01-17 03:10:59.112 SERVICE: 6.6
D/ipps    ( 1600): file>>>/storage/emulated/0/neptune/app.db
D/ipps    ( 1600): insert Db>>>SQLiteDatabase: /storage/emulated/0/neptune/app.db
D/ipps    ( 1600): after insert Db>>>0
E/SpdevServerThread(  771): msg from sp
E/SpdevServerThread(  771): get a message msg.cmd=3
E/SpdevServerThread(  771): sp icon
E/SpdevServerThread(  771): subcmd is:0x04
E/SpdevServerThread(  771): msg is:0x00
W/ContextImpl(  771): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1214 android.content.ContextWrapper.sendBroadcast:372 com.pax.daemon.observer.ServerService$2.onIconEvent:498 com.pax.daemon.server.SpdevServerThread.notifyIconStatusObserver:268 com.pax.daemon.server.SpdevServerThread.msg_handler:67
E/IcCardStatusReceive(  668): onReceive=com.pax.intent.action.ICCSTATUS
W/InputMethodManagerService(  488): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@420ab808 attribute=null, token = android.os.BinderProxy@422039d8
E/ActivityManager(  488): hbc:home_stack_is_frant_stack = false
E/ActivityManager(  488): hbc:mService.mBooting = false
D/ConnectivityService(  488): onUidRulesChanged(uid=10058, uidRules=0)
D/IPP_IPPS_com.pax.ipp.manager.Terminal( 1501): 01-17 03:10:59.473 HOLDED BY=, RECENT IS=1600, HOLDER IS RECENT=false
D/IPP_IPPS_com.pax.ipp.manager.Terminal( 1501): 01-17 03:10:59.474 HAS RELEASED=true
D/IPP_IPPI_com.pax.ippi.impl.NeptuneUser( 1600): 01-17 03:10:59.477 unRegister
D/DeviceManagerService(  488): setNavigationBarInvisible: invisible=false
W/DeviceManagerService(  488): setBackKeyDisable disable = false
D/DeviceManagerService(  488): setHomeKeyDisable disable=false
D/DeviceManagerService(  488): setRecentKeyDisable disable=false
D/audio_hw_primary(  144): out_standby
D/BatteryService(  488): huangbc ... shutdownIfBatteryNotPresent call ...
D/BatteryService(  488): huangbc ... shutdownIfBatteryNotPresent call ...
D/PowerManagerService(  488): mHoldBootFastWakeLock = true
I/PowerUI (  546): mIntentReceiver action=android.intent.action.BATTERY_CHANGED
E/PaxSmartDeviceManagerService(  668): mBatteryReceiver=BATTERY_STATUS_CHARGING
D/ConnectivityService(  488): Sampling interval elapsed, updating statistics ..
D/ConnectivityService(  488): Done.
D/ConnectivityService(  488): Setting timer for 30seconds
D/AlarmManager(  488): hbc ... set alarm:package =  android, type = 3, triggerAtTime = 4792556, windowLength = -1, interval = 0
E/PaxSmartDeviceManagerService(  668): MyTimerTask------

应该发生的是切换到设备的支付活动,但屏幕上没有任何反应。

这部分日志提示我,我的函数实际上正在尝试做这件事,但出了点问题,但我是 Nativescript 和 android 的新手。

W/DeviceManager(  488): ++++++++++switch == true
E/DeviceManager(  488): +++switch = true   action=com.mypos.transaction.START_TRANSACTION   packageName=   callingPackage=sellfer.pos   className=
W/PAXDROID/PaxCustomerManager(  488): Runtime: /data/app/com.mypos-2.apk is in the whitelist, no need to verify it at run time.
W/ActivityManager(  488): startActivityMayWait() packageName = com.mypos, appSourcePath = /data/app/com.mypos-2.apk
I/ActivityManager(  488): START u0 {act=com.mypos.transaction.START_TRANSACTION cmp=com.mypos/.ui.activity.PaymentActivity (has extras)} from pid 6712
4

0 回答 0