/// <summary> /// Creates a new Account. Access is restricted to an API account with create merchant privileges. /// </summary> /// <param name="createAccount">An XML request to create an account</param> /// <returns>An Account object</returns> public Account CreateAccount(CreateAccount createAccount) { Account result = null; Uri uri = new Uri(this.EndPoint.AbsoluteUri + "api/account/create"); HttpWebRequest request = this.CreateRequestPOST(uri, createAccount); using (HttpWebResponse response = request.GetResponseWithoutException() as HttpWebResponse) { if (response.StatusCode == HttpStatusCode.Created) { using (StreamReader reader = new StreamReader(response.GetResponseStream())) { XDocument document = XDocument.Load(reader); result = new Account(document.Element("Account")); } } else { this.HandleError(response); } } return result; }
/// <summary> /// Creates a new Account. Access is restricted to an API account with create merchant privileges. /// </summary> /// <param name="merchantID">Merchant system account ID</param> /// <param name="emailAddress">Email address of the primary user</param> /// <param name="firstName">First name of the primary user</param> /// <param name="lastName">Last name of the primary user</param> /// <param name="companyName">Merchant Company</param> /// <param name="country">Country that the merchant is headquartered in. ISO 3166-1 2 character country code</param> /// <param name="vatID">Tax ID for VAT accounting. Required for Irish merchants only</param> /// <returns>An Account object</returns> public Account CreateAccount(String merchantID, String emailAddress, String firstName, String lastName, String companyName, String country, String vatID = null) { CreateAccount createAccountRequest = new CreateAccount(merchantID, emailAddress, firstName, lastName, companyName, country, vatID); Account account = this.CreateAccount(createAccountRequest); return account; }