diff --git a/app/Classes/Modules/Bookings/ControllersLogic/FetchBookingPaymentQuotationLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/FetchBookingPaymentQuotationLogic.php index 5885d560..eaac0adc 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/FetchBookingPaymentQuotationLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/FetchBookingPaymentQuotationLogic.php @@ -72,7 +72,8 @@ class FetchBookingPaymentQuotationLogic extends AbstractControllerLogic return $this->response(['data' => $this->generatesBookingQuotation->execute( $this->fetchBookingQuotation->execute($booking->company, $conversionObject), - $this->fetchesCompanyPaymentAttemptLimit->execute($booking->company) + $this->fetchesCompanyPaymentAttemptLimit->execute($booking->company), + $conversionObject )]); } diff --git a/app/Classes/Modules/Bookings/Services/GeneratesBookingQuotation.php b/app/Classes/Modules/Bookings/Services/GeneratesBookingQuotation.php index 8f40187b..7d6c018e 100644 --- a/app/Classes/Modules/Bookings/Services/GeneratesBookingQuotation.php +++ b/app/Classes/Modules/Bookings/Services/GeneratesBookingQuotation.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\Bookings\Services; use App\Classes\Modules\Bookings\DataTransferObjects\CalculationObject; +use App\Classes\Modules\Currencies\DataTransferObjects\CurrencyConversionObject; use App\Http\Resources\BankResource; use App\Models\Bank; use Carbon\Carbon; @@ -12,12 +13,14 @@ use Carbon\CarbonInterval; class GeneratesBookingQuotation { - public function execute(CalculationObject $calculationObject, ?int $paymentAttemptLimit = 0){ + public function execute(CalculationObject $calculationObject, ?int $paymentAttemptLimit = 0, ?CurrencyConversionObject $currencyConversionObject = null){ $date = Carbon::now(); $days = $date->diffInDays($date->copy()->addMinutes($paymentAttemptLimit)); $hours = $date->diffInHours($date->copy()->addMinutes($paymentAttemptLimit)->subDays($days)) ; $minutes = $date->diffInMinutes($date->copy()->addMinutes($paymentAttemptLimit)->subDays($days)->subHours($hours)); + $receive_date = $currencyConversionObject ? Carbon::now()->endOfDay()->addWeekdays($currencyConversionObject->getServiceId() === 1 ? 1 : 3)->timezone('Asia/Singapore')->format('4:00 \P\M, jS M, Y \G\M\T T') : null; + return [ 'bank' => new BankResource(Bank::find($calculationObject->getConfigurations()->getBankId())), 'rate' => $calculationObject->getConfigurations()->getRate(), @@ -30,6 +33,7 @@ class GeneratesBookingQuotation 'sub_total' => $calculationObject->getSubTotal(), 'total' => $calculationObject->getTotal(), 'date' => Carbon::now()->timezone('Asia/Singapore')->format('h:i a, jS M, Y \G\M\T T'), + 'receive_date' => $receive_date, 'payment_attempt_limit' => CarbonInterval::days($days)->hours($hours)->minutes($minutes)->forHumans() ]; } diff --git a/app/Classes/Modules/Companies/ControllersLogic/FetchCompanyBookingQuotationLogic.php b/app/Classes/Modules/Companies/ControllersLogic/FetchCompanyBookingQuotationLogic.php index 37225631..926acaae 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/FetchCompanyBookingQuotationLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/FetchCompanyBookingQuotationLogic.php @@ -14,6 +14,7 @@ use App\Models\Company; use App\Models\Currency; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Carbon\Carbon; class FetchCompanyBookingQuotationLogic extends AbstractControllerLogic { @@ -71,7 +72,7 @@ class FetchCompanyBookingQuotationLogic extends AbstractControllerLogic if($calculationObject->getConvertibleTotal() < $calculationObject->getConfigurations()->getMinLimit()) throw new RequestValidationException('Your transfer is below the minimum amount allowed of '.$calculationObject->getConfigurations()->getMinLimit().' '.$currency->short_code); //TODO add po limit validation - return $this->response(['data' => $this->generatesBookingQuotation->execute($calculationObject)]); + return $this->response(['data' => $this->generatesBookingQuotation->execute($calculationObject, 0, $conversionObject)]); } diff --git a/resources/assets/vue/components/bookings/forms/CurrencyConverterComponent.vue b/resources/assets/vue/components/bookings/forms/CurrencyConverterComponent.vue index 29b05824..df8d0ef2 100644 --- a/resources/assets/vue/components/bookings/forms/CurrencyConverterComponent.vue +++ b/resources/assets/vue/components/bookings/forms/CurrencyConverterComponent.vue @@ -6,6 +6,11 @@ {{error}} +
+
+
The recipient will receive the transfer amount by
{{ this.calculation.receive_date }}
+
+