diff --git a/app/Classes/Modules/Bookings/Processors/CreateBookingPaymentProcessor.php b/app/Classes/Modules/Bookings/Processors/CreateBookingPaymentProcessor.php index 00f63d0f..00fe657c 100644 --- a/app/Classes/Modules/Bookings/Processors/CreateBookingPaymentProcessor.php +++ b/app/Classes/Modules/Bookings/Processors/CreateBookingPaymentProcessor.php @@ -119,7 +119,7 @@ class CreateBookingPaymentProcessor if($conversionObject->getAmount() > round($outstanding, 2)) throw new MalformedRequestException('Your payment must not be greater than '. $outstanding .'.'); } - $configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject, $voucherCode); + $configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject, $voucherCode, null, $booking); $paymentAttemptLimit = $this->fetchesCompanyPaymentAttemptLimit->execute($booking->company); @@ -163,7 +163,7 @@ class CreateBookingPaymentProcessor $transaction = $this->createsTransaction->execute($booking, $object); // $cash_back_transaction = $this->createCashBackTransactionProcessor->execute($transaction); - $this->bookingToVoucherifyProcessor->execute($booking->company->employees()->first(), $transaction, $booking->company->id, $configurations->getSubTotal(), $configurations->getVoucherDiscountAmount(), 0, $voucherCode); + $this->bookingToVoucherifyProcessor->execute($booking->company->employees()->first(), $transaction, $booking->company->id, $configurations->getSubTotal(), $configurations->getServiceCharge(), $configurations->getVoucherDiscountAmount(), $voucherCode); if(PaymentMethodType::PAYMENT_METHODS[$paymentMethod] == PaymentMethodType::WALLET){ $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED); diff --git a/app/Models/Booking.php b/app/Models/Booking.php index 70d30b03..a1e8f412 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -127,16 +127,17 @@ class Booking extends AbstractModel implements Documentable, Transactionable, Ke /** * @return MorphMany */ - public function attributesKVP(): MorphMany + public function voucherifyEntities(): MorphMany { - return $this->morphMany(KeyValuePair::class, 'owner'); + return $this->morphMany(VoucherEntityMapping::class, 'owner'); } /** * @return MorphMany */ - public function voucherifyEntities(): MorphMany + public function attributesKVP(): MorphMany { - return $this->morphMany(VoucherEntityMapping::class, 'owner'); + return $this->morphMany(KeyValuePair::class, 'owner'); } + } diff --git a/routes/web.php b/routes/web.php index 4726d956..c90d445d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1375,6 +1375,7 @@ Route::get('/admin-workflow/list', function () { return view('pages.admin-workflow.list-workflow'); })->name('admin-workflow.list'); + Route::get('/test-test', function () { dd('test-test'); });