Getting Order object

Hello,
I have use the latest Poynt Sdk.
I need to apply a discount on a product when it was added to the order. I tried to get the order object from PoyntOrderService once the product was added to the order but it was always null.
But, if the order is saved and then reopened it returns the order object correctly.
So I’m wondering what I’m doing wrong or how can I get the order during adding new products or new line items.

Thanks for help,
Appreciated

Hi,

That’s correct, an Order is not persisted until it’s processed or explicitly saved. Hence the reason why you won’t be able to find the order through the Poynt Order Service. But what you are doing is what the custom discount service is for. When you register your service as a custom discount service, you will receive call backs w/ both order and the item added from the Register app. Your service can then apply discounts and update amounts as they apply.

Sorry for the delay in getting our docs up on the site. We will try to publish them as quickly as we can.

cheers,
Praveen

Hi Praveen,

I am wondering if you can send me a code sample for how you can register a discount service?! so when i add an item in register it calls apply discount callback.

Thanks in advance,
Best Regards,
Motaz Elsaher.

You can find a work-in-progress sample here: https://github.com/poynt/PoyntSamples/tree/custom-tenders
Please note that the interfaces might change a little bit as we are trying to optimize it for better performance and integration effort. Also there isn’t much documentation yet - so here are a few things to note:

  • Notice the config entry in the manifest file - the xml file is where you configure your discount capability info
  • implement IPoyntCustomDiscountService AIDL
  • install it on your development device (note this is not supported on production devices yet)
  • currently you will see your discount service showing up in the Payment Fragment (under options menu). But soon we will add calls to Register app so you get callbacks when items are being added.

Give it a try and post questions here - meanwhile we will try to get the docs and implementation more stable.

cheers,
Praveen