/** * Prepare Customer and Contacts * * Queries the customer ID, or creates a new customer if necessary. Then adds * or edits the contacts as necessary. * * @param array $contacts An array of ContactDBO's * @param AccountDBO $accountDBO The account DBO * @return array ID's in an associative array with keys: customerid, adminid, techid, billingid */ function prepareCustomerContacts($contacts, $accountDBO) { // Reseller Club uses e-mail addresses as customer usernames $customer = $accountDBO->getContactEmail(); // Query the customer's ID if (!($customerID = $this->queryCustomerID($customer))) { // Add a new customer if (!($customerID = $this->addCustomer($accountDBO->getContactEmail(), $this->getDefaultCustomerPassword(), $accountDBO->getContactName(), $accountDBO->getBusinessName(), $accountDBO->getAddress1(), $accountDBO->getAddress2(), null, $accountDBO->getCity(), $accountDBO->getState(), $accountDBO->getCountry(), $accountDBO->getPostalCode(), $accountDBO->getPhone(), $accountDBO->getMobilePhone(), $accountDBO->getFax()))) { fatal_error("ResellerClub::registerNewDomain()", "There was an error when trying to add a new Reseller Club customer"); } } // Enter Admin contact $adminID = $this->addOrEditContact($customerID, $contacts['admin']); if (!is_numeric($adminID) || $adminID < 0) { fatal_error("ResellerClub::registerDomain", "could not add Admin contact for domain registration at Reseller Club!"); } // Enter Technical contact $techID = $this->addOrEditContact($customerID, $contacts['tech']); if (!is_numeric($techID) || $techID < 0) { fatal_error("ResellerClub::registerDomain", "could not add Tech contact for domain registration at Reseller Club!"); } // Enter Billing contact $billingID = $this->addOrEditContact($customerID, $contacts['billing']); if (!is_numeric($billingID) || $billingID < 0) { fatal_error("ResellerClub::registerDomain", "could not add Billing contact for domain registration at Reseller Club!"); } return array("customerid" => $customerID, "adminid" => $adminID, "techid" => $techID, "billingid" => $billingID); }