예제 #1
0
 /**
  * Set correct values on subscription address based on given subscription and order address
  *
  * @param Adyen_Subscription_Model_Subscription $subscription
  * @param Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address $address
  * @return $this
  */
 public function initAddress(Adyen_Subscription_Model_Subscription $subscription, $address)
 {
     $this->setSubscriptionId($subscription->getId());
     // Reset (possible) original values
     $this->setOrderAddressId(null)->setCustomerAddressId(null)->setQuoteAddressId(null);
     if ($address->getAddressType() == Mage_Sales_Model_Order_Address::TYPE_BILLING) {
         $this->setType(self::ADDRESS_TYPE_BILLING);
     } else {
         $this->setType(self::ADDRESS_TYPE_SHIPPING);
     }
     // Note: Only use customer address if 'save_in_address_book' or 'same_as_billing'
     // is also checked at the address, because it's not enough to rely solely on the
     // customer address ID, because an address can be changed when creating an order
     // in the backend, but this ID still remains when a quote is converted to an order
     if ($address->getCustomerAddressId() && $address->getData('save_in_address_book')) {
         // Create customer address
         $this->setSource(self::ADDRESS_SOURCE_CUSTOMER)->setCustomerAddressId($address->getCustomerAddressId());
     } elseif ($address instanceof Mage_Sales_Model_Quote_Address) {
         // Create quote address
         $this->setSource(self::ADDRESS_SOURCE_QUOTE)->setQuoteAddressId($address->getId());
     } else {
         // Create order address
         $this->setSource(self::ADDRESS_SOURCE_ORDER)->setOrderAddressId($address->getId());
     }
     return $this;
 }
예제 #2
0
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $active = Mage::helper('giftwrap')->enableGiftwrap();
     if (!$active) {
         return;
     }
     if (Mage::app()->getStore()->isAdmin()) {
         return $this;
     }
     $items = $address->getAllItems();
     if (!count($items)) {
         return $this;
     }
     $address_id = $address->getId();
     /*
      * 	update of version 0.2.2
      */
     $giftwrapAmount = Mage::helper('giftwrap')->giftwrapAmount(null, $address_id);
     $address->setGiftwrapAmount($giftwrapAmount);
     $address->setBaseGiftwrapAmount(0);
     //var_dump($address->getData());die();
     // if($giftwrapAmount>0){
     // $taxAmount = 10;
     // $address->setTaxAmount($address->getTaxAmount() + $taxAmount);
     // $address->setBaseTaxAmount($address->getBaseTaxAmount() + $taxAmount);
     // }
     Mage::getModel('core/session')->setData('giftwrap_amount', $giftwrapAmount);
     $address->setGrandTotal($address->getGrandTotal() + $address->getGiftwrapAmount());
     $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getGiftwrapAmount());
     //var_dump($address->getData());die();
     return $this;
 }
 /**
  * Set correct values on subscription address based on given subscription and order address
  *
  * @param Adyen_Subscription_Model_Subscription $subscription
  * @param Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address $address
  * @return $this
  */
 public function initAddress(Adyen_Subscription_Model_Subscription $subscription, $address)
 {
     $this->setSubscriptionId($subscription->getId());
     // Reset (possible) original values
     $this->setOrderAddressId(null)->setCustomerAddressId(null)->setQuoteAddressId(null);
     if ($address->getAddressType() == Mage_Sales_Model_Order_Address::TYPE_BILLING) {
         $this->setType(self::ADDRESS_TYPE_BILLING);
     } else {
         $this->setType(self::ADDRESS_TYPE_SHIPPING);
     }
     if ($address instanceof Mage_Sales_Model_Quote_Address) {
         // Create quote address
         $this->setSource(self::ADDRESS_SOURCE_QUOTE)->setQuoteAddressId($address->getId());
     } else {
         // Create order address
         $this->setSource(self::ADDRESS_SOURCE_ORDER)->setOrderAddressId($address->getId());
     }
     return $this;
 }
