public function test_accessors() { /** === Test Data === */ $COUNTRY_CODE = 'country code'; $CUSTOMER_ID = 'cust id'; $DEPTH = 'depth'; $HUMAN_REF = 'mlm id'; $PARENT_ID = 'parent id'; $PATH = 'path'; $REFERRAL_CODE = 'referral_code'; /** === Call and asserts === */ $this->obj->setCountryCode($COUNTRY_CODE); $this->obj->setCustomerId($CUSTOMER_ID); $this->obj->setDepth($DEPTH); $this->obj->setHumanRef($HUMAN_REF); $this->obj->setParentId($PARENT_ID); $this->obj->setPath($PATH); $this->obj->setReferralCode($REFERRAL_CODE); $this->assertEquals($COUNTRY_CODE, $this->obj->getCountryCode()); $this->assertEquals($CUSTOMER_ID, $this->obj->getCustomerId()); $this->assertEquals($DEPTH, $this->obj->getDepth()); $this->assertEquals($HUMAN_REF, $this->obj->getHumanRef()); $this->assertEquals($PARENT_ID, $this->obj->getParentId()); $this->assertEquals($PATH, $this->obj->getPath()); $this->assertEquals($REFERRAL_CODE, $this->obj->getReferralCode()); }
/** * * @param <type> $request * @return <type> */ public function execute($request) { $this->setLayout(false); sfConfig::set('sf_web_debug', false); sfConfig::set('sf_debug', false); if ($this->getRequest()->isXmlHttpRequest()) { $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8'); } $customerName = $request->getParameter('customerName'); $description = $request->getParameter('description'); $customer = new Customer(); $customer->setName($customerName); $customer->setDescription($description); $customer->save(); $array = array('id' => $customer->getCustomerId()); return $this->renderText(json_encode($array)); }
/** * * @param <type> $request * @return <type> */ public function execute($request) { $this->setLayout(false); sfConfig::set('sf_web_debug', false); sfConfig::set('sf_debug', false); $csrfToken = $request->getParameter('csrfToken'); $form = new TimesheetFormToImplementCsrfTokens(); if ($form->getCSRFToken() != $csrfToken) { return sfView::NONE; } if ($this->getRequest()->isXmlHttpRequest()) { $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8'); } $customerName = $request->getParameter('customerName'); $description = $request->getParameter('description'); $customer = new Customer(); $customer->setName($customerName); $customer->setDescription($description); $customer->save(); $array = array('id' => $customer->getCustomerId()); return $this->renderText(json_encode($array)); }
$domainHash = array($VAR['DOMAIN_NAME'] => $VAR['TERM']); $nsHash = array($VAR['NS1'] => $VAR['NS2']); $USERNAME = $VAR['DIRECTI_USERNAME']; $PASSWORD = $VAR['DIRECTI_PASSWORD']; $PARENTID = $VAR['DIRECTI_PARENTID']; $LIB_DIR = ""; $iserror = false; require_once $LIB_DIR . "domorder.class.php"; require_once $LIB_DIR . "customer.class.php"; require_once $LIB_DIR . "response.class.php"; $DomOrder = new DomOrder($LIB_DIR . "wsdl/domain.wsdl"); // Creating an instance of DomOrder by passing wsdl url. $Customer = new Customer($LIB_DIR . "wsdl/customer.wsdl"); // Creating an instance of DomOrder by passing wsdl url. // create/get the accounts id: $return = $Customer->getCustomerId($USERNAME, $PASSWORD, "reseller", "en", $PARENTID, $VAR['ACCT_USER']); if (is_array($return)) { # add account $return = $Customer->addCustomer($USERNAME, $PASSWORD, "reseller", "en", $PARENTID, $VAR['ACCT_USER'], $VAR['ACCT_PASS'], $VAR['ACCT_NAME'], $VAR['ACCT_ADDR'], "", "", "", $VAR['ACCT_CITY'], $VAR['ACCT_STATE'], $VAR['ACCT_COUNTRY'], $VAR['ACCT_ZIP'], "01", "8885551212", "01", "8885551212", "01", "8885551212", "en"); } // Register domain if (!is_array($return)) { $account = $return; $return = $DomOrder->registerDomain($USERNAME, $PASSWORD, "reseller", "en", $PARENTID, $domainHash, $nsHash, $account, $account, $account, $account, $account, 'NoInvoice'); } $response = new Response($return); // Status if (@$return['status'] == 'Success') { echo 'REGISTER SUCCESS!'; } // Common Output for all above functions.
public function getCustomers() { return $customers_id = Customer::getCustomerId(); }
function createCustomer() { $Customer = new Customer(LIBRARIES . "directi" . PATH_SEP . "wsdl" . PATH_SEP . "customer.wsdl"); $return = $Customer->addCustomer($this->USERNAME, $this->PASSWORD, $this->ROLE, $this->LANGPREF, $this->PARENTID, $this->data['email'], $this->data['dom_pass'], $this->data['name'], $this->data['domain'], $this->data['address'], "", "", $this->data['city'], $this->data['state'], $this->data['country'], $this->data['zip'], $this->data['country_code'], $this->data['telephone'], "", "", "", "", $this->LANGPREF); $response = new Response($return); $response->errorAnalyse(); if ($response->isError()) { $this->error_str = $response->errorMsg; $this->iserror = true; if ($response->errorCode == "com.logicboxes.foundation.sfnb.user.CustomerExistsException") { $return = $Customer->getCustomerId($this->USERNAME, $this->PASSWORD, $this->ROLE, $this->LANGPREF, $this->PARENTID, $this->data['email']); $this->account = $return; $response = new Response($return); $response->errorAnalyse(); if ($response->isError()) { $this->error_str = $response->errorMsg; $this->iserror = true; return; } else { $this->error_str = ""; $this->iserror = false; return; } } return; } else { $this->account = $response->getResult(); } if (empty($this->account)) { $this->error_str = "An unknown error occurred while creating customer!"; $this->iserror = true; } return; }