diff --git a/app/Classes/General/LogHelper.php b/app/Classes/General/LogHelper.php new file mode 100644 index 00000000..23d133c8 --- /dev/null +++ b/app/Classes/General/LogHelper.php @@ -0,0 +1,51 @@ +channelName = $channelName; + return $logHelper; + } + + public function info($message) + { + $envVar = env('LARAVEL_VAPOR_ENABLED'); + Log::info("LogHelper.info: {$message}, channelName: {$this->channelName}, envVar {$envVar}"); + if ($envVar) { + Log::channel($this->channelName.'_vapor')->info($message); + } + else{ + Log::channel($this->channelName)->info($message); + } + } + + public function warning($message) + { + $envVar = env('LARAVEL_VAPOR_ENABLED'); + Log::info("LogHelper.warning: {$message}, channelName: {$this->channelName}, envVar {$envVar}"); + if ($envVar) { + Log::channel($this->channelName . '_vapor')->warning($message); + } else { + Log::channel($this->channelName)->warning($message); + } + } + + public function error($message) + { + $envVar = env('LARAVEL_VAPOR_ENABLED'); + Log::info("LogHelper.error: {$message}, channelName: {$this->channelName}, envVar {$envVar}"); + if ($envVar) { + Log::channel($this->channelName . '_vapor')->error($message); + } else { + Log::channel($this->channelName)->error($message); + } + } +} diff --git a/app/Classes/Jobs/Commands/V2/DeleteOrderV2CommandJob.php b/app/Classes/Jobs/Commands/V2/DeleteOrderV2CommandJob.php index 256ed7b8..8b944e05 100644 --- a/app/Classes/Jobs/Commands/V2/DeleteOrderV2CommandJob.php +++ b/app/Classes/Jobs/Commands/V2/DeleteOrderV2CommandJob.php @@ -10,9 +10,11 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; +use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Models\Booking; -use Illuminate\Support\Facades\Log; + class DeleteOrderV2CommandJob implements ShouldQueue { @@ -72,10 +74,15 @@ class DeleteOrderV2CommandJob implements ShouldQueue $text = implode(', ', $text); } - Log::info(Carbon::now() . ' : ' . $text); + Log::info(Carbon::now() . ' [DeleteOrderV2] : ' . $text); + $filesystemDriver = Storage::getDefaultDriver(); + if($filesystemDriver === 's3'){ - $filePath = storage_path('logs/delete-orders.log'); //cief todo: should map to the equivalent in AWS S3 bucket - $textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL; - file_put_contents($filePath, $textToAppend, FILE_APPEND); + } + else{ + $filePath = storage_path('logs/delete-orders.log'); + $textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL; + file_put_contents($filePath, $textToAppend, FILE_APPEND); + } } } diff --git a/app/Classes/Modules/Exports/Services/ExportCurrencyVendorOrder.php b/app/Classes/Modules/Exports/Services/ExportCurrencyVendorOrder.php new file mode 100644 index 00000000..2d3a79f9 --- /dev/null +++ b/app/Classes/Modules/Exports/Services/ExportCurrencyVendorOrder.php @@ -0,0 +1,44 @@ +request = $request; + } + + public function view(): View + { + $id = $this->request->route('id'); + + $group = Group::findOrFail($id); + + $supplier = $group->issuerCompany; + + $transferFeeTransactions = $group->transactions()->with([ + 'transactions' => function ($transaction) { + return $transaction->where('type', TransactionType::TRANSFER_FEE); + } + ])->get()->pluck('transactions')->flatten(); + + return view('pages.pdfs.currency_vendor_order_inner', [ + 'transactions' => $group->transactions, + 'transferFeeTransactions' => $transferFeeTransactions, + 'supplier' => $supplier + ]); + } +} diff --git a/app/Classes/ValueObjects/Constants/TransactionType.php b/app/Classes/ValueObjects/Constants/TransactionType.php index e14930b0..09479729 100644 --- a/app/Classes/ValueObjects/Constants/TransactionType.php +++ b/app/Classes/ValueObjects/Constants/TransactionType.php @@ -38,4 +38,23 @@ final class TransactionType { public const BILL_REFUND = 16; -} + public const ID_TO_NAME = [ + self::PAYMENT_ATTEMPT => "PAYMENT_ATTEMPT", + self::PAYMENT => "PAYMENT", + self::INVOICE => "INVOICE", + self::BILL => "BILL", + self::PROFORMA => "PROFORMA", + self::TOP_UP => "TOP_UP", + self::REFUND => "REFUND", + self::PURCHASE_ORDER => "PURCHASE_ORDER", + self::SUPPLIER_DELIVER => "SUPPLIER_DELIVER", + self::CREDIT_NOTE => "CREDIT_NOTE", + self::DEBIT_NOTE => "DEBIT_NOTE", + self::WITHDRAW => "WITHDRAW", + self::TRANSFER_FEE => "TRANSFER_FEE", + self::CASH_BACK => "CASH_BACK", + self::SUPPLIER_PAYMENT => "SUPPLIER_PAYMENT", + self::SUPPLIER_REFUND => "SUPPLIER_REFUND", + ]; + + } diff --git a/app/Console/Commands/DeleteOrderCommand.php b/app/Console/Commands/DeleteOrderCommand.php index 9bcefe47..e2542cee 100644 --- a/app/Console/Commands/DeleteOrderCommand.php +++ b/app/Console/Commands/DeleteOrderCommand.php @@ -6,6 +6,7 @@ use Illuminate\Console\Command; use Carbon\Carbon; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\TransactionType; +use Illuminate\Support\Facades\Storage; use App\Models\Booking; class DeleteOrderCommand extends Command @@ -77,10 +78,15 @@ class DeleteOrderCommand extends Command $text = implode(', ', $text); } - $this->info(Carbon::now() . ' : ' . $text); + $this->info(Carbon::now() . ' [DeleteOrderV1]: ' . $text); + $filesystemDriver = Storage::getDefaultDriver(); + if($filesystemDriver === 's3'){ - $filePath = storage_path('logs/delete-orders.log'); - $textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL; - file_put_contents($filePath, $textToAppend, FILE_APPEND); + } + else{ + $filePath = storage_path('logs/delete-orders.log'); + $textToAppend = Carbon::now()->format('[Y-m-d H:i:s]') . ' ' . $text . PHP_EOL; + file_put_contents($filePath, $textToAppend, FILE_APPEND); + } } } diff --git a/app/Http/Controllers/Exports/ExportCustomersToExcelController.php b/app/Http/Controllers/Exports/ExportCustomersToExcelController.php index 7e484c6c..59f3aba0 100644 --- a/app/Http/Controllers/Exports/ExportCustomersToExcelController.php +++ b/app/Http/Controllers/Exports/ExportCustomersToExcelController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Exports; +use App\Classes\Modules\Exports\Services\ExportCurrencyVendorOrder; use App\Classes\Modules\Exports\Services\ExportsCustomers; use App\Classes\Modules\Exports\Services\ExportsTransactions; use App\Classes\Modules\Exports\Services\ExportsBookingTransactions; @@ -37,6 +38,12 @@ class ExportCustomersToExcelController public function export(ExportsCustomers $exportsCustomers, Request $request){ return $exportsCustomers->download('customers.csv', Excel::CSV, ['Content-Type' => 'text/csv']); } + public function exportCurrencyVendorOrder(ExportCurrencyVendorOrder $exportCurrencyVendorOrder, Request $request){ + $exportCurrencyVendorOrder = new ExportCurrencyVendorOrder($request); + $response = $exportCurrencyVendorOrder->download('CurrencyVendorOrder.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); + ob_end_clean(); + return $response; + } public function transactions(ExportsTransactions $exportsTransactions, Request $request){ return $exportsTransactions->download('transactions.csv', Excel::CSV, ['Content-Type' => 'text/csv']); diff --git a/app/Http/Resources/BookingResource.php b/app/Http/Resources/BookingResource.php index 6803eec9..2612c5b4 100644 --- a/app/Http/Resources/BookingResource.php +++ b/app/Http/Resources/BookingResource.php @@ -56,7 +56,8 @@ class BookingResource extends JsonResource ->whereDate('expires_on', '>=', Carbon::now()) ->get() ), - 'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>=', Carbon::now())->where('expires_on', '>', Carbon::now()->toTimeString())->get()), + // 'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::PENDING_SUBMISSION)->whereDate('expires_on', '>=', Carbon::now())->where('expires_on', '>', Carbon::now()->toTimeString())->get()), + 'expired_payment_attempts' => TransactionResource::collection($this->transactions()->payments()->where('status', ApprovalStatus::EXPIRED)->get()), 'payment_history' => TransactionResource::collection($this->transactions()->where(function($query){ $query->where(function($query){ $query->payments()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED, ApprovalStatus::REFUNDED]); diff --git a/composer.json b/composer.json index f9a24d18..757d16f2 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "laravel/vapor-cli": "^1.55", "laravel/vapor-core": "^2.33", "maatwebsite/excel": "^3.1", + "maxbanton/cwh": "^2.0", "mpdf/mpdf": "^8.1", "rinvex/countries": "^6.1", "rspective/voucherify": " v2.0.*", diff --git a/resources/assets/vue/app.js b/resources/assets/vue/app.js index f2aba812..19d403c5 100644 --- a/resources/assets/vue/app.js +++ b/resources/assets/vue/app.js @@ -38,6 +38,13 @@ Vue.use(VueTheMask); Vue.use(filters); Vue.directive('closable', closable); +Vue.directive('tooltip', function(el, binding){ + $(el).tooltip({ + title: binding.value, + placement: binding.arg, + trigger: 'hover' + }) +}) Vue.mixin({ methods: { route: route, diff --git a/resources/assets/vue/components/bookings/elements/PaymentComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentComponent.vue index 1db46493..1f9a606f 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentComponent.vue @@ -13,7 +13,7 @@ -
+
diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index d3a370b7..e560f76d 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -289,7 +289,7 @@
-
+
@@ -319,7 +319,7 @@
-
+
Created At
diff --git a/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue b/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue index 3470891a..5d27ca3f 100644 --- a/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue +++ b/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue @@ -46,8 +46,8 @@
Paid Amount: {{ paidAmount }}
-
Paid Amount: {{ (Math.round((this.data.refunded_amount + Number.EPSILON) * 100) / 100).toFixed(2) }}
-
Refund Amount: {{ refundAmount }}
+
Refunded Amount: {{ (Math.round((this.data.refunded_amount + Number.EPSILON) * 100) / 100).toFixed(2) }}
+
Refund Amount Requested: {{ refundAmount }}
@@ -67,7 +67,7 @@