paypal / here-sideloader-api-samples

Sideloader API samples that enable to integrate PayPal Here into other apps
Other
24 stars 32 forks source link

Crash on return to app #42

Closed quanvh3 closed 8 years ago

quanvh3 commented 8 years ago

I'm using Paypalhere sideloader on Android, but after completed payment, i assume that press to "new order" will bring me back to my app but it always crash. Here are the stack trace, please verify for me if there is any missing paramter for the input : Caused by: java.lang.NullPointerException: replacement == null at java.lang.String.replace(String.java:1223) at com.paypal.here.services.thirdpartyintegration.ThirdPartyInvoice.createThirdPartyReturnUrl(SourceFile:286) at com.paypal.here.activities.charge.BaseChargePresenter.handleThirdPartyCallback(SourceFile:830) at com.paypal.here.activities.charge.BaseChargePresenter.onPreviousTransactionCompleted(SourceFile:493) at com.paypal.here.activities.charge.BaseChargePresenter.initOrder(SourceFile:467) at com.paypal.here.activities.charge.BaseChargePresenter.onResume(SourceFile:436) at com.paypal.here.activities.charge.AudioChargePresenter.onResume(SourceFile:90) at com.paypal.here.activities.charge.orderentry.ChargePresenterDelegate.onResume(SourceFile:369) at com.paypal.here.activities.charge.ChargeActivity.onResume(SourceFile:724)

lernerb commented 8 years ago

Can you provide us with an example sideload that you are sending that reproduces the crash?

Feel free to obfuscate any personal information.

Sent from my iPhone

On Mar 17, 2016, at 6:29 AM, quanvh3 notifications@github.com wrote:

I'm using Paypalhere sideloader on Android, but after completed payment, i assume that press to "new order" will bring me back to my app but it always crash. Here are the stack trace, please verify for me if there is any missing paramter for the input : Caused by: java.lang.NullPointerException: replacement == null at java.lang.String.replace(String.java:1223) at com.paypal.here.services.thirdpartyintegration.ThirdPartyInvoice.createThirdPartyReturnUrl(SourceFile:286) at com.paypal.here.activities.charge.BaseChargePresenter.handleThirdPartyCallback(SourceFile:830) at com.paypal.here.activities.charge.BaseChargePresenter.onPreviousTransactionCompleted(SourceFile:493) at com.paypal.here.activities.charge.BaseChargePresenter.initOrder(SourceFile:467) at com.paypal.here.activities.charge.BaseChargePresenter.onResume(SourceFile:436) at com.paypal.here.activities.charge.AudioChargePresenter.onResume(SourceFile:90) at com.paypal.here.activities.charge.orderentry.ChargePresenterDelegate.onResume(SourceFile:369) at com.paypal.here.activities.charge.ChargeActivity.onResume(SourceFile:724)

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

shankie-codes commented 8 years ago

+1 on this issue for me. I have this issue regardless of the return URL – whether it's my application's URL scheme, or something on the web as in the example below

Here's my sideload URL:

paypalhere://takePayment/v2?returnUrl=http%3A%2F%2Fgoogle.com&invoice=%7B"merchantEmail"%3A"bookings@example.com"%2C"itemList"%3A%7B"item"%3A%5B%7B"name"%3A"something"%2C"description"%3A"something"%2C"quantity"%3A"1.0"%2C"unitPrice"%3A5%2C"taxName"%3A"Tax"%2C"taxRate"%3A"1"%7D%5D%7D%2C"currencyCode"%3A"GBP"%2C"paymentTerms"%3A"DueOnReceipt"%2C"discountPercent"%3A"0.0"%7D

quanvh3 commented 8 years ago

Here is my request for paypal here sideloader :

paypalhere://takePayment/v2?accepted=cash%2Ccard%2Cpaypal&returnUrl=myreturnurl%3A%2F%2FtakePayment%2F%7Bresult%7D%3FDone%26PaymentType%3D%7BType%7D%26InvoiceId%3D%7BInvoiceId%7D%26TxId%3D%7BTxId%7D%26GrandTotal%3D%7BGrandTotal%7D&invoice={"currencyCode":"€","discountPercent":"0.0","itemList":{"item":[{"description":"4fasd5f5","name":"The Get Up Kids: Band Camp Pullover Hoodie","quantity":1.0,"taxName":"","taxRate":"2.32","unitPrice":30.05},{"description":"MM-A900M","name":"Samsung MM-A900M Ace","quantity":1.0,"taxName":"","taxRate":"11.61","unitPrice":150.24}]},"payerEmail":"1446008120@ex.com","paymentTerms":"DueOnReceipt"}&step=choosePayment

