本文整理汇总了PHP中Address::setLine1方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::setLine1方法的具体用法?PHP Address::setLine1怎么用?PHP Address::setLine1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::setLine1方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testapi
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());
}
}
}
示例2: testLatLongValidation
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'");
}
}
}
示例3: _convertRequestAddress
/**
* 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;
}
示例4: buildMerchants
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;
}
示例5: buildAtms
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;
}
示例6: buildAtms
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;
}
示例7: buildMerchantIds
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;
}
示例8: buildFromJSON
/**
*
* 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;
}
示例9: AddressServiceSoap
<?php
require '../../AvaTax4PHP/AvaTax.php';
// include in all Avalara Scripts
require '../Credentials.php';
// where service URL, account, license key are set
$client = new AddressServiceSoap('Development');
$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;
示例10: CreateTaxRequestForBINo
private function CreateTaxRequestForBINo($bino)
{
$request = new GetTaxRequest();
//Set origin Address
$origin = new Address();
$origin->setLine1("Avalara");
$origin->setLine2("900 winslow way");
$origin->setLine3("Suite 100");
$origin->setCity("Bainbridge Island");
$origin->setRegion("WA");
$origin->setPostalCode("98110-1896");
$origin->setCountry("USA");
$request->setOriginAddress($origin);
//Set destination address
$destination = new Address();
$destination->setLine1("3130 Elliott");
$destination->setCity("Seattle");
$destination->setRegion("WA");
$destination->setPostalCode("98121");
$destination->setCountry("USA");
$request->setDestinationAddress($destination);
//Set line
$line = new Line();
$line->setNo("1");
//string // line Number of invoice
$line->setBusinessIdentificationNo("LL123");
$line->setItemCode("Item123");
//string
$line->setQty(1.0);
//decimal
$line->setAmount(1010.0);
$request->setLines(array($line));
$request->setCompanyCode('DEFAULT');
// Your Company Code From the Dashboard
$request->setDocCode("DocTypeTest");
$request->setBusinessIdentificationNo($bino);
$request->setDocDate(date_format(new DateTime(), "Y-m-d"));
$request->setCustomerCode("TaxSvcTest");
//string Required
$request->setSalespersonCode("");
// string Optional
$request->setDetailLevel(DetailLevel::$Tax);
//Summary or Document or Line or Tax or Diagnostic
return $request;
}
示例11: TaxServiceSoap
require '../Credentials.php';
// where service URL, account, license key are set
$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"));
示例12: GetTaxRequest
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;
}
示例13: merchant_application
public function merchant_application($data)
{
$errors = array();
$results = array();
$i = 0;
// Instantiate State Model
$States = new State();
// Newest modification for Merchant Application submission
foreach ($data['Property'] as $property) {
// Create client
$o_bcpc = new BaseCommerceClient(RENTSQUARE_PARTNER_USER, RENTSQUARE_PARTNER_PASS, RENTSQUARE_PARTNER_KEY);
$o_bcpc->setSandbox(BC_SANDBOXVALUE);
$o_merch_app = new MerchantApplication();
$o_account = new Account();
// Account & Address infno
//$o_account->setAccountName( $property['legal_name'] );
$o_account->setAccountName("RentSquare LLC");
$o_account->setAcceptACH(true);
$o_account->setAcceptBC(true);
// Legal Address
$legal_state = $States->findById($property['legal_state_id']);
$legal_state = $legal_state['State']['abbr'];
$state_inc = $States->findById($property['state_inc']);
$state_inc = $state_inc['State']['abbr'];
$home_state = $States->findById($data['User']['state_id']);
$home_state = $home_state['State']['abbr'];
switch ($property['ownership_type']) {
case 0:
$ownership_type = 'Corporation';
break;
case 1:
$ownership_type = 'LLC';
break;
case 2:
$ownership_type = 'Partnership';
$state_inc = 'N/A';
break;
case 3:
$ownership_type = 'Sole Proprietor';
$property['legal_ein'] = $data['User']['ssn'];
$state_inc = 'N/A';
break;
}
$o_legal_address = new Address(Address::$XS_ADDRESS_NAME_LEGAL);
//$o_legal_address->setLine1( $property['legal_street'] );
//$o_legal_address->setCity( $property['legal_city'] );
//$o_legal_address->setState( $legal_state );
//$o_legal_address->setZipcode( $property['legal_zip'] );
$o_legal_address->setLine1("218 S. Formosa Ave");
$o_legal_address->setCity("Los Angeles");
$o_legal_address->setState("CA");
$o_legal_address->setZipcode("90036");
$o_legal_address->setCountry("USA");
$o_account->setLegalAddress($o_legal_address);
//$o_account->setAccountPhoneNumber( $property['legal_phone'] );
//$o_account->setCustomerServicePhoneNumber( $data['User']['phone'] );
//$o_account->setEIN( $property['legal_ein'] );
$o_account->setAccountPhoneNumber("303-809-6116");
$o_account->setReferralPartnerID("a0Fi0000005jNJ3");
//*** Hardcoded at BC
$o_account->setCongaTemplateId("a0d310000006iKoi");
//*** Hardcoded at BC
$o_account->setCustomerServicePhoneNumber("303-809-6116");
$o_account->setDBA($property['legal_dba']);
$o_account->setEntityType(Account::$XS_ENTITY_TYPE_CORP);
$o_account->setAssociationNumber("268000");
$o_account->setEIN("452501975");
$o_account->setIpAddressOfAppSubmission("192.168.0.1");
//*** Hardcoded at BC
$o_account->setWebsite('http://rentsquare.com');
// Settlement Account Bank Info
$o_account->setSettlementAccountBankName($property['bank_name']);
$o_account->setSettlementAccountBankPhone('');
//** TODO Required I think - need to add to form?
$o_account->setSettlementAccountName($property['legal_name']);
$o_account->setSettlementAccountNumber($property['bank_account_num']);
$o_account->setSettlementAccountRoutingNumber($property['routing_number']);
$o_account->setSettlementSameAsFeeAccount(true);
$o_merch_app->setAccount($o_account);
$o_dba_address = new Address(Address::$XS_ADDRESS_NAME_DBA);
$o_dba_address->setLine1($property['legal_street']);
$o_dba_address->setCity($property['legal_city']);
$o_dba_address->setState($state_inc);
//** Should this be legal state??
$o_dba_address->setZipcode($property['legal_zip']);
$o_dba_address->setCountry("USA");
$o_location = new Location();
$o_location->setContactSameAsOwner(true);
$o_location->setDescriptionOfProductsAndServices("Property Management Services");
$o_location->setDBAAddress($o_dba_address);
//$o_location->setDescription( Location::$XS_DESCRIPTION_CONSULTING ); // Dont see in Angela's document
//$o_cal = Calendar->getInstance(); //*** Hardcoded at BC
//$o_cal->add( Calendar->YEAR, -2 ); //*** Hardcoded at BC
//$o_year = $o_cal->getTime(); //*** Hardcoded at BC
//$o_location->setEntityStartDate( $o_year ); //*** Hardcoded at BC
$o_location->setEntityState($legal_state);
//** Should this be legal state??
$o_location->setSalesAgentName('Sean Perlmutter');
$o_location->setProgramPricing('RentSquare');
$o_location->setProgramDetails('Fees Billed to Partner');
//.........这里部分代码省略.........
示例14: getTax
function getTax($calculationHelper, $calc, $price, $sale = false, $committ = false)
{
if ($calc->activated == 0) {
return false;
}
$shopperData = $this->getShopperData();
if (!$shopperData) {
return false;
}
//if(self::$stop) return self::$stop;
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';
}
$client = new TaxServiceSoap('Development');
$request = new GetTaxRequest();
$origin = new Address();
//$destination = $this->fillValidateAvalaraAddress($calc);
//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];
//vmdebug('my vendor fields',$vendorFields);
$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;
}
$request->setDestinationAddress($destination);
//Address
//vmdebug('The date',$origin,$destination);
$request->setCompanyCode($calc->company_code);
// Your Company Code From the Dashboard
if ($calc->committ and $sale) {
$request->setDocType(DocumentType::$SalesInvoice);
// Only supported types are SalesInvoice or SalesOrder
$request->setCommit(true);
//invoice number, problem is that the invoice number is at this time not known, but the order_number may reachable
$request->setDocCode($committ);
vmdebug('Request as SalesInvoice with invoiceNumber ' . $committ);
} else {
$request->setDocType(DocumentType::$SalesOrder);
$request->setCommit(false);
//invoice number, problem is that the invoice number is at this time not known, neither the order_number
$request->setDocCode('VM2.0.16_order_request');
vmdebug('Request as SalesOrder');
}
$request->setDocDate(date('Y-m-d'));
//date
//$request->setSalespersonCode(""); // string Optional
$request->setCustomerCode($shopperData['customer_id']);
//string Required
if (isset($shopperData['tax_usage_type'])) {
$request->setCustomerUsageType($shopperData['tax_usage_type']);
//string Entity Usage
}
$cartPrices = $calculationHelper->getCartPrices();
//vmdebug('$cartPrices',$cartPrices);
$request->setDiscount($cartPrices['discountAmount']);
//decimal
//$request->setDiscount(0.0);
// $request->setPurchaseOrderNo(""); //string Optional
//.........这里部分代码省略.........
示例15: getAddressesByRayon
public function getAddressesByRayon($address, $rayon)
{
$list = [];
try {
if (!parent::getBdd()->inTransaction()) {
parent::getBdd()->beginTransaction();
}
$query = "SELECT *, ( 6371 * acos( cos( radians(:latitude) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:longitude) )\n + sin( radians(:latitude) ) * sin( radians( latitude ) ) ) ) AS distance FROM address HAVING distance < :rayon ORDER BY distance LIMIT 0 , 150;";
$request = parent::getBdd()->prepare($query);
$request->bindParam(':latitude', $address->getLatitude());
$request->bindParam(':longitude', $address->getLongitude());
$request->bindParam(':rayon', $rayon);
$request->execute();
while ($data = $request->fetch()) {
$address = new Address();
$address->setId($data['id']);
$address->setLine1($data['line1']);
$address->setLine2($data['line2']);
$address->setZipCode($data['zipcode']);
$address->setCity($data['city']);
$address->setLatitude($data['latitude']);
$address->setLongitude($data['longitude']);
array_push($list, $address);
}
if ($list == []) {
return null;
}
return $list;
} catch (Exception $e) {
error_log($e->getMessage());
}
return null;
}