Support refunding payment from 'More actions'

This commit is contained in:
Hillel Coren 2017-02-09 12:49:57 +02:00
parent 0d71d54b07
commit 176f8374af
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -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;