diff --git a/app/code/community/RicardoMartins/PagSeguro/Helper/Data.php b/app/code/community/RicardoMartins/PagSeguro/Helper/Data.php index 27b4b650..600938cc 100644 --- a/app/code/community/RicardoMartins/PagSeguro/Helper/Data.php +++ b/app/code/community/RicardoMartins/PagSeguro/Helper/Data.php @@ -43,6 +43,7 @@ class RicardoMartins_PagSeguro_Helper_Data extends Mage_Core_Helper_Abstract const XML_PATH_JSDELIVR_MINIFY = 'payment/rm_pagseguro/jsdelivr_minify'; const XML_PATH_STC_MIRROR = 'payment/rm_pagseguro/stc_mirror'; const XML_PATH_PAYMENT_PAGSEGURO_CC_MULTICC_ACTIVE = 'payment/rm_pagseguro_cc/multicc_active'; + const MAX_ALLOWED_NOINTERESTINSTALLMENTQUANTITY = 18; //PagSeguro limitation /** * Returns session ID from PagSeguro that will be used on JavaScript methods. @@ -674,6 +675,12 @@ public function getMaxInstallmentsNoInterest($amount) $selectedMaxInstallmentNoInterest = $amount / $freeAmt; $selectedMaxInstallmentNoInterest = (int)floor($selectedMaxInstallmentNoInterest); + //prevents internal server error from PagSeguro when receiving a value > 18 + $selectedMaxInstallmentNoInterest = min( + $selectedMaxInstallmentNoInterest, + self::MAX_ALLOWED_NOINTERESTINSTALLMENTQUANTITY + ); + return ($selectedMaxInstallmentNoInterest > 1) ? $selectedMaxInstallmentNoInterest : false; //prevents 0 or 1 } } \ No newline at end of file diff --git a/app/code/community/RicardoMartins/PagSeguro/etc/config.xml b/app/code/community/RicardoMartins/PagSeguro/etc/config.xml index c95469d3..d3c46f72 100644 --- a/app/code/community/RicardoMartins/PagSeguro/etc/config.xml +++ b/app/code/community/RicardoMartins/PagSeguro/etc/config.xml @@ -2,7 +2,7 @@ - 3.15.3 + 3.15.4