Stores the given or fetched billing address in the basket.
763435
public function process()
	{
		$view = $this->getView();

		try
		{
			// only start if there's something to do
			if( $view->param( 'ca_billingoption', null ) === null ) {
				return;
			}

			$this->setAddress( $view );

			parent::process();
		}
		catch( \Aimeos\Controller\Frontend\Exception $e )
		{
			$view->billingError = $e->getErrorList();
			throw $e;
		}
	}
188532
private function processBillingAddress($orderData)
    {
        if ($orderData->getBillingAddress()) {
            $billingData = $orderData->getBillingAddress()->getData();
            $this->billingAddress = [
                'billing_address_1' => $this->_getStreet(
                    $billingData['street'],
                    1
                ),
                'billing_address_2' => $this->_getStreet(
                    $billingData['street'],
                    2
                ),
                'billing_city' => $billingData['city'],
                'billing_region' => $billingData['region'],
                'billing_country' => $billingData['country_id'],
                'billing_postcode' => $billingData['postcode'],
            ];
        }
    }
697127
def get_address(self, address):
        
        
        params = self.build_basic_request()
        params['address'] = address

        response = util.call_api("merchant/{0}/address_balance".format(self.identifier), params,
                                 base_url=self.service_url)
        json_response = json.loads(response)
        self.parse_error(json_response)
        return Address(json_response['balance'],
                       json_response['address'],
                       None,
                       json_response['total_received'])
1190447
public function ChangeSelectedAddress()
    {
        $this->SetPreventProcessStepMethodFromExecuting(true);
        // the method only works if the user is logged in
        $oUser = self::getExtranetUserProvider()->getActiveUser();
        if ($oUser->IsLoggedIn()) {
            $sNewShippingAddressId = $this->GetShippingAddressData('selectedAddressId');
            $sNewBillingAddressId = $this->GetBillingAddressData('selectedAddressId');

            if ('1' == $this->GetShipToBillingAddress()) {
                if (0 != strcmp($sNewBillingAddressId, $sNewShippingAddressId)) {
                    if (TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING == $this->AddressUsedAsPrimaryAddress()) {
                        $sNewShippingAddressId = $sNewBillingAddressId;
                    } else {
                        $sNewBillingAddressId = $sNewShippingAddressId;
                    }
                }
            } else {
                // they were different.. if they are now the same, we should set the new state
                if (0 == strcmp($sNewBillingAddressId, $sNewShippingAddressId)) {
                    $this->SetShipToBillingAddress('1');
                }
            }

            if (!empty($sNewBillingAddressId)) {
                if ('new' != $sNewBillingAddressId) {
                    $oNewBillingAdr = $oUser->SetAddressAsBillingAddress($sNewBillingAddressId);
                    if ($oNewBillingAdr) {
                        $this->SetBillingAddressData($oNewBillingAdr->sqlData);
                    } else {
                        // invalid request...
                        if (false == $this->GetBillingAddressData('selectedAddressId')) {
                            // there was nothing selected... so we get an an alternative
                            $sNewBillingAddressId = $this->GetAnotherAddressFromUser($sNewBillingAddressId, TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING);
                            $oNewBillingAdr = $oUser->SetAddressAsBillingAddress($sNewBillingAddressId);
                            if ($oNewBillingAdr) {
                                $this->SetBillingAddressData($oNewBillingAdr->sqlData);
                            } else {
                                $this->SetBillingAddressData(array('selectedAddressId' => 'new'));
                            }
                        }
                    }
                } else {
                    $this->SetBillingAddressData(array('selectedAddressId' => 'new'));
                }
            }

            if (!empty($sNewShippingAddressId)) {
                if ('new' != $sNewShippingAddressId) {
                    $oNewShippingAdr = $oUser->SetAddressAsShippingAddress($sNewShippingAddressId);
                    if ($oNewShippingAdr) {
                        $this->SetShippingAddressData($oNewShippingAdr->sqlData);
                    } else {
                        // invalid request...
                        if (false == $this->GetShippingAddressData('selectedAddressId')) {
                            // there was nothing selected... so we get an an alternative
                            $sNewShippingAddressId = $this->GetAnotherAddressFromUser($sNewBillingAddressId, TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
                            $oNewShippingAdr = $oUser->SetAddressAsShippingAddress($sNewShippingAddressId);
                            if ($oNewShippingAdr) {
                                $this->SetShippingAddressData($oNewShippingAdr->sqlData);
                            } else {
                                $this->SetShippingAddressData(array('selectedAddressId' => 'new'));
                            }
                        }
                    }
                } else {
                    $this->SetShippingAddressData(array('selectedAddressId' => 'new'));
                }
            }

            // check if shipping != billing AND ShipToBillingAddress() == '1' or the other way around. if that is the case,
            // then we need to adjust ShipToBillingAddress to match the new setting
            if (1 == $this->GetShipToBillingAddress() && $this->GetShippingAddressData('selectedAddressId') != $this->GetBillingAddressData('selectedAddressId')) {
                $this->SetShipToBillingAddress(0);
            } elseif (0 == $this->GetShipToBillingAddress() && $this->GetShippingAddressData('selectedAddressId') == $this->GetBillingAddressData('selectedAddressId')) {
                $this->SetShipToBillingAddress(1);
            }
            TShopBasket::GetInstance()->RecalculateBasket();
        }
    }
176202
def updateSquareFees(paymentRecord):
    '''
    
    '''

    fees = paymentRecord.netFees
    invoice = paymentRecord.invoice
    invoice.fees = fees
    invoice.save()
    invoice.allocateFees()
    return fees
736496
private function _calculateOrderTotalBasedOnBuyerDestinationAddress()
    {
        $response = $this->callStepAndCheckForException('getOrderReferenceDetails');
        
        $this->printResponseToWebpage(
            "printGetOrderReferenceDetailsResponse", array($response)
        );

        $orderTotalPreTaxAndShipping
            = $this->_getPreTaxAndShippingOrderAmountFromQueryParams();
        $shippingType = $this->_getShippingTypeFromQueryParams();
    
        return $this->exampleClass->calculateOrderTotalBasedOnBuyerDetails(
            $response->getGetOrderReferenceDetailsResult()->getOrderReferenceDetails(),
            $orderTotalPreTaxAndShipping,
            $shippingType
        );
    }
245407
protected function InitShippingAddress()
    {
        $inputFilterUtil = $this->getInputFilterUtil();
        $shippingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_SHIPPING);
        if (null !== $shippingAddressData) {
            $this->SetShippingAddressData($shippingAddressData);
            $this->bUserDataSubmission = true;
        } else {
            $billingAddressData = $inputFilterUtil->getFilteredPostInput(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING);
            if (null !== $billingAddressData && TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING == $this->AddressUsedAsPrimaryAddress()) {
                $this->SetShippingAddressData($this->GetBillingAddressData());
            } else {
                $oUser = self::getExtranetUserProvider()->getActiveUser();
                $oShipping = $oUser->GetShippingAddress();
                $aShipping = array();
                if ($oShipping) {
                    $aShipping = $oShipping->sqlData;
                }
                $this->SetShippingAddressData($aShipping);
            }
        }
    }
