question

garyf avatar image
garyf asked garyf commented

Payment of invoices or similar

I'm putting together an application which is to pay invoices by looking up a rest api and adding line items to an order. The lookup searches a reference number and returns an amount and some related data to the app. This all works well when using my app and passing to the tender process using startActivityForResult(intent, 1) with an OnOrderUpdateListener2 to run an update via onPaymentProcessed to the remote API.

However, the invoices are to be within a store front/office which may sell further items on the same order. We have therefore transfer our app to the register which shows my list items and all other inventory items as required. All good to this point! Our problem is that the register then moves to tender and once successful "done" is pressed on the tender screen. We return back to the register and we're ready to create a new order. At this point I'm wanting to send the intent back to our app and the update listener is no longer run. I would imagine this is due to the intent moving 3 steps rather than 2 however this is an assumption.

To note, we are unable to use web hooks as the underlying installation will be on a LAN with no ability to host a web server (due to policy).

My question therefore is

  1. should the orderConnector.addOnOrderChangedListener(..) be retained when moving to the register intent and subsequently to the tender intent. i.e. should I expect that the listener is called when the tender is complete
  2. is there an alternative method using the register, to add add an item to an order but intervene with a dialog to lookup the invoice before adding it to the order.

Many thanks

Gary

4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bryanne Vega avatar image Bryanne Vega commented ·

What if you use ONPAYEMENTPROCESSED or similar intents, it'll return you the order ID & you can perform your backend operations?

0 Likes 0 ·
garyf avatar image garyf commented ·

Hi Bryanne,

I presume you mean an implementation of the OnOrderUpdateListener2 interface? which is what we do. This seems to work if you go from our Intent to the tender. It doesn't if you go to the register. It seems either to be a design choice by clover or a bug.

0 Likes 0 ·
Bryanne Vega avatar image Bryanne Vega commented ·

Hi Gary,

No, an actual broadcast listener, here's an example of mine:

 private final BroadcastReceiver paymentMadeReceiver= new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, final Intent intent) {
                    if (intent.getAction().equals("com.clover.intent.action.PAYMENT_PROCESSED)) {

                    }
        }
    };
0 Likes 0 ·
garyf avatar image garyf commented ·

Hi Byranne,

We're fairly new to the Android ecosystem so will take a look - thanks for the tip.

Gary

0 Likes 0 ·

0 Answers

Welcome to the
Clover Developer Community