question

abhishek avatar image
abhishek asked David Marginian Deactivated answered

Receipt Issue.

Hello


Please find the below process i am using for authorization and capturing the pre auth amount and also the issue i am getting while printing the receipt.


Process:- I am authorizing and capturing the pre-auth using PaymentConnector, the methods using(for authorization using the method preAuth() and for capturing the pre-auth using the method capturePreAuth()).


Response getting while authorizing the amount:- getting all the payment details with auth amount, order id, payment id etc.

Response getting while capturing the pre-auth:- getting only payment id, close amount and tip amount but not order id etc.


Issue:- The issue i am getting while printing the receipt using order and payment id, reprint receipt only printing the authorized amount but not closed amount and tip amount.


Can you please suggest and help us over here to fix this issue. this is very urgent as my customers are waiting for the app. please help us this would be very helpful. thanks in advance.

@Sam@justin.a@keithryanwong@Greg@Jeffrey BlattmanRaymond Lee ♦♦Mark Mullan ♦@kedar.deo@varsha.a@David Marginian


Thanks and regards

Abhishek







Remote Pay Android
10 |2000

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

David Marginian avatar image
David Marginian Deactivated answered

Per our native POS example app. Note how we set the payment per the captured amounts. You will need to do something similar and then print the receipt.

 @Override
    public void onCapturePreAuthResponse(final CapturePreAuthResponse response) {
      Log.d(TAG, "onCapturePreAuthResponse: " + response.toString());
      if (response.getSuccess()) {
        for(final POSOrder order: store.getOrders()) {
          final POSPayment payment = order.getPreAuth();
          payment.setAmount();
          if (payment != null) {
            if (payment.getId().equals(response.getPaymentId())) {
              final long paymentAmount = response.getAmount();
              runOnUiThread(new Runnable() {
                @Override
                public void run() {
                  order.setPreAuth(null);
                  store.addPaymentToOrder(payment, store.getCurrentOrder());
                  payment.setPaymentStatus(POSPayment.Status.AUTHORIZED);
                  payment.setAmount(paymentAmount);
                  payment.setTransactionTitle("Auth");
                  payment.setTipAmount(response.getTipAmount());
                  ...


10 |2000

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

abhishek avatar image
abhishek answered David Marginian Deactivated edited

Can anyone help on this as this is very urgent.

Thank you so much.

1 comment
10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

Regarding the pre auth capture response, take a look at our example (onCapturePreAuthResponse):

https://github.com/clover/remote-pay-android-examples/blob/master/native-android-example-pos/src/main/java/com/clover/example/NativePOSActivity.java

We store the order and pull the details we need. For the print issue I will have to test that next week. In the meantime post your code.




0 Likes 0 ·
abhishek avatar image
abhishek answered David Marginian Deactivated converted comment to answer

Hi Devid


Thanks for your response, Please verify the below code we have implemented and let us know the issue,

For Authorization

PreAuthRequest preAuthRequest = new PreAuthRequest();
preAuthRequest.setExternalId(ExternalIdUtils.generateNewID());
preAuthRequest.setDisableReceiptSelection(true);
preAuthRequest.setAmount(Long.parseLong(currVal.toString()));
paymentConnector.preAuth(preAuthRequest);

For Capturing the pre-auth

CapturePreAuthRequest capturePreAuthRequest=new CapturePreAuthRequest();
capturePreAuthRequest.setAmount(paymentAmount);
capturePreAuthRequest.setTipAmount(tipAmount);
capturePreAuthRequest.setPaymentId(paymentId);
paymentConnector.capturePreAuth(capturePreAuthRequest);


The Receipt Code,

Payment payment=order.getPayments().get(0);

try {
    PrintJob printJob = new StaticPaymentPrintJob.Builder().payment(payment).build();
    printJob.print(context, CloverAccount.getAccount(context));
} catch (Exception e) {
    e.printStackTrace();
}


While printing the receipt, it's showing only auth amount on receipt.


Please suggest.

10 |2000

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