Clarify payment refunds

This commit is contained in:
Hillel Coren 2018-02-16 14:55:02 +02:00
parent 019dcfe7c6
commit fc2a264bfb
3 changed files with 74 additions and 69 deletions

View File

@ -146,8 +146,9 @@ class PaymentDatatable extends EntityDatatable
$max_refund = number_format($model->amount - $model->refunded, 2);
$formatted = Utils::formatMoney($max_refund, $model->currency_id, $model->country_id);
$symbol = Utils::getFromCache($model->currency_id ? $model->currency_id : 1, 'currencies')->symbol;
$local = in_array($model->gateway_id, [GATEWAY_BRAINTREE, GATEWAY_STRIPE, GATEWAY_WEPAY]) || ! $model->gateway_id ? 0 : 1;
return "javascript:showRefundModal({$model->public_id}, '{$max_refund}', '{$formatted}', '{$symbol}')";
return "javascript:showRefundModal({$model->public_id}, '{$max_refund}', '{$formatted}', '{$symbol}', {$local})";
},
function ($model) {
return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id])

View File

@ -2741,6 +2741,7 @@ $LANG = array(
'taxes_are_not_included_help' => 'Taxes are excluded from the cost.',
'change_requires_purge' => 'Changing this setting requires :link the account data.',
'purging' => 'purging',
'warning_local_refund' => 'The refund will be recorded in the app but will NOT be processed by the payment gateway.',
);

View File

@ -24,11 +24,13 @@
<label class="col-sm-offset-2 col-sm-2 control-label"></label>
<div class="col-sm-6">
<div class="input-group">
{!! Former::checkbox('refund_email')
->text('send_email_to_client')
->raw() !!}
{!! Former::checkbox('refund_email')->text('send_email_to_client')->raw() !!}
</div>
</div>
</div><br/>
<div id="refundLocalWarning" class="text-muted">
{{ trans('texts.warning_local_refund') }}
</div>
</div>
@ -48,11 +50,12 @@
<script type="text/javascript">
var paymentId = null;
function showRefundModal(id, amount, formatted, symbol) {
function showRefundModal(id, amount, formatted, symbol, local) {
paymentId = id;
$('#refundCurrencySymbol').text(symbol);
$('#refundMax').text(formatted);
$('#refundAmount').val(amount).attr('max', amount);
$('#refundLocalWarning').toggle(!!local);
$('#paymentRefundModal').modal('show');
}