Batch receipt printing
[DEPRECATED] printBatchReceipt()¶
This method should be called to print the receipt when a batch is closed.
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
request |
PrintReceiptRequest |
Yes | Data transfer object that will contain the payment request information. |
callback |
PaymentCallback |
Yes | Interface that will be executed for notifications of success or error of the payment process. |
Detail of the Parameters
request (PrintReceiptRequest)
| Name | Type | Mandatory | Description |
|---|---|---|---|
ApplicationInfo.credentials |
Credentials |
Yes | Credentials of the application that is requesting the operation, as registered at PayStore. Basically, it's about the application ID and the access token. |
ApplicationInfo.softwareVersion |
String |
Yes | Version of the application requesting the batch printout |
batchNumber |
Long |
Yes | Closed batch number |
previewBatchReceipt |
Long |
No | Indicates whether the batch receipt preview screen should be displayed |
printBatchReceipt |
Long |
No | Indicates whether the batch receipt should be printed automatically |
callback (PaymentCallback)
| Name | Type | Mandatory | Description |
|---|---|---|---|
onSuccess |
Method for notification on success | ||
onError |
Method for notification in case of error. | ||
ErrorData.paymentsResponseCode |
String |
Yes | Response code for the error that occurred. See Response Codes |
ErrorData.acquirerResponseCode |
String |
No | Response code for the occurred error returned by the acquirer. Note that this error will only be returned if the transaction is not authorized by the acquirer. |
ErrorData.responseMessage |
String |
Yes | Descriptive message of the reason for the non-authorization. If the transaction was denied by the acquirer, it will contain the message returned by the acquirer. |
ErrorData.acquirerAdditionalMessage |
String |
No | Additional message sent by the acquirer in the transaction response. |
Example of the batch printing flow¶
public class MyActivity extends Activity implements PaymentClient.PaymentCallback {
private PaymentClient paymentClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment);
paymentClient = new PaymentClientImpl();
}
@Override
protected void onResume() {
super.onResume();
paymentClient.bind(this);
}
@Override
protected void onDestroy() {
try {
paymentClient.unbind(this);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
super.onDestroy();
}
public void doExecute(){
ApplicationInfo appInfo = new ApplicationInfo();
appInfo.setCredentials(new Credentials("demo-app", "TOKEN-KEY-DEMO"));
appInfo.setSoftwareVersion("1.0.0.0");
PrintBatchReceiptRequest printBatchReceiptRequest = new PrintBatchReceiptRequest();
printBatchReceiptRequest.setApplicationInfo(appInfo);
printBatchReceiptRequest.setBatchNumber(1L);
printBatchReceiptRequest.setPreviewReceiptBatch(true);
printBatchReceiptRequest.setPrintReceiptBatch(true);
try {
paymentClient.printBatchReceipt(printBatchReceiptRequest, this);
} catch (ClientException e) {
Log.e(TAG, "Error starting devolution", e);
}
}
@Override
public void onError(ErrorData errorData) {
Log.e(TAG, "Error: " + errorData.getResponseMessage());
}
@Override
public void onSuccess(Object o) {
Log.i(TAG, "Success!");
}
}