/** * Armazena as informações passadas via formulário no frontend * @access public * @param array $data * @return Uecommerce_Mundipagg_Model_Standard */ public function assignData($data) { parent::assignData($data); }
/** * Armazena as informações passadas via formulário no frontend * @access public * @param array $data * @return Uecommerce_Mundipagg_Model_Standard */ public function assignData($data) { $info = $this->getInfoInstance(); // Reset interests first $this->resetInterest($info); $cctype = $data[$this->_code . '_1_1_cc_type']; if (isset($data[$this->_code . '_token_1_1']) && $data[$this->_code . '_token_1_1'] != 'new') { $parcelsNumber = $data[$this->_code . '_credito_parcelamento_1_1']; $cardonFile = Mage::getModel('mundipagg/cardonfile')->load($data[$this->_code . '_token_1_1']); $cctype = Mage::getSingleton('mundipagg/source_cctypes')->getCcTypeForLabel($cardonFile->getCcType()); } else { $parcelsNumber = $data[$this->_code . '_new_credito_parcelamento_1_1']; } /** * @var $interest Uecommerce_Mundipagg_Helper_Installments */ $interest = Mage::helper('mundipagg/installments')->getInterestForCard($parcelsNumber, $cctype); $interestInformation = array(); $interestInformation[$this->_code . '_1_1'] = new Varien_Object(); $interestInformation[$this->_code . '_1_1']->setInterest(str_replace(',', '.', $interest)); if ($interest > 0) { $info->setAdditionalInformation('mundipagg_interest_information', array()); $info->setAdditionalInformation('mundipagg_interest_information', $interestInformation); $this->applyInterest($info, $interest); } else { // If none of Cc parcels doens't have interest we reset interest $this->resetInterest($info); } parent::assignData($data); }
/** * Armazena as informações passadas via formulário no frontend * @access public * @param array $data * @return Uecommerce_Mundipagg_Model_Standard */ public function assignData($data) { $info = $this->getInfoInstance(); $this->resetInterest($info); parent::assignData($data); $cctype1 = $data[$this->_code . '_3_1_cc_type']; if (isset($data[$this->_code . '_token_3_1']) && $data[$this->_code . '_token_3_1'] != 'new') { $parcelsNumber1 = $data[$this->_code . '_credito_parcelamento_3_1']; $cardonFile = Mage::getModel('mundipagg/cardonfile')->load($data[$this->_code . '_token_3_1']); $cctype1 = Mage::getSingleton('mundipagg/source_cctypes')->getCcTypeForLabel($cardonFile->getCcType()); $value1 = $data[$this->_code . '_value_3_1']; } else { $parcelsNumber1 = $data[$this->_code . '_new_credito_parcelamento_3_1']; $value1 = $data[$this->_code . '_new_value_3_1']; } $cctype2 = $data[$this->_code . '_3_2_cc_type']; if (isset($data[$this->_code . '_token_3_2']) && $data[$this->_code . '_token_3_2'] != 'new') { $parcelsNumber2 = $data[$this->_code . '_credito_parcelamento_3_2']; $cardonFile = Mage::getModel('mundipagg/cardonfile')->load($data[$this->_code . '_token_3_2']); $cctype2 = Mage::getSingleton('mundipagg/source_cctypes')->getCcTypeForLabel($cardonFile->getCcType()); $value2 = $data[$this->_code . '_value_3_2']; } else { $parcelsNumber2 = $data[$this->_code . '_new_credito_parcelamento_3_2']; $value2 = $data[$this->_code . '_new_value_3_2']; } $cctype3 = $data[$this->_code . '_3_3_cc_type']; if (isset($data[$this->_code . '_token_3_3']) && $data[$this->_code . '_token_3_3'] != 'new') { $parcelsNumber3 = $data[$this->_code . '_credito_parcelamento_3_3']; $cardonFile = Mage::getModel('mundipagg/cardonfile')->load($data[$this->_code . '_token_3_3']); $cctype3 = Mage::getSingleton('mundipagg/source_cctypes')->getCcTypeForLabel($cardonFile->getCcType()); $value3 = $data[$this->_code . '_value_3_3']; } else { $parcelsNumber3 = $data[$this->_code . '_new_credito_parcelamento_3_3']; $value3 = $data[$this->_code . '_new_value_3_3']; } $interest1 = 0; $interest2 = 0; $interest3 = 0; $interestInformation = array(); if (Mage::app()->getRequest()->getActionName() == 'partialPost') { $keyCode = $this->_code . '_partial'; $interestInformation = $info->getAdditionalInformation('mundipagg_interest_information'); } else { $keyCode = $this->_code; } if ($cctype1) { $interest1 = Mage::helper('mundipagg/installments')->getInterestForCard($parcelsNumber1, $cctype1, $value1); $interestInformation[$keyCode . '_3_1'] = new Varien_Object(); $interestInformation[$keyCode . '_3_1']->setInterest(str_replace(',', '.', $interest1))->setValue(str_replace(',', '.', $value1)); } if ($cctype2) { $interest2 = Mage::helper('mundipagg/installments')->getInterestForCard($parcelsNumber2, $cctype2, $value2); $interestInformation[$keyCode . '_3_2'] = new Varien_Object(); $interestInformation[$keyCode . '_3_2']->setInterest(str_replace(',', '.', $interest2))->setValue(str_replace(',', '.', $value2)); } if ($cctype3) { $interest3 = Mage::helper('mundipagg/installments')->getInterestForCard($parcelsNumber3, $cctype3, $value3); $interestInformation[$keyCode . '_3_3'] = new Varien_Object(); $interestInformation[$keyCode . '_3_3']->setInterest(str_replace(',', '.', $interest3))->setValue(str_replace(',', '.', $value3)); } $interest = $interest1 + $interest2 + $interest3; if ($interest > 0) { $info->setAdditionalInformation('mundipagg_interest_information', array()); $info->setAdditionalInformation('mundipagg_interest_information', $interestInformation); $this->applyInterest($info, $interest); } else { // If none of Cc parcels doens't have interest we reset interest $this->resetInterest($info); } return $this; }
/** * Armazena as informações passadas via formulário no frontend * @access public * @param array $data * @return Uecommerce_Mundipagg_Model_Standard */ public function assignData($data) { if (!$data instanceof Varien_Object) { $data = new Varien_Object($data); } $info = $this->getInfoInstance(); // Reset interests from old methods first $this->resetInterest($info); parent::assignData($data); }