首页 > 解决方案 > 试图在没有解码器的情况下使虚拟上下文成为当前的

问题描述

我正在尝试将 Paytm API 集成到我的应用程序中。Paytm 在生成校验和后尝试访问 webview,但出现此错误,

Trying to make virtual context current without decoder

造成这种情况的主要原因是什么?

这是我的 api 调用,paytm 从中生成校验和,我正在获取校验和并启动 paytm 服务。但是在打开这个 webview 时我得到了错误。

public void paymentVerification(String authToken, String farmerId, Context context) {
        EndPoints.getPaymentDetails( authToken, farmerId, new Callback<BasicResponse>() {
            @Override
            public void onResponse(@NonNull Call<BasicResponse> call, @NotNull Response<BasicResponse> response) {
                if (response.isSuccessful()) {
                    BasicResponse basicResponse = response.body();
                    assert basicResponse != null;
                    ErrorCode errorCode = basicResponse.getErrorCode();
                    if (!NetworkErrorHandlingUtils.ErrorCheck( errorCode )) {
                        //  update farmerMutableLiveData Details...
                        PaymentLogResponse paymentLogResponse = GsonUtils.fromGson( basicResponse.getResponse(), PaymentLogResponse.class );

                        //  for production environment...
                        PaytmPGService Service = PaytmPGService.getStagingService();
                        HashMap<String, String> paramMap = new HashMap<>();
                        paramMap.put( "MID", paymentLogResponse.getMerchantId() );
                        // Key in your staging and production MID available in your dashboard
                        paramMap.put( "ORDER_ID", paymentLogResponse.getOrderId() );
                        paramMap.put( "CUST_ID", paymentLogResponse.getCustomerId() );
                        paramMap.put( "CHANNEL_ID", paymentLogResponse.getChannelId().name() );
                        paramMap.put( "TXN_AMOUNT", paymentLogResponse.getAmountPaid() );
                        paramMap.put( "WEBSITE", paymentLogResponse.getWebsite().name() );
                        // This is the staging value. Production value is available in your dashboard
                        paramMap.put( "INDUSTRY_TYPE_ID", paymentLogResponse.getIndustry_type().name() );
                        // This is the staging value. Production value is available in your dashboard
                        paramMap.put( "CALLBACK_URL", "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=" + paymentLogResponse.getOrderId() );
                        paramMap.put( "CHECKSUMHASH", paymentLogResponse.getChecksumHash() );
                        PaytmOrder Order = new PaytmOrder( paramMap );
                        Service.initialize( Order, null );
                        Service.startPaymentTransaction( context, true, true, new PaytmPaymentTransactionCallback() {
                            /*Call Backs*/
                            public void someUIErrorOccurred(String inErrorMessage) {
                            }

                            public void onTransactionResponse(Bundle inResponse) {
                            }

                            public void networkNotAvailable() {
                            }

                            public void clientAuthenticationFailed(String inErrorMessage) {
                            }

                            public void onErrorLoadingWebPage(int iniErrorCode, String inErrorMessage, String inFailingUrl) {
                            }

                            public void onBackPressedCancelTransaction() {
                            }

                            public void onTransactionCancel(String inErrorMessage, Bundle inResponse) {
                            }
                        } );
                    } else {
                        //  show error dialog here..., the error could be from one of the Error Code...

                    }
                }
            }

            @Override
            public void onFailure(@NonNull Call<BasicResponse> call, @NotNull Throwable t) {
                //  show UI for API Failure...
                if (t instanceof NoConnectivityException) {
                    //  This is where it throws No Internet connectivity error...
                    //  show some UI here, sefu...
                    IntentUtils.PassIntent( context, NetworkErrorActivity.class );
                }
                //  there's some other error, not network connectivity issue...
                else {

                }
            }
        } );
    }

标签: androidpaytm

解决方案


推荐阅读