402482
private function _calculatePaymentAmountBasedOnBuyerDestinationAddress ()
    {
        $response = $this->callStepAndCheckForException('getBillingAgreementDetails');
        
        $this->printResponseToWebpage("printGetBillingAgreementDetailsResponse", array(
            $response
        ));
        
        $paymentAmountPreTaxAndShipping = $this->_getPreTaxAndShippingPaymentAmountFromQueryParams();
        $shippingType = $this->_getShippingTypeFromQueryParams();
        
        return $this->exampleClass->calculatePaymentAmountBasedOnBuyerDetails(
                $response->getGetBillingAgreementDetailsResult()
                    ->getBillingAgreementDetails(), $paymentAmountPreTaxAndShipping, $shippingType);
    }
1239452
protected function addAddress()
    {
        if (!$this->isError()) {

            $id = $this->address->add($this->getSubmitted());

            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }

            $this->line($id);
        }
    }
840989
def update_billing_info(self, billing_info):
        """"""
        url = urljoin(self._url, '/billing_info')
        response = billing_info.http_request(url, 'PUT', billing_info,
            {'Content-Type': 'application/xml; charset=utf-8'})
        if response.status == 200:
            pass
        elif response.status == 201:
            billing_info._url = response.getheader('Location')
        else:
            billing_info.raise_http_error(response)

        response_xml = response.read()
        logging.getLogger('recurly.http.response').debug(response_xml)
        billing_info.update_from_element(ElementTree.fromstring(response_xml))
259380
def handle_address_save(self, sender, instance, **kwargs):
    
    objects = self.find_associated_with_address(instance)
    for obj in objects:
      self.handle_save(obj.__class__, obj)
433569
private function setSenderPhone()
    {
        $addressData = ($this->getBillingAddress())
            ? $this->getBillingAddress()
            : $this->_order->getShippingAddress();

        if (! empty($addressData['telephone'])) {
            $phone = \UOL\PagSeguro\Helper\Data::formatPhone($addressData['telephone']);
            $this->_paymentRequest->setSender()->setPhone()->withParameters(
                $phone['areaCode'],
                $phone['number']
            );
        }
    }
