calculatesBookingPayableAmount = $calculatesBookingPayableAmount; $this->calculatesBookingFloatingAmount = $calculatesBookingFloatingAmount; $this->calculatesBookingRefundAmount = $calculatesBookingRefundAmount; } public function execute(Booking $booking){ $originalBookingAmount = $booking->fix_amount; $refundedAmount = $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id); if($originalBookingAmount === $refundedAmount){ return $originalBookingAmount - $this->calculatesBookingFloatingAmount->execute($booking, $booking->fix_currency_id) - $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id); } else{ return $originalBookingAmount - $this->calculatesBookingFloatingAmount->execute($booking, $booking->fix_currency_id) - $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id) + $refundedAmount; } } public function executeWithoutFloatingAmount(Booking $booking){ return $booking->fix_amount - $this->calculatesBookingPayableAmount->execute($booking, $booking->fix_currency_id) + $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id); } }