public int CreateCustomerAccount(ContractAccount accountInfo) { // setup url OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl; // init customer api OrderBoxCoreLib.Customer customer = new OrderBoxCoreLib.Customer(); // create customer account if it doesn't exist int customerId = customer.addCustomer(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, accountInfo[ContractAccount.EMAIL], accountInfo[ContractAccount.PASSWORD], String.Concat(accountInfo[ContractAccount.FIRST_NAME], " ", accountInfo[ContractAccount.LAST_NAME]), GetCompanyName(accountInfo[ContractAccount.COMPANY_NAME]), GetAddress(accountInfo[ContractAccount.ADDRESS]), GetAddress(null), GetAddress(null), accountInfo[ContractAccount.CITY], accountInfo[ContractAccount.STATE], accountInfo[ContractAccount.COUNTRY], accountInfo[ContractAccount.ZIP], GetDialingAreaCode(accountInfo[ContractAccount.PHONE_NUMBER]), GetDialingNumber(accountInfo[ContractAccount.PHONE_NUMBER]), String.Empty, String.Empty, GetDialingAreaCode(accountInfo[ContractAccount.FAX_NUMBER]), GetDialingNumber(accountInfo[ContractAccount.FAX_NUMBER]), "en"); // setup url OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl; // init contact api OrderBoxDomainsLib.DomContact contact = new OrderBoxDomainsLib.DomContact(); // create default contact int defaultContactId = contact.addDefaultContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, customerId); // return result return(customerId); }
/// <summary> /// Ctor. /// </summary> /// <param name="service"></param> /// <param name="consumer"></param> public ProvisioningContext(Contract contract, Service service, ContractAccount consumer, Service parentSvc) { this.contractInfo = contract; this.serviceInfo = service; this.consumerInfo = consumer; this.parentSvcInfo = parentSvc; }
public void LoadContractAccount(ContractAccount account) { txtAddress.Text = account[ContractAccount.ADDRESS]; // txtCity.Text = account[ContractAccount.CITY]; // txtCompany.Text = account[ContractAccount.COMPANY_NAME]; // EnsureCountriesLoaded(); // ecUtils.SelectListItem(ddlCountry, account[ContractAccount.COUNTRY]); // EnsureCountryStatesLoad(); // if (ddlCountryStates.Items.Count > 0) ecUtils.SelectListItem(ddlCountryStates, account[ContractAccount.STATE]); else txtCountryState.Text = account[ContractAccount.STATE]; // txtEmail.Text = account[ContractAccount.EMAIL]; // txtPhoneNumber.Text = account[ContractAccount.PHONE_NUMBER]; // txtFaxNumber.Text = account[ContractAccount.FAX_NUMBER]; // txtFirstName.Text = account[ContractAccount.FIRST_NAME]; // txtLastName.Text = account[ContractAccount.LAST_NAME]; // txtPostalCode.Text = account[ContractAccount.ZIP]; }
public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { string domainName = GetDomainName(domainSvc.Fqdn); string domainTld = GetDomainTLD(domainSvc.Fqdn); AddParam("Command", "Extend"); AddParam("SLD1", domainName); AddParam("TLD1", domainTld); AddParam("NumYears", domainSvc.PeriodLength.ToString()); EnomResult enomResult = new EnomResult( ExecuteCommand() ); // throws an exception if (!enomResult.Succeed) { RaiseRegistrarException(enomResult); } // something wrong was happend we should throw an exception if (enomResult["RRPCode"] != "200") { throw new Exception( "Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"] ); } domainSvc["OrderID"] = enomResult["OrderID"]; }
internal static string GetCustomerInvoiceFormattedInternally(string contractId, int invoiceId, string cultureName) { Contract contract = ContractSystem.ContractController.GetContract(contractId); ContractAccount accountSettings = ContractSystem.ContractController.GetContractAccountSettings(contractId); // return(GetCustomerInvoiceFormattedInternally(contract, invoiceId, accountSettings, cultureName)); }
public static int SendPaymentReceivedNotification(CustomerPayment payment) { ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(payment.ContractId); Hashtable items = new Hashtable(); items["Payment"] = payment; items["Customer"] = account; return(SendSystemNotification(StoreSettings.PAYMENT_RECEIVED, account, items, "HtmlBody", "TextBody")); }
public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { int customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]); // setup service url OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl; // init domain order api OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder(); // Get all domain name registration details Hashtable domainDetails = domOrder.getDetailsByDomain(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainSvc.Fqdn, new ArrayList { "All" }); // fill parameters hashtable Hashtable domainHash = new Hashtable { { domainSvc.Fqdn, new Hashtable { { ENTITY_ID, domainDetails[ENTITY_ID] }, { NO_OF_YEARS, domainSvc.PeriodLength.ToString() }, { EXPIRY_DATE, domainDetails[ENDTIME] } } } }; // Send renewal request to the registrar Hashtable orderResult = domOrder.renewDomain(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainHash, NO_INVOICE); // switch to the nested data bunch of the result received orderResult = (Hashtable)orderResult[domainSvc.Fqdn]; // check returned status switch ((String)orderResult[STATUS]) { case "error": // error throw new Exception(Convert.ToString(orderResult[ERROR])); case "Failed": // error throw new Exception(Convert.ToString(orderResult[ACTION_STATUS_DESC])); case "Success": // success case "InvoicePaid": // success // we are success so copy order number domainSvc[EAQID] = Convert.ToString(orderResult[EAQID]); domainSvc[ENTITY_ID] = Convert.ToString(orderResult[ENTITY_ID]); break; } }
public static int SendServiceSuspendedNotification(int serviceId) { Hashtable items = new Hashtable(); Service serviceInfo = ServiceController.GetService(serviceId); ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(serviceInfo.ContractId); items["Service"] = serviceInfo; items["Customer"] = account; return(SendSystemNotification(StoreSettings.SERVICE_SUSPENDED, account, items, "HtmlBody", "TextBody")); }
public override void ExecuteTrigger(TriggerEventArgs eventArgs) { // try { Contract contract = ContractSystem.ContractController.GetContract(ReferenceId); // if (contract.Status == ContractStatus.Pending) { // ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(ReferenceId); // // create user account ES.UserInfo userInfo = new ES.UserInfo(); userInfo.Username = account[ContractAccount.USERNAME]; // userInfo.Password = account[ContractAccount.PASSWORD]; userInfo.Email = account[ContractAccount.EMAIL]; userInfo.FirstName = account[ContractAccount.FIRST_NAME]; userInfo.LastName = account[ContractAccount.LAST_NAME]; userInfo.HtmlMail = (account[ContractAccount.MAIL_FORMAT] == "HTML"); userInfo.Address = account[ContractAccount.ADDRESS]; userInfo.City = account[ContractAccount.CITY]; userInfo.CompanyName = account[ContractAccount.COMPANY_NAME]; userInfo.Country = account[ContractAccount.COUNTRY]; userInfo.State = account[ContractAccount.STATE]; userInfo.PrimaryPhone = account[ContractAccount.PHONE_NUMBER]; userInfo.Fax = account[ContractAccount.FAX_NUMBER]; userInfo.InstantMessenger = account[ContractAccount.INSTANT_MESSENGER]; userInfo.Zip = account[ContractAccount.ZIP]; userInfo.Role = ES.UserRole.User; userInfo.Status = ES.UserStatus.Active; // set account parent userInfo.OwnerId = contract.ResellerId; userInfo.Created = DateTime.Now; // create account int resultCode = ES.UserController.AddUser(userInfo, true, account[ContractAccount.PASSWORD]); // if (resultCode > 0) { ContractSystem.ContractController.UpdateContract(ReferenceId, resultCode, contract.AccountName, ContractStatus.Active, 0m, contract.FirstName, contract.LastName, contract.Email, contract.CompanyName, null, null); } } } catch (Exception ex) { TriggerStatus = "ERROR"; ES.TaskManager.WriteError(ex); } }
public void LoadContractAccount(ContractAccount account) { litAddress.Text = account[ContractAccount.ADDRESS]; litCity.Text = account[ContractAccount.CITY]; ltrCompany.Text = account[ContractAccount.COMPANY_NAME]; litCountry.Text = account[ContractAccount.COUNTRY]; litEmail.Text = account[ContractAccount.EMAIL]; litFaxNumber.Text = account[ContractAccount.FAX_NUMBER]; litFirstName.Text = account[ContractAccount.FIRST_NAME]; litLastName.Text = account[ContractAccount.LAST_NAME]; litPhoneNumber.Text = account[ContractAccount.PHONE_NUMBER]; litPostalCode.Text = account[ContractAccount.ZIP]; litState.Text = account[ContractAccount.STATE]; }
public ProvisioningContext GetProvisioningContext(int serviceId, bool sendEmail) { IServiceProvisioning controller = (IServiceProvisioning)this; Service serviceInfo = controller.GetServiceInfo(serviceId); Contract contractInfo = ContractSystem.ContractController.GetContract(serviceInfo.ContractId); ContractAccount consumerInfo = ContractSystem.ContractController.GetContractAccountSettings( serviceInfo.ContractId, true); // load parent svc Service parentSvcInfo = (serviceInfo.ParentId == 0) ? null : ServiceController.GetService(serviceInfo.ParentId); // return prepeared context ProvisioningContext ctx = new ProvisioningContext(contractInfo, serviceInfo, consumerInfo, parentSvcInfo); // ctx.SendEmail = sendEmail; // return(ctx); }
public static int SendNewInvoiceNotification(Invoice invoice, List <InvoiceItem> invoiceLines, KeyValueBunch extraArgs) { Contract contract = ContractSystem.ContractController.GetContract(invoice.ContractId); ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(invoice.ContractId); Dictionary <int, Service> invoiceServices = ServiceController.GetServicesDictionary(invoiceLines); Hashtable items = new Hashtable(); items["Invoice"] = invoice; items["InvoiceLines"] = invoiceLines; items["InvoiceServices"] = invoiceServices; items["Tax"] = StorehouseController.GetTaxation(contract.ResellerId, invoice.TaxationId); items["Customer"] = account; items["IsEmail"] = "1"; if (extraArgs != null) { items["ExtraArgs"] = extraArgs; } return(SendSystemNotification(StoreSettings.NEW_INVOICE, account, items, "HtmlBody", "TextBody")); }
public int AddCustomerContact(int customerId, string contactType, ContractAccount accountInfo, Hashtable extraInfo) { // setup url OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl; // init customer api OrderBoxDomainsLib.DomContact contact = new DomContact(); // create customer account if it doesn't exist int contactId = contact.addContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, String.Concat(accountInfo[ContractAccount.FIRST_NAME], " ", accountInfo[ContractAccount.LAST_NAME]), accountInfo[ContractAccount.COMPANY_NAME], accountInfo[ContractAccount.EMAIL], GetAddress(accountInfo[ContractAccount.ADDRESS]), GetAddress(null), GetAddress(null), accountInfo[ContractAccount.CITY], accountInfo[ContractAccount.STATE], accountInfo[ContractAccount.COUNTRY], accountInfo[ContractAccount.ZIP], GetDialingAreaCode(accountInfo[ContractAccount.PHONE_NUMBER]), GetDialingNumber(accountInfo[ContractAccount.PHONE_NUMBER]), GetDialingAreaCode(accountInfo[ContractAccount.FAX_NUMBER]), GetDialingNumber(accountInfo[ContractAccount.FAX_NUMBER]), customerId, contactType, extraInfo); // return(contactId); }
protected static int SendSystemNotification(string settingsName, ContractAccount recipient, Hashtable items, string htmlKeyName, string textKeyName) { // load e-mail template StoreSettings settings = StorehouseController.GetStoreSettings(ES.SecurityContext.User.UserId, settingsName); // bool htmlMail = (recipient[ContractAccount.MAIL_FORMAT] == "HTML"); string email = recipient[ContractAccount.EMAIL]; // string messageBody = htmlMail ? settings[htmlKeyName] : settings[textKeyName]; Template tmp = new Template(messageBody); if (items != null) { foreach (string key in items.Keys) { tmp[key] = items[key]; } } StringWriter writer = new StringWriter(); try { tmp.Evaluate(writer); } catch (ParserException ex) { writer.WriteLine(String.Format("Error in template (Line {0}, Column {1}): {2}", ex.Line, ex.Column, ex.Message)); } // evaluate message body messageBody = writer.ToString(); return(ES.MailHelper.SendMessage(settings["From"], email, settings["CC"], settings["Subject"], messageBody, htmlMail)); }
public static int AddInvoice(string contractId, List <InvoiceItem> invoiceLines, KeyValueBunch extraArgs) { ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(contractId); // read customer tax Taxation tax = GetCustomerTaxation(contractId, account[ContractAccount.COUNTRY], account[ContractAccount.STATE]); int taxationId = (tax == null) ? -1 : tax.TaxationId; // Calculate invoice amounts decimal totalAmount = 0, subTotalAmount = 0, taxAmount = 0; CalculateInvoiceChargeAmounts(tax, invoiceLines, out totalAmount, out subTotalAmount, out taxAmount); // align svcs suspend date int[] svcs = new int[invoiceLines.Count]; for (int i = 0; i < invoiceLines.Count; i++) { svcs[i] = invoiceLines[i].ServiceId; } DateTime sdateAligned = ServiceController.GetSvcsSuspendDateAligned(svcs, DateTime.Now); // StoreSettings settings = StorehouseController.GetStoreSettings(ES.SecurityContext.User.UserId, StoreSettings.SYSTEM_SETTINGS); // get invoice grace period in days int gracePeriod = Common.Utils.Utils.ParseInt(settings["InvoiceGracePeriod"], 0); // if (gracePeriod < 0) { gracePeriod = 0; } // DateTime created = DateTime.Now; DateTime dueDate = sdateAligned.AddDays(gracePeriod); // return(AddInvoice(contractId, created, dueDate, taxationId, totalAmount, subTotalAmount, taxAmount, invoiceLines, extraArgs)); }
public GenericResult AddContract(int resellerId, ContractAccount accountSettings) { object[] results = this.Invoke("AddContract", new object[] { resellerId, accountSettings}); return ((GenericResult)(results[0])); }
/// <remarks/> public System.IAsyncResult BeginAddContract(int resellerId, ContractAccount accountSettings, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("AddContract", new object[] { resellerId, accountSettings}, callback, asyncState); }
public static GenericResult AddContract(ContractAccount accountSettings) { return EC.Services.Storefront.AddContract(ecPanelRequest.ResellerId, accountSettings); }
public static GenericResult AddContract(int resellerId, ContractAccount accountSettings) { return EC.Services.Storefront.AddContract(resellerId, accountSettings); }
public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { domainSvc["OrderID"] = DateTime.Now.ToString("yyyy-MM-dd") + "-" + domainSvc.Fqdn; }
public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { int customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]); // setup service url OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl; // init domain order api OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder(); // Get all domain name registration details Hashtable domainDetails = domOrder.getDetailsByDomain(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainSvc.Fqdn, new ArrayList { "All" }); // fill parameters hashtable Hashtable domainHash = new Hashtable { { domainSvc.Fqdn, new Hashtable { {ENTITY_ID, domainDetails[ENTITY_ID]}, {NO_OF_YEARS, domainSvc.PeriodLength.ToString()}, {EXPIRY_DATE, domainDetails[ENDTIME]} } } }; // Send renewal request to the registrar Hashtable orderResult = domOrder.renewDomain(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainHash, NO_INVOICE); // switch to the nested data bunch of the result received orderResult = (Hashtable)orderResult[domainSvc.Fqdn]; // check returned status switch ((String)orderResult[STATUS]) { case "error": // error throw new Exception(Convert.ToString(orderResult[ERROR])); case "Failed": // error throw new Exception(Convert.ToString(orderResult[ACTION_STATUS_DESC])); case "Success": // success case "InvoicePaid": // success // we are success so copy order number domainSvc[EAQID] = Convert.ToString(orderResult[EAQID]); domainSvc[ENTITY_ID] = Convert.ToString(orderResult[ENTITY_ID]); break; } }
/// <summary> /// Performs checkout operation /// </summary> /// <param name="spaceId">Space.</param> /// <param name="gatewayId">Gateway.</param> /// <param name="invoiceId">Invoice.</param> /// <param name="details">Array of parameters.</param> /// <returns>Checkout result object.</returns> public static CheckoutResult CheckOut(string contractId, int invoiceId, string methodName, CheckoutDetails details) { CheckoutResult result = new CheckoutResult(); try { Contract contractInfo = ContractSystem.ContractController.GetContract(contractId); // impersonate ContractSystem.ContractController.ImpersonateAsContractReseller(contractInfo); // TRACE ES.TaskManager.StartTask(TASK_SOURCE, CHECKOUT_TASK, methodName); ES.TaskManager.Write("Start accepting payment for invoice"); ES.TaskManager.WriteParameter("ContractID", contractId); ES.TaskManager.WriteParameter("InvoiceID", invoiceId); // get user details ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(contractId); // try to load plugin type and throw an exception if type not found IPaymentGatewayProvider provider = (IPaymentGatewayProvider)SystemPluginController.GetContractPaymentMethod( contractInfo, methodName); // add invoice details Invoice invoice = InvoiceController.GetCustomerInvoiceInternally(invoiceId); // append information for the provider details[CheckoutKeys.ContractNumber] = contractId; details[CheckoutKeys.Amount] = invoice.Total.ToString("0.00"); details[CheckoutKeys.InvoiceNumber] = invoice.InvoiceNumber; details[CheckoutKeys.Currency] = invoice.Currency; ES.TaskManager.Write("Submitting payment transaction"); // call checkout routine TransactionResult pgResult = provider.SubmitPaymentTransaction(details); // log provider response SystemPluginController.LogContractPayment(contractInfo, methodName, pgResult.RawResponse); // ERROR if (!pgResult.Succeed) { result.Succeed = false; result.StatusCode = pgResult.StatusCode; // ES.TaskManager.WriteError("Transaction failed"); ES.TaskManager.WriteParameter("StatusCode", result.StatusCode); ES.TaskManager.WriteParameter("RawResponse", pgResult.RawResponse); // EXIT return(result); } // OK ES.TaskManager.Write("Transaction is OK"); // check whether the transaction already exists CustomerPayment tran = StorehouseController.LookupForTransaction(pgResult.TransactionId); // lookup for pending transaction if (tran == null) { // add payment record result.PaymentId = StorehouseController.AddCustomerPayment(contractId, invoice.InvoiceId, pgResult.TransactionId, invoice.Total, invoice.Currency, methodName, pgResult.TransactionStatus); // ERROR if (result.PaymentId < 1) { result.Succeed = false; result.StatusCode = result.PaymentId.ToString(); // ES.TaskManager.WriteError("Could not add customer payment record to the db"); ES.TaskManager.WriteParameter("ResultCode", result.StatusCode); // EXIT return(result); } } // if transaction is already submitted just update it's status if (tran != null) { StorehouseController.UpdateTransactionStatus(tran.PaymentId, pgResult.TransactionStatus); } // OK result.Succeed = true; // ensure user requests to persist his payment details for credit card if (details.Persistent && methodName == PaymentMethod.CREDIT_CARD) { StorehouseController.SetPaymentProfile(contractId, details); } } catch (Exception ex) { result.Succeed = false; result.StatusCode = GENERAL_FAILURE; // ES.TaskManager.WriteError(ex); } finally { ES.TaskManager.CompleteTask(); } // EXIT return(result); }
public GenericResult AddContract(int resellerId, ContractAccount accountSettings) { return(ContractSystem.ContractController.AddContract(resellerId, accountSettings)); }
public void InvoiceActiveServices() { DateTime dateTimeNow = DateTime.Now; // load store settings StoreSettings settings = StorehouseController.GetStoreSettings(SecurityContext.User.UserId, StoreSettings.SYSTEM_SETTINGS); // int threshold = Convert.ToInt32(settings["SvcInvoiceThreshold"]); // get expiring services today List <Service> services = ServiceController.GetServicesToInvoice(SecurityContext.User.UserId, dateTimeNow, threshold); // group services by users Dictionary <string, List <int> > usersServices = new Dictionary <string, List <int> >(); // iterate foreach (Service service in services) { if (!usersServices.ContainsKey(service.ContractId)) { usersServices.Add(service.ContractId, new List <int>()); } usersServices[service.ContractId].Add(service.ServiceId); } // generate invoice per contract foreach (string contractId in usersServices.Keys) { try { TaskManager.Write("Creating invoice"); // TRACE Contract contract = ContractSystem.ContractController.GetContract(contractId); ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(contractId); TaskManager.WriteParameter("ContractID", contractId); TaskManager.WriteParameter("Username", account[ContractAccount.USERNAME]); // List <int> userSvcs = usersServices[contractId]; // build invoice items List <InvoiceItem> invoiceLines = InvoiceController.CalculateInvoiceLinesForServices(userSvcs); // int resultCode = InvoiceController.AddInvoice(contractId, invoiceLines, null); // if (resultCode < 1) { TaskManager.WriteParameter("ResultCode", resultCode); continue; } // if (ServiceController.SetUsageRecordsClosed(userSvcs.ToArray()) != 0) { TaskManager.WriteWarning("Unable to close usage records automatically"); } // TRACE TaskManager.WriteParameter("InvoiceID", resultCode); TaskManager.Write("Succeed"); } catch (Exception ex) { TaskManager.WriteError(ex); } } }
public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { AddParam("Command", "Purchase"); // as per Enom API reference this parameter use is recommended in production mode // as it uses a queued order peorcessing instead of real-time. AddParam("QueueOrder", "1"); string domainName = GetDomainName(domainSvc.Fqdn); string domainTld = GetDomainTLD(domainSvc.Fqdn); // add domain AddParam("SLD", domainName); AddParam("TLD", domainTld); AddParam("NumYears", domainSvc.PeriodLength.ToString()); if (LiveMode && (nameServers != null && nameServers.Length > 0)) { // load name servers for (int i = 0; i < nameServers.Length; i++) { AddParam(String.Concat("NS", i + 1), nameServers[i].Trim()); } } else { // use Enom's name servers AddParam("UseDNS", "default"); } if (domainSvc.Fqdn.EndsWith(".uk")) { // special stub for org.uk and org.uk domains // org.uk and co.uk tlds should have at least 2 NS if (nameServers != null && nameServers.Length == 1) { // we already have first ns added // so push the second ns AddParam("NS2", nameServers[0].Trim()); } AddParam("registered_for", domainSvc["RegisteredFor"]); AddParam("uk_legal_type", domainSvc["UK_LegalType"]); AddParam("uk_reg_co_no", domainSvc["UK_CompanyIdNumber"]); AddParam("uk_reg_opt_out", domainSvc["HideWhoisInfo"]); } // us TLDs extensions else if (domainSvc.Fqdn.EndsWith(".us")) { AddParam("global_cc_us", accountInfo[ContractAccount.COUNTRY]); AddParam("us_nexus", domainSvc["NexusCategory"]); AddParam("us_purpose", domainSvc["ApplicationPurpose"]); } // eu TLDs extensions else if (domainSvc.Fqdn.EndsWith(".eu")) { AddParam("eu_whoispolicy", domainSvc["EU_WhoisPolicy"]); AddParam("eu_agreedelete", domainSvc["EU_AgreeDelete"]); AddParam("eu_adr_lang", domainSvc["EU_ADRLang"]); // AddParam("AdminOrganizationName", accountInfo[ContractAccount.COMPANY_NAME]); AddParam("AdminFirstName", accountInfo[ContractAccount.FIRST_NAME]); AddParam("AdminLastName", accountInfo[ContractAccount.LAST_NAME]); AddParam("AdminAddress1", accountInfo[ContractAccount.ADDRESS]); AddParam("AdminAddress2", accountInfo[ContractAccount.ADDRESS]); AddParam("AdminCity", accountInfo[ContractAccount.CITY]); AddParam("AdminStateProvinceChoice", "P"); AddParam("AdminProvince", accountInfo[ContractAccount.STATE]); AddParam("AdminPostalCode", accountInfo[ContractAccount.ZIP]); AddParam("AdminCountry", accountInfo[ContractAccount.COUNTRY]); AddParam("AdminEmailAddress", accountInfo[ContractAccount.EMAIL]); AddParam("AdminPhone", accountInfo[ContractAccount.PHONE_NUMBER]); AddParam("AdminFax", accountInfo[ContractAccount.FAX_NUMBER]); AddParam("AdminJobTitle", "Administrator"); AddParam("RegistrantJobTitle", "Registrant"); } AddParam("UseCreditCard", "no"); AddParam("RegistrantFirstName", accountInfo[ContractAccount.FIRST_NAME]); AddParam("RegistrantLastName", accountInfo[ContractAccount.LAST_NAME]); AddParam("RegistrantAddress1", accountInfo[ContractAccount.ADDRESS]); AddParam("RegistrantCity", accountInfo[ContractAccount.CITY]); AddParam("RegistrantEmailAddress", accountInfo[ContractAccount.EMAIL]); AddParam("RegistrantPhone", accountInfo[ContractAccount.PHONE_NUMBER]); AddParam("RegistrantCountry", accountInfo[ContractAccount.COUNTRY]); AddParam("RegistrantStateProvince", accountInfo[ContractAccount.STATE]); AddParam("RegistrantPostalCode", accountInfo[ContractAccount.ZIP]); //} // unlock registrar /*if (domainSvc["LockRegistrar"] == "0") * AddParam("UnLockRegistrar", "1");*/ // load contacts //AddCustomerContacts(contacts); // return enom result EnomResult enomResult = new EnomResult( ExecuteCommand() ); // throws an exception if (!enomResult.Succeed) { RaiseRegistrarException(enomResult); } // if something wrong was happend then throws an exception if (enomResult["RRPCode"] != "200") { throw new Exception( "Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"] ); } // copy order if domainSvc["OrderID"] = enomResult["OrderID"]; //PushDomainToSubAccount(args); }
public void RenewDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { string domainName = GetDomainName(domainSvc.Fqdn); string domainTld = GetDomainTLD(domainSvc.Fqdn); AddParam("Command", "Extend"); AddParam("SLD1", domainName); AddParam("TLD1", domainTld); AddParam("NumYears", domainSvc.PeriodLength.ToString()); EnomResult enomResult = new EnomResult( ExecuteCommand() ); // throws an exception if (!enomResult.Succeed) RaiseRegistrarException(enomResult); // something wrong was happend we should throw an exception if (enomResult["RRPCode"] != "200") { throw new Exception( "Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"] ); } domainSvc["OrderID"] = enomResult["OrderID"]; }
public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { AddParam("Command", "Purchase"); // as per Enom API reference this parameter use is recommended in production mode // as it uses a queued order peorcessing instead of real-time. AddParam("QueueOrder", "1"); string domainName = GetDomainName(domainSvc.Fqdn); string domainTld = GetDomainTLD(domainSvc.Fqdn); // add domain AddParam("SLD", domainName); AddParam("TLD", domainTld); AddParam("NumYears", domainSvc.PeriodLength.ToString()); if (LiveMode && (nameServers != null && nameServers.Length > 0)) { // load name servers for (int i = 0; i < nameServers.Length; i++) AddParam(String.Concat("NS", i + 1), nameServers[i].Trim()); } else { // use Enom's name servers AddParam("UseDNS", "default"); } if (domainSvc.Fqdn.EndsWith(".uk")) { // special stub for org.uk and org.uk domains // org.uk and co.uk tlds should have at least 2 NS if (nameServers != null && nameServers.Length == 1) { // we already have first ns added // so push the second ns AddParam("NS2", nameServers[0].Trim()); } AddParam("registered_for", domainSvc["RegisteredFor"]); AddParam("uk_legal_type", domainSvc["UK_LegalType"]); AddParam("uk_reg_co_no", domainSvc["UK_CompanyIdNumber"]); AddParam("uk_reg_opt_out", domainSvc["HideWhoisInfo"]); } // us TLDs extensions else if (domainSvc.Fqdn.EndsWith(".us")) { AddParam("global_cc_us", accountInfo[ContractAccount.COUNTRY]); AddParam("us_nexus", domainSvc["NexusCategory"]); AddParam("us_purpose", domainSvc["ApplicationPurpose"]); } // eu TLDs extensions else if (domainSvc.Fqdn.EndsWith(".eu")) { AddParam("eu_whoispolicy", domainSvc["EU_WhoisPolicy"]); AddParam("eu_agreedelete", domainSvc["EU_AgreeDelete"]); AddParam("eu_adr_lang", domainSvc["EU_ADRLang"]); // AddParam("AdminOrganizationName", accountInfo[ContractAccount.COMPANY_NAME]); AddParam("AdminFirstName", accountInfo[ContractAccount.FIRST_NAME]); AddParam("AdminLastName", accountInfo[ContractAccount.LAST_NAME]); AddParam("AdminAddress1", accountInfo[ContractAccount.ADDRESS]); AddParam("AdminAddress2", accountInfo[ContractAccount.ADDRESS]); AddParam("AdminCity", accountInfo[ContractAccount.CITY]); AddParam("AdminStateProvinceChoice", "P"); AddParam("AdminProvince", accountInfo[ContractAccount.STATE]); AddParam("AdminPostalCode", accountInfo[ContractAccount.ZIP]); AddParam("AdminCountry", accountInfo[ContractAccount.COUNTRY]); AddParam("AdminEmailAddress", accountInfo[ContractAccount.EMAIL]); AddParam("AdminPhone", accountInfo[ContractAccount.PHONE_NUMBER]); AddParam("AdminFax", accountInfo[ContractAccount.FAX_NUMBER]); AddParam("AdminJobTitle", "Administrator"); AddParam("RegistrantJobTitle", "Registrant"); } AddParam("UseCreditCard", "no"); AddParam("RegistrantFirstName", accountInfo[ContractAccount.FIRST_NAME]); AddParam("RegistrantLastName", accountInfo[ContractAccount.LAST_NAME]); AddParam("RegistrantAddress1", accountInfo[ContractAccount.ADDRESS]); AddParam("RegistrantCity", accountInfo[ContractAccount.CITY]); AddParam("RegistrantEmailAddress", accountInfo[ContractAccount.EMAIL]); AddParam("RegistrantPhone", accountInfo[ContractAccount.PHONE_NUMBER]); AddParam("RegistrantCountry", accountInfo[ContractAccount.COUNTRY]); AddParam("RegistrantStateProvince", accountInfo[ContractAccount.STATE]); AddParam("RegistrantPostalCode", accountInfo[ContractAccount.ZIP]); //} // unlock registrar /*if (domainSvc["LockRegistrar"] == "0") AddParam("UnLockRegistrar", "1");*/ // load contacts //AddCustomerContacts(contacts); // return enom result EnomResult enomResult = new EnomResult( ExecuteCommand() ); // throws an exception if (!enomResult.Succeed) RaiseRegistrarException(enomResult); // if something wrong was happend then throws an exception if (enomResult["RRPCode"] != "200") { throw new Exception( "Reason Code: " + enomResult["RRPCode"] + "; Description: " + enomResult["RRPText"] ); } // copy order if domainSvc["OrderID"] = enomResult["OrderID"]; //PushDomainToSubAccount(args); }
public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { int customerId = 0; // 1. check customer exists if (CheckSubAccountExists(accountInfo[ContractAccount.EMAIL])) { customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]); } else { customerId = CreateCustomerAccount(accountInfo); } // obtain default contact id int contactId = GetDefaultContactId(customerId); // check for demo mode if so then set demo-nameservers. if (!LiveMode) { nameServers = new string[] { "ns1.onlyfordemo.net", "ns2.onlyfordemo.net" } } ; // fill parameters hashtable Hashtable domainHash = new Hashtable(); // copy domain name domainHash[domainSvc.Fqdn] = domainSvc.PeriodLength.ToString(); // setup service url OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl; // init domain order api OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder(); // int validateAttempts = 0; VALIDATE_REGISTRATION: // validate params Hashtable valResult = domOrder.validateDomainRegistrationParams(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId, contactId, customerId, NO_INVOICE); // get domain name hashtable valResult = (Hashtable)valResult[domainSvc.Fqdn]; // check validation status if ((String)valResult[STATUS] == "error") { // try to update extended contact fields and re-validate params if (validateAttempts == 0 && domainSvc.Fqdn.EndsWith(".us")) { validateAttempts++; // OrderBoxDomainsLib.DomContactExt contactExt = new DomContactExt(); // fill extension hash Hashtable exthash = new Hashtable(); Hashtable domus = new Hashtable(); domus["nexusCategory"] = domainSvc["NexusCategory"]; domus["applicationPurpose"] = domainSvc["ApplicationPurpose"]; exthash["domus"] = domus; // set default contact extensions bool succeed = contactExt.setContactDetails(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, contactId, exthash, "domus"); // check result if (succeed) { goto VALIDATE_REGISTRATION; } } // throw new Exception((String)valResult[ERROR]); } // register domain Hashtable orderResult = domOrder.addWithoutValidation(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId, contactId, customerId, NO_INVOICE); // switch to the nested data bunch orderResult = (Hashtable)orderResult[domainSvc.Fqdn]; // check returned status switch ((String)orderResult[STATUS]) { case "error": // error throw new Exception(Convert.ToString(orderResult[ERROR])); case "Failed": // error throw new Exception(Convert.ToString(orderResult[ACTION_STATUS_DESC])); case "Success": // success case "InvoicePaid": // success // we are success so copy order number domainSvc[EAQID] = Convert.ToString(orderResult[EAQID]); domainSvc[ENTITY_ID] = Convert.ToString(orderResult[ENTITY_ID]); break; } }
/// <remarks/> public void AddContractAsync(int resellerId, ContractAccount accountSettings, object userState) { if ((this.AddContractOperationCompleted == null)) { this.AddContractOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddContractOperationCompleted); } this.InvokeAsync("AddContract", new object[] { resellerId, accountSettings}, this.AddContractOperationCompleted, userState); }
internal static string GetCustomerInvoiceFormattedInternally(Contract contract, int invoiceId, ContractAccount accountSettings, string cultureName) { // Invoice invoiceInfo = GetCustomerInvoiceInternally(invoiceId); // impersonate ES.SecurityContext.SetThreadPrincipal(contract.ResellerId); // load settings StoreSettings settings = StorehouseController.GetStoreSettings(contract.ResellerId, StoreSettings.NEW_INVOICE); // string templateBody = settings["HtmlBody"]; // Taxation invoiceTax = StorehouseController.GetTaxation(contract.ResellerId, invoiceInfo.TaxationId); // List<InvoiceItem> invoiceLines = GetCustomerInvoiceItems(invoiceId); Dictionary<int, Service> invoiceServices = ServiceController.GetServicesDictionary(invoiceLines); // Template tm = new Template(templateBody); tm["Invoice"] = invoiceInfo; tm["InvoiceLines"] = invoiceLines; tm["InvoiceServices"] = invoiceServices; tm["Customer"] = accountSettings; tm["Tax"] = invoiceTax; StringWriter writer = new StringWriter(); try { // Preserve an original thread culture CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture; // if (!String.IsNullOrEmpty(cultureName)) { try { CultureInfo formattingCulture = new CultureInfo(cultureName); // Empty currency symbol to supporty 3-letters ISO format // hardcorded in HTML templates formattingCulture.NumberFormat.CurrencySymbol = String.Empty; // Set formatting culture Thread.CurrentThread.CurrentCulture = formattingCulture; } catch (Exception ex) { TaskManager.WriteWarning("Wrong culture name has been provided. Culture name: {0}.", cultureName); TaskManager.WriteWarning(ex.StackTrace); TaskManager.WriteWarning(ex.Message); } } // Process template tm.Evaluate(writer); templateBody = writer.ToString(); // Revert the original thread's culture back Thread.CurrentThread.CurrentCulture = originalCulture; } catch (ParserException ex) { return String.Format("Error in template (Line {0}, Column {1}): {2}", ex.Line, ex.Column, ex.Message); } return templateBody; }
public void RegisterDomain(DomainNameSvc domainSvc, ContractAccount accountInfo, string[] nameServers) { int customerId = 0; // 1. check customer exists if (CheckSubAccountExists(accountInfo[ContractAccount.EMAIL])) customerId = GetCustomerAccountId(accountInfo[ContractAccount.EMAIL]); else customerId = CreateCustomerAccount(accountInfo); // obtain default contact id int contactId = GetDefaultContactId(customerId); // check for demo mode if so then set demo-nameservers. if (!LiveMode) nameServers = new string[] { "ns1.onlyfordemo.net", "ns2.onlyfordemo.net" }; // fill parameters hashtable Hashtable domainHash = new Hashtable(); // copy domain name domainHash[domainSvc.Fqdn] = domainSvc.PeriodLength.ToString(); // setup service url OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl; // init domain order api OrderBoxDomainsLib.DomOrder domOrder = new OrderBoxDomainsLib.DomOrder(); // int validateAttempts = 0; VALIDATE_REGISTRATION: // validate params Hashtable valResult = domOrder.validateDomainRegistrationParams(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId, contactId, customerId, NO_INVOICE); // get domain name hashtable valResult = (Hashtable)valResult[domainSvc.Fqdn]; // check validation status if ((String)valResult[STATUS] == "error") { // try to update extended contact fields and re-validate params if (validateAttempts == 0 && domainSvc.Fqdn.EndsWith(".us")) { validateAttempts++; // OrderBoxDomainsLib.DomContactExt contactExt = new DomContactExt(); // fill extension hash Hashtable exthash = new Hashtable(); Hashtable domus = new Hashtable(); domus["nexusCategory"] = domainSvc["NexusCategory"]; domus["applicationPurpose"] = domainSvc["ApplicationPurpose"]; exthash["domus"] = domus; // set default contact extensions bool succeed = contactExt.setContactDetails(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, contactId, exthash, "domus"); // check result if (succeed) goto VALIDATE_REGISTRATION; } // throw new Exception((String)valResult[ERROR]); } // register domain Hashtable orderResult = domOrder.addWithoutValidation(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, domainHash, new ArrayList(nameServers), contactId, contactId, contactId, contactId, customerId, NO_INVOICE); // switch to the nested data bunch orderResult = (Hashtable)orderResult[domainSvc.Fqdn]; // check returned status switch ((String)orderResult[STATUS]) { case "error": // error throw new Exception(Convert.ToString(orderResult[ERROR])); case "Failed": // error throw new Exception(Convert.ToString(orderResult[ACTION_STATUS_DESC])); case "Success": // success case "InvoicePaid": // success // we are success so copy order number domainSvc[EAQID] = Convert.ToString(orderResult[EAQID]); domainSvc[ENTITY_ID] = Convert.ToString(orderResult[ENTITY_ID]); break; } }
protected static int SendSystemNotification(string settingsName, ContractAccount recipient, Hashtable items, string htmlKeyName, string textKeyName) { // load e-mail template StoreSettings settings = StorehouseController.GetStoreSettings(ES.SecurityContext.User.UserId, settingsName); // bool htmlMail = (recipient[ContractAccount.MAIL_FORMAT] == "HTML"); string email = recipient[ContractAccount.EMAIL]; // string messageBody = htmlMail ? settings[htmlKeyName] : settings[textKeyName]; Template tmp = new Template(messageBody); if (items != null) { foreach (string key in items.Keys) tmp[key] = items[key]; } StringWriter writer = new StringWriter(); try { tmp.Evaluate(writer); } catch (ParserException ex) { writer.WriteLine(String.Format("Error in template (Line {0}, Column {1}): {2}", ex.Line, ex.Column, ex.Message)); } // evaluate message body messageBody = writer.ToString(); return ES.MailHelper.SendMessage(settings["From"], email, settings["CC"], settings["Subject"], messageBody, htmlMail); }
public GenericResult AddContract(int resellerId, ContractAccount accountSettings) { return ContractSystem.ContractController.AddContract(resellerId, accountSettings); }
public int CreateCustomerAccount(ContractAccount accountInfo) { // setup url OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl; // init customer api OrderBoxCoreLib.Customer customer = new OrderBoxCoreLib.Customer(); // create customer account if it doesn't exist int customerId = customer.addCustomer(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, accountInfo[ContractAccount.EMAIL], accountInfo[ContractAccount.PASSWORD], String.Concat(accountInfo[ContractAccount.FIRST_NAME], " ", accountInfo[ContractAccount.LAST_NAME]), GetCompanyName(accountInfo[ContractAccount.COMPANY_NAME]), GetAddress(accountInfo[ContractAccount.ADDRESS]), GetAddress(null), GetAddress(null), accountInfo[ContractAccount.CITY], accountInfo[ContractAccount.STATE], accountInfo[ContractAccount.COUNTRY], accountInfo[ContractAccount.ZIP], GetDialingAreaCode(accountInfo[ContractAccount.PHONE_NUMBER]), GetDialingNumber(accountInfo[ContractAccount.PHONE_NUMBER]), String.Empty, String.Empty, GetDialingAreaCode(accountInfo[ContractAccount.FAX_NUMBER]), GetDialingNumber(accountInfo[ContractAccount.FAX_NUMBER]), "en"); // setup url OrderBoxDomainsLib.APIKit.Properties.Url = ServiceUrl; // init contact api OrderBoxDomainsLib.DomContact contact = new OrderBoxDomainsLib.DomContact(); // create default contact int defaultContactId = contact.addDefaultContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, customerId); // return result return customerId; }
internal static string GetCustomerInvoiceFormattedInternally(Contract contract, int invoiceId, ContractAccount accountSettings, string cultureName) { // Invoice invoiceInfo = GetCustomerInvoiceInternally(invoiceId); // impersonate ES.SecurityContext.SetThreadPrincipal(contract.ResellerId); // load settings StoreSettings settings = StorehouseController.GetStoreSettings(contract.ResellerId, StoreSettings.NEW_INVOICE); // string templateBody = settings["HtmlBody"]; // Taxation invoiceTax = StorehouseController.GetTaxation(contract.ResellerId, invoiceInfo.TaxationId); // List <InvoiceItem> invoiceLines = GetCustomerInvoiceItems(invoiceId); Dictionary <int, Service> invoiceServices = ServiceController.GetServicesDictionary(invoiceLines); // Template tm = new Template(templateBody); tm["Invoice"] = invoiceInfo; tm["InvoiceLines"] = invoiceLines; tm["InvoiceServices"] = invoiceServices; tm["Customer"] = accountSettings; tm["Tax"] = invoiceTax; StringWriter writer = new StringWriter(); try { // Preserve an original thread culture CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture; // if (!String.IsNullOrEmpty(cultureName)) { try { CultureInfo formattingCulture = new CultureInfo(cultureName); // Empty currency symbol to supporty 3-letters ISO format // hardcorded in HTML templates formattingCulture.NumberFormat.CurrencySymbol = String.Empty; // Set formatting culture Thread.CurrentThread.CurrentCulture = formattingCulture; } catch (Exception ex) { TaskManager.WriteWarning("Wrong culture name has been provided. Culture name: {0}.", cultureName); TaskManager.WriteWarning(ex.StackTrace); TaskManager.WriteWarning(ex.Message); } } // Process template tm.Evaluate(writer); templateBody = writer.ToString(); // Revert the original thread's culture back Thread.CurrentThread.CurrentCulture = originalCulture; } catch (ParserException ex) { return(String.Format("Error in template (Line {0}, Column {1}): {2}", ex.Line, ex.Column, ex.Message)); } return(templateBody); }
public int AddCustomerContact(int customerId, string contactType, ContractAccount accountInfo, Hashtable extraInfo) { // setup url OrderBoxCoreLib.APIKit.Properties.Url = ServiceUrl; // init customer api OrderBoxDomainsLib.DomContact contact = new DomContact(); // create customer account if it doesn't exist int contactId = contact.addContact(Username, Password, RESELLER_ROLE, SERVICE_LANGUAGE, ParentId, String.Concat(accountInfo[ContractAccount.FIRST_NAME], " ", accountInfo[ContractAccount.LAST_NAME]), accountInfo[ContractAccount.COMPANY_NAME], accountInfo[ContractAccount.EMAIL], GetAddress(accountInfo[ContractAccount.ADDRESS]), GetAddress(null), GetAddress(null), accountInfo[ContractAccount.CITY], accountInfo[ContractAccount.STATE], accountInfo[ContractAccount.COUNTRY], accountInfo[ContractAccount.ZIP], GetDialingAreaCode(accountInfo[ContractAccount.PHONE_NUMBER]), GetDialingNumber(accountInfo[ContractAccount.PHONE_NUMBER]), GetDialingAreaCode(accountInfo[ContractAccount.FAX_NUMBER]), GetDialingNumber(accountInfo[ContractAccount.FAX_NUMBER]), customerId, contactType, extraInfo); // return contactId; }
public static CheckoutFormParams GetCheckoutFormParams(string contractId, int invoiceId, string methodName, KeyValueBunch options) { Contract contractInfo = ContractSystem.ContractController.GetContract(contractId); // Impersonate ContractSystem.ContractController.ImpersonateAsContractReseller(contractInfo); // SupportedPlugin pmPlugin = GetResellerPMPlugin(contractInfo.ResellerId, methodName); // if (pmPlugin == null) { throw new Exception("Incorrect payment method has been specified"); } // create instance of plugin IInteractivePaymentGatewayProvider provider = (IInteractivePaymentGatewayProvider) SystemPluginController.GetSystemPluginInstance(contractInfo, pmPlugin, true); // Invoice userInvoice = InvoiceController.GetCustomerInvoiceInternally(invoiceId); // List <InvoiceItem> invoiceLines = InvoiceController.GetCustomerInvoiceItems(invoiceId); // load contract account ContractAccount account = ContractSystem.ContractController.GetContractAccountSettings(contractId); // build form parameters FormParameters formParams = new FormParameters(); // copy reseller id formParams[FormParameters.CONTRACT] = userInvoice.ContractId; // copy invoice number formParams[FormParameters.INVOICE] = userInvoice.InvoiceId.ToString(); // copy invoice amount formParams[FormParameters.AMOUNT] = userInvoice.Total.ToString("0.00"); // copy invoice tax amount formParams[FormParameters.TAX_AMOUNT] = userInvoice.TaxAmount.ToString("0.00"); // copy invoice currency formParams[FormParameters.CURRENCY] = userInvoice.Currency; // copy first name formParams[FormParameters.FIRST_NAME] = account[ContractAccount.FIRST_NAME]; // copy last name formParams[FormParameters.LAST_NAME] = account[ContractAccount.LAST_NAME]; // copy email formParams[FormParameters.EMAIL] = account[ContractAccount.EMAIL]; // copy address formParams[FormParameters.ADDRESS] = account[ContractAccount.ADDRESS]; // copy country formParams[FormParameters.COUNTRY] = account[ContractAccount.COUNTRY]; // copy phone number formParams[FormParameters.PHONE] = account[ContractAccount.PHONE_NUMBER]; // copy city formParams[FormParameters.CITY] = account[ContractAccount.CITY]; // copy state formParams[FormParameters.STATE] = account[ContractAccount.STATE]; // copy zip formParams[FormParameters.ZIP] = account[ContractAccount.ZIP]; // copy options if any if (options != null) { foreach (string keyName in options.GetAllKeys()) { formParams[keyName] = options[keyName]; } } // return result return(provider.GetCheckoutFormParams(formParams, invoiceLines.ToArray())); }
/// <remarks/> public void AddContractAsync(int resellerId, ContractAccount accountSettings) { this.AddContractAsync(resellerId, accountSettings, null); }