question

James Tickett avatar image
James Tickett asked ·

Which Broadcast do I need?

I need to pass the Order ID back to my app once payment has been processed.

I've been using ACTION_PAYMENT_PROCESSED, however, it skips the screen where the employee has the option to print/email/SMS receipts or void the transaction. Ideally I would like this screen to still follow payment, and to then move back into my app once the "Done" button is pressed on this screen.

Is there a Broadcast for this action?

Also, is there some way to listen to all Clover broadcasts? I mean other than registering a reciever for every type of intent!

IntentsBroadcasts
2 comments
10 |2000 characters needed characters left characters exceeded

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

I'm not cleat what you are asking. Are you saying that when you get that broadcast you are starting your app, and you'd like to be able to start your app at a later point, after the receipt screen?

0 Likes 0 · ·

That's it.

My app loads once payment is processed, which cuts out the customer receipt stage. We could code some basic receipt printing into the app, but if there's a way of keeping the regular screen (with the other options of email/sms) then that would be handy!

0 Likes 0 · ·

1 Answer

Mike M avatar image
Mike M answered ·

There is no broadcast action for the "Done" button being pressed in the Register app.

There are alternative ways of listening to the different states an Order can travel through as well. Please see: onOrderUpdateListener2 in OrderConnector

Also, you don't have to register a new receiver for each intent action, you can add them to one intent filter and just have a switch to split out the code. See example below:

BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
  @Override
  public void onReceive(Context context, Intent intent) {
    Log.e("SOMETHING", intent.getAction());
    switch (intent.getAction()){
      case Intents.ACTION_ORDER_CREATED:
        orderWasCreated(intent);
        break;
      case Intents.ACTION_PAYMENT_PROCESSED:
        paymentProcessed(intent);
        break;
      default:
        break;
    }
  }
};
IntentFilter filter = new IntentFilter();
filter.addAction(Intents.ACTION_ORDER_CREATED);
filter.addAction(Intents.ACTION_LINE_ITEM_ADDED);
filter.addAction(Intents.ACTION_PAYMENT_PROCESSED);
filter.addAction(Intents.ACTION_ORDER_SAVED);
filter.addAction(Intents.ACTION_ACTIVE_REGISTER_ORDER);
filter.addAction(Intents.ACTION_V1_ACTIVE_PAY_ORDER);
filter.addAction(Intents.ACTION_V1_ORDER_BUILD_START);
filter.addAction(Intents.ACTION_V1_ORDER_BUILD_STOP);
filter.addAction(Intents.ACTION_V1_PAY_BUILD_SHOW);
filter.addAction(Intents.ACTION_V1_PAY_BUILD_HIDE);
filter.addAction(Intents.ACTION_V1_PAY_BUILD_START);
filter.addAction(Intents.ACTION_V1_PAY_BUILD_STOP);
filter.addAction(Intents.ACTION_V1_PAY_EXECUTE_START);
filter.addAction(Intents.ACTION_V1_PAY_EXECUTE_STOP);
registerReceiver(broadcastReceiver, filter);
4 comments Share
10 |2000 characters needed characters left characters exceeded

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

I think the more important point is that it doesn't matter if there's a broadcast for the done button. Pressing of the done button doesn't ensure that the payment won't be voided later.

0 Likes 0 · ·

Cheers Mike!

Jeff, I'm not trying to ensure payment voiding is passed and can't be returned to... it's just that the screen seems to consist of all the useful stuff you want to offer after processing a payment. At the moment if a customer wants a receipt I imagine it would go like this:

My app (constructs order) -> Clover Payment -> My app (prints tickets purchased) -> Go to Launcher -> Clover Orders (pick the order, then "Reissue receipt" button, then pick receipt type desired)

I suppose if I kill my app after the print job starts, then it should return to that receipt screen in Payments?

0 Likes 0 · ·

Are you asking how to launch Clover's print receipt screen in your custom payment flow? Did you see ACTION_START_PRINT_RECEIPTS in the SDK?

0 Likes 0 · ·

Ooh I hadn't spotted that one. Sounds like it'll work perfectly. Thanks Jeff!

0 Likes 0 · ·

Welcome to the
Clover Developer Community