Hi,
I'm trying to use the First Data Global Gateway web service API. I was able to reverence the WSDL file in VS and get the classes to show up. I get the error "Object reference not set to an instance of an object." I can't figure out what I'm doing wrong.
FDGGWSApiOrderService OrderService = new FDGGWSApiOrderService();
OrderService.Url = @"https://ws.merchanttest.firstdataglobalgateway.com/fdggwsapi/services/order.wsdl";
OrderService.ClientCertificates.Add(X509Certificate.CreateFromCertFile(ConfigurationManager.AppSettings["Keyfile"]));
NetworkCredential nc = new NetworkCredential(ConfigurationManager.AppSettings["CredUser"], ConfigurationManager.AppSettings["CredPass"]);
OrderService.Credentials = nc;
FDGGWSApiActionRequest ActionRequest = new FDGGWSApiActionRequest();
RecurringPayment recurring = new RecurringPayment();
// Sets for new recurring payment
recurring.Function = RecurringPaymentFunction.install;
// Info for Recurring Payment
RecurringPaymentInformation recurinfo = new RecurringPaymentInformation();
recurinfo.InstallmentCount = "99";
recurinfo.InstallmentFrequency = "1";
recurinfo.InstallmentPeriod = RecurringPaymentInformationInstallmentPeriod.year;
recurinfo.MaximumFailures = "3";
DateTime date = DateTime.Now;
string strDate = date.ToString("yyyyMMdd");
recurinfo.RecurringStartDate = strDate;
recurring.RecurringPaymentInformation = recurinfo;
// Card Data
CreditCardData CardData = new CreditCardData();
CardData.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.CardNumber, ItemsChoiceType.ExpMonth, ItemsChoiceType.ExpYear, ItemsChoiceType.CardCodeValue };
CardData.Items = new string[] { "4111111111111111", "05", "2015", "598" };
// Next line is where the ERROR occurs
recurring.TransactionDataType.Item = CardData;
// Add Billing Address
Billing BillAddr = new Billing();
BillAddr.Name = "Kris Scheppe";
BillAddr.Address1 = "3446 Marinatown Ln.";
//BillAddr.City = txtCcCity.Text;
BillAddr.City = "Fort Myers";
BillAddr.State = "FL";
BillAddr.Zip = "33080";
BillAddr.Country = "US";
recurring.Billing = BillAddr;
// Set the Order Id
recurring.OrderId = "1590";
// Set Payment Amount
Payment charge = new Payment();
charge.ChargeTotal = 120.00M;
recurring.Payment = charge;
TransactionDetails txnDetails = new TransactionDetails();
txnDetails.OrderId = "21";
txnDetails.PONumber = "2106";
recurring.TransactionDetails = txnDetails;
FDGGWSAPI.Action action = new FDGGWSAPI.Action();
action.Item = recurring;
ActionRequest.Item = action;
// Get the Response
FDGGWSApiActionResponse response = null;
OrderService.FDGGWSApiAction(ActionRequest);
if (response.ProcessorResponseMessage == "APPROVED")
{
MultiView1.SetActiveView(vwSuccess);
}
else
{
lblError.Text = response.ErrorMessage;
lblStatus.Text = response.TransactionResult;
MultiView1.SetActiveView(vwFailure);
}
Any help you can provide would be appreciated.
Thanks,
its4net