mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 13:14:30 -04:00
Clarify payment refunds
This commit is contained in:
parent
019dcfe7c6
commit
fc2a264bfb
@ -146,8 +146,9 @@ class PaymentDatatable extends EntityDatatable
|
|||||||
$max_refund = number_format($model->amount - $model->refunded, 2);
|
$max_refund = number_format($model->amount - $model->refunded, 2);
|
||||||
$formatted = Utils::formatMoney($max_refund, $model->currency_id, $model->country_id);
|
$formatted = Utils::formatMoney($max_refund, $model->currency_id, $model->country_id);
|
||||||
$symbol = Utils::getFromCache($model->currency_id ? $model->currency_id : 1, 'currencies')->symbol;
|
$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) {
|
function ($model) {
|
||||||
return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id])
|
return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id])
|
||||||
|
@ -2741,6 +2741,7 @@ $LANG = array(
|
|||||||
'taxes_are_not_included_help' => 'Taxes are excluded from the cost.',
|
'taxes_are_not_included_help' => 'Taxes are excluded from the cost.',
|
||||||
'change_requires_purge' => 'Changing this setting requires :link the account data.',
|
'change_requires_purge' => 'Changing this setting requires :link the account data.',
|
||||||
'purging' => 'purging',
|
'purging' => 'purging',
|
||||||
|
'warning_local_refund' => 'The refund will be recorded in the app but will NOT be processed by the payment gateway.',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -24,11 +24,13 @@
|
|||||||
<label class="col-sm-offset-2 col-sm-2 control-label"></label>
|
<label class="col-sm-offset-2 col-sm-2 control-label"></label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
{!! Former::checkbox('refund_email')
|
{!! Former::checkbox('refund_email')->text('send_email_to_client')->raw() !!}
|
||||||
->text('send_email_to_client')
|
|
||||||
->raw() !!}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div><br/>
|
||||||
|
|
||||||
|
<div id="refundLocalWarning" class="text-muted">
|
||||||
|
{{ trans('texts.warning_local_refund') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -47,29 +49,30 @@
|
|||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var paymentId = null;
|
var paymentId = null;
|
||||||
function showRefundModal(id, amount, formatted, symbol) {
|
function showRefundModal(id, amount, formatted, symbol, local) {
|
||||||
paymentId = id;
|
paymentId = id;
|
||||||
$('#refundCurrencySymbol').text(symbol);
|
$('#refundCurrencySymbol').text(symbol);
|
||||||
$('#refundMax').text(formatted);
|
$('#refundMax').text(formatted);
|
||||||
$('#refundAmount').val(amount).attr('max', amount);
|
$('#refundAmount').val(amount).attr('max', amount);
|
||||||
|
$('#refundLocalWarning').toggle(!!local);
|
||||||
$('#paymentRefundModal').modal('show');
|
$('#paymentRefundModal').modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRefundClicked(){
|
function onRefundClicked(){
|
||||||
$('#completeRefundButton').prop('disabled', true);
|
$('#completeRefundButton').prop('disabled', true);
|
||||||
submitForm_payment('refund', paymentId);
|
submitForm_payment('refund', paymentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRefundEmailChange() {
|
function onRefundEmailChange() {
|
||||||
if (! isStorageSupported()) {
|
if (! isStorageSupported()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var checked = $('#refund_email').is(':checked');
|
var checked = $('#refund_email').is(':checked');
|
||||||
localStorage.setItem('last:send_refund_email', checked ? true : '');
|
localStorage.setItem('last:send_refund_email', checked ? true : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#completeRefundButton').click(onRefundClicked);
|
$('#completeRefundButton').click(onRefundClicked);
|
||||||
$('#refund_email').click(onRefundEmailChange);
|
$('#refund_email').click(onRefundEmailChange);
|
||||||
|
|
||||||
@ -78,6 +81,6 @@
|
|||||||
$('#refund_email').prop('checked', true);
|
$('#refund_email').prop('checked', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user