mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 22:13:59 +00:00
20 lines
625 B
PHP
20 lines
625 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Bookings\Services;
|
|
|
|
|
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
|
use App\Classes\ValueObjects\Constants\TransactionType;
|
|
use App\Models\Booking;
|
|
use Carbon\Carbon;
|
|
|
|
class CalculatesBookingRefundAmount
|
|
{
|
|
|
|
public function execute(Booking $booking, int $type, ?string $payment_reference = NULL){
|
|
return $type === 1 ?
|
|
$booking->transactions()->refunds($payment_reference)
|
|
->selectRaw('sum(amount - service_charge - tax) as sub_total')->get()->sum('sub_total') : $booking->transactions()->refunds($payment_reference)->sum('original_amount');
|
|
}
|
|
|
|
} |