Code to reproduce the exception (built against the latest version of the C# SDK):
var reportingGateway = new ReportingGateway("-- your api login id --", "-- your transaction key --", ServiceMode.Live);
var batches = reportingGateway.GetSettledBatchList();
I rebuilt the SDK from the provided source code, and figured out that the problem is in one two places.
The first possible fix is In ReportingGateway::GetSettledBatchList:
public List GetSettledBatchList(DateTime from, DateTime to) {
var req = new getSettledBatchListRequest();
req.firstSettlementDate = from;
req.lastSettlementDate = to;
req.includeStatistics = true;
var response = (getSettledBatchListResponse)_gateway.Send(req);
return Batch.NewFromResponse(response);
}
This method is missing assignments to the *Specified properties that exist on getSettledBatchRequest (see http://msdn.microsoft.com/en-us/library/bb402199.aspx). Modifying this method to set each of the *Specified properties to true fixes the issue.
The other possible fix is to remove the *Specified properties from getSettledBatchRequest. The code for that class is currently:
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "AnetApi/xml/v1/schema/AnetApiSchema.xsd")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "AnetApi/xml/v1/schema/AnetApiSchema.xsd", IsNullable = false)]
public partial class getSettledBatchListRequest : ANetApiRequest {
private bool includeStatisticsField;
private bool includeStatisticsFieldSpecified;
private System.DateTime firstSettlementDateField;
private bool firstSettlementDateFieldSpecified;
private System.DateTime lastSettlementDateField;
private bool lastSettlementDateFieldSpecified;
///
public bool includeStatistics {
get {
return this.includeStatisticsField;
}
set {
this.includeStatisticsField = value;
}
}
///
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool includeStatisticsSpecified {
get {
return this.includeStatisticsFieldSpecified;
}
set {
this.includeStatisticsFieldSpecified = value;
}
}
///
public System.DateTime firstSettlementDate {
get {
return this.firstSettlementDateField;
}
set {
this.firstSettlementDateField = value;
}
}
///
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool firstSettlementDateSpecified {
get {
return this.firstSettlementDateFieldSpecified;
}
set {
this.firstSettlementDateFieldSpecified = value;
}
}
///
public System.DateTime lastSettlementDate {
get {
return this.lastSettlementDateField;
}
set {
this.lastSettlementDateField = value;
}
}
///
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool lastSettlementDateSpecified {
get {
return this.lastSettlementDateFieldSpecified;
}
set {
this.lastSettlementDateFieldSpecified = value;
}
}
}
Changing it to the following (just removing those *Specified properties) fixes the issue and the SDK works as expected:
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "AnetApi/xml/v1/schema/AnetApiSchema.xsd")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "AnetApi/xml/v1/schema/AnetApiSchema.xsd", IsNullable = false)]
public partial class getSettledBatchListRequest : ANetApiRequest {
private bool includeStatisticsField;
private bool includeStatisticsFieldSpecified;
private System.DateTime firstSettlementDateField;
private bool firstSettlementDateFieldSpecified;
private System.DateTime lastSettlementDateField;
private bool lastSettlementDateFieldSpecified;
///
public bool includeStatistics {
get {
return this.includeStatisticsField;
}
set {
this.includeStatisticsField = value;
}
}
///
public System.DateTime firstSettlementDate {
get {
return this.firstSettlementDateField;
}
set {
this.firstSettlementDateField = value;
}
}
///
public System.DateTime lastSettlementDate {
get {
return this.lastSettlementDateField;
}
set {
this.lastSettlementDateField = value;
}
}
}
I am currenlty using a modified version of the SDK in which I removed the *Specified properties from the getSettledBatchListRequest class. However this is not ideal; I would prefer to be using the SDK as provided by Authorize.Net without any modifications.