public function testapi() { $o_bcpc = new BaseCommerceClient(RENTSQUARE_MERCH_USER, RENTSQUARE_MERCH_PASS, RENTSQUARE_MERCH_KEY); $o_bcpc->setSandbox(BC_SANDBOXVALUE); $o_address = new Address(); $o_address->setName(Address::$XS_ADDRESS_NAME_BILLING); $o_address->setLine1("123 Some Address"); $o_address->setCity("Tempe"); $o_address->setState("AZ"); $o_address->setZipcode("12345"); $o_bc = new BankCard(); $o_bc->setBillingAddress($o_address); $o_bc->setExpirationMonth("02"); $o_bc->setExpirationYear("2015"); $o_bc->setName("Nick 2"); $o_bc->setNumber("4111111111111111"); $o_bc->setToken("myToken12asdfas3"); $o_bc = $o_bcpc->addBankCard($o_bc); if ($o_bc->isStatus(BankCard::$XS_BC_STATUS_FAILED)) { //the add Failed, look at messages array for reason(s) why //var_dump( $o_bc->getMessages() ); $this->set('message', $o_bc->getMessages()); } else { if ($o_bc->isStatus(BankCard::$XS_BC_STATUS_ACTIVE)) { //Card added successfully //var_dump( $o_bc->getToken() ); $this->set('message', $o_bc->getToken()); } } }
public static function fromArray($data) { $address = new Address(); if (isset($data['street'])) { $address->setStreet($data['street']); } if (isset($data['street2'])) { $address->setStreet2($data['street2']); } if (isset($data['zip'])) { $address->setZip($data['zip']); } if (isset($data['city'])) { $address->setCity($data['city']); } if (isset($data['country'])) { $address->setCountry($data['country']); } if (isset($data['state'])) { $address->setState($data['state']); } if (isset($data['tel'])) { $address->setTel($data['tel']); } if (isset($data['fax'])) { $address->setFax($data['fax']); } if (isset($data['email'])) { $address->setEmail($data['email']); } return $address; }
function testLatLongValidation() { $address = new Address(); $address->setLine1("900 Winslow Way"); $address->setLine2("Ste 130"); $address->setCity("Bainbridge Island"); $address->setRegion("WA"); $address->setPostalCode("98110"); $address->setLongitude("-122.510359"); $address->setLatitude("47.624972"); $validateRequest = new ValidateRequest(); $validateRequest->setAddress($address); $validateRequest->setTextCase(TextCase::$Upper); //added for 4.13 changes $validateRequest->setCoordinates(true); //Sets Profile name from Configuration File to "Jaas" //this will force it to Jaas (PostLocate) $this->client = new AddressServiceSoap("JaasDevelopement"); //validate the Request $result = $this->client->validate($validateRequest); //Re-Assigning to the original Profile $this->client = new AddressServiceSoap("Development"); $this->assertEqual($result->getResultCode(), SeverityLevel::$Success); $validAddresses = $result->getValidAddresses(); $this->assertEqual(1, count($validAddresses)); $validAddresses = $result->getValidAddresses(); if (count($validAddresses) != 1) { echo "Unexpected number of addresses returned. Expected one address."; } else { $validAddress = $validAddresses[0]; $this->assertEqual(strtoupper($address->getLine1()) . " E " . strtoupper($address->getLine2()), $validAddress->getLine1()); $this->assertEqual("", $validAddress->getLine2()); $this->assertEqual(strtoupper($address->getCity()), $validAddress->getCity()); $this->assertEqual(strtoupper($address->getRegion()), $validAddress->getRegion()); $this->assertEqual($address->getPostalCode() . "-2450", $validAddress->getPostalCode()); $this->assertEqual("H", $validAddress->getAddressType()); $this->assertEqual("C051", $validAddress->getCarrierRoute()); //Ticket 21203: Modified Fips Code value for jaas enabled account. //$this->assertEqual("5303500000", $validAddress->getFipsCode()); $this->assertEqual("5303503736", $validAddress->getFipsCode()); $this->assertEqual("KITSAP", $validAddress->getCounty()); $this->assertEqual(strtoupper($address->getCity()) . " " . strtoupper($address->getRegion()) . " " . $address->getPostalCode() . "-2450", $validAddress->getLine4()); $this->assertEqual("981102450307", $validAddress->getPostNet()); // Added 4.13 changes for the Lat Long // Update to check for ZIP+4 precision // Zip+4 precision coordinates if (strlen($validAddress->getLatitude()) > 7) { echo "ZIP+4 precision coordinates received"; $this->assertEqual($address->getLatitude(), $validAddress->getLatitude()); $this->assertEqual($address->getLongitude(), $validAddress->getLongitude()); } else { echo "ZIP5 precision coordinates received"; $this->assertEqual(substr($validAddress->getLatitude(), 0, 4), substr($address->getLatitude(), 0, 4), "Expected Latitude to start with '47.64'"); $this->assertEqual(substr($validAddress->getLongitude(), 0, 6), substr($address->getLongitude(), 0, 6), "Expected Longitude to start with '-122.53'"); } } }
function createAddress() { $address = new Address(); $address->setAddress("Av. Tiradentes"); $address->setNumber("123"); $address->setComplement("Ap. 203"); $address->setNeighborhood("Centro"); $address->setCity("São Paulo"); $address->setState(StateEnum::SAO_PAULO); $address->setZipCode("17500000"); return $address; }
/** * Sets attributes from the Mage address on the AvaTax Request address. * * @return $this */ protected function _convertRequestAddress() { if (!$this->_requestAddress) { $this->_requestAddress = new Address(); } $this->_requestAddress->setLine1($this->_mageAddress->getStreet(1)); $this->_requestAddress->setLine2($this->_mageAddress->getStreet(2)); $this->_requestAddress->setCity($this->_mageAddress->getCity()); $this->_requestAddress->setRegion($this->_mageAddress->getRegionCode()); $this->_requestAddress->setCountry($this->_mageAddress->getCountry()); $this->_requestAddress->setPostalCode($this->_mageAddress->getPostcode()); return $this; }
public function buildMerchants($xml) { $merchants = new Merchants(); $merchants->setPageOffset((string) $xml->PageOffset); $merchants->setTotalCount((string) $xml->TotalCount); // merchant $merchantArray = array(); foreach ($xml->Merchant as $merchant) { $tmpMerchant = new Merchant(); $tmpMerchant->setId((string) $merchant->Id); $tmpMerchant->setName((string) $merchant->Name); $tmpMerchant->setWebsiteUrl((string) $merchant->WebsiteUrl); $tmpMerchant->setPhoneNumber((string) $merchant->PhoneNumber); $tmpMerchant->setCategory((string) $merchant->Category); $tmpLocation = new Location(); $location = $merchant->Location; $tmpLocation->setName((string) $location->Name); $tmpLocation->setDistance((string) $location->Distance); $tmpLocation->setDistanceUnit((string) $location->DistanceUnit); $tmpAddress = new Address(); $address = $location->Address; $tmpAddress->setLine1((string) $address->Line1); $tmpAddress->setLine2((string) $address->Line2); $tmpAddress->setCity((string) $address->City); $tmpAddress->setPostalCode((string) $address->PostCode); $tmpCountry = new Country(); $tmpCountry->setName((string) $address->Country->Name); $tmpCountry->setCode((string) $address->Country->Code); $tmpCountrySubdivision = new CountrySubdivision(); $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name); $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code); $tmpAddress->setCountry($tmpCountry); $tmpAddress->setCountrySubdivision($tmpCountrySubdivision); $tmpPoint = new Point(); $point = $location->Point; $tmpPoint->setLatitude((string) $point->Latitude); $tmpPoint->setLongitude((string) $point->Longitude); // ACCEPTANCE FRAMEWORK NEEDS LOOKED AT <RETURN XML AND DOC DOES NOT HAVE ALL VALUES> //$tmpAcceptance = new Acceptance(); //$acceptance = $merchant->Acceptance; // FEATURES FRAMEWORK NEEDS LOOKED AT <RETURN XML AND DOC DOES NOT HAVE ALL VALUES> //$tmpFeatures = new Features(); //$features = $merchant->Features; $tmpLocation->setPoint($tmpPoint); $tmpLocation->setAddress($tmpAddress); $tmpMerchant->setLocation($tmpLocation); array_push($merchantArray, $tmpMerchant); } $merchants->setMerchant($merchantArray); return $merchants; }
public function buildAtms($xml) { $atms = new Atms(); $atms->setPageOffset($xml->PageOffset); $atms->setTotalCount($xml->TotalCount); $atmArray = array(); foreach ($xml->Atm as $atm) { $tmpAtm = new Atm(); $tmpAtm->setHandicapAccessible((string) $atm->HandicapAccessible); $tmpAtm->setCamera((string) $atm->Camera); $tmpAtm->setAvailability((string) $atm->Availability); $tmpAtm->setAccessFees((string) $atm->AccessFees); $tmpAtm->setOwner((string) $atm->Owner); $tmpAtm->setSharedDeposit((string) $atm->SharedDeposit); $tmpAtm->setSurchargeFreeAlliance((string) $atm->SurchargeFreeAlliance); $tmpAtm->setSponsor((string) $atm->Sponsor); $tmpAtm->setSupportEMV((string) $atm->SupportEMV); $tmpAtm->setSurchargeFreeAllianceNetwork((string) $atm->SurchargeFreeAllianceNetwork); $tmpLocation = new Location(); $location = $atm->Location; $tmpLocation->setName((string) $location->Name); $tmpLocation->setDistance((string) $location->Distance); $tmpLocation->setDistanceUnit((string) $location->DistanceUnit); $tmpAddress = new Address(); $address = $location->Address; $tmpAddress->setLine1((string) $address->Line1); $tmpAddress->setLine2((string) $address->Line2); $tmpAddress->setCity((string) $address->City); $tmpAddress->setPostalCode((string) $address->PostCode); $tmpCountry = new Country(); $tmpCountry->setName((string) $address->Country->Name); $tmpCountry->setCode((string) $address->Country->Code); $tmpCountrySubdivision = new CountrySubdivision(); $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name); $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code); $tmpAddress->setCountry($tmpCountry); $tmpAddress->setCountrySubdivision($tmpCountrySubdivision); $tmpPoint = new Point(); $point = $location->Point; $tmpPoint->setLatitude((string) $point->Latitude); $tmpPoint->setLongitude((string) $point->Longitude); $tmpLocation->setPoint($tmpPoint); $tmpLocation->setAddress($tmpAddress); $tmpAtm->setLocation($tmpLocation); array_push($atmArray, $tmpAtm); } $atms->setAtm($atmArray); return $atms; }
private function parseForm(HTTPRequest $request, Address $address) { $title = htmlspecialchars($request->postData('title')); $address1 = htmlspecialchars($request->postData('address-1')); $address2 = htmlspecialchars($request->postData('address-2')); $zipCode = htmlspecialchars($request->postData('zip-code')); $city = htmlspecialchars($request->postData('city')); $country = 'France'; $address->setTitle($title); $address->setAddress1($address1); $address->setAddress2($address2); $address->setZipCode($zipCode); $address->setCity($city); $address->setCountry($country); $address->setUserId($this->app->user()->getAttribute('id')); }
public function buildAtms($xml) { $pageOffset = (string) $xml->PageOffset; $totalCount = (string) $xml->TotalCount; $restaurantArray = array(); foreach ($xml->Restaurant as $restaurant) { $tmpRestaurant = new Restaurant(); $tmpRestaurant->setId((string) $restaurant->Id); $tmpRestaurant->setName((string) $restaurant->Name); $tmpRestaurant->setWebsiteUrl((string) $restaurant->WebsiteUrl); $tmpRestaurant->setPhoneNumber((string) $restaurant->PhoneNumber); $tmpRestaurant->setCategory((string) $restaurant->Category); $tmpRestaurant->setLocalFavoriteInd((string) $restaurant->LocalFavoriteInd); $tmpRestaurant->setHiddenGemInd((string) $restaurant->HiddenGemInd); $tmpLocation = new Location(); $location = $restaurant->Location; $tmpLocation->setName((string) $location->Name); $tmpLocation->setDistance((string) $location->Distance); $tmpLocation->setDistanceUnit((string) $location->DistanceUnit); $tmpAddress = new Address(); $address = $location->Address; $tmpAddress->setLine1((string) $address->Line1); $tmpAddress->setLine2((string) $address->Line2); $tmpAddress->setCity((string) $address->City); $tmpAddress->setPostalCode((string) $address->PostCode); $tmpCountry = new Country(); $tmpCountry->setName((string) $address->Country->Name); $tmpCountry->setCode((string) $address->Country->Code); $tmpCountrySubdivision = new CountrySubdivision(); $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name); $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code); $tmpAddress->setCountry($tmpCountry); $tmpAddress->setCountrySubdivision($tmpCountrySubdivision); $tmpPoint = new Point(); $point = $location->Point; $tmpPoint->setLatitude((string) $point->Latitude); $tmpPoint->setLongitude((string) $point->Longitude); $tmpLocation->setPoint($tmpPoint); $tmpLocation->setAddress($tmpAddress); $tmpRestaurant->setLocation($tmpLocation); array_push($restaurantArray, $tmpRestaurant); } $restaurants = new Restaurants($pageOffset, $totalCount, $restaurantArray); return $restaurants; }
public function testPopulateWithPlace() { $point = new Point(); $point->setLat('-23.59243454'); $point->setLng('-46.68677054'); $city = new City(); $city->setCountry('BR'); $city->setState('SP'); $city->setName('São Paulo'); $category = new Category(); $category->setId('123'); $category->setName('Empresas de Internet'); $address = new Address(); $address->setStreet("Rua Funchal"); $address->setNumber(129); $address->setComplement('6o andar'); $address->setCity($city); $place = new Place(); $place->setId("M25GJ288"); $place->setName("Apontador.com - São Paulo"); $place->setDescription("Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br)."); $place->setIconUrl("http://localphoto.s3.amazonaws.com/C40372534F143O1437_9896391605729015_l.jpg"); $place->setPoint($point); $place->setCategory($category); $place->setAddress($address); $this->og->populate($place); $rootUrl = \ROOT_URL; $testMeta = <<<META \t<meta property="og:title" content="Apontador.com - São Paulo"/> \t<meta property="og:description" content="Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br)."/> \t<meta property="og:image" content="http://maplink.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054"/> \t<meta property="og:url" content="{$rootUrl}sp/s-o-paulo/empresas-de-internet/apontador-com-s-o-paulo/M25GJ288.html"/> \t<meta property="og:street-address" content="Rua Funchal, 129"/> \t<meta property="og:locality" content="São Paulo"/> \t<meta property="og:region" content="SP"/> \t<meta property="og:country-name" content="Brasil"/> \t<meta property="og:latitude" content="-23.59243454"/> \t<meta property="og:longitude" content="-46.68677054"/> \t<meta property="og:type" content="company"/> META; $this->assertEquals($testMeta, $this->og->getMeta()); $testArray = array('title' => 'Apontador.com - São Paulo', 'description' => 'Líder em geolocalização no Brasil e uma das 250 maiores empresas de internet do mundo, segundo o AlwaysOn, o Apontador (www.apontador.com) desenvolve e oferece serviços e ferramentas de busca e localização para facilitar o dia a dia dos usuários, além de mostrar a opinião do público para os locais cadastrados em seus sites. Com mais de 10 milhões de visitantes mensais, a empresa inclui o site líder em busca local Apontador (www.apontador.com.br) e o de mapas e rotas MapLink (www.maplink.com.br).', 'image' => 'http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054', 'url' => ROOT_URL . 'sp/s-o-paulo/empresas-de-internet/apontador-com-s-o-paulo/M25GJ288.html', 'street-address' => 'Rua Funchal, 129', 'locality' => 'São Paulo', 'region' => 'SP', 'country-name' => 'Brasil', 'latitude' => '-23.59243454', 'longitude' => '-46.68677054', 'type' => 'company'); $this->assertEquals($testArray, $this->og->getArray()); }
public function buildMerchantIds($xml) { $merchantArray = array(); foreach ($xml->ReturnedMerchants->Merchant as $merchant) { $xmlAddress = $merchant->Address; $xmlCountrySubdivision = $merchant->Address->CountrySubdivision; $xmlCountry = $merchant->Address->Country; $xmlMerchant = $merchant; $address = new Address(); $address->setLine1((string) $xmlAddress->Line1); $address->setLine2((string) $xmlAddress->Line2); $address->setCity((string) $xmlAddress->City); $address->setPostalCode((string) $xmlAddress->PostalCode); $countrySubdivision = new CountrySubdivision(); $countrySubdivision->setCode((string) $xmlCountrySubdivision->Code); $countrySubdivision->setName((string) $xmlCountrySubdivision->Name); $country = new Country(); $country->setCode((string) $xmlCountry->Code); $country->setName((string) $xmlCountry->Name); $address->setCountrySubdivision($countrySubdivision); $address->setCountry($country); $tmpMerchant = new Merchant(); $tmpMerchant->setAddress($address); $tmpMerchant->setPhoneNumber((string) $xmlMerchant->PhoneNumber); $tmpMerchant->setBrandName((string) $xmlMerchant->BrandName); $tmpMerchant->setMerchantCategory((string) $xmlMerchant->MerchantCategory); $tmpMerchant->setMerchantDbaName((string) $xmlMerchant->MerchantDbaName); $tmpMerchant->setDescriptorText((string) $xmlMerchant->DescriptorText); $tmpMerchant->setLegalCorporateName((string) $xmlMerchant->LegalCorporateName); $tmpMerchant->setBrickCount((string) $xmlMerchant->BrickCount); $tmpMerchant->setComment((string) $xmlMerchant->Comment); $tmpMerchant->setLocationId((string) $xmlMerchant->LocationId); $tmpMerchant->setOnlineCount((string) $xmlMerchant->OnlineCount); $tmpMerchant->setOtherCount((string) $xmlMerchant->OtherCount); $tmpMerchant->setSoleProprietorName((string) $xmlMerchant->SoleProprietorName); array_push($merchantArray, $tmpMerchant); } $returnedMerchants = new ReturnedMerchants(); $returnedMerchants->setMerchant($merchantArray); $merchantIds = new MerchantIds(); $merchantIds->setReturnedMerchants($returnedMerchants); $merchantIds->setMessage($xml->Message); return $merchantIds; }
function create_ecp_PaymentMethod() { $uniqueValue = get_unique_value(); $merchantAccountId = 'account-' . $uniqueValue; $merchantPaymentMethodId = 'pm-' . $uniqueValue; $email = get_unique_value() . '@nomail.com'; $successUrl = 'http://good.com/'; //need a trailing slash $errorUrl = 'http://bad.com/'; //need a trailing slash $name = 'John Vindicia'; $addr1 = '303 Twin Dolphin Drive'; $city = 'Redwood City'; $district = 'CA'; $postalCode = '94065'; $country = 'US'; $address = new Address(); $address->setName($name); $address->setAddr1($addr1); $address->setCity($city); $address->setDistrict($district); $address->setPostalCode($postalCode); $address->setCountry($country); $paymentmethod = new PaymentMethod(); $paymentmethod->setType('ECP'); $paymentmethod->setAccountHolderName($name); $paymentmethod->setBillingAddress($address); $paymentmethod->setMerchantPaymentMethodId($merchantPaymentMethodId); $paymentmethod->setCurrency('USD'); $ecp = new ECP(); $ecp->setAccount('495958930'); $ecp->setRoutingNumber('611111111'); $ecp->setAllowedTransactionType('Inbound'); $ecp->setAccountType('ConsumerChecking'); $paymentmethod->setECP($ecp); $account = new Account(); $account->setMerchantAccountId($merchantAccountId); $account->setEmailAddress($email); $account->setShippingAddress($address); $account->setEmailTypePreference('html'); $account->setName($name); $account->setPaymentMethods(array($paymentmethod)); return $account; }
function create_paypal_PaymentMethod() { $uniqueValue = get_unique_value(); $merchantAccountId = 'account-' . $uniqueValue; $merchantPaymentMethodId = 'pm-' . $uniqueValue; $email = get_unique_value() . '@nomail.com'; $successUrl = 'http://good.com/'; //need a trailing slash $errorUrl = 'http://bad.com/'; //need a trailing slash $name = 'John Vindicia'; $addr1 = '303 Twin Dolphin Drive'; $city = 'Redwood City'; $district = 'CA'; $postalCode = '94065'; $country = 'US'; $address = new Address(); $address->setName($name); $address->setAddr1($addr1); $address->setCity($city); $address->setDistrict($district); $address->setPostalCode($postalCode); $address->setCountry($country); $paymentmethod = new PaymentMethod(); $paymentmethod->setType('PayPal'); $paymentmethod->setAccountHolderName($name); $paymentmethod->setBillingAddress($address); $paymentmethod->setMerchantPaymentMethodId($merchantPaymentMethodId); $paymentmethod->setCurrency('USD'); $paypal = new PayPal(); $paypal->setReturnUrl($successUrl); $paypal->setCancelUrl($errorUrl); $paymentmethod->setPaypal($paypal); $account = new Account(); $account->setMerchantAccountId($merchantAccountId); $account->setEmailAddress($email); $account->setShippingAddress($address); $account->setEmailTypePreference('html'); $account->setName($name); //$account->setPaymentMethods(array($paymentmethod)); //return $account; return array('account' => $account, 'paymentmethod' => $paymentmethod); }
public function testPopulateWithPlace() { $point = new Point(); $point->setLat('-23.59243454'); $point->setLng('-46.68677054'); $city = new City(); $city->setCountry('BR'); $city->setState('SP'); $city->setName('São Paulo'); $category = new Category(); $category->setId('067'); $category->setName('Restaurante'); $address = new Address(); $address->setStreet("R. Min. Jesuino Cardoso"); $address->setNumber(473); $address->setCity($city); $place = new Place(); $place->setId("UCV34B2P"); $place->setName("Uziel Restaurante"); $place->setDescription("Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R\$ 26,90, mas você paga no máximo R\$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant"); $place->setIconUrl("http://maplink.com.br/widget?v=4.1&lat=-23.5926083&lng=-46.6818329"); $place->setPoint($point); $place->setCategory($category); $place->setAddress($address); $this->abm->populate($place); $rootUrl = \ROOT_URL; $testMeta = <<<META \t<meta property="restaurant:title" content="Uziel Restaurante"/> \t<meta property="restaurant:description" content="Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R\$ 26,90, mas você paga no máximo R\$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant"/> \t<meta property="restaurant:image" content="http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054"/> \t<meta property="restaurant:url" content="{$rootUrl}sp/s-o-paulo/restaurante/uziel-restaurante/UCV34B2P.html"/> \t<meta property="restaurant:address" content="R. Min. Jesuino Cardoso, 473"/> \t<meta property="restaurant:city" content="São Paulo"/> \t<meta property="restaurant:state" content="SP"/> \t<meta property="restaurant:country-name" content="Brasil"/> \t<meta property="restaurant:type" content="restaurant"/> META; $this->assertEquals($testMeta, $this->abm->getMeta()); $testArray = array('title' => 'Uziel Restaurante', 'description' => 'Se você procura um restaurante com variedade, qualidade com preço justo você encontra no Uziel restaurante!O preço do kilo é R$ 26,90, mas você paga no máximo R$ 15,90 por pesagem de refeições (excluindo sobremesas, bebidas e doces). Acima de 500 gramas você ainda ganha um refrescoUm bom vinho, gelatina e cafezinho são por nossa conta.Se precisar de internet você pode contar com nossa rede Wi-Fi.Nosso cardápio diário possui 5 tipos de carne todos os dias, feijoada completa e separada (feijão e carnes) às quartas, 6 tipos de massa nas quintas e 4 tipos de pizzas nassextas, além de opções de peixes todas as terças e sextas.Oferecemos convênio com descontos progressivos para empresas e um bolo com o sabor a escolha do aniversariante, caso agende com antecedência e traga mais de 10 pessoas para almoçar no seu aniversário.Aceitamos todos os cartões de crédito e vales refeição.Você pode receber nosso cardápio atualizado diariamente pelo twitter http://twitter.com/uzielrestaurant', 'image' => 'http://maplink.apontador.com.br/widget?v=4.1&lat=-23.59243454&lng=-46.68677054', 'url' => ROOT_URL . 'sp/s-o-paulo/restaurante/uziel-restaurante/UCV34B2P.html', 'address' => 'R. Min. Jesuino Cardoso, 473', 'city' => 'São Paulo', 'state' => 'SP', 'country-name' => 'Brasil', 'type' => 'restaurant'); $this->assertEquals($testArray, $this->abm->getArray()); }
/** * @param Address $address * @return boolean */ public function setShippingAddress($shippingAddress) { $bool = $this->shippingAddress->setStreetAddress($shippingAddress->getStreetAddress()); if (!$bool) { return FALSE; } $bool = $this->shippingAddress->setCity($shippingAddress->getCity()); if (!$bool) { return FALSE; } $bool = $this->shippingAddress->setParish($shippingAddress->getParish()); if (!$bool) { return FALSE; } $bool = $this->shippingAddress->setPostalCode($shippingAddress->getPostalCode()); if (!$bool) { return FALSE; } return TRUE; }
public static function map(Address $address, array $properties) { if (array_key_exists('id', $properties)) { $address->setId($properties['id']); } if (array_key_exists('street', $properties)) { $address->setStreet($properties['street']); } if (array_key_exists('suburb', $properties)) { $address->setSuburb($properties['suburb']); } if (array_key_exists('city', $properties)) { $address->setCity($properties['city']); } if (array_key_exists('post_code', $properties)) { $address->setPostCode($properties['post_code']); } if (array_key_exists('street_no', $properties)) { $address->setstreetNo($properties['street_no']); } }
public function validate($street, $zip, $apartment = false, $city = false, $state = false) { $verify = new AddressVerify($this->config['username']); $address = new Address(); $address->setFirmName(null); $address->setApt($apartment); $address->setAddress($street); $address->setCity($city); $address->setState($state); $address->setZip5($zip); $address->setZip4(''); // Add the address object to the address verify class $verify->addAddress($address); // Perform the request and return result $val1 = $verify->verify(); $val2 = $verify->getArrayResponse(); // var_dump($verify->isError()); // See if it was successful if ($verify->isSuccess()) { return ['address' => $val2['AddressValidateResponse']['Address']]; } else { return ['error' => $verify->getErrorMessage()]; } }
/** * @group shopobjects */ function testSetAddressParameters() { // GIVEN $incompleteAddressParameter = $this->givenIncompleteAddressParameter(); // WHEN $address = new Address($incompleteAddressParameter); $address->setBirthday("01.02.1900"); $address->setCity("Cologne"); $address->setCompany("FakeCompany"); $address->setCountry("England"); $address->setEmailAddress("*****@*****.**"); $address->setFirstName("Max"); $address->setLastName("Miller"); $address->setSalutation("Mr."); $address->setState("NRW"); $address->setStreet("First street 2"); $address->setStreetDetails("c/o Mister Smith"); $address->setTitle("Master"); $address->setVatId("DE1234567890"); $address->setZipCode("12345"); // THEN $this->assertFalse($address->error()); $this->thenCompleteAddressInformationIsExisting($address); }
function CreateAccount($merchantAccountId, $email) { $account = new Account(); $account->setName('Migrated Customer'); $account->setMerchantAccountId($merchantAccountId); // Be conscious that using real email addresses in ProdTest depending on configuration will // have live emails triggered and sent on billing events for the Account. // It is recommended that when testing in ProdTest be certain to mask real email addresses. $account->setEmailAddress($email); $account->setEmailTypePreference('html'); $account->setWarnBeforeAutoBilling(true); $anyOtherHelpfulDataForCSRsWhenLookingUpAccount = new NameValuePair(); $anyOtherHelpfulDataForCSRsWhenLookingUpAccount->setName('HelpfulData'); $anyOtherHelpfulDataForCSRsWhenLookingUpAccount->setValue('BestCustomerEver'); $account->setNameValues(array($anyOtherHelpfulDataForCSRsWhenLookingUpAccount)); $address = new Address(); $address->setAddr1('303 Twin Dolphin Drive'); $address->setAddr2('Suite 200'); $address->setCity('Redwood City'); $address->setDistrict('CA'); $address->setPostalCode('94065'); $address->setCountry('US'); $address->setPhone('123-456-7890'); $srd = ''; $account->setShippingAddress($address); $response = $account->update($srd); // Log soap id for each API call. // $log->addDebug('Method = Account.update' . PHP_EOL); // $log->addDebug('Soap Id = ' . $response['data']->return->soapId . PHP_EOL); // $log->addDebug('Return Code = ' . $response['returnCode'] . PHP_EOL); // $log->addDebug('Return String = ' . $response['returnString'] . PHP_EOL); if ($response['returnCode'] == 200) { print "Call succeeded" . PHP_EOL; } else { print "Call failed" . PHP_EOL; print_r($response); } }
/** * Generic address maker * * @param string $line1 * @param string $line2 * @param string $city * @param string $state * @param string $zip * @param string $country * @return Address */ protected function _newAddress($line1, $line2, $city, $state, $zip, $country = 'USA') { $address = new Address(); $address->setLine1($line1); $address->setLine2($line2); $address->setCity($city); $address->setRegion($state); $address->setPostalCode($zip); $address->setCountry($country); return $address; }
function createStandardRequest($calc, $products, $sign = 1) { if (!class_exists('TaxServiceSoap')) { require VMAVALARA_CLASS_PATH . DS . 'TaxServiceSoap.class.php'; } if (!class_exists('DocumentType')) { require VMAVALARA_CLASS_PATH . DS . 'DocumentType.class.php'; } if (!class_exists('DetailLevel')) { require VMAVALARA_CLASS_PATH . DS . 'DetailLevel.class.php'; } if (!class_exists('Line')) { require VMAVALARA_CLASS_PATH . DS . 'Line.class.php'; } if (!class_exists('ServiceMode')) { require VMAVALARA_CLASS_PATH . DS . 'ServiceMode.class.php'; } if (!class_exists('Line')) { require VMAVALARA_CLASS_PATH . DS . 'Line.class.php'; } if (!class_exists('GetTaxRequest')) { require VMAVALARA_CLASS_PATH . DS . 'GetTaxRequest.class.php'; } if (!class_exists('GetTaxResult')) { require VMAVALARA_CLASS_PATH . DS . 'GetTaxResult.class.php'; } if (!class_exists('Address')) { require VMAVALARA_CLASS_PATH . DS . 'Address.class.php'; } if (is_object($calc)) { $calc = get_object_vars($calc); } $request = new GetTaxRequest(); $origin = new Address(); //In Virtuemart we have not differenct warehouses, but we have a shipment address //So when the vendor has a shipment address, we assume that it is his warehouse //Later we can combine products with shipment addresses for different warehouse (yehye, future music) //But for now we just use the BT address if (!class_exists('VirtueMartModelVendor')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'vendor.php'; } $userId = VirtueMartModelVendor::getUserIdByVendorId($calc['virtuemart_vendor_id']); $userModel = VmModel::getModel('user'); $virtuemart_userinfo_id = $userModel->getBTuserinfo_id($userId); // this is needed to set the correct user id for the vendor when the user is logged $userModel->getVendor($calc['virtuemart_vendor_id']); $vendorFieldsArray = $userModel->getUserInfoInUserFields('mail', 'BT', $virtuemart_userinfo_id, FALSE, TRUE); $vendorFields = $vendorFieldsArray[$virtuemart_userinfo_id]; $origin->setLine1($vendorFields['fields']['address_1']['value']); $origin->setLine2($vendorFields['fields']['address_2']['value']); $origin->setCity($vendorFields['fields']['city']['value']); $origin->setCountry($vendorFields['fields']['virtuemart_country_id']['country_2_code']); $origin->setRegion($vendorFields['fields']['virtuemart_state_id']['state_2_code']); $origin->setPostalCode($vendorFields['fields']['zip']['value']); $request->setOriginAddress($origin); //Address if (isset($this->addresses[0])) { $destination = $this->addresses[0]; } else { return FALSE; } if (!class_exists('calculationHelper')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php'; } $calculator = calculationHelper::getInstance(); $request->setCurrencyCode($calculator->_currencyDisplay->_vendorCurrency_code_3); //CurrencyCode $request->setDestinationAddress($destination); //Address $request->setCompanyCode($calc['company_code']); // Your Company Code From the Dashboard $request->setDocDate(date('Y-m-d')); //date, checked $request->setCustomerCode(self::$vmadd['customer_number']); //string Required if (isset(self::$vmadd['tax_usage_type'])) { $request->setCustomerUsageType(self::$vmadd['tax_usage_type']); //string Entity Usage } if (isset(self::$vmadd['tax_exemption_number'])) { $request->setExemptionNo(self::$vmadd['tax_exemption_number']); //string if not using ECMS which keys on customer code } if (isset(self::$vmadd['taxOverride'])) { $request->setTaxOverride(self::$vmadd['taxOverride']); avadebug('I set tax override ', self::$vmadd['taxOverride']); } $setAllDiscounted = false; if (isset($products['discountAmount'])) { if (!empty($products['discountAmount'])) { //$request->setDiscount($sign * $products['discountAmount'] * (-1)); //decimal $request->setDiscount($sign * $products['discountAmount']); //decimal vmdebug('We sent as discount ' . $request->getDiscount()); $setAllDiscounted = true; } unset($products['discountAmount']); } $request->setDetailLevel('Tax'); //Summary or Document or Line or Tax or Diagnostic $lines = array(); $n = 0; $this->_lineNumbersToCartProductId = array(); foreach ($products as $k => $product) { $n++; $this->_lineNumbersToCartProductId[$n] = $k; $line = new Line(); $line->setNo($n); //string // line Number of invoice $line->setItemCode($product['product_sku']); //string $line->setDescription($product['product_name']); //product description, like in cart, atm only the name, todo add customfields if (!empty($product['categories'])) { //avadebug('AvaTax setTaxCode Product has categories !',$catNames); if (!class_exists('TableCategories')) { require JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'categories.php'; } $db = JFactory::getDbo(); $catTable = new TableCategories($db); foreach ($product['categories'] as $cat) { $catTable->load($cat); $catslug = $catTable->slug; if (strpos($catslug, 'avatax-') !== FALSE) { $taxCode = substr($catslug, 7); if (!empty($taxCode)) { $line->setTaxCode($taxCode); } else { vmError('AvaTax setTaxCode, category could not be parsed ' . $catslug); } break; } } } //$line->setTaxCode(""); //string $line->setQty($product['amount']); //decimal $line->setAmount($sign * $product['price'] * $product['amount']); //decimal // TotalAmmount if ($setAllDiscounted or !empty($product['discount'])) { $line->setDiscounted(1); } else { $line->setDiscounted(0); } $line->setRevAcct(""); //string $line->setRef1(""); //string $line->setRef2(""); //string if (isset(self::$vmadd['tax_usage_type'])) { $line->setCustomerUsageType(self::$vmadd['tax_usage_type']); //string Entity Usage } if (isset(self::$vmadd['tax_exemption_number'])) { $line->setExemptionNo(self::$vmadd['tax_exemption_number']); //string if not using ECMS which keys on customer code } if (isset(self::$vmadd['taxOverride'])) { //create new TaxOverride Object set //$line->setTaxOverride(self::$vmadd['taxOverride']); } $lines[] = $line; } $this->newATConfig($calc); $request->setLines($lines); return $request; }
} else { $address->setActive(!$address->isActive()); $entityManager->flush(); $response['address'] = $address->__toJson(); $response['msg'] = array('desc' => 'Address with id "' . $addressId . '" successful updated.', 'code' => '200'); } /** only if we want add some entry in our database */ } elseif ($request->getMethod() === "POST" && $request->get('action', false) === 'add') { /** simple add without checks - while not required - only try catch */ try { $address = new Address(); $address->setForename($request->get('forename')); $address->setSurname($request->get('surname')); $address->setStreet($request->get('street')); $address->setZip($request->get('zip')); $address->setCity($request->get('city')); $address->setPhonenumber($request->get('phonenumber')); $address->setDateofbirth($request->get('date_of_birth') ? new DateTime($request->get('date_of_birth')) : null); $entityManager->persist($address); $entityManager->flush(); $response['address'] = $address->__toJson(); $response['msg'] = array('desc' => 'Address with id "' . $address->getId() . '" successful created.', 'code' => '200'); } catch (Exception $e) { $response['msg'] = array('desc' => $e->getMessage(), 'code' => '500'); } /** simple get with filtered query */ } else { /** @var \Doctrine\ORM\QueryBuilder $addressRepository */ $addressRepository = $entityManager->getRepository('Address')->createQueryBuilder('a'); /** adds forename filter */ if ($request->get('forename', false)) {
protected function runPage() { if (WebRequest::wasPosted()) { if (!WebRequest::postInt("calroom")) { $this->showCal(); return; } $startdate = new DateTime(WebRequest::post("qbCheckin")); $enddate = new DateTime(WebRequest::post("qbCheckout")); $room = Room::getById(WebRequest::postInt("calroom")); for ($date = $startdate; $date < $enddate; $date->modify("+1 day")) { if (!$room->isAvailable($date)) { $this->error("room-not-available"); $this->showCal(); return; } } // search for customer if (!($customer = Customer::getByEmail(WebRequest::post("qbEmail")))) { $customer = new Customer(); $suTitle = WebRequest::post("qbTitle"); $suFirstname = WebRequest::post("qbFirstname"); $suLastname = WebRequest::post("qbLastname"); $suAddress = WebRequest::post("qbAddress"); $suCity = WebRequest::post("qbCity"); $suPostcode = WebRequest::post("qbPostcode"); $suCountry = WebRequest::post("qbCountry"); $suEmail = WebRequest::post("qbEmail"); $customer->setPassword($suEmail); // set values $customer->setTitle($suTitle); $customer->setFirstname($suFirstname); $customer->setSurname($suLastname); $address = new Address(); $address->setLine1($suAddress); $address->setCity($suCity); $address->setPostCode($suPostcode); $address->setCountry($suCountry); $address->save(); $customer->setAddress($address); $customer->setEmail($suEmail); // save it $customer->save(); $customer->sendMailConfirm(); // save it again $customer->save(); } $booking = new Booking(); $booking->setStartDate(WebRequest::post("qbCheckin")); $booking->setEndDate(WebRequest::post("qbCheckout")); $booking->setAdults(WebRequest::post("qbAdults")); $booking->setChildren(WebRequest::post("qbChildren")); $booking->setPromocode(WebRequest::post("qbPromoCode")); $booking->setRoom($room->getId()); $booking->setCustomer($customer->getId()); $booking->save(); $msg = Message::getMessage("booking-confirmation"); $msg = str_replace("\$1", $booking->getStartDate(), $msg); $msg = str_replace("\$2", $booking->getEndDate(), $msg); $msg = str_replace("\$3", $booking->getAdults(), $msg); $msg = str_replace("\$4", $booking->getChildren(), $msg); $msg = str_replace("\$5", $booking->getRoom()->getName(), $msg); Mail::send($customer->getEmail(), Message::getMessage("booking-confimation-subject"), $msg); $this->mSmarty->assign("content", $msg); return; } throw new YouShouldntBeDoingThatException(); }
/** * * Builds and Returns an Address object based off of the JSON input. * * @param vo_json JSON representation of an address * @return the Address * @throws JSONException if the json is not properly formatted */ static function buildFromJSON($o_data) { $o_instance = new Address(); if ($o_data != NULL) { if (array_key_exists("address_name", $o_data)) { $o_instance->setName($o_data['address_name']); } if (array_key_exists("address_line1", $o_data)) { $o_instance->setLine1($o_data['address_line1']); } if (array_key_exists("address_line2", $o_data)) { $o_instance->setLine2($o_data['address_line2']); } if (array_key_exists("address_city", $o_data)) { $o_instance->setCity($o_data['address_city']); } if (array_key_exists("address_state", $o_data)) { $o_instance->setState($o_data['address_state']); } if (array_key_exists("address_zipcode", $o_data)) { $o_instance->setZipcode($o_data['address_zipcode']); } if (array_key_exists("address_country", $o_data)) { $o_instance->setCountry($o_data['address_country']); } } return $o_instance; }
$STDIN = fopen('php://stdin', 'r'); try { $address = new Address(); // Get The address from the user via keyboard input echo "Address Line 1: "; $input = rtrim(fgets($STDIN)); $address->setLine1($input); echo "Address Line 2: "; $input = rtrim(fgets($STDIN)); $address->setLine2($input); echo "Address Line 3: "; $input = rtrim(fgets($STDIN)); $address->setLine3($input); echo "City: "; $input = rtrim(fgets($STDIN)); $address->setCity($input); echo "State/Province: "; $input = rtrim(fgets($STDIN)); $address->setRegion($input); echo "Postal Code: "; $input = rtrim(fgets($STDIN)); $address->setPostalCode($input); $textCase = TextCase::$Mixed; $coordinates = 1; $request = new ValidateRequest($address, $textCase ? $textCase : TextCase::$Default, $coordinates); $result = $client->Validate($request); echo "\n" . 'Validate ResultCode is: ' . $result->getResultCode() . "\n"; if ($result->getResultCode() != SeverityLevel::$Success) { foreach ($result->getMessages() as $msg) { echo $msg->getName() . ": " . $msg->getSummary() . "\n"; }
public function testPopulate() { $subCategory = new Subcategory(); $subCategory->setId(1234); $subCategory->setName("Self Service"); $category = new Category(); $category->setId(12); $category->setName("Restaurantes"); $category->setSubCategory($subCategory); $city = new City(); $city->setCountry("Brasil"); $city->setState("SP"); $city->setName("São Paulo"); $address = new Address(); $address->setCity($city); $address->setComplement("1 Andar"); $address->setDistrict("Vila Olímpia"); $address->setNumber("129"); $address->setStreet("Rua Funchal"); $address->setZipcode("04551-069"); $gasStation = new GasStation(array('price_gas' => 1, 23, 'price_vodka' => 23, 45)); $placeInfo = new PlaceInfo(); $placeInfo->setGasStation($gasStation); $data = new \stdClass(); $data->id = 123; $data->name = "Chegamos!"; $data->average_rating = 4; $data->review_count = 3; $data->category = $category; $data->subcategory = $subCategory; $data->address = $address; $data->point->lat = "-23.529366"; $data->point->lng = "-47.467117"; $data->main_url = "http://chegamos.com/"; $data->other_url = "http://chegamos.com.br/"; $data->icon_url = "http://chegamos.com/img/icon.png"; $data->description = "Description"; $data->created = "01/12/2010 16:19"; $data->phone = "11 2222-3333"; $data->extended = $placeInfo; $data->num_visitors = 1024; $data->num_photos = 5; $this->object->populate($data); $this->assertEquals(123, $this->object->getId()); $this->assertEquals("Chegamos!", $this->object->getName()); $this->assertEquals(4, $this->object->getAverageRating()); $this->assertEquals("Bom", $this->object->getAverageRatingString()); $this->assertEquals(3, $this->object->getReviewCount()); $this->assertEquals("app\\models\\Category", \get_class((object) $this->object->getCategory())); $this->assertEquals("Restaurantes - Self Service", (string) $this->object->getCategory()); $this->assertEquals("app\\models\\Address", \get_class((object) $this->object->getAddress())); $this->assertEquals("Rua Funchal, 129 - Vila Olímpia<br/>São Paulo - SP", (string) $this->object->getAddress()); $this->assertEquals("-23.529366,-47.467117", (string) $this->object->getPoint()); $this->assertEquals("http://chegamos.com/", $this->object->getMainUrl()); $this->assertEquals("http://chegamos.com.br/", $this->object->getOtherUrl()); $this->assertEquals("http://chegamos.com/img/icon.png", $this->object->getIconUrl()); $this->assertEquals("Description", $this->object->getDescription()); $this->assertEquals("01/12/2010 16:19", $this->object->getCreated()); $this->assertEquals("11 2222-3333", $this->object->getPhone()); $this->assertEquals("app\\models\\PlaceInfo", \get_class((object) $this->object->getPlaceInfo())); $this->assertEquals(1024, $this->object->getNumVisitors()); $this->assertEquals(5, $this->object->getNumPhotos()); }
$client = new TaxServiceSoap('Development'); $request = new GetTaxRequest(); //Add Origin Address $origin = new Address(); $origin->setLine1("435 Ericksen Ave NE"); $origin->setLine2("Suite 200"); $origin->setCity("Bainbridge Island"); $origin->setRegion("WA"); $origin->setPostalCode("98110-1896"); $request->setOriginAddress($origin); //Address //Add Destination address $destination = new Address(); $destination->setLine1("900 Winslow Way"); $destination->setLine2("Suite 200"); $destination->setCity("Bainbridge Island"); $destination->setRegion("WA"); $destination->setPostalCode("98110"); $request->setDestinationAddress($destination); //Address $request->setCompanyCode('DEFAULT'); // Your Company Code From the Dashboard $request->setDocType(DocumentType::$SalesInvoice); // Only supported types are SalesInvoice or SalesOrder $dateTime = new DateTime(); $docCode = "PHPSample" . date_format($dateTime, "dmyGis"); $request->setDocCode($docCode); // invoice number $request->setDocDate(date_format($dateTime, "Y-m-d")); //date $request->setSalespersonCode("");
function wc_autoship_taxnow_add_tax_rates($tax_rates, $schedule_id) { include_once WP_PLUGIN_DIR . '/taxnow_woo/taxnow-woo.class.php'; include_once WP_PLUGIN_DIR . '/woocommerce-autoship/classes/wc-autoship-schedule.php'; if (class_exists('class_taxNOW_woo') && class_exists('WC_Autoship_Schedule')) { // Create TaxNOW instance $taxnow_woo = new class_taxNOW_woo(); // Get autoship schedule $schedule = new WC_Autoship_Schedule($schedule_id); // Get autoship customer $customer = $schedule->get_customer(); // Create service $service = $taxnow_woo->create_service('TaxServiceSoap', false); $request = new GetTaxRequest(); $request->setDocDate(date('Y-m-d', current_time('timestamp'))); $request->setDocCode(''); $request->setCustomerCode($customer->get_email()); $request->setCompanyCode(get_option('tnwoo_company_code')); $request->setDocType(DocumentType::$SalesOrder); $request->setDetailLevel(DetailLevel::$Tax); $request->setCurrencyCode(get_option('woocommerce_currency')); $request->setBusinessIdentificationNo(get_option('tnwoo_business_vat_id')); // Origin address $origin = new Address(); $origin->setLine1(get_option('tnwoo_origin_street')); $origin->setCity(get_option('tnwoo_origin_city')); $origin->setRegion(get_option('tnwoo_origin_state')); $origin->setPostalCode(get_option('tnwoo_origin_zip')); $origin->setCountry(get_option('tnwoo_origin_country')); $request->setOriginAddress($origin); // Destination address $destination = new Address(); $destination->setLine1($customer->get('shipping_address_1')); $destination->setCity($customer->get('shipping_city')); $destination->setRegion($customer->get('shipping_state')); $destination->setPostalCode($customer->get('shipping_postcode')); $destination->setCountry($customer->get('shipping_country')); $request->setDestinationAddress($destination); // Lines items $items = $schedule->get_items(); $lines = array(); $global_tax_code = get_option('tnwoo_default_tax_code'); foreach ($items as $i => $item) { // Get WooCommerce product ID $product_id = $item->get_product_id(); // Create line item $line = new Line(); $line->setItemCode($product_id); $line->setDescription($product_id); $tax_code = get_post_meta($product_id, '_taxnow_taxcode', true); $line->setTaxCode(!empty($tax_code) ? $tax_code : $global_tax_code); $line->setQty((int) $item->get_quantity()); $line->setAmount((double) $item->get_autoship_price()); $line->setNo($i + 1); $line->setDiscounted(0); $lines[] = $line; } $request->setLines($lines); // Pretax discount $discount_pretax = 0.0; // Send request $taxnow_woo->log_add_entry('calculate_tax', 'request', $request); try { $response = $service->getTax($request); $taxnow_woo->log_add_entry('calculate_tax', 'response', $response); if ($response->getResultCode() == SeverityLevel::$Success) { foreach ($response->GetTaxLines() as $l => $TaxLine) { foreach ($TaxLine->getTaxDetails() as $d => $TaxDetail) { // Create WooCommerce tax rate $tax_rate = array('rate' => 100.0 * $TaxDetail->getRate(), 'label' => $TaxDetail->getTaxName(), 'shipping' => 'no', 'compound' => 'no'); $tax_rates["wc_autoship_taxnow_{$l}_{$d}"] = $tax_rate; } } } } catch (Exception $e) { $taxnow_woo->log_add_entry('calculate_tax', 'exception', $e->getMessage()); } } // Return tax rates return $tax_rates; }
/** * Populates the Venue object from the request * @return bean Venue */ private function getBeanFromRequest() { $venue = new Venue(); $addr = new Address(); $addr->setOid($_REQUEST['aoid']); $addr->setStreet($_REQUEST['street']); $addr->setUnit($_REQUEST['unit']); $addr->setCity($_REQUEST['city']); $addr->setState($_REQUEST['state']); $addr->setPostalCode($_REQUEST['postalCode']); $addr->setPhone($_REQUEST['phone']); $venue->setOid($_REQUEST['oid']); $venue->setName($_REQUEST['name']); $venue->setDescription($_REQUEST['description']); $venue->setPubState($_REQUEST['pubState']); $venue->setAddress($addr); if (isset($_REQUEST['gallery'])) { $venue->setGallery($_REQUEST['gallery']); } $links = array(); //$links['exhibition'] = $_REQUEST['exhibition']; //$links['program'] = isset($_REQUEST['program']) ? $_REQUEST['program'] : null; //$links['course'] = isset($_REQUEST['course']) ? $_REQUEST['course'] : null; $venue->setEvents($links); return $venue; }
require_once 'Vindicia/Soap/Vindicia.php'; require_once 'Vindicia/Soap/Const.php'; $parentID = $argv[1]; print "parent: {$parentID} \n"; $name = "Child One"; $addr1 = "19 Davis Dr"; $city = "Belmont"; $state = "CA"; $postalcode = "94002"; $country = "US"; $email = "childAccount" . rand(10000, 99999) . "@vindicia.com"; $address = new Address(); $address->setName($name); $address->setAddr1($addr1); $address->setCity($city); $address->setDistrict($state); $address->setPostalCode($postalcode); $address->setCountry($country); $accountID = "childAccount" . rand(1000, 9999) . "-" . rand(1000, 999999); $child1 = new Account(); $child1->setMerchantAccountId($accountID); $child1->setEmailAddress($email); $child1->setShippingAddress($address); $child1->setEmailTypePreference('html'); $child1->setWarnBeforeAutoBilling(false); $child1->setName($name); $parent = new Account(); $parent->setMerchantAccountId($parentID); // use the force flag to remove these children from a previous parent // and assign them to this new one