shankie-codes commented 8 years ago

That's interesting @quanvh3 . You haven't URL-encoded your JSON, which it probably isn't going to like as there are characters in there which are invalid in a URL. This makes me thing that somehow my URL also isn't valid.

@lernerb any thoughts?

quanvh3 commented 8 years ago

That was my bad, everything work nicely after i encoded my json invoice.

Thanks @lernerb , @shankiesan for your support.

shankie-codes commented 8 years ago

Ah but my problem still isn't solved! :smile:

What's wrong with my invoice?

You're welcome @quanvh3

quanvh3 commented 8 years ago

@shankiesan

paypalhere://takePayment/v2?returnUrl=http%3A%2F%2Fgoogle.com&invoice=%7B"merchantEmail"%3A"bookings@example.com"%2C"itemList"%3A%7B"item"%3A%5B%7B"name"%3A"something"%2C"description"%3A"something"%2C"quantity"%3A"1.0"%2C"unitPrice"%3A5%2C"taxName"%3A"Tax"%2C"taxRate"%3A"1"%7D%5D%7D%2C"currencyCode"%3A"GBP"%2C"paymentTerms"%3A"DueOnReceipt"%2C"discountPercent"%3A"0.0"%7D

Is this your final url to sent to Paypal, i still can see " in your uri. Otherwise u might just provide your final uri to see if anything goes wrong.

Mine look something like this :

paypalhere://takePayment/?accepted=cash%2Ccard%2Cpaypal&returnUrl=myreturnurl%3A%2F%2FonHandleResult%2F%7Bresult%7D%3FDone%26PaymentType%3D%7BType%7D%26InvoiceId%3D%7BInvoiceId%7D%26TxId%3D%7BTxId%7D%26GrandTotal%3D%7BGrandTotal%7D&invoice=%7B%22currencyCode%22%3A%22%E2%82%AC%22%2C%22discountPercent%22%3A%220.0%22%2C%22itemList%22%3A%7B%22item%22%3A%5B%7B%22description%22%3A%22VGN-TXN27N%2FB%22%2C%22name%22%3A%22Sony%20VAIO%20VGN-TXN27N%2FB%2011.1%5C%22%20Notebook%20PC%22%2C%22quantity%22%3A1.0%2C%22taxName%22%3A%22%22%2C%22taxRate%22%3A%22208.99%22%2C%22unitPrice%22%3A2495.37%7D%2C%7B%22description%22%3A%228525PDA%22%2C%22name%22%3A%22AT%5Cu0026T%208525%20PDA%22%2C%22quantity%22%3A1.0%2C%22taxName%22%3A%22%22%2C%22taxRate%22%3A%2215.48%22%2C%22unitPrice%22%3A184.83%7D%2C%7B%22description%22%3A%22sw810i%22%2C%22name%22%3A%22Sony%20Ericsson%20W810i%22%2C%22quantity%22%3A1.0%2C%22taxName%22%3A%22%22%2C%22taxRate%22%3A%2230.96%22%2C%22unitPrice%22%3A369.68%7D%5D%7D%2C%22payerEmail%22%3A%221446008120%40ex.com%22%2C%22paymentTerms%22%3A%22DueOnReceipt%22%7D&step=choosePayment

shankie-codes commented 8 years ago

Hmm that might be it. Yes it doesn't seem to be replacing my double-quotes.

I'll have a look at that.

lernerb commented 8 years ago

Sorry I missed all those messages, it was 4am on the east coast! Try properly URL encoding, the "" shouldn't be there. If it still crashes after that I can take another look.

On Monday, March 21, 2016, shankiesan notifications@github.com wrote:

Hmm that might be it. Yes it doesn't seem to be replacing my double-quotes.

I'll have a look at that.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/paypal/here-sideloader-api-samples/issues/42#issuecomment-199221059

Sent from Gmail Mobile

shankie-codes commented 8 years ago

Yeah, the " definitely look wrong. I'll try reencoding and get back to you. Will be later this week!

Thanks for your help @lernerb