Support refunding manual payment

This commit is contained in:
Hillel Coren 2017-01-16 14:51:43 +02:00
parent 62ae88df87
commit f9fef333ec
3 changed files with 6 additions and 4 deletions

View File

@ -131,9 +131,7 @@ class PaymentDatatable extends EntityDatatable
function ($model) { function ($model) {
return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id]) return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id])
&& $model->payment_status_id >= PAYMENT_STATUS_COMPLETED && $model->payment_status_id >= PAYMENT_STATUS_COMPLETED
&& $model->refunded < $model->amount && $model->refunded < $model->amount;
&& $model->transaction_reference
&& in_array($model->gateway_id , static::$refundableGateways);
} }
] ]
]; ];

View File

@ -161,6 +161,9 @@ class PaymentService extends BaseService
if ($paymentDriver->refundPayment($payment, $amount)) { if ($paymentDriver->refundPayment($payment, $amount)) {
$successful++; $successful++;
} }
} else {
$payment->recordRefund($amount);
$successful++;
} }
} }
} }

View File

@ -8,7 +8,8 @@
{!! Former::open($url)->method($method) {!! Former::open($url)->method($method)
->rules([ ->rules([
'name' => 'required', 'name' => 'required',
'rate' => 'required' 'rate' => 'required',
'is_inclusive' => 'required',
]) ])
->addClass('warn-on-exit') !!} ->addClass('warn-on-exit') !!}