diff --git a/app/code/community/RicardoMartins/PagSeguro/Helper/Params.php b/app/code/community/RicardoMartins/PagSeguro/Helper/Params.php index 6bdf8d8e..d0730773 100644 --- a/app/code/community/RicardoMartins/PagSeguro/Helper/Params.php +++ b/app/code/community/RicardoMartins/PagSeguro/Helper/Params.php @@ -222,7 +222,7 @@ public function getAddressParams(Mage_Sales_Model_Order $order, $type) $addressComplement = $this->_getAddressAttributeValue($address, $addressComplementAttribute); $addressDistrict = $this->_getAddressAttributeValue($address, $addressNeighborhoodAttribute); $addressPostalCode = $digits->filter($address->getPostcode()); - $addressCity = $address->getCity(); + $addressCity = $this->removeAccents($address->getCity()); $addressState = $this->getStateCode($address->getRegion()); @@ -355,6 +355,11 @@ public function stripAccents($string) return preg_replace('/[`^~\'"]/', null, iconv('UTF-8', 'ASCII//TRANSLIT', $string)); } + public function removeAccents($text) + { + return Mage::helper('core')->removeAccents($text); + } + /** * Calculates the "Extra" value that corresponds to Tax values minus Discount given * It makes the correct discount to be shown correctly on PagSeguro @@ -525,13 +530,17 @@ protected function _getShippingType(Mage_Sales_Model_Order $order) protected function _getAddressAttributeValue($address, $attributeId) { $isStreetline = preg_match('/^street_(\d{1})$/', $attributeId, $matches); + $result = ''; if ($isStreetline !== false && isset($matches[1])) { //uses streetlines - return $address->getStreet(intval($matches[1])); + $result = $address->getStreet(intval($matches[1])); } else if ($attributeId == '') { //do not tell pagseguro return ''; + } else { + $result = (string)$address->getData($attributeId); } - return (string)$address->getData($attributeId); + + return $this->removeAccents($result); } /**