question

radha avatar image
radha asked radha commented

Unable to add customized at the bottom of the receipt using ReceiptRegistrationConnector

I want to add dynamic text at the bottom of the receipt. It tried ReceiptRegistrationConnector as mentioned in https://github.com/clover/clover-android-sdk/blob/master/clover-android-sdk/src/main/java/com/clover/sdk/v1/printer/ReceiptRegistrationConnector.java but it didnt work. Is this the only solution. can we give any url for the authority in content provider or is it predefined for receipt

when im using the note option, im able to print the text at the top of the receipt but i want text to be added at the bottom.

I tried with the smart receipts but it is used only for the static text not dynamic

Can someone suggest me how to add dynamic text at the bottom of the receipt.

OrdersPrintPaymentConnector
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

·
David Marginian avatar image
David Marginian Deactivated answered radha commented

Per Jeff's answer here it seems ReceiptRegistrationConnector should work: https://community.clover.com/questions/23/how-can-i-add-textimages-to-customer-receipts.html

I don't know what isn't working for you perhaps you can provide information.


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

radha avatar image radha commented ·

Manifest

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 <provider
         android:name="com.ebiz.cloverconnector.models.ReceiptRegistrationProvider"
            android:authorities="com.ebiz.cloverconnector.models"
            android:exported="true"/>



0 Likes 0 ·
radha avatar image radha commented ·

Code to print receipt with the text at the bottom


code in print btn onclick

Cursor c = getContentResolver().query(OrderContract.Summaries.contentUriWithAccount(account), new String[]{OrderContract.Summaries.ID}, null, null, OrderContract.Summaries.LAST_MODIFIED + " DESC LIMIT 1"); 
if (c != null && c.getCount()>0)  {
           c.moveToFirst();
           String cid =  c.getString(c.getColumnIndex(OrderContract.Summaries.ID));
           if(cid != null && !cid.equals("")) orderId = cid;
            c.close();                }

  receiptRegistrationConnector.register(Uri.parse(ReceiptRegistrationProvider.CONTENT_URI_TEXT.toString()),
                new ReceiptRegistrationConnector.ReceiptRegistrationCallback<Void>() {
                    @Override
                    public void onServiceSuccess(Void result, ResultStatus status) {
                        super.onServiceSuccess(result, status);
                        updateAdd(status);
                       new MyAsyncTask().execute();
                    }

                    @Override
                    public void onServiceFailure(ResultStatus status) {
                        super.onServiceFailure(status);
                        updateAdd(status);
                      new MyAsyncTask().execute();
                    }

                    @Override
                    public void onServiceConnectionFailure() {
                        super.onServiceConnectionFailure();
                        updateAdd(null);
                        new MyAsyncTask().execute();
                    }
                });

Async task -
  new StaticPaymentPrintJob.Builder()
                        .order(order)
                        .build().print(context, account);

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ radha commented ·

Please explain the problem you are experiencing, have you checked the logs?

0 Likes 0 ·
radha avatar image radha commented ·

That is the code, issue is unable to add the text at the bottom of the receipt

1. cursor is returning the orderId
2. receiptRegistrationConnection.register is returning this error "ResultStatus{statusCode=SERVICE_ERROR, statusMessage=null}" in onServiceFailure method




0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ radha commented ·

Anything in the logs?


0 Likes 0 ·
radha avatar image radha David Marginian ♦♦ commented ·

ResultStatus{statusCode=SERVICE_ERROR, statusMessage=null} only this error

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