예제 #4
0
파일: Rule.php 프로젝트: blazeriaz/youguess
 /**
  * Return id for address
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  string
  */
 private function _getAddressId($address)
 {
     if ($address instanceof Mage_Sales_Model_Quote_Address) {
         return $address->getId();
     }
     return $address;
 }
예제 #5
0
 public function addAddress(Mage_Sales_Model_Quote_Address $address)
 {
     $address->setQuote($this);
     if (!$address->getId()) {
         $this->getAddressesCollection()->addItem($address);
     }
     return $this;
 }
예제 #6
0
 /**
  * Checks the shipping address is equal with billing address
  *
  * ATTENTION!!!
  * It should be removed when mobile app will send just the 'use_for_shipping' flag
  * instead of send shipping address same as a billing address
  *
  * @todo Remove when mobile app will send just the 'use_for_shipping' flag
  * @param array $data
  * @param Mage_Sales_Model_Quote_Address $billingAddress
  * @param integer $shippingAddressId
  * @return bool
  */
 protected function _checkUseForShipping(array $data, $billingAddress, $shippingAddressId)
 {
     $useForShipping = !$shippingAddressId || $billingAddress->getId() == $shippingAddressId;
     if ($useForShipping) {
         foreach ($data as $key => $value) {
             if ($key == 'save_in_address_book') {
                 continue;
             }
             $billingData = $billingAddress->getDataUsingMethod($key);
             if (is_array($value) && is_array($billingData)) {
                 foreach ($value as $k => $v) {
                     if (!isset($billingData[$k]) || $billingData[$k] != trim($v)) {
                         $useForShipping = false;
                         break;
                     }
                 }
             } else {
                 if (is_string($value) && $billingData != trim($value)) {
                     $useForShipping = false;
                     break;
                 } else {
                     $useForShipping = false;
                     break;
                 }
             }
         }
     }
     return $useForShipping;
 }
