diff --git a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php index 7cf4bdef..607b45fa 100644 --- a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php +++ b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php @@ -3,6 +3,7 @@ namespace App\Classes\Modules\Billplzs\Services; use Illuminate\Support\Facades\Http; +use App\Classes\Exceptions\MalformedRequestException; class CreatesBillplzBill { @@ -12,7 +13,7 @@ class CreatesBillplzBill */ public function execute(string $name, string $email, string $description, float $amount, string $billNumber, ?string $bankCode = null) { try{ - $response = Http::withBasicAuth(config('billplz.api_key').':', '')->post(config('billplz.base_url').'/api/v3/bills', [ + $response = Http::withBasicAuth(config('billplz.api_key').':', '')->withOptions(["verify"=>false])->post(config('billplz.base_url').'/api/v3/bills', [ 'collection_id' => config('billplz.collection_id'), 'name' => $name, 'email' => $email, @@ -36,7 +37,7 @@ class CreatesBillplzBill return null; } }catch(\Exception $exception){ - throw new MalformedRequestException('Unable to get correct response from billplz server'); + throw new MalformedRequestException('Unable to get correct response from billplz server' . $exception->getMessage()); } } } \ No newline at end of file diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php index 0fc448b2..411b9163 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php @@ -97,7 +97,7 @@ class CreateBookingRefundLogic extends AbstractControllerLogic $transactionRefundCalculationObject->init(); $object = new TransactionObject($billNumber, TransactionType::REFUND, 1, $booking->company->id, - $request->input('bank_id'), $transactionRefundCalculationObject->getConversionObject()->getPaymentMethod(), + $request->input('bank_id'),$transactionRefundCalculationObject->getConversionObject()->getPaymentMethod(), $transactionRefundCalculationObject->getRefundTotalAmount(), $transactionRefundCalculationObject->getAmount(), 1, $transactionRefundCalculationObject->getConversionObject()->getCurrencyId(), $transactionRefundCalculationObject->getTransaction()->currency_rate, $transactionRefundCalculationObject->getRefundTax(), $transactionRefundCalculationObject->getRefundServiceCharge(), null, ApprovalStatus::PENDING_VERIFICATION, [], $transaction->bill_no); diff --git a/app/Classes/ValueObjects/Constants/PaymentMethodType.php b/app/Classes/ValueObjects/Constants/PaymentMethodType.php index 4efec990..848cf3cd 100644 --- a/app/Classes/ValueObjects/Constants/PaymentMethodType.php +++ b/app/Classes/ValueObjects/Constants/PaymentMethodType.php @@ -19,7 +19,7 @@ final class PaymentMethodType { 'cheque' => self::CHEQUE, 'ba' => self::BA, 'wallet' => self::WALLET, - 'payment gateway' => self::PAYMENT_GATEWAY, + 'payment_gateway' => self::PAYMENT_GATEWAY, ]; public const PAYMENT_METHODS_ID = [ @@ -27,7 +27,7 @@ final class PaymentMethodType { self::CHEQUE => 'cheque', self::BA => 'ba', self::WALLET => 'wallet', - self::PAYMENT_GATEWAY => 'payment gateway' + self::PAYMENT_GATEWAY => 'payment_gateway' ]; } diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index df1a5685..9d30af54 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -22,6 +22,8 @@ class TransactionResource extends JsonResource 'booking' => new BookingResource($this->booking), 'type' => (int) $this->type, 'bill_no' => $this->bill_no, + 'payment_reference' => $this->payment_reference, + 'payment_method' => $this->payment_method, 'recipient_bank_account' => new BankResource($this->when((int) $this->type === TransactionType::BILL,$this->booking->bank)), 'amount' => (double) $this->amount, 'original_amount' => (double) $this->original_amount, diff --git a/resources/assets/vue/components/accounts/forms/TopUpAccountComponent.vue b/resources/assets/vue/components/accounts/forms/TopUpAccountComponent.vue new file mode 100644 index 00000000..af8a43b7 --- /dev/null +++ b/resources/assets/vue/components/accounts/forms/TopUpAccountComponent.vue @@ -0,0 +1,196 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 3abccf8b..d619921d 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -118,12 +118,16 @@
- + + + +
-
+ +
@@ -172,7 +176,7 @@
- + @@ -187,7 +191,7 @@
- + @@ -234,6 +238,12 @@ status: false }, amount: (Math.round(1000 * 100) / 100).toFixed(2), + parameters: { + amount: (Math.round(1000 * 100) / 100).toFixed(2), + bank_id: 1 + }, + expanded: false, + section: 'bookingDetailSection', } }, computed: { @@ -242,6 +252,9 @@ } }, methods: { + submitForm(){ + this.submit(this.route('api.booking.refund.create', this.data.booking.id, this.data.id), 'post', this.section, true, true); + }, requestRefund(){ this.expandRefund = !this.expandRefund; this.expandPaymentDetails = !this.expandPaymentDetails; diff --git a/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue b/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue new file mode 100644 index 00000000..9a810def --- /dev/null +++ b/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue @@ -0,0 +1,337 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue index 9efbe54c..05e20926 100644 --- a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue +++ b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue @@ -169,7 +169,7 @@
-
+
@@ -207,7 +207,7 @@
-
+
Maybank2u
@@ -220,7 +220,7 @@
-
+
Cimb
diff --git a/resources/assets/vue/components/bookings/forms/ConfirmQuotationFormComponent.vue b/resources/assets/vue/components/bookings/forms/ConfirmQuotationFormComponent.vue index 86be8e1a..ad0fe0c0 100644 --- a/resources/assets/vue/components/bookings/forms/ConfirmQuotationFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/ConfirmQuotationFormComponent.vue @@ -98,10 +98,14 @@ submitForm(){ this.submit(route('api.booking.payment.create', this.id), 'post', this.section, false, false); }, - successHandler(){ + successHandler(response){ this.$emit('cancelQuotation'); this.updateList(); this.closeModal(); + + if (response.payload.data.payment_method === 5) { + window.location.href = 'https://www.billplz.com/bills/' + response.payload.data.payment_reference + '?auto_submit=true'; + } } } } diff --git a/resources/assets/vue/components/settings/elements/CurrenciesListComponent.vue b/resources/assets/vue/components/settings/elements/CurrenciesListComponent.vue index 3554a8f2..b7792264 100644 --- a/resources/assets/vue/components/settings/elements/CurrenciesListComponent.vue +++ b/resources/assets/vue/components/settings/elements/CurrenciesListComponent.vue @@ -75,9 +75,11 @@
- + + - + +
@@ -202,7 +204,7 @@ } }, { - payment_method: 'payment gateway', + payment_method: 'payment_gateway', selling: { type: 'rate', value: 0 diff --git a/resources/views/pages/dashboards/account_admin.blade.php b/resources/views/pages/dashboards/account_admin.blade.php index e8256f8f..51ce8ebe 100644 --- a/resources/views/pages/dashboards/account_admin.blade.php +++ b/resources/views/pages/dashboards/account_admin.blade.php @@ -1,7 +1,7 @@
-
+