Hi. guys.
I download the ARB simple code on C# and modified it to fit my asp.net website.
The only problem is I cann't get the subscription status. the program always return a "active" status even the subcription is canceled.
I guess the problem is cause by the code marked by red.
I cann't use " string SubStatus = theResponse.Status;" as ARB simple code to get the status. theResponse only has status option, there isn't a "Status".
So I modify the code to" string SubStatus = theResponse.status.ToString();" and then, subStatus always show "active".
Please help me to figure out where is problem?
Here is my code.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using MySql.Data.MySqlClient; using System.Xml; using System.Xml.Serialization; using System.Net; using System.Text; using System.IO; using AuthorizeNet; using AuthorizeNet.Helpers; using AuthorizeNet.APICore; private static bool GetStatusSubscription() { bool bResult = true; //Console.WriteLine("\r\nGet subscription status"); // This is the API interface object ARBGetSubscriptionStatusRequest statusSubscriptionRequest = new ARBGetSubscriptionStatusRequest(); // Populate the subscription request with test data PopulateSubscription(statusSubscriptionRequest); // The response type will normally be ARBGetSubscriptionStatusRequest. // However, in the case of an error such as an XML parsing error, the response // type will be ErrorResponse. object response = null; XmlDocument xmldoc = null; bResult = PostRequest(statusSubscriptionRequest, out xmldoc); if (bResult) bResult = ProcessXmlResponse(xmldoc, out response); if (bResult) ProcessResponse(response); ARBGetSubscriptionStatusResponse theResponse = (ARBGetSubscriptionStatusResponse)response; SubStatus = theResponse.status.ToString(); if (!bResult) { int x = 90;//Console.WriteLine("An unexpected error occurred processing this request."); } return bResult;
05-26-2011 04:21 PM
I was having the same problem, but I was using PHP and not C#. What fixed my solution was that I was looking for the status as well, but "status" is case sensitive. Instead of "status" it should be "Status". That worked for me.
05-26-2011 05:00 PM
No.
In C#, function "status" will come out automatic. I can't set to "Status" manually, it will generate a compile error.
ARBSubscriptionStatusEnum ST = theResponse.status; it should be "theResponse.Status", but it isn't on the way.
I wonder it is a bug from" using AuthorizeNet.APICore".
05-26-2011 05:41 PM
Hey guys,
The SDK needs to be updated to look for "Status" not "status." I've sent this on to our developers. Thanks for the heads up!
Thanks,
Michelle
Developer Community Manager
06-02-2011 01:39 PM