예제 #7
0
 /**
  * @param Mage_Sales_Model_Quote_Address $address
  * @return $this|Mage_Sales_Model_Quote_Address_Total_Abstract
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $helper = Mage::helper('mageworx_multifees');
     if ($address->getSubtotal() == 0 && floatval($address->getCustomerCreditAmount()) == 0) {
         return $this;
     }
     if ($this->_collected) {
         return $this;
     }
     ////////////////////////////////////////////////////////////////////
     $subtotalRowTOTAL = 0;
     $CompanyTotal = 0;
     $PersonTotal = 0;
     $quote = Mage::getSingleton('checkout/cart')->getQuote();
     $cartItems = $quote->getAllVisibleItems();
     $userGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
     foreach ($cartItems as $item) {
         $subtotalRow = 0;
         $_product = Mage::getModel('catalog/product')->load($item->getProductId());
         $ids = $_product->getCategoryIds();
         $productId = $item->getProductId();
         $qty = $item->getQty();
         $price = $item->getProduct()->getPrice();
         $subtotalRow = $subtotalRow + $price * $qty;
         //If the product has perception tax for persons
         if (array_search("372", $ids) != false && $subtotalRow >= 100) {
             $PersonTotal = $PersonTotal + $subtotalRow;
         }
         //If the product has perception tax for persons
         if (array_search("373", $ids) != false) {
             $CompanyTotal = $CompanyTotal + $subtotalRow;
         }
     }
     //If the user is Not log in
     if ($userGroupId == 0 || $userGroupId == 8) {
         $subtotalRowTOTAL = $PersonTotal;
         $subtotalRowTOTAL = $subtotalRowTOTAL / 1.18;
     } elseif ($userGroupId == 8) {
         $subtotalRowTOTAL = $CompanyTotal;
         $subtotalRowTOTAL = $subtotalRowTOTAL / 1.18;
     } else {
         $subtotalRowTOTAL = 0;
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////
     $baseSubtotalRow = floatval($subtotalRowTOTAL);
     $baseSubtotal = floatval($address->getBaseSubtotalWithDiscount());
     $baseShipping = floatval($address->getBaseShippingAmount());
     // - $address->getBaseShippingTaxAmount()
     $baseTax = floatval($address->getBaseTaxAmount());
     //amount
     $address->setMultifeesAmount(0);
     $address->setBaseMultifeesAmount(0);
     $address->setDetailsMultifees(null);
     $quote = $address->getQuote();
     $feeMessages = new Varien_Data_Collection();
     // add payment fee (front and admin)
     if (Mage::app()->getRequest()->getPost('is_payment_fee', false)) {
         $feesPost = Mage::app()->getRequest()->getPost('fee', array());
         foreach ($feesPost as $feeId => $data) {
             if (isset($data['message'])) {
                 $obj = new Varien_Object();
                 $obj->setFeeId($feeId);
                 $obj->setMessage($data['message']);
                 $feeMessages->addItem($obj);
             }
         }
         $helper->addFeesToCart($feesPost, $quote->getStoreId(), false, 2, 0);
     }
     // add shipping fee (front and admin)
     if (Mage::app()->getRequest()->getPost('is_shipping_fee', false)) {
         $feesPost = Mage::app()->getRequest()->getPost('fee', array());
         foreach ($feesPost as $feeId => $data) {
             if (isset($data['message'])) {
                 $obj = new Varien_Object();
                 $obj->setFeeId($feeId);
                 $obj->setMessage($data['message']);
                 $feeMessages->addItem($obj);
             }
         }
         $helper->addFeesToCart($feesPost, $quote->getStoreId(), false, 3, 0);
     }
     $feesData = $helper->getQuoteDetailsMultifees($address->getId());
     // autoadd default cart fees, no hidden
     if (is_null($feesData) && $helper->isEnableCartFees()) {
         $this->autoAddFeesByParams(1, 0, 2, 1, '', $quote, $address, $helper, null);
     }
     // autoadd hidden cart fees
     if ($helper->isEnableCartFees()) {
         $this->autoAddFeesByParams(1, 0, 1, 1, '', $quote, $address, $helper, null);
     }
     // autoadd hidden shipping fees
     if ($helper->isEnableShippingFees() && $address->getShippingMethod()) {
         $this->autoAddFeesByParams(3, 0, 1, 1, strval($address->getShippingMethod()), $quote, $address, $helper, $feeMessages);
     }
     // autoadd hidden fees
     if ($helper->isEnablePaymentFees() && $quote->getPayment()->getMethod()) {
         // autoadd default payment fees, no hidden
         if (is_null($feesData) && Mage::app()->getRequest()->getControllerName() == 'express') {
             $this->autoAddFeesByParams(2, 0, 3, 1, $quote->getPayment()->getMethod(), $quote, $address, $helper, null);
         }
         // autoadd hidden payment fees
         $this->autoAddFeesByParams(2, 0, 1, 1, $quote->getPayment()->getMethod(), $quote, $address, $helper, $feeMessages);
     }
     $feesData = $helper->getQuoteDetailsMultifees($address->getId());
     if (!is_array($feesData) || count($feesData) == 0) {
         return $this;
     }
     // check conditions added fees
     // get all possible fees
     $possibleFeesCollection = $helper->getMultifees(0, 0, 0, 0, '', $quote, $address);
     $possibleFees = array();
     foreach ($possibleFeesCollection as $fee) {
         $possibleFees[$fee->getId()] = $fee;
     }
     $store = $quote->getStore();
     $baseMultifeesAmount = 0;
     $baseMultifeesTaxAmount = 0;
     foreach ($feesData as $feeId => $data) {
         if (!isset($data['options']) || !isset($possibleFees[$feeId])) {
             unset($feesData[$feeId]);
             continue;
         }
         $baseMultifeesLeft = 0;
         $appliedTotals = $data['applied_totals'];
         foreach ($appliedTotals as $field) {
             switch ($field) {
                 case 'subtotal':
                     $baseMultifeesLeft += $baseSubtotal;
                     break;
                 case 'shipping':
                     $baseMultifeesLeft += $baseShipping;
                     break;
                 case 'tax':
                     $baseMultifeesLeft += $baseTax;
                     break;
                 case 'rowsubtotal':
                     $baseMultifeesLeft += $baseSubtotalRow;
                     break;
             }
         }
         $taxClassId = $data['tax_class_id'];
         // Caluclation the subtotal/discount with/without tax
         $baseSubtotal = floatval($address->getBaseSubtotal());
         $discountAmount = $address->getBaseDiscountAmount();
         if (Mage::helper('tax')->discountTax()) {
             // check discount with tax
             $discountAmount = floatval($helper->getPriceExcludeTax($discountAmount, $quote, $data['tax_class_id']));
         }
         $baseSubtotal = floatval($baseSubtotal + $discountAmount);
         /////////////////////
         //Custom
         //////////////////////
         $baseSubtotalRow = floatval($baseSubtotalRow + $discountAmount);
         $feePrice = 0;
         $feeTax = 0;
         foreach ($data['options'] as $optionId => $value) {
             if (isset($value['percent'])) {
                 $opBasePrice = $baseMultifeesLeft * $value['percent'] / 100;
             } else {
                 $opBasePrice = $value['base_price'] * $possibleFees[$feeId]->getFoundQty($address->getId());
             }
             $opPrice = $store->convertPrice($opBasePrice);
             if ($helper->isTaxСalculationIncludesTax()) {
                 $opBaseTax = $opBasePrice - $helper->getPriceExcludeTax($opBasePrice, $quote, $taxClassId, $address);
                 $opTax = $opPrice - $helper->getPriceExcludeTax($opPrice, $quote, $taxClassId, $address);
             } else {
                 // add tax
                 $opBasePrice += $opBaseTax = $helper->getTaxPrice($opBasePrice, $quote, $taxClassId, $address);
                 $opPrice += $opTax = $helper->getTaxPrice($opPrice, $quote, $taxClassId, $address);
             }
             // round price
             $opBasePrice = $store->roundPrice($opBasePrice);
             $opPrice = $store->roundPrice($opPrice);
             $opBaseTax = $store->roundPrice($opBaseTax);
             $opTax = $store->roundPrice($opTax);
             //$opPrice, $opBasePrice = inclTax
             $feesData[$feeId]['options'][$optionId]['base_price'] = $opBasePrice;
             $feesData[$feeId]['options'][$optionId]['price'] = $opPrice;
             $feesData[$feeId]['options'][$optionId]['base_tax'] = $opBaseTax;
             $feesData[$feeId]['options'][$optionId]['tax'] = $opTax;
             $feeTax += $opBaseTax;
             $feePrice += $opBasePrice;
         }
         $feesData[$feeId]['base_price'] = $feePrice;
         $feesData[$feeId]['price'] = $store->convertPrice($feePrice);
         $feesData[$feeId]['base_tax'] = $feeTax;
         $feesData[$feeId]['tax'] = $store->convertPrice($feeTax);
         $baseMultifeesAmount += $feePrice;
         $baseMultifeesTaxAmount += $feeTax;
     }
     $multifeesAmount = $store->roundPrice($store->convertPrice($baseMultifeesAmount));
     $baseMultifeesAmount = $store->roundPrice($baseMultifeesAmount);
     $multifeesTaxAmount = $store->roundPrice($store->convertPrice($baseMultifeesTaxAmount));
     $baseMultifeesTaxAmount = $store->roundPrice($baseMultifeesTaxAmount);
     if ($helper->isIncludeFeeInShippingPrice()) {
         $address->setBaseShippingAmount($baseMultifeesAmount - $baseMultifeesTaxAmount + $address->getBaseShippingAmount());
         $address->setShippingAmount($multifeesAmount - $multifeesTaxAmount + $address->getShippingAmount());
         $address->setBaseShippingTaxAmount($baseMultifeesTaxAmount + $address->getBaseShippingTaxAmount());
         $address->setShippingTaxAmount($multifeesTaxAmount + $address->getShippingTaxAmount());
         $address->setBaseShippingInclTax($baseMultifeesAmount + $address->getBaseShippingInclTax());
         $address->setShippingInclTax($multifeesAmount + $address->getShippingInclTax());
         $address->setBaseGrandTotal($address->getBaseGrandTotal() + $baseMultifeesAmount - $baseMultifeesTaxAmount);
         $address->setGrandTotal($address->getGrandTotal() + $multifeesAmount - $multifeesTaxAmount);
     } else {
         $address->setBaseMultifeesAmount($baseMultifeesAmount);
         $address->setMultifeesAmount($multifeesAmount);
         $address->setBaseMultifeesTaxAmount($baseMultifeesTaxAmount);
         $address->setMultifeesTaxAmount($multifeesTaxAmount);
         $address->setDetailsMultifees(serialize($feesData));
         $address->setBaseTotalAmount('multifees', $baseMultifeesAmount);
         $address->setTotalAmount('multifees', $multifeesAmount);
     }
     $address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseMultifeesTaxAmount);
     $address->setTaxAmount($address->getTaxAmount() + $multifeesTaxAmount);
     // emulation $this->_saveAppliedTaxes($address, $applied, $tax, $baseTax, $rate);
     $appliedTaxes = $address->getAppliedTaxes();
     if (is_array($appliedTaxes)) {
         foreach ($appliedTaxes as $row) {
             if (isset($appliedTaxes[$row['id']]['amount'])) {
                 $appliedTaxes[$row['id']]['amount'] += $multifeesTaxAmount;
                 $appliedTaxes[$row['id']]['base_amount'] += $baseMultifeesTaxAmount;
                 break;
             }
         }
         $address->setAppliedTaxes($appliedTaxes);
     }
     $this->_collected = true;
     return $this;
 }
예제 #8
0
파일: Tax.php 프로젝트: shabirm/avatax
 /**
  * Add tax totals information to address object
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $config = Mage::getSingleton('tax/config');
     $quote = $address->getQuote();
     $store = $quote->getStore();
     $amount = $address->getTaxAmount();
     $fullInfo = array();
     $summary = Mage::getModel('avatax/avatax_estimate')->getSummary($address->getId());
     foreach ($summary as $key => $row) {
         $id = 'avatax-' . $key;
         $fullInfo[$id] = array('rates' => array(array('code' => $row['name'], 'title' => $row['name'], 'percent' => $row['rate'], 'position' => $key, 'priority' => $key, 'rule_id' => 0)), 'percent' => $row['rate'], 'id' => $id, 'process' => 0, 'amount' => $row['amt'], 'base_amount' => $row['amt']);
     }
     if ($amount != 0 || Mage::helper('tax')->displayZeroTax($store)) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $fullInfo, 'value' => $amount, 'area' => null));
     }
     /**
      * Modify subtotal
      */
     if (method_exists($config, "displayCartSubtotalBoth") && method_exists($config, "displayCartSubtotalInclTax") && ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store))) {
         $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
         $address->setSubtotalInclTax($subtotalInclTax);
         $address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
     }
     return $this;
 }
 /**
  * @param array $args Must contain key/value for:
  *                         - ship_group => eBayEnterprise\RetailOrderManagement\Payload\TaxDutyFee\ITaxedShipGroup
  *                         - address => Mage_Sales_Model_Quote_Address
  *                         May contain key/value for:
  *                         - tax_factory => EbayEnterprise_Tax_Helper_Factory
  *                         - logger => EbayEnterprise_MageLog_Helper_Data
  *                         - log_context => EbayEnterprise_MageLog_Helper_Context
  */
 public function __construct(array $args)
 {
     list($this->_shipGroup, $this->_address, $this->_taxFactory, $this->_logger, $this->_logContext) = $this->_checkTypes($args['ship_group'], $args['address'], $this->_nullCoalesce($args, 'tax_factory', Mage::helper('ebayenterprise_tax/factory')), $this->_nullCoalesce($args, 'logger', Mage::helper('ebayenterprise_magelog')), $this->_nullCoalesce($args, 'log_context', Mage::helper('ebayenterprise_magelog/context')));
     $this->_addressId = $this->_address->getId();
     $this->_quoteId = $this->_address->getQuoteId();
 }
