question

krishna avatar image
krishna asked ·

Is there any way to update payment receipt when payment is done form clover sale app(ACTION_MANUAL_PAY).

We are firing ACTION_MANUAL_PAY intent to launch Sale application of clover. After successful payment we need to add some data to payment and get it printed with customer receipt. Is there any way to update payment data to get it on customer receipt when printed from clover sale application.
PaymentsPrint
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.

1 Answer

sam avatar image
sam answered ·
Listen for activityResult and grab the payment object. You won't be able to directly edit payment data. But if you're looking to add a line to the receipt, use the Order `Note` field. Then, you can print receipt with new note line added.


 @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == MANUAL_PAY) {
Payment p = data.getParcelableExtra(Intents.EXTRA_PAYMENT);
final String oId = p.getOrder().getId();
new AsyncTask<Void, Void, Void>() {
@Overrideprotected Void doInBackground(Void... params) {
try{
Order o = mOrderConnector.getOrder(oId).setNote("TEST");
mOrderConnector.updateOrder(o);
pj = new StaticReceiptPrintJob.Builder().order(o).build();
pj.print(getBaseContext(), mAccount);
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
}.execute();

}

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.

Welcome to the
Clover Developer Community