From 49c4362ba1b639c8ed2d1cab66ce5a6e4daec631 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sun, 21 Nov 2021 23:30:59 +0800 Subject: [PATCH] fix payment gateway & add regenerate invoices button --- .env.example | 2 - .../Abstracts/AbstractControllerLogic.php | 1 + .../General/Eloquent/AbstractUpdateRecord.php | 1 - .../General/Eloquent/Filters/IsPublished.php | 2 +- .../Eloquent/Filters/PaymentReference.php | 2 +- .../DataTransferObjects/FullNameObject.php | 7 +- .../ControllersLogic/CallbackBillplzLogic.php | 40 +++-- .../BillplzXSignatureObject.php | 18 +-- .../Billplzs/Services/CreatesBillplzBill.php | 19 ++- .../Billplzs/Services/GetBillplzBill.php | 7 +- .../CreateBookingPaymentLogic.php | 4 +- .../CalculatesBookingTransferredAmount.php | 2 +- .../CreateInvoiceTransactionProcessor.php | 1 - .../Services/CreatesTransaction.php | 2 +- .../CallbackBillplzController.php | 11 +- .../CreateBillplzBillController.php | 4 +- app/Http/Resources/BookingResource.php | 1 - app/Http/Resources/TransactionResource.php | 4 +- app/Models/Booking.php | 3 - .../elements/PaymentHistoryComponent.vue | 28 +++- .../SupplierPendingOrderComponent.vue | 2 +- .../BookingPaymentQuotationComponent.vue | 150 ++++++++++++++---- .../forms/ConfirmQuotationFormComponent.vue | 17 +- .../RegenerateBookingInvoicesComponent.vue | 33 ++++ .../BookingDetailsSectionComponent.vue | 19 ++- .../views/pages/booking_details.blade.php | 2 +- .../views/pages/dashboards/admin.blade.php | 2 +- .../views/pages/payments_redirect.blade.php | 67 ++++++++ routes/api.php | 8 +- routes/billplz.php | 2 +- routes/web.php | 10 +- 31 files changed, 344 insertions(+), 127 deletions(-) rename app/Http/Controllers/{Billplzs => Billplz}/CallbackBillplzController.php (52%) rename app/Http/Controllers/{Billplzs => Billplz}/CreateBillplzBillController.php (82%) create mode 100644 resources/assets/vue/components/bookings/forms/RegenerateBookingInvoicesComponent.vue create mode 100644 resources/views/pages/payments_redirect.blade.php diff --git a/.env.example b/.env.example index 6367c9b8..f3d4fd56 100644 --- a/.env.example +++ b/.env.example @@ -56,5 +56,3 @@ BILLPLZ_BASE_URL="https://www.billplz-sandbox.com" BILLPLZ_API_KEY="0fa4c710-761b-4a7a-a501-c2c2d02643d5" BILLPLZ_X_SIGNATURE_KEY="S-pbNVthVRsvnPfZlgLwqqOg" BILLPLZ_COLLECTION_ID="hev2wdjy" -BILLPLZ_REDIRECT_URL="http://localhost:9003/bookings/billplz" -BILLPLZ_CALLBACK_URL="localhost:9003/api/v1/billplz/callback" \ No newline at end of file diff --git a/app/Classes/General/Abstracts/AbstractControllerLogic.php b/app/Classes/General/Abstracts/AbstractControllerLogic.php index 2fdd0dab..d68c9db8 100644 --- a/app/Classes/General/Abstracts/AbstractControllerLogic.php +++ b/app/Classes/General/Abstracts/AbstractControllerLogic.php @@ -61,6 +61,7 @@ abstract class AbstractControllerLogic return $response; } catch (ErrorException|GeneralExceptions $exception){ + dd($exception); return (new ApiResponseObject($this->getNotificationTitle().' failed', $exception->getMessage(), $exception->getCode() ? $exception->getCode() : HttpStatus::SERVER_ERROR))->handler(); diff --git a/app/Classes/General/Eloquent/AbstractUpdateRecord.php b/app/Classes/General/Eloquent/AbstractUpdateRecord.php index 44129c92..17690ce4 100644 --- a/app/Classes/General/Eloquent/AbstractUpdateRecord.php +++ b/app/Classes/General/Eloquent/AbstractUpdateRecord.php @@ -17,7 +17,6 @@ abstract class AbstractUpdateRecord */ public function handler(Model $model){ try{ - if($model->save()){ return $model; } } catch (QueryException $exception){ diff --git a/app/Classes/General/Eloquent/Filters/IsPublished.php b/app/Classes/General/Eloquent/Filters/IsPublished.php index 9b5b23c1..3e9c8ca4 100644 --- a/app/Classes/General/Eloquent/Filters/IsPublished.php +++ b/app/Classes/General/Eloquent/Filters/IsPublished.php @@ -5,7 +5,7 @@ namespace App\Classes\General\Eloquent\Filters; use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; -class isPublished implements Filter +class IsPublished implements Filter { /** diff --git a/app/Classes/General/Eloquent/Filters/PaymentReference.php b/app/Classes/General/Eloquent/Filters/PaymentReference.php index 10c1fa49..5f5d53f5 100644 --- a/app/Classes/General/Eloquent/Filters/PaymentReference.php +++ b/app/Classes/General/Eloquent/Filters/PaymentReference.php @@ -14,7 +14,7 @@ class PaymentReference implements Filter */ public static function apply(Builder $builder, $value) { - return $builder->where('payment_reference', $value); + return $builder->where('payment_reference', '=', $value); } } \ No newline at end of file diff --git a/app/Classes/Modules/Accounts/DataTransferObjects/FullNameObject.php b/app/Classes/Modules/Accounts/DataTransferObjects/FullNameObject.php index c17a8b72..59396c54 100644 --- a/app/Classes/Modules/Accounts/DataTransferObjects/FullNameObject.php +++ b/app/Classes/Modules/Accounts/DataTransferObjects/FullNameObject.php @@ -4,7 +4,7 @@ namespace App\Classes\Modules\Accounts\DataTransferObjects; use App\Classes\General\Interfaces\DataTransferObject; -class FullnameObject implements DataTransferObject +class FullNameObject implements DataTransferObject { /** @var string */ private $name; @@ -12,11 +12,6 @@ class FullnameObject implements DataTransferObject /** * UserObject constructor. * @param string $name - * @param string $email - * @param string $password - * @param string $passwordConfirmation - * @param int|null $type - * @param int|null $status */ public function __construct(string $name) { diff --git a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php index 8dece746..73f502b4 100644 --- a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php +++ b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php @@ -2,8 +2,10 @@ namespace App\Classes\Modules\Billplzs\ControllersLogic; -use ErrorException; +use App\Classes\Exceptions\ResourceNotFoundException; +use App\Http\Resources\TransactionResource; +use App\Models\User; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; @@ -14,19 +16,11 @@ use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Transactions\Services\FetchesTransaction; use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus; +use Illuminate\Support\Facades\Auth; -class CallbackBillplzLogic extends AbstractControllerLogic +class CallbackBillplzLogic { - /** - * @return array - */ - protected function notification():array { - return [ - 'title' => 'Callback Billplz', - 'message' => 'You have successfully receive Billplz callback' - ]; - } /** @var GetBillplzBill */ private $getBillplzBill; @@ -40,7 +34,7 @@ class CallbackBillplzLogic extends AbstractControllerLogic /** * CreateBookingLogic constructor. - * @param CreateGetBillplzBillsBillplzBill $getBillplzBill + * @param GetBillplzBill $getBillplzBill * @param FetchesTransaction $fetchesTransaction * @param UpdatesTransactionStatus $updatesTransactionStatus */ @@ -54,27 +48,29 @@ class CallbackBillplzLogic extends AbstractControllerLogic /** * @param Request $request - * @return JsonResponse - * @throws \App\Classes\Exceptions\AccessForbiddenException - * @throws \App\Classes\Exceptions\MalformedRequestException - * @throws \App\Classes\Exceptions\RequestValidationException + * @return \Illuminate\Http\RedirectResponse + * @throws MalformedRequestException + * @throws ResourceNotFoundException */ - public function logic(Request $request) : JsonResponse + public function execute(Request $request) { $billplzXSignatureObject = new BillplzXSignatureObject($request); - if(!$billplzXSignatureObject->isValidSignature()) throw new MalformedRequestException('Unable to get correct response from billplz server.'); + if(!$billplzXSignatureObject->isValidSignature()) throw new MalformedRequestException('Billplz Payment validation failed.'); $billPlz = $this->getBillplzBill->execute($billplzXSignatureObject->getBillPlzId()); - if(!$billPlz) throw new MalformedRequestException('Unable to get correct response from billplz server.'); + if(!$billPlz) throw new ResourceNotFoundException('Billplz bill not found.'); $transaction = $this->fetchesTransaction->execute(['payment_reference' => $billplzXSignatureObject->getBillPlzId()]); - if($billPlz->state == 'paid') $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED); - - return $this->response(['data' => $billPlz]); + $this->updatesTransactionStatus->execute($transaction, $billPlz->state === 'paid' ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION); + + $token = Auth::fromUser(User::find(1)); + $request->headers->set('Authorization', 'Bearer '.$token); + return view('pages.payments_redirect', ['marking' => $transaction->booking->marking, 'payment_reference' => $transaction->payment_reference, 'status' => $billPlz->state === 'paid' ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION, 'amount' => $transaction->amount]); +// return redirect()->route('booking.details', ['marking' => $transaction->booking->marking, 'payment_status' => $billPlz->state === 'paid' ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION]); } } \ No newline at end of file diff --git a/app/Classes/Modules/Billplzs/DataTransferObjects/BillplzXSignatureObject.php b/app/Classes/Modules/Billplzs/DataTransferObjects/BillplzXSignatureObject.php index db3e3ad6..ec46e24d 100644 --- a/app/Classes/Modules/Billplzs/DataTransferObjects/BillplzXSignatureObject.php +++ b/app/Classes/Modules/Billplzs/DataTransferObjects/BillplzXSignatureObject.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\Billplzs\DataTransferObjects; use Illuminate\Http\Request; use App\Classes\General\Interfaces\DataTransferObject; +use function PHPSTORM_META\map; class BillplzXSignatureObject implements DataTransferObject { @@ -30,20 +31,19 @@ class BillplzXSignatureObject implements DataTransferObject { $this->request = $request; - $this->billPlzId = $request->id ? $request->id : $request->{'billplz[id]'}; + $this->billPlzId = $request->input('billplz')['id']; - $this->requestXSignature = $request->x_signature ? $request->x_signature : $request->{'billplz[x_signature]'}; + $this->requestXSignature = $request->input('billplz')['x_signature']; $this->_constructBillplzArray()->_natSortBillplzArray()->_constructBillplzString()->_computeBillplzXSignature(); } private function _constructBillplzArray(){ - foreach($this->request->all() as $key => $value){ - if($key != 'x_signature' && $key != 'billplz[x_signature]'){ - $key = str_replace(']', '', str_replace('[', '', $key)); - $this->billPlzConstructArray[] = $key.$value; - } - } + + $this->billPlzConstructArray = collect($this->request->input('billplz'))->forget('x_signature')->map(function($item, $key){ + return 'billplz'.$key.$item; + })->toArray(); + return $this; } @@ -98,7 +98,7 @@ class BillplzXSignatureObject implements DataTransferObject public function isValidSignature(): bool { - return $this->billPlzComputedXSignature == $this->requestXSignature ? true : false; + return $this->billPlzComputedXSignature === $this->requestXSignature ? true : false; } } \ No newline at end of file diff --git a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php index 607b45fa..26b2800b 100644 --- a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php +++ b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php @@ -7,20 +7,27 @@ use App\Classes\Exceptions\MalformedRequestException; class CreatesBillplzBill { + /** - * @return \Illuminate\Database\Eloquent\Model - * @throws \App\Classes\Exceptions\MalformedRequestException + * @param string $name + * @param string $email + * @param string $description + * @param float $amount + * @param string $billNumber + * @param null|string $bankCode + * @return null|object + * @throws MalformedRequestException */ - public function execute(string $name, string $email, string $description, float $amount, string $billNumber, ?string $bankCode = null) { + public function execute(string $name, string $email, string $description, float $amount, string $billNumber, ?string $bankCode = null) { try{ $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, 'description' => $description, - 'amount' => $amount, - 'redirect_url' => config('billplz.redirect_url'), - 'callback_url' => config('billplz.callback_url'), + 'amount' => round($amount, 2) * 100, + 'redirect_url' => route('online_payment.redirect'), + 'callback_url' => route('api.online_payment.callback'), 'reference_1_label' => 'Bank Code', 'reference_1' => $bankCode ? $bankCode : config('billplz.maybank'), 'reference_2_label' => 'Bill Number', diff --git a/app/Classes/Modules/Billplzs/Services/GetBillplzBill.php b/app/Classes/Modules/Billplzs/Services/GetBillplzBill.php index ff7c129f..2a86b403 100644 --- a/app/Classes/Modules/Billplzs/Services/GetBillplzBill.php +++ b/app/Classes/Modules/Billplzs/Services/GetBillplzBill.php @@ -2,13 +2,16 @@ namespace App\Classes\Modules\Billplzs\Services; +use App\Classes\Exceptions\MalformedRequestException; use Illuminate\Support\Facades\Http; class GetBillplzBill { + /** - * @return \Illuminate\Database\Eloquent\Model - * @throws \App\Classes\Exceptions\MalformedRequestException + * @param string $billPlzId + * @return null|object + * @throws MalformedRequestException */ public function execute(string $billPlzId) { try{ diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php index db1c0d2b..ea2058b5 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingPaymentLogic.php @@ -99,7 +99,7 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic $billNumber = $this->generatesTransactionBillNumber->execute('PYMT-'); if(PaymentMethodType::PAYMENT_METHODS[$request->input('payment_method')] == PaymentMethodType::PAYMENT_GATEWAY){ - $billPlzBill = $this->createsBillplzBill->execute($request->user()->name, $request->user()->email, 'This payment is made on behave '.$booking->company->name, $configurations->getTotal(), $billNumber, $request->input('bank_code')); + $billPlzBill = $this->createsBillplzBill->execute($request->user()->name, $request->user()->email, 'This payment is made on behave of '.$booking->company->name, $configurations->getTotal(), $billNumber, $request->input('bank_code')); } $object = new TransactionObject($billNumber, TransactionType::PAYMENT, 1, $booking->company->id, @@ -109,7 +109,7 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic $configurations->getTax(), $configurations->getServiceCharge(), Carbon::now()->addMinutes($paymentAttemptLimit), ApprovalStatus::PENDING_SUBMISSION, [], isset($billPlzBill) ? $billPlzBill->id : NULL); $transaction = $this->createsTransaction->execute($booking, $object); - + return $this->resourceResponse(new TransactionResource($transaction)); } diff --git a/app/Classes/Modules/Bookings/Services/CalculatesBookingTransferredAmount.php b/app/Classes/Modules/Bookings/Services/CalculatesBookingTransferredAmount.php index 5224e044..57a5525c 100644 --- a/app/Classes/Modules/Bookings/Services/CalculatesBookingTransferredAmount.php +++ b/app/Classes/Modules/Bookings/Services/CalculatesBookingTransferredAmount.php @@ -12,7 +12,7 @@ class CalculatesBookingTransferredAmount { public function execute(Booking $booking){ - return $booking->transactions()->bills()->transferred()->sum('original_amount'); + return $booking->transactions()->bills()->complete()->sum('original_amount'); } } \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionProcessor.php b/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionProcessor.php index ff76d197..e583eaf9 100644 --- a/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionProcessor.php +++ b/app/Classes/Modules/Transactions/Processors/CreateInvoiceTransactionProcessor.php @@ -115,7 +115,6 @@ class CreateInvoiceTransactionProcessor if ((float) $booking_amount > (float) $payable_amount) { return; } - // confirm that all payments has been transferred if($this->calculatesBookingTransferredAmount->execute($booking) !== $this->calculatesBookingPaidAmount->execute($booking)){ return; diff --git a/app/Classes/Modules/Transactions/Services/CreatesTransaction.php b/app/Classes/Modules/Transactions/Services/CreatesTransaction.php index b2e13067..06530564 100644 --- a/app/Classes/Modules/Transactions/Services/CreatesTransaction.php +++ b/app/Classes/Modules/Transactions/Services/CreatesTransaction.php @@ -5,12 +5,12 @@ namespace App\Classes\Modules\Transactions\Services; use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord; use App\Classes\General\Interfaces\Transactionable; use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject; -use App\Models\Booking; use App\Models\Transaction; class CreatesTransaction extends AbstractUpdateRelationshipRecord { /** + * @param Transactionable $transactionable * @param TransactionObject $object * @return \Illuminate\Database\Eloquent\Model * @throws \App\Classes\Exceptions\MalformedRequestException diff --git a/app/Http/Controllers/Billplzs/CallbackBillplzController.php b/app/Http/Controllers/Billplz/CallbackBillplzController.php similarity index 52% rename from app/Http/Controllers/Billplzs/CallbackBillplzController.php rename to app/Http/Controllers/Billplz/CallbackBillplzController.php index 33525632..dfac2c05 100644 --- a/app/Http/Controllers/Billplzs/CallbackBillplzController.php +++ b/app/Http/Controllers/Billplz/CallbackBillplzController.php @@ -1,19 +1,20 @@ execute($request); } diff --git a/app/Http/Controllers/Billplzs/CreateBillplzBillController.php b/app/Http/Controllers/Billplz/CreateBillplzBillController.php similarity index 82% rename from app/Http/Controllers/Billplzs/CreateBillplzBillController.php rename to app/Http/Controllers/Billplz/CreateBillplzBillController.php index cd62cfec..c10bad79 100644 --- a/app/Http/Controllers/Billplzs/CreateBillplzBillController.php +++ b/app/Http/Controllers/Billplz/CreateBillplzBillController.php @@ -1,6 +1,6 @@ service); return [ 'id' => $this->id, 'company' => new CompanyResource($this->company), diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index 9d30af54..266f8fc2 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -23,8 +23,8 @@ class TransactionResource extends JsonResource '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)), + 'payment_method' => (float) $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, 'currency' => new CurrencyResource($this->currency), diff --git a/app/Models/Booking.php b/app/Models/Booking.php index c3492241..17a50213 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -6,11 +6,8 @@ use App\Classes\General\Interfaces\Documentable; use App\Classes\General\Interfaces\Transactionable; use App\Classes\ValueObjects\Constants\RoleTypes; use App\Scopes\CustomerBookingsScope; -use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\MorphMany; -use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\SoftDeletes; /** diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index d619921d..eedb1cf8 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -6,8 +6,11 @@
Status
-
- {{ item.status === 1 ? 'Pending Verification' : item.status === 2 ? 'Processing Payment' : item.status === 4 ? 'Rejected' : 'Transferred'}} +
+ {{ item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Processing Payment'}} +
+
+ {{ item.status === 1 ? 'Processing Payment' : 'Transferred'}}
@@ -19,16 +22,22 @@
-
{{ item.status === 1 ? 'Submitted' : item.status === 2 ? 'Received' : item.status === 4 ? 'Rejected' : 'Paid'}} On: {{item.updated_at}}
+
{{ item.status === 1 ? 'Submitted' : item.status === 2 ? 'Received' : item.status === 4 ? 'Rejected' : 'Paid'}} On: {{item.updated_at}}
-
+
+
+
+ + +
+
@@ -87,7 +96,7 @@
Your Payment Proof
-
+
@@ -100,6 +109,13 @@
+
Our Payment Proof
@@ -116,7 +132,7 @@
-
+
diff --git a/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue b/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue index 0b6fe5db..0487b05c 100644 --- a/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue +++ b/resources/assets/vue/components/bookings/elements/SupplierPendingOrderComponent.vue @@ -30,7 +30,7 @@
Date
- {{item.documents.created_at}} + {{item.payment_method === 5 ? item.updated_at : item.documents.created_at}}
diff --git a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue index 05e20926..ccc7c12b 100644 --- a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue +++ b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue @@ -106,14 +106,14 @@
-
+
{{error}}
-
+
@@ -184,7 +184,7 @@
-
+
@@ -199,38 +199,130 @@
- -
+
- -
-
-
-
-
- - Maybank2u -
+
+
+
+
+
+

Online Banking

+
+
+
+
+
+ +
+

Cheque

- -
+
-
-
- - Cimb +
+
+
+
+
+ Personal Account Banks +
+
+
+
+
+
+
+
+
+ +
+
+

Maybank2u

+
+
+
+
+
+
+
+
+ +
+
+

CimbClicks

+
+
+
+
+
+
+
+
+
+
+
+
+
+ Business Account Banks +
+
+
+
+
+
+
+
+
+ +
+
+

Maybank2E

+
+
+
+
+
+
+
+
+ +
+
+

BizChannel

+
+
+
+
+
+
+
+
+ + +
+
+
+ +
+
+
+
-
-
+
@@ -321,7 +413,7 @@
- +
@@ -353,7 +445,6 @@ status: false }, onlinePayment: { - bankName: '', id: '', status: false }, @@ -378,10 +469,9 @@ } }, - selectOnlinePaymentBank(bankName){ + selectOnlinePaymentBank(bankCode){ this.onlinePayment = { - bankName: bankName.bankName, - id: bankName.id, + id: bankCode, status: true, } @@ -414,8 +504,4 @@ mixins: [componentHandler], directives: {money: VMoney} } - - - \ No newline at end of file + \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/forms/ConfirmQuotationFormComponent.vue b/resources/assets/vue/components/bookings/forms/ConfirmQuotationFormComponent.vue index ad0fe0c0..b0b89274 100644 --- a/resources/assets/vue/components/bookings/forms/ConfirmQuotationFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/ConfirmQuotationFormComponent.vue @@ -8,12 +8,17 @@
Congratulation, you have got great rates.
-
+
You can proceed by bank in {{(Math.round((calculation.total + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} MYR to the bank account detailed below and upload your payment proof to proceed with your transfer after clicking on the confirm button below.
-
+
+
+
You will be redirected to your bank to complete the payment of {{(Math.round((calculation.total + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} MYR after clicking on the confirm button below. please follow your bank instruction to complete the payment
+
+
+
-
Please upload your payment proof before the booking expires within {{calculation.payment_attempt_limit}}.
+
Please upload your payment proof complete your payment before the booking expires within {{calculation.payment_attempt_limit}}.
@@ -77,6 +82,9 @@ payment_method: { required: true }, + bank_code: { + required: false + }, id: { type: Number, required: true @@ -91,6 +99,7 @@ parameters: { payment_method: this.payment_method, amount: this.amount, + bank_code: this.bank_code, } } }, @@ -104,7 +113,7 @@ 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'; + window.location.href = 'https://www.billplz-sandbox.com/bills/' + response.payload.data.payment_reference + '?auto_submit=true'; } } } diff --git a/resources/assets/vue/components/bookings/forms/RegenerateBookingInvoicesComponent.vue b/resources/assets/vue/components/bookings/forms/RegenerateBookingInvoicesComponent.vue new file mode 100644 index 00000000..5cda2e90 --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/RegenerateBookingInvoicesComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue index 013a511e..5e61c1c2 100644 --- a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue @@ -4,7 +4,7 @@
-
+
@@ -203,6 +203,10 @@
+
Regenerate Invoices
+ + +
@@ -250,7 +254,16 @@
-
+ +
- +
diff --git a/resources/views/pages/booking_details.blade.php b/resources/views/pages/booking_details.blade.php index a9ad70a7..d1e3925a 100644 --- a/resources/views/pages/booking_details.blade.php +++ b/resources/views/pages/booking_details.blade.php @@ -4,7 +4,7 @@
@if(!env('IS_PRODUCTION')) - Merge Transfer Orders + {{--Merge Transfer Orders--}} @endif
diff --git a/resources/views/pages/dashboards/admin.blade.php b/resources/views/pages/dashboards/admin.blade.php index 13e9e7ac..d2e89685 100644 --- a/resources/views/pages/dashboards/admin.blade.php +++ b/resources/views/pages/dashboards/admin.blade.php @@ -328,7 +328,7 @@
- + diff --git a/resources/views/pages/payments_redirect.blade.php b/resources/views/pages/payments_redirect.blade.php new file mode 100644 index 00000000..f9faac98 --- /dev/null +++ b/resources/views/pages/payments_redirect.blade.php @@ -0,0 +1,67 @@ +@extends('layouts.base_portal') +@section('inner_content') +
+
+
+
+ @if($status === 2) + + @else + + @endif +
+
+ @if($status === 2) +
+
+
+
+
Your Payment is Successful
+

Thank you for your payment. Your transfer request is now being processed and you will be notified once its complete.

+
+
+ +
+
+ @else +
+
+
+
+
Your Payment is Pending Verification
+

It seems that your payment attempt is still pending verification. Either your payment has failed or is pending verification, you can try to reattempt your payment to complete your transaction.

+
+
+ +
+
+ @endif + +
+
+@endsection \ No newline at end of file diff --git a/routes/api.php b/routes/api.php index 0dc5b6a5..983edf2f 100644 --- a/routes/api.php +++ b/routes/api.php @@ -23,13 +23,7 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function Route::get('countries/list', 'Services\CountriesListController@index')->name('list.countries'); }); - Route::group(['prefix' => 'billplz', 'as' => 'billplz.', 'namespace' => 'Billplzs'], function () { - Route::group(['prefix' => 'bill', 'as' => 'bill.'], function () { - Route::post('/callback', 'CallbackBillplzController@callback')->name('callback'); - }); - }); - - + Route::post('online_payment/callback', 'billplz\CallbackBillplzController@callback')->name('online_payment.callback'); Route::group(['middleware' => 'valid.token'], function () { diff --git a/routes/billplz.php b/routes/billplz.php index cee3c778..e1717a20 100644 --- a/routes/billplz.php +++ b/routes/billplz.php @@ -2,7 +2,7 @@ use Illuminate\Support\Facades\Route; -Route::group(['prefix' => 'billplz', 'as' => 'billplz.', 'namespace' => 'Billplzs'], function () { +Route::group(['prefix' => 'billplz', 'as' => 'billplz.', 'namespace' => 'Billplz'], function () { Route::group(['prefix' => 'bill', 'as' => 'bill.'], function () { Route::post('/create', 'CreateBillplzBillController@create')->name('create'); }); diff --git a/routes/web.php b/routes/web.php index c0e8a208..0e211389 100644 --- a/routes/web.php +++ b/routes/web.php @@ -100,9 +100,13 @@ Route::get('/test', function(){ }); -Route::get('/bookings/billplz', function () { - return view('pages.billplz_redirect'); -})->name('bookings.billplz'); + + +Route::get('/online_payment/redirect', 'billplz\CallbackBillplzController@callback')->name('online_payment.redirect'); + +//Route::get('/online_payment/redirect', function () { +// return view('pages.billplz_redirect'); +//})->name('online_payment.redirect'); Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');