question

ismdcf avatar image
ismdcf asked Jeffrey Blattman edited

Invoke Fire Order Print Option from the Clover Android SDK

We would like to automatically print the order receipts from the configured order printers based on the labels, Just like how the fire option works in printer timing selection from order receipts settings. When we try to use the following code it prompts the user to select an order printer


PrintJob print_job = new StaticOrderPrintJob.Builder().order(mOrder).build();
print_job.print(thisActivity, account);


Is there are a way to replicate the "fire when hitting pay" option from the register app using the android SDK in our application.

App MarketDevKit
10 |2000

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

1 Answer

·
Jeffrey Blattman avatar image
Jeffrey Blattman answered Jeffrey Blattman edited

Did you look at OrderConnector.fire()? Also,


When we try to use the following code it prompts the user to select an order printer

That will only be the case if they have multiple order printers configured. You can either use PrinterConnector to look up the available printers and let the user select (or pick one arbitrarily) or set the "print to any" flag on the print job... which causes it to just use the first one in the list of configured printers.

2 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.

ismdcf avatar image ismdcf commented ·

Hi @ Jeffrey Blattman,

Thanks for the reply, I tried the method and it gave the expected result, One question about it, is there a way to force a reprint using the above method. I tried below method but got an error

orderConnector.refire(orderId);

Logcat error

W/System.err: com.clover.sdk.v1.ClientException: status code: -1

at com.clover.sdk.v1.ServiceConnector.throwOnFailure(ServiceConnector.java:316)

06-11 23:01:22.370 17960-18074/com.test.app W/System.err: at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:249)

06-11 23:01:22.371 17960-18074/com.test.app W/System.err: at com.clover.sdk.v3.order.OrderV31Connector.refire(OrderV31Connector.java:1086)

0 Likes 0 ·
Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ ismdcf commented ·

Could be do to this:

public boolean refire(String orderId, ResultStatus resultStatus) {
  throw new UnsupportedOperationException();
}

Looking at the history someone had an idea but never implemented it. I'll file an internal issue to fix that (but the fix might be to just remove the method from the docs).

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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

Welcome to the
Clover Developer Community