My Profile_


Open Totals

Returns the details about the currently open batch.

This transaction is similar to the Batch Close. The difference is that it does not close the batch for settlement.

Canada Code Sample

package Canada;
import JavaAPI.*;
public class TestCanadaOpenTotals
{ public static void main(String[] args)
{ String store_id =
"
store5";
String api_token = "yesguy";
String ecr_no = "66013455";
//String ecr_no = "66011091";
String processing_country_code = "CA";
OpenTotals opentotals = new OpenTotals();
opentotals.setEcrno(ecr_no);
HttpsPostRequest mpgReq = new HttpsPostRequest
();
mpgReq.setProcCountryCode(processing_country_
code);
mpgReq.setTestMode(true); //false or comment
out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(opentotals);
mpgReq.send();
try
{ Receipt receipt =
mpgReq.getReceipt();
if ((receipt.getReceiptId()).equals("Global
Error Receipt") ||
receipt.getReceiptId().equals("null") ||
receipt.getReceiptId().equals(""))
{ System.out.println("CardType =
null");
System.out.println("TransAmount = " +
receipt.getTransAmount());
System.out.println("TxnNumber = " +
receipt.getTxnNumber());
System.out.println("ReceiptId = " +
receipt.getReceiptId());
System.out.println("TransType = " +
receipt.getTransType());
System.out.println("ReferenceNum = " +
receipt.getReferenceNum());
System.out.println("ResponseCode = " +
receipt.getResponseCode());
System.out.println("ISO = " + receipt.getISO
());
System.out.println("BankTotals = null");
System.out.println("Message = " +
receipt.getMessage());
System.out.println("AuthCode = " +
receipt.getAuthCode());
System.out.println("Complete = " +
receipt.getComplete());
System.out.println("TransDate = " +
receipt.getTransDate());
System.out.println("TransTime = " +
receipt.getTransTime());
System.out.println("Ticket = " +
receipt.getTicket());
System.out.println("TimedOut = " +
receipt.getTimedOut());
} else
{ for (
String ecr :
receipt.getTerminalIDs())
{ System.out.println("ECR: "
+
ecr);
for (String cardType : receipt.getCreditCards
(ecr))
{ System.out.println("\tCard Type: "
+
cardType);
System.out.println("\t\tPurchase: Count = "
+ receipt.getPurchaseCount(ecr, cardType)
+ " Amount = "
+ receipt.getPurchaseAmount(ecr,
cardType));
System.out.println("\t\tRefund: Count = "
+ receipt.getRefundCount(ecr, cardType)
+ " Amount = "
+ receipt.getRefundAmount(ecr, cardType));
System.out.println("\t\tCorrection: Count = "
+ receipt.getCorrectionCount(ecr, cardType)
+ " Amount = "
+ receipt.getCorrectionAmount(ecr,
cardType));
}}}} catch (
Exception e)
{ e.printStackTrace();
}}}
                
USA Code Sample

package USA;
import JavaAPI.*;
public class TestUSAPurchase
{ public static void main(String[] args)
{ String store_id =
"
monusqa002";
String api_token = "qatoken";
java.util.Date createDate = new java.util.Date
();
String order_id = "Test"+createDate.getTime();
String amount = "5.00";
String pan = "4242424242424242";
String expdate = "1602"; //YYMM format
String crypt = "7";
String commcard_invoice = "INVC090";
String commcard_tax_amount = "1.00";
String processing_country_code = "US";
boolean status_check = false;
Purchase purchase = new Purchase();
purchase.setOrderId(order_id);
purchase.setAmount(amount);
purchase.setPan(pan);
purchase.setExpdate(expdate);
purchase.setCryptType(crypt);
purchase.setCommcardInvoice(commcard_invoice);
purchase.setCommcardTaxAmount(commcard_tax_
amount);
HttpsPostRequest mpgReq = new HttpsPostRequest
();
mpgReq.setProcCountryCode(processing_country_
code);
mpgReq.setTestMode(true); //false or comment
out this line for production transactions
mpgReq.setStoreId(store_id);
mpgReq.setApiToken(api_token);
mpgReq.setTransaction(purchase);
mpgReq.setStatusCheck(status_check);
mpgReq.send();
try
{ Receipt receipt =
mpgReq.getReceipt();
System.out.println("CardType = " +
receipt.getCardType());
System.out.println("TransAmount = " +
receipt.getTransAmount());
System.out.println("TxnNumber = " +
receipt.getTxnNumber());
System.out.println("ReceiptId = " +
receipt.getReceiptId());
System.out.println("TransType = " +
receipt.getTransType());
System.out.println("ReferenceNum = " +
receipt.getReferenceNum());
System.out.println("ResponseCode = " +
receipt.getResponseCode());
System.out.println("Message = " +
receipt.getMessage());
System.out.println("AuthCode = " +
receipt.getAuthCode());
System.out.println("Complete = " +
receipt.getComplete());
System.out.println("TransDate = " +
receipt.getTransDate());
System.out.println("TransTime = " +
receipt.getTransTime());
System.out.println("Ticket = " +
receipt.getTicket());
System.out.println("TimedOut = " +
receipt.getTimedOut());
//System.out.println("CardLevelResult = " +
receipt.getCardLevelResult());
//System.out.println("StatusCode = " +
receipt.getStatusCode());
//System.out.println("StatusMessage = " +
receipt.getStatusMessage());
} catch (
Exception e)
{ e.printStackTrace();
}}}
                

OpenTotals transaction object definition

OpenTotals opentotals = new OpenTotals();

HttpsPostRequest object for Open Totals transaction

HttpsPostRequest mpgReq = new HttpsPostRequest();

mpgReq.setTransaction(opentotals);

Open Totals transaction object mandatory values

Value Type Limits Set method Description
ECR (electronic cash register) number String No limit (value provided by Moneris) opentotals.setEcrno(ecr_no); Electronic cash register number.

Predecessors
  • NA
Successors
  • NA