|
Version: 7C
HC7 Build: 7.00.0012 and later
API Build: 1.00.0001 and later
Plan Manager - SellPlan sells provided plan to a specified user. This web service call can be made as http://your-domain.com/HC7API/PlanManager.asmx?op=SellPlan.
Input Parameters
HostUserName
HostPassword
PlanName - name of plan you want sell
CustomerName - name of the user to whom you want to sell plan
Quantity - number of instances you want to sell
OptionalParam
SetupDiscount - percentage of discount on setup price
RecurringDiscount - percentage of discount on recurring price
RecurringDuration - invoicing duration of sold plan
Language
Output Parameters
XML error report in case of Quota Violation embedded in Result Node of Response packet.
Sample Optional Parameters
<Parameters>
<Parameter Name = "SetupDiscount">3</Parameter>
<Parameter Name = "RecurringDiscount">5</Parameter>
<Parameter Name = "RecurringDuration">1</Parameter>
</Parameters>
Sample SOAP Request
POST /HC7API/PlanManager.asmx HTTP/1.1
Host: your-domain.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/SellPlan"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SellPlan xmlns="http://tempuri.org/">
<HostUserName>host</HostUserName>
<HostPassword>host123</HostPassword>
<PlanName>MyPlan</PlanName>
<CustomerName>john</CustomerName>
<Quantity>1</Quantity>
<OptionalParam>xml</OptionalParam>
</SellPlan>
</soap:Body>
</soap:Envelope>
Sample HTTP Request
POST /HC7API/PlanManager.asmx/SellPlan HTTP/1.1
Host: your-domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
HostUserName=host&HostPassword=host123&PlanName=MyPlan&CustomerName=john&
Quantity=1&OptionalParam=xml
Sample C# Code
public PlanManager.Response SellPlan(string strHostUserName, string strHostPassword, string strPlanName, string strCustomerName, int nQuantity)
{
try
{
PlanManager.PlanManager oPlan = new PlanManager.PlanManager();
PlanManager.Response oResponse = new PlanManager.Response();
XmlDocument oDoc = new XmlDocument();
//Adding root node
XmlNode xOptionalParam = oDoc.CreateNode(XmlNodeType.Element,"Parameters","");
//Adding sub nodes
XmlNode xParameter = oDoc.CreateNode(XmlNodeType.Element,"Parameter","");
XmlAttribute xAttribute = oDoc.CreateAttribute("Name");
xAttribute.Value = "SetupDiscount";
xParameter.Attributes.Append(xAttribute);
xParameter.InnerText = "3";
xOptionalParam.AppendChild(xParameter);
.......
.......
.......
oResponse = oPlan.SellPlan(strHostUserName, strHostPassword, strPlanName, strCustomerName,
nQuantity, OptionalParam);
}
catch
{
}
return oResponse;
}
Sample Response
<Response>
<Method>SellPlan</Method>
<Status>false</Status>
<ErrorCode>70100060</ErrorCode>
<ErrorDescription>You have not enough resource quota to sell this plan.</ErrorDescription>
<Result>
<ResultReport xmlns="">
<ViolatedResources>
<RecordCount>23</RecordCount>
<RecordRow>
<ResourceName>User Accounts</ResourceName>
<DesiredQuantity>Unlimited</DesiredQuantity>
<AllocatedQuantity>10</AllocatedQuantity>
<SoldQuantity>3 + 1 (Reseller's)</SoldQuantity>
<RemainingQuantity>6</RemainingQuantity>
</RecordRow>
.......
.......
.......
</ViolatedResources>
</ResultReport>
</Result>
</Response>