GetBatchHistory
- Method
SlimCD.Reports.GetBatchHistory2Purpose
Get the batch totals for a particular site/date range, returning a standard format for all processors .
Description
GetBatchHistory returns records representing data for each batch within the specified date range. Each record represents a batch of transactions, and contains a unique Batch ID that can be provided to GetClosedBatchTransactions to retrieve the actual transactions in that batch.Business Rules
Argument List
Name Required Usage GetBatchHistoryRequest Required Object containing properties for the request timeout Optional Integer wait time, in seconds, before timeout response is generated callback* Optional Function to call upon completion of asynchronous request *for JavaScript only
GetBatchHistory Request Fields
Field Name Type Length Required Description Username string 20 require Username or API Access Credential that accesses web service. Password string 20 require Plaintext password for the client account. SiteID integer 10 optional Assigned by the Slim CD administrator.. StartDate date 10 require Date of beginning of search. EndDate date 10 require Date of end of search. 1. Passwords are required except when the username is set to an API Access Credential, in which case it should be passed in as an empty string.
Reply Fields
reply outer tag for the reply data block response Success, FAIL, Error response code 0, 1, 2 (respective) matching the above description If successful, this will contain the single word, OK. Otherwise it will contain a description of failure or error which occurred reponseurl The Slimcd.com url which was called for this operation datablock The confirmation text returned from the server. Reply Hierarchy
- reply
- response
- responsecode
- description
- responseurl
- datablock
- Batches
- BatchRecord
- ID
- BatchDate
- MerchantID
- BatchNumber
- RecordCount
- Amount
- SalesCount
- SalesAmount
- RefundCount
- RefundAmount
- ResponseCode
- ResponseText
- ErrorCodes
- ErrorData
- BatchRecord
- Batches
Remarks
- General
- Names in name/value pairs are NOT case-sensitive
- Names inside XML tags ARE case-sensitive
- Function-Specific
- None
- reply
- Include
012<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script>
Method
1234function GetBatchHistory(request,callback)function GetBatchHistory(request,timeout,callback)
Request
123456789request= {"username": "R6UT8C6M","password": "","siteid": "0","startdate": "7/16/2013","enddate": "7/16/2013"}
Reply
1234567891011121314151617181920212223242526272829303132callback ( {"reply":{"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/reports.asmx/GetBatchHistory2","datablock": {"Batches": {"BatchRecord": [{"ID": "892004","BatchDate": "7/16/2013 12:05:00 AM","MerchantID": "888000000961","BatchNumber": "945","RecordCount": "1","Amount": "12.00","SalesCount": null,"SalesAmount": null,"RefundCount": null,"RefundAmount": null,"ResponseCode": "GB","ResponseText": "ACCEPTED","ErrorCodes": null,"ErrorData": null}]}}}} );
Sample Code
1234567891011121314151617181920<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script><script>// <![CDATA[SlimCD.Reports.GetBatchHistory({"username": "R6UT8C6M","password": "","siteid": "0","startdate": "7/16/2013","enddate": "7/16/2013"},function (reply) {if (reply.response == "Success") {alert ('Batch Closed');} else {alert('There was a problem closing the batch:\r\n' + reply.description);}});// ]]></script>
Downloads
- Include
012include 'slimcd.php';
Method
123function Reports_GetBatchHistory(Reports_GetBatchHistoryRequest $request,$timeout=false)Request
123456789101112class Reports_GetBatchHistoryRequest{// property declarationpublic $username = '';public $password = '';public $siteid=0;public $startdate="";public $enddate="";}JSON Reply
12345678910111213141516171819202122232425262728293031{"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/reports.asmx/GetBatchHistory2","datablock": {"Batches": {"BatchRecord": [{"ID": "892004","BatchDate": "7/16/2013 12:05:00 AM","MerchantID": "888000000961","BatchNumber": "945","RecordCount": "1","Amount": "12.00","SalesCount": null,"SalesAmount": null,"RefundCount": null,"RefundAmount": null,"ResponseCode": "GB","ResponseText": "ACCEPTED","ErrorCodes": null,"ErrorData": null}]}}}Sample Code
12345678910111213141516171819202122include 'slimcd.php';// Create the Slim CD object$SlimCD = new SlimCD() ;// Create a GetBatchHistory Request class$request = new Reports_GetBatchHistoryRequest() ;$request->username = 'R6UT8C6M';$request->password = '';$request->siteid=0;$request->startdate="7/16/2013";$request->enddate="7/16/2013";$result = $SlimCD->Reports_GetBatchHistory($request);if ($result->response == 'Success') {echo 'Success!' ;}else {echo $result->response . ':' . $result->description ;}Downloads
Download full sample source. - Include
123using SlimCD;
Method
123public GetBatchHistoryReply GetBatchHistory(GetBatchHistoryRequest request, int timeout);
Request
12345678910public class GetBatchHistoryRequest{public string username;public string password;public int siteid;public string startdate;public string enddate;}
Reply
123456789101112public class GetBatchHistoryReply{public string response;public string responsecode;public string description;public string responseurl;public string Batches;public string senddata;public string recvdata;}
Cross Reference: ClientSample Code
12345678910111213141516171819202122SlimCD.Reports reports = new SlimCD.Reports();reports.debug = true;reports.transURL = TransURL;reports.statsURL = StatsURL;GetBatchHistoryRequest request = new GetBatchHistoryRequest();GetBatchHistoryReply reply = new GetBatchHistoryReply();request.username = R6UT8C6M;request.password = "";request.siteid = 0;request.startdate = "7/16/2013" ;request.enddate = "7/16/2013";reply = reports.GetBatchHistory(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads
Download full sample source. - Include
123using SlimCD;
Method
0123public async Task GetBatchHistory(GetBatchHistoryRequest request,int timeout);
Request
12345678910public class GetBatchHistoryRequest{public string username;public string password;public int siteid;public string startdate;public string enddate;}
Reply
123456789101112public class GetBatchHistoryReply{public string response;public string responsecode;public string description;public string responseurl;public string Batches;public string senddata;public string recvdata;}
Cross Reference: Client
Sample Code
12345678910111213141516171819202122SlimCD.Reports reports = new SlimCD.Reports();reports.debug = true;reports.transURL = TransURL;reports.statsURL = StatsURL;GetBatchHistoryRequest request = new GetBatchHistoryRequest();GetBatchHistoryReply reply = new GetBatchHistoryReply();request.username = R6UT8C6M;request.password = "";request.siteid = 0;request.startdate = "7/16/2013" ;request.enddate = "7/16/2013";reply = await reports.GetBatchHistory(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}
Downloads - Include
012#import "SlimCD.h"
Method
12345- (void) reportsGetBatchHistoryWithRequest:(ReportsGetBatchHistoryRequest*)request replyBlock:(ReportsGetBatchHistoryReplyBlock)replyBlock;- (void) reportsGetBatchHistoryWithRequest:(ReportsGetBatchHistoryRequest*)request timeout:(NSTimeInterval)timeout replyBlock:(ReportsGetBatchHistoryReplyBlock)replyBlock;Request
1234567891011@interface ReportsGetBatchHistoryRequest@property (strong) NSString *userName;@property (strong) NSString *password;@property (strong) NSNumber *siteID;@property (strong) NSDate* startDate;@property (strong) NSDate* endDate;@endReply
123456789101112131415161718192021222324252627@interface ReportsGetBatchHistoryReply : SlimCDReply// Array of ReportsGetBatchHistoryRecord objects.@property (strong) NSArray *records;@end@interface ReportsGetBatchHistoryRecord : SlimCDObject@property (strong) NSString *batchID;@property (strong) NSString *batchDate;@property (strong) NSString *merchantID;@property (strong) NSString *batchNumber;@property (strong) NSString *recordCount;@property (strong) NSString *amount;@property (strong) NSString *salesCount;@property (strong) NSString *salesAmount;@property (strong) NSString *refundCount;@property (strong) NSString *refundAmount;@property (strong) NSString *responseCode;@property (strong) NSString *responseText;@property (strong) NSString *errorCodes;@property (strong) NSString *errorData;@endSample Code
12345678910111213141516171819202122SlimCD *api = [[SlimCD alloc] init];ReportsGetBatchHistoryRequest *request = [[ReportsGetBatchHistoryRequest alloc] init];request.userName = @"1032";request.password = @"289075";request.siteID = @228226448;request.startDate = [NSDate date];request.endDate = [NSDate date];[api reportsGetBatchHistoryWithRequest:request replyBlock:^(ReportsGetBatchHistoryReply *reply ){if ( reply.responseCode == RC_SUCCESS ){NSLog(@"Batch history loaded successfully.");}else{NSLog(@"Unable to load batch history.");}}]; - Method
1234567public void getBatchHistory(GetBatchHistoryRequest reportBatchHistoryRequest,int timeout ,GetBatchHistoryCallback callback)public void getBatchHistory(GetBatchHistoryRequest reportBatchHistoryRequest,GetBatchHistoryCallback callback)
Request
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657public class GetBatchHistoryReply {private String response="";private String responsecode="";private String description="";private String responseurl="";private String sentdata="";private String recvdata="";private Batches batches=null;// setters and getters.public Batches getBatches() {return batches;}public void setBatches(Batches batches) {this.batches = batches;}public String getResponse() {return response;}public void setResponse(String response) {this.response = response;}public String getResponsecode() {return responsecode;}public void setResponsecode(String responsecode) {this.responsecode = responsecode;}public String getDescription() {return description;}public void setDescription(String description) {this.description = description;}public String getResponseurl() {return responseurl;}public void setResponseurl(String responseurl) {this.responseurl = responseurl;}public String getSentdata() {return sentdata;}public void setSentdata(String sentdata) {this.sentdata = sentdata;}public String getRecvdata() {return recvdata;}public void setRecvdata(String recvdata) {this.recvdata = recvdata;}}
Sample Code
12345678910111213141516171819202122232425// Set the request parameter.GetBatchHistoryRequest request=new GetBatchHistoryRequest();request.setUsername("R6UT8C6M");request.setPassword("");request.setSiteid(0);request.setStartdate("7/16/2013");request.setEnddate("7/16/2013");new ReportsGetBatchHistory().getBatchHistory(request, new GetBatchHistoryCallback(){ @Overridepublic void getBatchHistoryReply(GetBatchHistoryReply reply) {if (reply.getResponse().equals("Success"))textBox.setText("Success");elsetextBox.setText("There was a problem:\n"+ reply.getResponse() +"\n Descriptin "+ reply.getDescription());}});
Downloads
Download full sample source. - URL
https://stats.slimcd.com/wswebservices/reports.asmx/GetBatchHistory2
Protocols
- SOAP/XML
- HTTP POST
- HTTP GET
Request
Status Codes
Status Code Status Description Explanation 200 200 OK Approved or declined attempts will return a response with an XML reply block 500 500 Internal Server Error The response will not contain XML, as a server error has occurred. Reply Output is in XML format if a status code of 200 is returned.
12345678910111213141516171819202122232425<!--?xml version="1.0" encoding="utf-8" ?-->Success0OKhttps://stats.slimcd.com/wswebservices/reports.asmx/GetBatchHistory28920047/16/2013 12:05:00 AM888000000961945112.00GBACCEPTEDIf the block’s tag does not indicate “Success”, the tag will contain an error description which can be displayed to the end-user
Sample Code
DOWNLOAD
EXERCISER TOOL
Remarks
- Remarks Go here
- URL
123https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetBatchHistory2
Protocols- HTTP POST
- HTTP GET
This function accepts either name/value pairs or JSON
Request
Reply
1234567891011121314151617181920212223242526272829303132{"reply": {"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/reports.asmx/GetBatchHistory2","datablock": {"Batches": {"BatchRecord": [{"ID": "892004","BatchDate": "7/16/2013 12:05:00 AM","MerchantID": "888000000961","BatchNumber": "945","RecordCount": "1","Amount": "12.00","SalesCount": null,"SalesAmount": null,"RefundCount": null,"RefundAmount": null,"ResponseCode": "GB","ResponseText": "ACCEPTED","ErrorCodes": null,"ErrorData": null}]}}}Sample Code
Remarks
- None