paypal / paypal-here-sdk-android-distribution

Add credit card (swipe & key-in) capabilities to your Android app
Other
83 stars 95 forks source link

Custom Receipt Screen #177

Open DowsingUK opened 4 years ago

DowsingUK commented 4 years ago

I've been trying to customize the receipt screen but I have no clue where to assign values, wherever I put some of the below sentences device freezes at beginPayment, would someone help me here please?

new ReceiptOptionsViewContent().title("You Paid $1.23"); new ReceiptOptionsViewContent().message("Payment"); new ReceiptOptionsViewContent().setPrompt("Would you like a receipt for this purchase");

new ReceiptEmailEntryViewContent().title("Send Email"); new ReceiptEmailEntryViewContent().sendButtonTitle("Send it now!");

new ReceiptSMSEntryViewContent().title("Send Text Message"); new ReceiptSMSEntryViewContent().sendButtonTitle("Send it now!");

And how can I modify this?

skipReceipt Booleans { "skipping": true, "charityEnabled": true }

ppmtscory commented 4 years ago

You're not allowed to modify the text/verbiage on the receipt options page. You can add an option if you need but can't modify the current listings.

DowsingUK commented 4 years ago

Do you have an example of how to add options? so far I can list the option but I haven't found a way to end the transaction...

` List moreOptions = new ArrayList<>(); moreOptions.add("Print");

currentTransaction.setAdditionalReceiptOptions(moreOptions, new TransactionContext.ReceiptOptionHandlerCallback()
{
  @Override
  public void receiptOptionHandler(Integer integer, String s, final TransactionRecord transactionRecord)
  {
    if(s.equals("Print"))
    {
      endCurrentTransaction()?
    }
});

`

ppmtscory commented 4 years ago

I'm confused as to what you're actually trying to accomplish. This functionality is meant to be able to add in additional options such as Print. If that was added, then within that method you would have APIs or methods that talk to your printer to print a receipt and then move to a different activity. If you simply want to close the receipt options page, you'd use the No Thanks option. Can you let me know exactly what you're trying to accomplish and I can help you with what to do?

DowsingUK commented 4 years ago

Well I'm trying to accomplish 3 very common and simple tasks but as far as I know 2 of them are impossible to do with this RetailSDK 1. Signature Screen in Portrait mode, 2. Localization, so the only one it seems achievable is 3. Print and then close the receipt options page in the print finish callback I do not need to move to a different activity I just expect currentTransaction.setCompletedHandler to be call after Print has finished just want the same behaviour as if I'd use No Thanks option

DowsingUK commented 4 years ago

So should I add the 3rd point to the list of impossible task to do with this RetailSDK?

ppmtscory commented 4 years ago

I apologize as I've not had a chance to run any tests to see if the receipt options are functioning the way that they should. When you make the print call, in your example, does the receipt options page not close and return control to your app? You don't need to check the string since you're only adding the single button - unless there's an issue, that handler would be called as soon as that option is selected and then would return control back to your app.

DowsingUK commented 4 years ago

It's not returning although it runs the print function but just get stuck at that receipt options page

ppmtscory commented 4 years ago

I will need to run some tests and get back to you.

DowsingUK commented 4 years ago

Ok thank you so much!

DowsingUK commented 4 years ago

Any chance you have found something that helps me implementing the Print option?

ppmtscory commented 4 years ago

I apologize but I've not had time to run any tests yet. I will hopefully get some time tomorrow.

ppmtscory commented 4 years ago

Alright, I had to update Android Studio and that opened up a whole other set of issues but I finally got my environment up and running to run some test. The conclusion of the test is that the added receipt option simply gives you the opportunity to run some API (to a printer, etc) and then it's up to you to move along once your process is complete. If you'd like the code that I used for the Sample App, I can share that but you really have a couple options:

  1. Complete the printing with your own implementation and then either move away from the receipt page on your own or do the printing in the background and then click the no thanks option when completed.
  2. Suppress the receipt options page altogether and handle all printing on your own with your own UI. This option requires an agreement on your part to provide the customer with an EMV compliant receipt and we provide a Receipt API to get the compliant information.
DowsingUK commented 4 years ago
  1. Would be so much better how can I achieve that?
ppmtscory commented 4 years ago

Can you please email pph-sdk@paypal.com with your business name, app name, and a simple business justification for wanting to suppress the receipt screen? I will respond there with the terms for you to accept.

joyheaven72 commented 9 months ago

currentTransaction.setAdditionalReceiptOptions(moreOptions, new TransactionContext.ReceiptOptionHandlerCallback() { @Override public void receiptOptionHandler(Integer integer, String s, final TransactionRecord transactionRecord) { if(s.equals("Print")) { endCurrentTransaction()? } });

Rtty