diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index 97b46a90c60a..8afd5cedfe27 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -136,7 +136,7 @@ class PaymentController extends BaseController $actions[] = ['url' => url("/invoices/{$payment->invoice->public_id}/edit"), 'label' => trans('texts.edit_invoice')]; if ($payment->canBeRefunded()) { - $actions[] = ['url' => "javascript:showRefundModal({$payment->public_id}, \"{$payment->getCompletedAmount()}\", \"{$payment->present()->amount}\", \"{$payment->present()->currencySymbol}\")", 'label' => trans('texts.refund_payment')]; + $actions[] = ['url' => "javascript:showRefundModal({$payment->public_id}, \"{$payment->getCompletedAmount()}\", \"{$payment->present()->completedAmount}\", \"{$payment->present()->currencySymbol}\")", 'label' => trans('texts.refund_payment')]; } $actions[] = DropdownButton::DIVIDER; diff --git a/app/Ninja/Presenters/PaymentPresenter.php b/app/Ninja/Presenters/PaymentPresenter.php index 1b7396bbbd2c..a2c15c478ce5 100644 --- a/app/Ninja/Presenters/PaymentPresenter.php +++ b/app/Ninja/Presenters/PaymentPresenter.php @@ -12,6 +12,11 @@ class PaymentPresenter extends EntityPresenter return Utils::formatMoney($this->entity->amount, $this->entity->client->currency_id); } + public function completedAmount() + { + return Utils::formatMoney($this->entity->getCompletedAmount(), $this->entity->client->currency_id); + } + public function currencySymbol() { return Utils::getFromCache($this->entity->currency_id ? $this->entity->currency_id : DEFAULT_CURRENCY, 'currencies')->symbol;