diff --git a/Gateway/Config/ConfigCc.php b/Gateway/Config/ConfigCc.php
index a6f57b7..320e0cc 100644
--- a/Gateway/Config/ConfigCc.php
+++ b/Gateway/Config/ConfigCc.php
@@ -63,26 +63,6 @@ class ConfigCc extends PaymentConfig
*/
public const GET_PHONE = 'get_phone';
- /**
- * @const string
- */
- public const USE_FRAUD_MANAGER = 'fraud_manager';
-
- /**
- * @const string
- */
- public const INSTALL_WITH_INTEREST = 'INSTALL_WITH_INTEREST';
-
- /**
- * @const string
- */
- public const INSTALL_NO_INTEREST = 'INSTALL_NO_INTEREST';
-
- /**
- * @const string
- */
- public const INSTALL_FULL = 'FULL';
-
/**
* @const string
*/
@@ -302,4 +282,20 @@ public function getInterestFree($storeId = null): int
return $free;
}
+
+ /**
+ * Get Min Value Installments.
+ *
+ * @param int|null $storeId
+ *
+ * @return int
+ */
+ public function getMinValuelInstallment($storeId = null): int
+ {
+ return (int) $this->scopeConfig->getValue(
+ 'payment/pagbank_paymentmagento_cc/min_value_installment',
+ ScopeInterface::SCOPE_STORE,
+ $storeId
+ );
+ }
}
diff --git a/Model/Api/ConsultPSInstallments.php b/Model/Api/ConsultPSInstallments.php
index 21521f1..9cd1632 100644
--- a/Model/Api/ConsultPSInstallments.php
+++ b/Model/Api/ConsultPSInstallments.php
@@ -73,9 +73,9 @@ public function __construct(
/**
* Get PagBank Installments.
*
- * @param int $storeId
- * @param string $creditCardBin
- * @param string $amount
+ * @param int|null $storeId
+ * @param string $creditCardBin
+ * @param string $amount
*
* @return array
*/
@@ -115,7 +115,9 @@ public function getPagBankInstallments($storeId, $creditCardBin, $amount)
$list = $brand;
}
- $response = $list['installment_plans'];
+ $list = $this->getAvailableInstallments($list['installment_plans'], $storeId);
+
+ $response = $list;
}
if (!$client->request()->isSuccessful()) {
@@ -136,4 +138,26 @@ public function getPagBankInstallments($storeId, $creditCardBin, $amount)
return $response;
}
+
+ /**
+ * Get Available Installments.
+ *
+ * @param array $list
+ * @param int|null $storeId
+ * @return array
+ */
+ public function getAvailableInstallments($list, $storeId)
+ {
+ $minInstallment = $this->configCc->getMinValuelInstallment($storeId) * 100;
+
+ foreach ($list as $key => $allInstallments) {
+ if ($key >= 1) {
+ if ($allInstallments['installment_value'] <= $minInstallment) {
+ unset($list[$key]);
+ }
+ }
+ }
+
+ return $list;
+ }
}
diff --git a/etc/adminhtml/system/credit_card.xml b/etc/adminhtml/system/credit_card.xml
index ac5fe73..4d751ff 100644
--- a/etc/adminhtml/system/credit_card.xml
+++ b/etc/adminhtml/system/credit_card.xml
@@ -82,20 +82,26 @@
-
+
PagBank\PaymentMagento\Model\Adminhtml\Source\Installments
Maximum number of installments accepted
required-entry validate-number
payment/pagbank_paymentmagento_cc/max_installment
-
+
PagBank\PaymentMagento\Model\Adminhtml\Source\Installments
Number of installments you want to accept without applying interest
required-entry validate-number
payment/pagbank_paymentmagento_cc/interest_free
+
+
+ It is the minimum value that the installment can have
+ required-entry validate-number validate-number-range validate-date-range number-range-5-9999
+ payment/pagbank_paymentmagento_cc/min_value_installment
+
\ No newline at end of file
diff --git a/etc/config.xml b/etc/config.xml
index 35efd05..6654a7b 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -81,6 +81,7 @@
HC,ELO,AE,VI,MC,DN,AU
18
1
+ 5.00
0
0
1
diff --git a/i18n/en_US.csv b/i18n/en_US.csv
index ca1cc04..aabdf96 100644
--- a/i18n/en_US.csv
+++ b/i18n/en_US.csv
@@ -166,6 +166,8 @@ Title,Title
"Maximum number of installments accepted","Maximum number of installments accepted"
"Number of interest-free installments","Number of interest-free installments"
"Number of installments you want to accept without applying interest","Number of installments you want to accept without applying interest"
+"The minimum installment price","The minimum installment price"
+"It is the minimum value that the installment can have,"It is the minimum value that the installment can have"
Developers,Developers
"Meet our Wiki.","Meet our Wiki."
Debug,Debug
diff --git a/i18n/pt_BR.csv b/i18n/pt_BR.csv
index 1fd6ded..6271517 100644
--- a/i18n/pt_BR.csv
+++ b/i18n/pt_BR.csv
@@ -166,6 +166,8 @@ Title,Título
"Maximum number of installments accepted","Número máximo de parcelas aceitas"
"Number of interest-free installments","Número de parcelas sem juros"
"Number of installments you want to accept without applying interest","Número de parcelas que pretende aceitar sem aplicar juros"
+"The minimum installment price","O preço mínimo da parcela"
+"It is the minimum value that the installment can have","É o valor mínimo que a parcela pode ter"
Developers,Desenvolvedores
"Meet our Wiki.","Conheça a nossa Wiki."
Debug,Debug