962073
def spendables_for_address(self, address):
        
        spendables = []
        url_append = "?unspentOnly=true&token=%s&includeScript=true" % self.api_key
        url = self.base_url("addrs/%s%s" % (address, url_append))
        result = json.loads(urlopen(url).read().decode("utf8"))
        for txn in result.get("txrefs", []):
            coin_value = txn.get("value")
            script = h2b(txn.get("script"))
            previous_hash = h2b_rev(txn.get("tx_hash"))
            previous_index = txn.get("tx_output_n")
            spendables.append(Tx.Spendable(coin_value, script, previous_hash, previous_index))
        return spendables
364911
public function Init()
    {
        parent::Init();
        $oUser = TdbDataExtranetUser::GetInstance();
        $shippingAddress = $oUser->GetShippingAddress();
        if (true === $shippingAddress->getIsAmazonShippingAddress()) {
            $oUser->resetAmazonAddresses();
            $basket = $this->getShopService()->getActiveBasket();
            $basket->RecalculateBasket(); // need to recalculate maybe changing address can change basket amount (gross net change)
        }
    }
58130
public void billingAccount_PUT(String billingAccount, OvhBillingAccount body) throws IOException {
		String qPath = "/telephony/{billingAccount}";
		StringBuilder sb = path(qPath, billingAccount);
		exec(qPath, "PUT", sb.toString(), body);
	}
808459
def create_order(email,
                 request,
                 addresses=None,
                 shipping_address=None,
                 billing_address=None,
                 shipping_option=None,
                 capture_payment=False):
    
    basket_items, _ = get_basket_items(request)
    if addresses:
        # Longclaw < 0.2 used 'shipping_name', longclaw > 0.2 uses a consistent
        # prefix (shipping_address_xxxx)
        try:
            shipping_name = addresses['shipping_name']
        except KeyError:
            shipping_name = addresses['shipping_address_name']

        shipping_country = addresses['shipping_address_country']
        if not shipping_country:
            shipping_country = None
        shipping_address, _ = Address.objects.get_or_create(name=shipping_name,
                                                            line_1=addresses[
                                                                'shipping_address_line1'],
                                                            city=addresses[
                                                                'shipping_address_city'],
                                                            postcode=addresses[
                                                                'shipping_address_zip'],
                                                            country=shipping_country)
        shipping_address.save()
        try:
            billing_name = addresses['billing_name']
        except KeyError:
            billing_name = addresses['billing_address_name']
        billing_country = addresses['shipping_address_country']
        if not billing_country:
            billing_country = None
        billing_address, _ = Address.objects.get_or_create(name=billing_name,
                                                           line_1=addresses[
                                                               'billing_address_line1'],
                                                           city=addresses[
                                                               'billing_address_city'],
                                                           postcode=addresses[
                                                               'billing_address_zip'],
                                                           country=billing_country)
        billing_address.save()
    else:
        shipping_country = shipping_address.country

    ip_address = get_real_ip(request)
    if shipping_country and shipping_option:
        site_settings = Configuration.for_site(request.site)
        shipping_rate = get_shipping_cost(
            site_settings,
            shipping_address.country.pk,
            shipping_option)['rate']
    else:
        shipping_rate = Decimal(0)

    order = Order(
        email=email,
        ip_address=ip_address,
        shipping_address=shipping_address,
        billing_address=billing_address,
        shipping_rate=shipping_rate
    )
    order.save()

    # Create the order items & compute total
    total = 0
    for item in basket_items:
        total += item.total()
        order_item = OrderItem(
            product=item.variant,
            quantity=item.quantity,
            order=order
        )
        order_item.save()

    if capture_payment:
        desc = 'Payment from {} for order id #{}'.format(email, order.id)
        try:
            transaction_id = GATEWAY.create_payment(request,
                                                    total + shipping_rate,
                                                    description=desc)
            order.payment_date = timezone.now()
            order.transaction_id = transaction_id
            # Once the order has been successfully taken, we can empty the basket
            destroy_basket(request)
        except PaymentError:
            order.status = order.FAILURE

        order.save()

    return order
29588
private function save_billing_address($data)
    {
        $member = Security::getCurrentUser();
        
        // If the user ticked "save address" then add to their account
        if ($member && array_key_exists('SaveBillingAddress', $data) && $data['SaveBillingAddress'] == 1) {
            // First save the details to the users account if they aren't set
            // We don't save email, as this is used for login
            $member->FirstName = ($member->FirstName) ? $member->FirstName : $data['FirstName'];
            $member->Surname = ($member->Surname) ? $member->Surname : $data['Surname'];
            $member->write();

            $contact = $member->Contact();
            $this->saveInto($contact);
            $contact->write();

            $address = ContactLocation::create();
            $this->saveInto($address);
            $address->ContactID = $contact->ID;
            $address->write();
        }
    }