Skip to content

Commit 34ef56b

Browse files
authored
Merge pull request SummaSolutions#39 from fdinapoli-summasolutions/us_706
Bugfix error message order without a payment
2 parents 3899447 + 5f413f2 commit 34ef56b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

app/code/MercadoPago/Core/Observer/RefundObserverBeforeSave.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function creditMemoRefundBeforeSave ($order, $creditMemo)
7474

7575
$isTotalRefund = $payment->getAmountPaid() == $payment->getAmountRefunded();
7676

77-
$isValidBasicData = $this->checkRefundBasicData ($paymentMethod);
77+
$isValidBasicData = $this->checkRefundBasicData ($paymentMethod, $paymentDate);
7878

7979
$isValidaData = $this->checkRefundData ($isCreditCardPayment,
8080
$orderStatus,
@@ -90,12 +90,18 @@ protected function creditMemoRefundBeforeSave ($order, $creditMemo)
9090

9191
/**
9292
* @param $paymentMethod
93+
* @param $paymentDate
9394
*
9495
* @return bool
9596
*/
96-
protected function checkRefundBasicData ($paymentMethod) {
97+
protected function checkRefundBasicData ($paymentMethod, $paymentDate) {
9798
$refundAvailable = $this->_dataHelper->isRefundAvailable();
9899

100+
if ($paymentDate == null) {
101+
$this->_messageManager->addErrorMessage(__('No payment is recorded. You can\'t make a refund on a unpaid order'));
102+
return false;
103+
}
104+
99105
if (!($paymentMethod == 'mercadopago_standard' || $paymentMethod == 'mercadopago_custom')) {
100106
$this->_messageManager->addErrorMessage(__('Order payment wasn\'t made by Mercado Pago. The refund will be made through Magento'));
101107
return false;

app/code/MercadoPago/Core/i18n/en_US.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,5 @@
198198
"Failed to make the refund by Mercado Pago","Failed to make the refund by Mercado Pago"
199199
"Mercado Pago - Refund not made","Mercado Pago - Refund not made"
200200
"Order payment wasn't made by Mercado Pago. The refund will be made through Magento", "Order payment wasn't made by Mercado Pago. The refund will be made through Magento"
201-
"Mercado Pago refunds are disabled. The refund will be made through Magento","Mercado Pago refunds are disabled. The refund will be made through Magento"
201+
"Mercado Pago refunds are disabled. The refund will be made through Magento","Mercado Pago refunds are disabled. The refund will be made through Magento"
202+
"No payment is recorded. You can\'t make a refund on a unpaid order","No payment is recorded. You can\'t make a refund on a unpaid order"

app/code/MercadoPago/Core/i18n/es_AR.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,5 @@
202202
"Failed to make the refund by Mercado Pago","Error al efectuar la devolución mediante Mercado Pago"
203203
"Mercado Pago - Refund not made","Mercado Pago - Devolución no efectuada"
204204
"Order payment wasn't made by Mercado Pago. The refund will be made through Magento","El pago de la orden no fue realizado mediante Mercado Pago. La devolución se hará a traves de Magento"
205-
"Mercado Pago refunds are disabled. The refund will be made through Magento","Las devoluciones de Mercado Pago están deshabilitadas. La devolución se hará a traves de Magento"
205+
"Mercado Pago refunds are disabled. The refund will be made through Magento","Las devoluciones de Mercado Pago están deshabilitadas. La devolución se hará a traves de Magento"
206+
"No payment is recorded. You can't make a refund on a unpaid order","No se registra ningún pago. No se pueden hacer devoluciones en ordenes sin pagar"

0 commit comments

Comments
 (0)