mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
37 lines
1.5 KiB
PHP
37 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Bookings\Services;
|
|
|
|
use App\Models\Booking;
|
|
|
|
class CalculatesBookingOutstanding
|
|
{
|
|
|
|
/** @var CalculatesBookingPayableAmount */
|
|
private $calculatesBookingPayableAmount;
|
|
|
|
/** @var CalculatesBookingFloatingAmount */
|
|
private $calculatesBookingFloatingAmount;
|
|
|
|
/** @var CalculatesBookingRefundAmount */
|
|
private $calculatesBookingRefundAmount;
|
|
|
|
/**
|
|
* CalculatesBookingOutstanding constructor.
|
|
* @param CalculatesBookingPayableAmount $calculatesBookingPayableAmount
|
|
* @param CalculatesBookingFloatingAmount $calculatesBookingFloatingAmount
|
|
* @param CalculatesBookingRefundAmount $calculatesBookingRefundAmount
|
|
*/
|
|
public function __construct(CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingFloatingAmount $calculatesBookingFloatingAmount, CalculatesBookingRefundAmount $calculatesBookingRefundAmount)
|
|
{
|
|
$this->calculatesBookingPayableAmount = $calculatesBookingPayableAmount;
|
|
$this->calculatesBookingFloatingAmount = $calculatesBookingFloatingAmount;
|
|
$this->calculatesBookingRefundAmount = $calculatesBookingRefundAmount;
|
|
}
|
|
|
|
|
|
public function execute(Booking $booking){
|
|
return $booking->fix_amount - $this->calculatesBookingFloatingAmount->execute($booking, $booking->fix_currency_id) - $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id) + $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id);
|
|
}
|
|
|
|
} |