paypal / android-checkout-sdk

Apache License 2.0
77 stars 38 forks source link

FATAL EXCEPTION: p.f0 Dispatcher #182

Open wangdabin2333 opened 1 year ago

wangdabin2333 commented 1 year ago

Before you create a new issue, please search for similar issues. It's possible somebody has encountered this bug already. PLEASE REMOVE THIS LINE TO ACKNOWLEDGE THAT AN ISSUE DOESN'T ALREADY EXIST FOR THIS BUG

Describe the bug There is no problem in the test environment, the formal environment payment will report errors

java.lang.IllegalAccessError: Method 'void com.paypal.pyplcheckout.home.viewmodel.MainPaysheetViewModel.h(com.paypal.pyplcheckout.home.viewmodel.MainPaysheetViewModel)' is inaccessible to class 'b.h0.f.m.b.c' (declaration of 'b.h0.f.m.b.c' appears in /data/app/~~a0Lqr52CIf93otvM-REm3A==/

com.paypal.checkout:android-sdk:0.8.7

I guess it was a mistake caused by confusion? I hope to solve this problem as soon as possible,thanks!

wangdabin2333 commented 1 year ago

I have confirmed that the formal environment can be paid normally after I remove the confusion

wangdabin2333 commented 1 year ago

The problem should be that the paypal callback cannot find the class of the original project after the confusion is added to the project

saperi22 commented 1 year ago

@wangdabin2333 It looks like you are trying to access something that's either internal or private to com.paypal.pyplcheckout.home.viewmodel.MainPaysheetViewModel. You shouldn't really be accessing anything in there.

Could you please make me understand what your use-case is and what you are trying to do?

wangdabin2333 commented 1 year ago

@RequiresApi(api = Build.VERSION_CODES.M) public void invokePayPalPay(AliPayBean.PaypalAndroidVO paypalAndroidVO, BaseActivity context, final DoResult doResult) { PayPalCheckout.startCheckout(new CreateOrder() { @Override public void create(@NonNull CreateOrderActions createOrderActions) { ArrayList purchaseUnits = new ArrayList<>(); PurchaseUnit purchaseUnit = new PurchaseUnit.Builder() .amount(new Amount.Builder().currencyCode(CurrencyCode.USD) .value(String.valueOf(paypalAndroidVO.getTotal())) .build()) .description(paypalAndroidVO.getOrderDescription()) .customId(paypalAndroidVO.getOrderId()) .build(); purchaseUnits.add(purchaseUnit); Order order = new Order(OrderIntent.CAPTURE, new AppContext.Builder().userAction(UserAction.PAY_NOW).build(), purchaseUnits, ProcessingInstruction.NO_INSTRUCTION); createOrderActions.create(order, (CreateOrderActions.OnOrderCreated) null); } }); PayPalCheckout.registerCallbacks(new OnApprove() { @Override public void onApprove(@NonNull Approval approval) { approval.getOrderActions().capture(new OnCaptureComplete() { @Override public void onCaptureComplete(CaptureOrderResult captureOrderResult) { Log.e(TAG, String.format("CaptureOrderResult: %s", captureOrderResult)); if (captureOrderResult instanceof CaptureOrderResult.Success) { OrderResponse orderResponse = ((CaptureOrderResult.Success) captureOrderResult).getOrderResponse(); if (orderResponse != null) { PurchaseUnit purchaseUnits = orderResponse.getPurchaseUnits().get(0); Payments payments = purchaseUnits.getPayments(); Capture capture = payments.getCaptures().get(0); doResult.confirmSuccess(paypalAndroidVO.getOrderId(), capture.getId()); } else { doResult.confirmError(); } } else if (captureOrderResult instanceof CaptureOrderResult.Error) { doResult.confirmError(); } } }); } }, new OnCancel() { @Override public void onCancel() { doResult.customerCanceled(); } }, new OnError() { @Override public void onError(@NonNull ErrorInfo errorInfo) { doResult.confirmError(); } });

tdchow commented 1 year ago

@wangdabin2333 - This looks to be an issue with proguard being enabled. When you're running in the test environment, do you have proguard disabled?