예제 #10
0
파일: Estimate.php 프로젝트: onepica/avatax
 /**
  * Get rates from Avalara
  *
  * @param Mage_Sales_Model_Quote_Address $address
  *
  * @return array
  */
 public function getRates(Mage_Sales_Model_Quote_Address $address)
 {
     if (self::$_hasError) {
         return array('failure' => true);
     }
     /** @var OnePica_AvaTax_Model_Sales_Quote_Address $address */
     $this->_lines = array();
     $this->setCanSendRequest(true);
     //reset flag
     //set up request
     $quote = $address->getQuote();
     $this->_request = new GetTaxRequest();
     $this->_request->setDocType(DocumentType::$SalesOrder);
     $this->_request->setDocCode('quote-' . $address->getId());
     $this->_addGeneralInfo($address);
     $this->_setOriginAddress($quote->getStoreId());
     $this->_setDestinationAddress($address);
     $this->_request->setDetailLevel(DetailLevel::$Line);
     $this->_addItemsInCart($address);
     $this->_addShipping($address);
     //Added code for calculating tax for giftwrap items
     $this->_addGwOrderAmount($address);
     $this->_addGwPrintedCardAmount($address);
     //check to see if we can/need to make the request to Avalara
     $requestKey = $this->_genRequestKey();
     $makeRequest = empty($this->_rates[$requestKey]['items']);
     //@startSkipCommitHooks
     $makeRequest &= count($this->_lineToLineId) ? true : false;
     $makeRequest &= $this->_request->getDestinationAddress() == '' ? false : true;
     $makeRequest &= $address->getId() ? true : false;
     $makeRequest &= !isset($this->_rates[$requestKey]['failure']);
     $makeRequest &= $this->isCanSendRequest();
     //@finishSkipCommitHooks
     //make request if needed and save results in cache
     if ($makeRequest) {
         $result = $this->_send($quote->getStoreId());
         $this->_rates[$requestKey] = array('timestamp' => $this->_getDateModel()->timestamp(), 'address_id' => $address->getId(), 'summary' => array(), 'items' => array(), 'gw_items' => array());
         //success
         /** @var GetTaxResult $result */
         if ($result->getResultCode() == SeverityLevel::$Success) {
             foreach ($result->getTaxLines() as $ctl) {
                 /** @var TaxLine $ctl */
                 $id = $this->_getItemIdByLine($ctl);
                 $code = $this->_getTaxArrayCodeByLine($ctl);
                 $this->_rates[$requestKey][$code][$id] = array('rate' => ($ctl->getTax() ? $ctl->getRate() : 0) * 100, 'amt' => $ctl->getTax(), 'taxable' => $ctl->getTaxable(), 'tax_included' => $ctl->getTaxIncluded());
             }
             $this->_rates[$requestKey]['summary'] = $this->_getSummaryFromResponse($result);
             //failure
         } else {
             $this->_rates[$requestKey]['failure'] = true;
             $this->_rates[$requestKey]['failure_details'] = $this->_getFailureDetails($result);
         }
         Mage::getSingleton('avatax/session')->setRates($this->_rates);
     }
     $rates = isset($this->_rates[$requestKey]) ? $this->_rates[$requestKey] : array();
     return $rates;
 }
예제 #11
0
 /**
  * Copies a given address to the order.
  *
  * @param Mage_Sales_Model_Order         $order
  * @param Mage_Sales_Model_Quote_Address $address
  *
  * @return $this
  *
  * @throws Exception
  */
 public function copyAddressToOrder(Mage_Sales_Model_Order $order, Mage_Sales_Model_Quote_Address $address)
 {
     /**
      * Convert the quote address to an order address and add it to the order.
      */
     $address->load($address->getId());
     $orderAddress = Mage::getModel('sales/convert_quote')->addressToOrderAddress($address);
     $order->addAddress($orderAddress)->save();
     /**
      * This is a fix for the order address missing a parent ID.
      */
     if (!$orderAddress->getParentId()) {
         $orderAddress->setParentId($order->getId());
     }
     /**
      * This is required for some PSP extensions which will not save the PakjeGemak address otherwise.
      */
     $orderAddress->save();
     return $this;
 }