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;