Compare commits

..

456 Commits

Author SHA1 Message Date
edmondlang 32bd000195 update address extra fields 2024-10-16 00:45:25 +08:00
edmondlang 29477c179e remove logging 2024-10-15 01:05:44 +08:00
edmondlang d5265c1254 update address extra fields 2024-10-15 01:01:31 +08:00
edmondlang f44497e50c address extra fields 2024-10-14 14:16:33 +08:00
edmondlang 7b0e271459 admin update new email for user 2024-10-12 15:23:12 +08:00
edmondlang bb08f5d872 admin update new email for user 2024-10-12 01:48:58 +08:00
Dillon Ngo 5b45d42aaa Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-10 18:13:24 +08:00
Dillon Ngo f1c7323a1d Laravel Vapor - New UI for admin to download reports 2024-10-10 17:30:27 +08:00
Dillon Ngo e8a17af3a6 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-10 17:10:03 +08:00
Dillon Ngo c67ca30100 Laravel Vapor - New UI for admin to download reports 2024-10-10 17:06:50 +08:00
Dillon Ngo 21ec1a582a Laravel Vapor - Fix a problem at container show page showing blank 2024-10-10 16:46:31 +08:00
Dillon Ngo 0b8aea4b60 Laravel Vapor - New UI for admin to download reports 2024-10-10 16:31:08 +08:00
Dillon Ngo 92cf194c07 Laravel Vapor - Fix another 504 issue when searching for container 2024-10-09 15:04:42 +08:00
Dillon Ngo 74ec1c949b Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-09 13:13:53 +08:00
Dillon Ngo 497666e582 Laravel Vapor - New schedule tasks and commands for token expiration for new user and password reset 2024-10-09 13:13:28 +08:00
Dillon Ngo 7953de1f7d Laravel Vapor - New schedule tasks and commands for token expiration for new user and password reset 2024-10-09 12:52:25 +08:00
Dillon Ngo dcca295c52 Laravel Vapor - New schedule tasks and commands for token expiration for new user and password reset 2024-10-09 12:22:50 +08:00
Dillon Ngo 283be0b8a4 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-08 20:07:11 +08:00
Dillon Ngo 3ac466f412 Laravel Vapor - Fix another 504 issue when searching for container 2024-10-08 19:49:30 +08:00
Dillon Ngo 87ffaa5b0d Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-08 18:13:29 +08:00
Dillon Ngo b5122e97c1 Laravel Vapor - Fix another 504 issue when searching for container 2024-10-08 17:57:03 +08:00
Dillon Ngo 940341a2be Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-08 17:33:31 +08:00
Dillon Ngo a956d4ac4c Laravel Vapor - Fix another 504 issue when searching for container 2024-10-08 17:33:10 +08:00
Dillon Ngo 4892555211 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-08 17:06:03 +08:00
Dillon Ngo a95f62b59a Laravel Vapor - Fix another 504 issue when searching for container 2024-10-08 16:52:03 +08:00
Dillon Ngo 821291f16f Laravel Vapor - Fix another 504 issue when searching for container 2024-10-08 16:06:24 +08:00
Dillon Ngo 0a7d93b034 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-08 00:23:33 +08:00
Dillon Ngo 2a9478f89a Laravel Vapor - Emergency fix cannot reset password 2024-10-08 00:22:39 +08:00
Dillon Ngo 58a4dabf09 Laravel Vapor - Commented out logs 2024-10-07 21:34:54 +08:00
Dillon Ngo 033b6a4c26 Laravel Vapor - Debug 2024-10-07 21:32:50 +08:00
Dillon Ngo 712d122d4a Laravel Vapor - Debug 2024-10-07 20:57:59 +08:00
Dillon Ngo e5498cffb8 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-05 14:46:04 +08:00
Dillon Ngo fc1f9f9f7e Laravel Vapor - New UI for admin to download reports 2024-10-05 14:32:54 +08:00
Dillon Ngo 077e719e69 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-05 14:15:45 +08:00
Dillon Ngo 1f1fb7d79a Laravel Vapor - Fix a problem with deployment 2024-10-05 14:14:59 +08:00
Dillon Ngo d0e2e17169 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-05 13:50:37 +08:00
Dillon Ngo bd8e30493f Laravel Vapor - New UI for admin to download reports 2024-10-05 13:34:21 +08:00
Dillon Ngo ff790885ab Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-04 02:56:36 +08:00
Dillon Ngo 7fc4324645 Laravel Vapor - New UI for admin to download reports 2024-10-04 02:56:07 +08:00
Dillon Ngo 69a898f7ee Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-04 02:38:22 +08:00
Dillon Ngo abad3cd591 Laravel Vapor - New UI for admin to download reports 2024-10-04 02:37:46 +08:00
Dillon Ngo 0e6d1b7633 Laravel Vapor - New UI for admin to download reports 2024-10-04 02:13:41 +08:00
Dillon Ngo 91576d9f7b Laravel Vapor - New UI for admin to download reports 2024-10-04 02:03:06 +08:00
Dillon Ngo 1606bc7426 Laravel Vapor - New UI for admin to download reports 2024-10-04 01:55:26 +08:00
Dillon Ngo 1f8351486f Laravel Vapor - New UI for admin to download reports 2024-10-04 01:50:00 +08:00
Dillon Ngo 9299c11131 Laravel Vapor - New UI for admin to download reports 2024-10-04 01:29:26 +08:00
Dillon Ngo 91b00baa07 Laravel Vapor - New UI for admin to download reports 2024-10-04 01:15:01 +08:00
Dillon Ngo 7d3e0c486f Laravel Vapor - New UI for admin to download reports 2024-10-04 00:41:10 +08:00
Dillon Ngo 87cf25a2f3 Laravel Vapor - New UI for admin to download reports 2024-10-04 00:20:54 +08:00
Dillon Ngo c3c9421e19 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-03 23:37:02 +08:00
Dillon Ngo e21804ceca Laravel Vapor - Fix a problem with deployment 2024-10-03 23:36:51 +08:00
Dillon Ngo d4ba2a2c43 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-03 23:29:16 +08:00
Dillon Ngo 38cdd37aea Laravel Vapor - New UI for admin to download reports 2024-10-03 22:41:35 +08:00
Dillon Ngo 5f6670ad91 Laravel Vapor - Fix a problem with deployment 2024-10-03 16:55:32 +08:00
Dillon Ngo 5799da5ae1 Laravel Vapor - Fix a problem with deployment 2024-10-03 16:37:08 +08:00
Dillon Ngo cd05d1bed3 Laravel Vapor - Fix a problem with deployment 2024-10-03 13:43:05 +08:00
Dillon Ngo 5753c63248 Laravel Vapor - Fix a problem with deployment 2024-10-03 13:09:51 +08:00
Dillon Ngo c01d5c993c Laravel Vapor - Fix a problem with deployment 2024-10-03 13:01:17 +08:00
Dillon Ngo 2c24c469f5 Laravel Vapor - Fix a problem with deployment 2024-10-03 12:54:20 +08:00
Dillon Ngo a18377df9f Laravel Vapor - Fix a problem with deployment 2024-10-03 12:24:01 +08:00
Dillon Ngo a99d19721c Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-03 12:02:44 +08:00
Dillon Ngo 753141ea81 Laravel Vapor - Fix a prolem when storage invoice is regenerated, storage invoices from other transactions of the same order gets deleted 2024-10-03 11:04:29 +08:00
Dillon Ngo 8a421e845e Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-02 10:03:53 +08:00
Dillon Ngo b26ed17008 Laraval Vapor - Look into Shipping Invoice kept regenerating even after user paid 2024-10-02 10:03:28 +08:00
Dillon Ngo 24fb998e4d Laravel Vapor - Making sure code meant for laravel vapor can run locally without any problem with default settings 2024-10-01 16:47:06 +08:00
Dillon Ngo 8459a784d0 Laravel Vapor - Making sure code meant for laravel vapor can run locally without any problem with default settings 2024-10-01 16:41:14 +08:00
Dillon Ngo c71827662c Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-10-01 16:13:39 +08:00
Dillon Ngo 3d98495f89 Laravel Vapor - Get rid of an error from logs: Trying to get property 'owner' of non-object 2024-10-01 15:54:32 +08:00
Dillon Ngo cb8a61947a Laravel Vapor - Disable vue polling component 2024-09-30 20:02:03 +08:00
Dillon Ngo 9b22be40b9 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-30 18:34:50 +08:00
Dillon Ngo c3b6247330 Laravel Vapor - Reinstate a UI for ssearching customer by eamil address that was not working for a long time 2024-09-30 18:34:23 +08:00
Dillon Ngo 0bb65a4061 Laravel Vapor - Reinstate a UI for ssearching customer by eamil address that was not working for a long time 2024-09-30 18:19:53 +08:00
Dillon Ngo cf9352487f Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-28 11:28:07 +08:00
Dillon Ngo 726f17aefe Laravel Vapor - Code Refactoring to use one component only and to make download work at local machine 2024-09-28 11:09:22 +08:00
Dillon Ngo 42de5881ee Laravel Vapor - Code Refactoring to use one component only and to make download work at local machine 2024-09-28 10:52:40 +08:00
Dillon Ngo 9fba6c9580 Laravel Vapor - Code Refactoring to use one component only and to make download work at local machine 2024-09-28 10:34:49 +08:00
Dillon Ngo 0c1d88a2df Laravel Vapor - Code Refactoring to use one component only and to make download work at local machine 2024-09-28 10:28:50 +08:00
Dillon Ngo dbfeaf2783 Laravel Vapor - Fix a problem with storage invoice does not show in pages other than page 1 in admin payment and billing page 2024-09-28 08:02:38 +08:00
Dillon Ngo b06dc438f5 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-28 08:01:40 +08:00
Dillon Ngo ccde9763f7 Laravel Vapor - Fix a problem with storage invoice does not show in pages other than page 1 in admin payment and billing page 2024-09-28 07:33:53 +08:00
Dillon Ngo 19be4b2a05 Laravel Vapor - Fix a problem with storage invoice does not show in pages other than page 1 in admin payment and billing page 2024-09-28 07:17:31 +08:00
Dillon Ngo f4cdc301d7 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-26 15:50:33 +08:00
Dillon Ngo 46d6e09fff Laravel Vapor - Fix a problem reported by Yien about missing ETD, ETA 2024-09-26 14:57:20 +08:00
Dillon Ngo 7d79abd023 Laravel Vapor - Code Refactoring 2024-09-26 14:05:15 +08:00
Dillon Ngo 4a4c6d6e99 Laravel Vapor - Code Refactoring 2024-09-26 13:52:13 +08:00
Dillon Ngo bdadd18a17 Laravel Vapor - Code Refactoring 2024-09-26 13:48:28 +08:00
Dillon Ngo 03d5c29ae1 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-26 11:10:15 +08:00
Dillon Ngo 99db37a67c Laravel Vapor - Fix a problem (kills all other running http request) when open a new tab to trigger download 2024-09-26 10:46:26 +08:00
Dillon Ngo a2f110b491 Laravel Vapor, Laravel Vapor - New download button to download on-hold-packing-list 2024-09-26 10:26:17 +08:00
Dillon Ngo 997c14d00e Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-26 09:29:23 +08:00
Dillon Ngo aacd953a82 Laravel Vapor - Update YD API schedule task frequency 2024-09-26 09:29:13 +08:00
Dillon Ngo 08aa383b91 Laravel Vapor - Housekeeping 2024-09-26 06:58:44 +08:00
Dillon Ngo d20cc1bc7b Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-26 06:54:04 +08:00
Dillon Ngo c4bbff232d Laravel Vapor - Housekeeping 2024-09-26 06:53:50 +08:00
Dillon Ngo b0a96441c4 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-26 06:23:15 +08:00
Dillon Ngo 3e888c7c08 Laravel Vapor - Fix missing packages summary info on customer page 2024-09-26 06:09:29 +08:00
Dillon Ngo dc484becc8 Laravel Vapor - Fix missing packages summary info on customer page 2024-09-26 05:59:12 +08:00
Dillon Ngo eda8b7eeba Laravel Vapor - Fix missing packages summary info on customer page 2024-09-25 20:50:25 +08:00
Dillon Ngo 71313491fe Laravel Vapor - Fix missing packages summary info on customer page 2024-09-25 20:17:24 +08:00
Dillon Ngo 0a42bc525a Laravel Vapor - Fix missing packages summary info on customer page 2024-09-25 20:02:20 +08:00
Dillon Ngo a6860de6f7 Laravel Vapor - Fix missing packages summary info on customer page 2024-09-25 19:20:09 +08:00
Dillon Ngo 01051dbdd4 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-25 16:49:34 +08:00
Dillon Ngo f0813b03c8 Laravel Vapor - code refactoring for Issue 13 2024-09-25 16:49:15 +08:00
Dillon Ngo ba86c2e903 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-25 15:09:29 +08:00
Dillon Ngo eb1d5423d8 Laravel Vapor - Convert /export/on-hold-packing-list into protected route like API + Disable direct dispatch of UpdatePerfexCRMPrelude job at PackingListToPerfexCRMProcessor 2024-09-25 14:33:12 +08:00
Dillon Ngo da2ff03c94 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-25 10:18:03 +08:00
Dillon Ngo 259eca063f Laravel Vapor - New download button to download on-hold-packing-list 2024-09-25 10:16:19 +08:00
Dillon Ngo a9f63ce137 Laravel Vapor - code refactoring for Issue 13 2024-09-25 09:57:08 +08:00
Dillon Ngo b83f62b703 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-25 09:28:36 +08:00
Dillon Ngo 428bf85043 Laravel Vapor - New download button to download on-hold-packing-list 2024-09-25 09:15:13 +08:00
Dillon Ngo ec8e2de45e Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-24 18:12:53 +08:00
Dillon Ngo 15f463c556 Laravel Vapor - Solve a missing information with received parcels on order page reported by Yien, rewrite front end component retrieve data 2024-09-24 18:12:43 +08:00
Dillon Ngo 14e3c4fac0 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-24 17:44:08 +08:00
Dillon Ngo f2833be359 Laravel Vapor - Solve a missing information with received parcels on order page reported by Yien, rewrite front end component retrieve data 2024-09-24 17:43:59 +08:00
Dillon Ngo 927f0f5980 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-24 17:21:09 +08:00
Dillon Ngo 430fe0456b Laravel Vapor - Solve a missing information with received parcels on order page reported by Yien, rewrite front end component retrieve data 2024-09-24 17:04:33 +08:00
Dillon Ngo 5a07ec7bba Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-23 15:33:35 +08:00
Dillon Ngo 9cb7d992ab Laravel Vapor - Fix an error: Trying to get property 'owner' of non-objec 2024-09-23 15:33:18 +08:00
Dillon Ngo e14aa4f9eb Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-23 14:11:57 +08:00
Dillon Ngo 040588c8ba Laravel Vapor - Fix 504 error 2024-09-23 14:01:01 +08:00
Dillon Ngo 02c0cc2d63 Laravel Vapor - Fix 504 error 2024-09-23 13:43:57 +08:00
Dillon Ngo c75866f958 Laravel Vapor - Fix 504 error 2024-09-23 13:29:51 +08:00
Dillon Ngo 9288f1e9f2 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-22 03:12:35 +08:00
Dillon Ngo eb68f1c394 Laravel Vapor - look into price increase for storage invoice 2024-09-22 02:55:49 +08:00
Dillon Ngo 5790f5a7a3 Laravel Vapor - look into price increase for storage invoice 2024-09-22 01:28:04 +08:00
Dillon Ngo 34b692fb4d Laravel Vapor - look into price increase for storage invoice 2024-09-21 23:48:50 +08:00
Dillon Ngo ee3de039fb Laravel Vapor - look into price increase for storage invoice 2024-09-21 23:28:42 +08:00
Dillon Ngo f293a975ed Laravel Vapor - look into price increase for storage invoice 2024-09-21 23:02:24 +08:00
Dillon Ngo d4f02cdafe Laravel Vapor - Code refactoring 2024-09-21 22:20:03 +08:00
Dillon Ngo 5d8d57e399 Laravel Vapor - Code refactoring 2024-09-21 13:15:05 +08:00
Dillon Ngo 608c9284dd Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-20 08:40:42 +08:00
Dillon Ngo 3a97b5e26d Laravel Vapor - Debugging 504 error 2024-09-20 08:22:47 +08:00
Dillon Ngo cca188eefd Laravel Vapor - Debugging 504 error 2024-09-20 07:26:48 +08:00
Dillon Ngo 5401b38638 Laravel Vapor - Debugging 504 error 2024-09-20 06:56:35 +08:00
Dillon Ngo 5bf7acad6b Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-20 01:46:49 +08:00
Dillon Ngo d61d58a51a Laravel Vapor - New table and command to handle delayed jobs 2024-09-20 01:46:38 +08:00
Dillon Ngo 8b7d2041ed Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-19 12:49:58 +08:00
Dillon Ngo 4d7e9dcd66 Laravel Vapor - Fix a null error 2024-09-19 12:37:07 +08:00
Dillon Ngo 6647ad6ffc Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-19 10:45:06 +08:00
Dillon Ngo 8795e116f0 Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 10:44:56 +08:00
Dillon Ngo 0927bf4f00 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-19 10:29:55 +08:00
Dillon Ngo c8ca6d7f6f Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 10:29:43 +08:00
Dillon Ngo 2a25eb18ae Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-19 10:16:03 +08:00
Dillon Ngo ea569b437b Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 10:15:31 +08:00
Dillon Ngo 0386c224b1 Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 10:13:52 +08:00
Dillon Ngo 457952cd44 Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 09:34:28 +08:00
Dillon Ngo c19c44bfbe Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 08:54:11 +08:00
Dillon Ngo fed40d8384 Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 08:38:13 +08:00
Dillon Ngo 49b5d142d9 Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 08:18:41 +08:00
Dillon Ngo cd36f5b435 Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 08:06:22 +08:00
Dillon Ngo 7170719203 Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-19 07:42:18 +08:00
Dillon Ngo f6bc88f553 Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 07:42:10 +08:00
Dillon Ngo 10c13446df Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-19 07:25:57 +08:00
Dillon Ngo e18ff9215a Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 07:25:32 +08:00
Dillon Ngo 4456ddcb6b Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 06:38:22 +08:00
Dillon Ngo c0fc26bd0a Merge branch 'dillon/34.7-jenkins-vapor' into vapor/production 2024-09-19 05:10:36 +08:00
Dillon Ngo 639b0ffe4a Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 04:55:06 +08:00
Dillon Ngo c0ff60c5e7 Laravel Vapor - New table and command to handle delayed jobs 2024-09-19 04:49:31 +08:00
Dillon Ngo 2b6727cadc Laravel Vapor - Show stack trace when enabled through environment variables 2024-09-15 22:40:28 +08:00
Dillon Ngo 4adc3a65be Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-15 17:27:31 +08:00
Dillon Ngo 53b8764a61 Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-15 17:27:23 +08:00
Dillon Ngo 2d3d0f3a58 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-15 16:47:45 +08:00
Dillon Ngo a2e65a2ba5 Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-15 16:47:30 +08:00
Dillon Ngo 01db290102 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 20:57:18 +08:00
Dillon Ngo 18e31994c0 Laravel Vapor - Deployment day to production, solve an error captured in logs 2024-09-14 20:57:05 +08:00
Dillon Ngo 0bf1ffbd7a Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 13:30:47 +08:00
Dillon Ngo 5fe17db78a Laravel Vapor - Deployment day to production, solve an error in fixing billplz callback failed 2024-09-14 13:30:38 +08:00
Dillon Ngo 252c9c915e Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 13:12:45 +08:00
Dillon Ngo 2a6858d243 Laravel Vapor - Deployment day to production, solve an error in YD API query + error in fixing billplz callback failed 2024-09-14 13:12:37 +08:00
Dillon Ngo 00f6e95bae Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 12:34:07 +08:00
Dillon Ngo ab48489b6e Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 12:33:57 +08:00
Dillon Ngo 146aab2978 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 12:13:59 +08:00
Dillon Ngo 2b529fa986 Laravel Vapor - Deployment day to production, debug billplz failed callback fix 2024-09-14 12:13:47 +08:00
Dillon Ngo cc9c4600f2 Laravel Vapor - Deployment day to production, solve 504 Endpoint request timed out error 2024-09-14 11:52:52 +08:00
Dillon Ngo cdc6ee1839 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 09:43:39 +08:00
Dillon Ngo 537a6b0b33 Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 09:43:22 +08:00
Dillon Ngo f7a22c2977 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 08:08:10 +08:00
Dillon Ngo 33341feb0e Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 08:08:02 +08:00
Dillon Ngo bdae6643c9 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 07:55:40 +08:00
Dillon Ngo 91fa3e08cd Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 07:55:27 +08:00
Dillon Ngo 5d6c86d651 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 07:37:54 +08:00
Dillon Ngo 44e124dfa3 Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 07:37:47 +08:00
Dillon Ngo 2c4a2ea942 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 06:58:31 +08:00
Dillon Ngo a6d032050c Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 06:58:23 +08:00
Dillon Ngo ef7cc68121 Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 06:58:02 +08:00
Dillon Ngo 57ec8c2b36 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 06:32:52 +08:00
Dillon Ngo 92d5ae0c76 Laravel Vapor - Deployment day to production, enable the rest of schedule tasks for production via commands 2024-09-14 06:32:19 +08:00
Dillon Ngo 1d6cd2a104 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 06:08:47 +08:00
Dillon Ngo 9516721ff5 Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 06:08:37 +08:00
Dillon Ngo 7f8597a79e Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 05:45:38 +08:00
Dillon Ngo 9782ac6fda Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 05:45:29 +08:00
Dillon Ngo d259df9796 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 05:17:11 +08:00
Dillon Ngo b117730619 Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 05:17:01 +08:00
Dillon Ngo 2f8502c92e Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 04:53:01 +08:00
Dillon Ngo e933470c17 Laravel Vapor - Deployment day to production, solve an error in YD API query 2024-09-14 04:52:46 +08:00
Dillon Ngo cc5fc19f24 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 04:09:14 +08:00
Dillon Ngo d93ee2462c Laravel Vapor - Deployment day to production, enable YD API query for a full run 2024-09-14 04:04:21 +08:00
Dillon Ngo 5279cc11c4 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 03:36:30 +08:00
Dillon Ngo a8cac0a121 Laravel Vapor - Deployment day to production, enable YD API query for a full run 2024-09-14 03:36:15 +08:00
Dillon Ngo 53d3afff72 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 03:17:42 +08:00
Dillon Ngo 78b36dab9d Laravel Vapor - Deployment day to production, Fix some undetected merge conflict 2024-09-14 03:17:26 +08:00
Dillon Ngo 40e6eee6d9 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 02:53:22 +08:00
Dillon Ngo 28dd444c0a Laravel Vapor - Deployment day to production, Update production domain 2 2024-09-14 02:53:05 +08:00
Dillon Ngo b2dea50fc0 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 01:53:31 +08:00
Dillon Ngo 0f04cec170 Laravel Vapor - Deployment day to production, Update production domain 1 2024-09-14 01:53:14 +08:00
Dillon Ngo 58efaddf7d Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-14 01:29:52 +08:00
Dillon Ngo 9882e5e75d Laravel Vapor - Deployment day to production, Update custom log channel retention period for production only 2024-09-14 01:23:17 +08:00
Dillon Ngo 11a5757303 Laravel Vapor - Deployment day to production YD API Testing 2024-09-14 01:07:50 +08:00
Dillon Ngo 3c6d1ec03b Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-12 22:48:52 +08:00
Dillon Ngo 2e871cd42f Laravel Vapor - New index for packages table 2024-09-12 22:36:03 +08:00
Dillon Ngo 643a903351 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-12 00:45:54 +08:00
Dillon Ngo b01159e47a Laravel Vapor - Update vapor.yml for production environment 2024-09-12 00:45:42 +08:00
Dillon Ngo b8474a2aff Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-12 00:20:18 +08:00
Dillon Ngo cf1e1b7cd4 Laravel Vapor - Debugging 504 error 2024-09-12 00:20:03 +08:00
Dillon Ngo 7234ebe67a Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-12 00:07:01 +08:00
Dillon Ngo 7658b8f72f Laravel Vapor - Debugging 504 error 2024-09-11 23:54:52 +08:00
Dillon Ngo 2cce3597f6 Laravel Vapor - Debugging 504 error 2024-09-11 23:32:53 +08:00
Dillon Ngo 8027bffdd8 Laravel Vapor - Debugging 504 error 2024-09-11 23:12:14 +08:00
Dillon Ngo 78ea976c72 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-11 06:56:38 +08:00
Dillon Ngo 3d0bdd70d5 Laravel Vapor - New Index for order table 2024-09-11 06:51:46 +08:00
Dillon Ngo ae03b75699 Merge branch 'dillon/34.6-jenkins-vapor' into vapor/production 2024-09-11 05:20:06 +08:00
Dillon Ngo 1dab162293 Laravel Vapor - new component to trigger and open download in new browser tab 2024-09-11 04:23:24 +08:00
Dillon Ngo 8df0b60c6a Laravel Vapor - new component to trigger and open download in new browser tab 2024-09-09 21:36:31 +08:00
Dillon Ngo db457fc63e Laravel Vapor - new component to trigger and open download in new browser tab 2024-09-09 21:24:53 +08:00
Dillon Ngo 9557496794 Laravel Vapor - Solve a probem with url encoding related to group payment 2024-09-09 18:06:04 +08:00
Dillon Ngo 638c4b233f Laravel Vapor - Update AWS RDS database 2024-09-08 02:10:26 +08:00
Dillon Ngo 108481f85a Laravel Vapor - Change AWS RDS database 2024-09-07 17:29:42 +08:00
Dillon Ngo 2b068d16cf Testing of new domain cief-malaysia.com in addition to the current existing izyim.com 2024-09-04 14:09:01 +08:00
Dillon Ngo 573a60c790 Laravel Vapor - Code refactor for YD API cron job 2024-09-04 13:21:57 +08:00
Dillon Ngo 9f7a40e0f8 Laravel Vapor - fill in latest changes of code from master branch 2024-09-04 13:01:52 +08:00
Dillon Ngo 1073fbfa4d Laravel Vapor - Sync V2 Commands with updates from latest changes in V1 Commands 2024-09-03 17:27:53 +08:00
Dillon Ngo 9c499b3874 Merge branch 'master' into dillon/34.6-jenkins-vapor 2024-09-03 16:06:33 +08:00
edmondlang b7c6c13bde fix payment-and-billing vue console error 2024-09-01 19:58:51 +08:00
edmondlang 01d666d92a fix payment-and-billing vue console error 2024-09-01 19:48:44 +08:00
Dillon Ngo 774f4f8d63 Laravel Vapor - Code refactor for YD API cron job 2024-08-29 15:14:21 +08:00
Dillon Ngo cfb5b32419 Laravel Vapor - Code refactor for YD API cron job - testing 2024-08-28 20:35:24 +08:00
Dillon Ngo 65d3af39ea Laravel Vapor - Code refactor for YD API cron job - testing 2024-08-28 20:20:59 +08:00
Dillon Ngo 0c0d5a1707 Laravel Vapor - Code refactor for YD API cron job - testing 2024-08-28 20:00:48 +08:00
Dillon Ngo 2023df9442 Laravel Vapor - Code refactor for YD API cron job - testing 2024-08-28 19:34:49 +08:00
Dillon Ngo c9935bfac7 Laravel Vapor - Code refactor for YD API cron job - testing 2024-08-28 19:02:08 +08:00
Dillon Ngo 389fae377b Laravel Vapor - Look into logs in different channel in cloudwatch 2024-08-28 18:27:02 +08:00
Dillon Ngo 64bccf7bad Get latest from V1 of YD API processor from master branch 2024-08-28 17:45:03 +08:00
Dillon Ngo 0e816337fc escape single quote in the gitCommitMessage that cause problem in deployment through Jenkins 2024-08-23 14:12:47 +08:00
Dillon Ngo b3973b52d1 Merge branch 'dillon/46.15-onhold-list-anomaly-fix' into 'master'
Data patch for a problem reported about an item not suppose to appear in ...

See merge request CIEFWorldwideSdnBhd/shipping-portal!236
2024-08-17 00:41:10 +00:00
Dillon Ngo 694876c31f Data patch for a problem reported about an item not suppose to appear in export/on-hold-packing-list 2024-08-17 08:39:19 +08:00
edmondlang 499782bbec update /export/aging-list, add 'is credit term customer' column 2024-08-04 00:39:15 +08:00
edmondlang f3eca3dd89 Export Group Transactions CSV 2024-08-03 23:04:47 +08:00
Aqqil Azman 9c4c472a40 fix wrong decimal round off 2024-08-01 09:37:22 +08:00
Aqqil Azman a67afdc0ff changed decimal points to 2 2024-08-01 09:34:14 +08:00
edmondlang b30cdaba84 fix export/aging-list, it has duplicated rows due to unnecessary joins 2024-07-26 00:58:49 +08:00
Dillon Ngo 9ac0ca45be Merge branch 'dillon/46.14-data-patch' into 'master'
Data patch for storage invoice

See merge request CIEFWorldwideSdnBhd/shipping-portal!235
2024-07-22 23:07:16 +00:00
Dillon Ngo 7e7e43ee9c Merge branch 'dillon/46.14-data-patch' into 'master'
Data patch for storage invoice

See merge request CIEFWorldwideSdnBhd/shipping-portal!234
2024-07-22 23:00:09 +00:00
Dillon Ngo 195e899751 Laravel Vapor - Code refactor for YD API cron job 2024-07-01 16:42:24 +08:00
Dillon Ngo 6710a2caf2 Laravel Vapor - Code refactor for YD API cron job 2024-07-01 14:41:27 +08:00
Dillon Ngo 5491047fe1 Laravel Vapor - Code refactor for YD API cron job 2024-07-01 14:21:23 +08:00
Dillon Ngo b2e4e67085 Laravel Vapor - Code refactor for YD API cron job 2024-07-01 13:59:01 +08:00
Dillon Ngo 49989fd154 Laravel Vapor - Renamed a file to fit its purpose 2024-07-01 13:14:41 +08:00
Dillon Ngo 151f9dc7bc Laravel Vapor - Convert a section component into polling component because of request timed out (error 504), debugging 2024-07-01 12:31:18 +08:00
Dillon Ngo d41889f84a Laravel Vapor - Convert a section component into polling component because of request timed out (error 504), debugging 2024-07-01 11:24:54 +08:00
Dillon Ngo 6a20acbb40 Laravel Vapor - New indexes through migration 2024-07-01 11:00:32 +08:00
Dillon Ngo ccdc0b4b0f Laravel Vapor - Convert a section component into polling component because of request timed out (error 504), debugging 2024-06-27 11:55:10 +08:00
Dillon Ngo c402f672c3 Laravel Vapor - Convert a section component into polling component because of request timed out (error 504), debugging 2024-06-27 09:37:57 +08:00
Dillon Ngo 8fe1f3261f Laravel Vapor - Convert a section component into polling component because of request timed out (error 504) 2024-06-27 08:56:09 +08:00
Dillon Ngo 493bb3512c Laravel Vapor - converted some components to do job polling because of Error 504 Endpoint request timed out 2024-06-25 13:49:05 +08:00
Dillon Ngo 073b69608a Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 16:48:58 +08:00
Dillon Ngo f0d8b18715 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 15:48:38 +08:00
Dillon Ngo 29ad0a0464 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 15:23:18 +08:00
Dillon Ngo 5eca74579d Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 14:02:54 +08:00
Dillon Ngo 84010579f2 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 13:48:48 +08:00
Dillon Ngo 8a36fb05b5 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 13:24:02 +08:00
Dillon Ngo bd7014fd7a Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 13:01:59 +08:00
Dillon Ngo 9806543d07 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 12:49:53 +08:00
Dillon Ngo d63decd446 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 12:34:56 +08:00
Dillon Ngo c05c0a83b4 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 12:05:12 +08:00
Dillon Ngo 05102576d8 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 11:25:11 +08:00
Dillon Ngo 88a6e546a8 Export pdf file from Laravel Vapor through S3 bucket (debug problem cannot download) 2024-06-24 11:11:16 +08:00
Dillon Ngo a14d9dbe27 Laraval Vapor - Update development and staging environment to use a duplicated production bucket for the purpose of testing 2024-06-23 20:45:07 +08:00
Dillon Ngo 63316212ec Export pdf file from Laravel Vapor through S3 bucket (code sync from exchange-2.0) 2024-06-23 20:20:27 +08:00
Dillon Ngo 746d4254c5 Merge branch 'dillon/34.4-jenkins-vapor' into dillon/34.5-jenkins-vapor 2024-06-22 12:59:01 +08:00
Dillon Ngo d81b07f758 Remove code no longer in used 2024-06-20 16:31:33 +08:00
Dillon Ngo eb2d17b73f Export pdf file from Laravel Vapor through S3 bucket (code sync from exchange-2.0) 2024-06-20 16:24:01 +08:00
Dillon Ngo 6a621029e6 Export pdf file from Laravel Vapor through S3 bucket (code sync from exchange-2.0) 2024-06-20 15:25:54 +08:00
Dillon Ngo 06e36bb754 Export pdf file from Laravel Vapor through S3 bucket (code sync from exchange-2.0) 2024-06-18 12:22:46 +08:00
Dillon Ngo cef88f8274 Export excel file from Laravel Vapor through S3 bucket (code sync from exchange-2.0) 2024-06-18 10:28:29 +08:00
Dillon Ngo d78b83054e Laravel Vapor - Sync code a fix from Exchange, a get request should not have a body 2024-05-26 19:52:26 +08:00
Dillon Ngo 808f327318 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-26 17:11:14 +08:00
Dillon Ngo 849b69b31a Fix a UI/UX problem at admin page when updating permits document at /settings page 2024-05-26 03:34:24 +08:00
Dillon Ngo bd849d3b70 Attempt to fix a UI/UX problem 2024-05-26 03:13:29 +08:00
Dillon Ngo 8cb21fc4f1 Laravel Vapor - Testing of sending email with file attached 2024-05-25 13:08:20 +08:00
Dillon Ngo 21485c7db7 Laravel Vapor - Testing of sending email with file attached 2024-05-25 12:34:33 +08:00
Dillon Ngo 4628b14a0b Laravel Vapor - New V2 command to do housekeeping at S3 Bucket 2024-05-25 12:16:37 +08:00
Dillon Ngo f176c82980 Laravel Vapor - Added comment 2024-05-25 02:41:32 +08:00
Dillon Ngo 4cf6825e42 Laravel Vapor - Debug Endpoint request timed out 2024-05-24 23:21:17 +08:00
Dillon Ngo 32a7228370 Laravel Vapor - Debug Endpoint request timed out 2024-05-21 10:38:58 +08:00
Dillon Ngo a4d98aa31a Laravel Vapor - Debug Endpoint request timed out 2024-05-21 10:20:56 +08:00
Dillon Ngo f779e563a6 Laravel Vapor - Debug Endpoint request timed out 2024-05-21 10:19:36 +08:00
Dillon Ngo e7e2b1eac2 Laravel Vapor - Debug Endpoint request timed out 2024-05-21 10:02:51 +08:00
Dillon Ngo 5410fefc1f Laravel Vapor - Debug Endpoint request timed out 2024-05-21 09:39:20 +08:00
Dillon Ngo b514ea15a1 Laravel Vapor - Debug Endpoint request timed out 2024-05-21 08:46:19 +08:00
Dillon Ngo 93f3a6343a Laravel Vapor - Debug Endpoint request timed out 2024-05-20 19:46:33 +08:00
Dillon Ngo 7c66eb657e Laravel Vapor - Debug Endpoint request timed out 2024-05-20 19:18:53 +08:00
Dillon Ngo 96ccdcd3da Laravel Vapor - Debug Endpoint request timed out 2024-05-20 18:58:30 +08:00
Dillon Ngo f37cae406a Laravel Vapor - Debug Endpoint request timed out 2024-05-20 18:22:46 +08:00
Dillon Ngo be87fc6b1c Laravel Vapor - Debug Endpoint request timed out 2024-05-20 05:00:11 +08:00
Dillon Ngo 6c64195a73 Laravel Vapor - Debug Endpoint request timed out 2024-05-20 04:35:40 +08:00
Dillon Ngo 431c2829fe Laravel Vapor - Debug Endpoint request timed out 2024-05-20 03:48:36 +08:00
Dillon Ngo 0a3f09032e Laravel Vapor - Debug Endpoint request timed out 2024-05-20 03:43:32 +08:00
Dillon Ngo 867e2455b3 Laravel Vapor - Debug Endpoint request timed out 2024-05-20 01:39:36 +08:00
Dillon Ngo b74257477b Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-20 00:26:53 +08:00
Dillon Ngo 3f3d2d1177 Merge branch 'dillon/51.5-vue-store-update' into dillon/34.4-jenkins-vapor 2024-05-19 23:49:14 +08:00
Dillon Ngo 706e9552a5 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 23:32:30 +08:00
Dillon Ngo dbeb4f9f04 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 23:25:58 +08:00
Dillon Ngo f23db32429 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 23:23:10 +08:00
Dillon Ngo 40fb3f986e Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 22:51:04 +08:00
Dillon Ngo 1e2faa0872 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 07:17:44 +08:00
Dillon Ngo 17698c276f Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 06:47:49 +08:00
Dillon Ngo 2fa2d444a4 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 06:26:08 +08:00
Dillon Ngo 484ca246b0 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 06:08:28 +08:00
Dillon Ngo ea1d32ee01 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 05:45:36 +08:00
Dillon Ngo 874dc2942a Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 05:16:57 +08:00
Dillon Ngo 185245f3eb Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 04:55:42 +08:00
Dillon Ngo 3b2e2216c1 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 04:32:57 +08:00
Dillon Ngo 68dad00c2d Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 04:21:32 +08:00
Dillon Ngo 1bcc345293 Laravel Vapor - Look into logs in different channel in cloudwatch 2024-05-19 03:34:52 +08:00
Dillon Ngo d6d11cb7d0 Laravel Vapor - Debug Endpoint request timed out 2024-05-19 01:31:55 +08:00
Dillon Ngo 670de560ed Laravel Vapor - Debug Endpoint request timed out 2024-05-18 23:42:50 +08:00
Dillon Ngo 50042aae4e Laravel Vapor - Debug Endpoint request timed out 2024-05-18 23:23:22 +08:00
Dillon Ngo 7480f54f84 Laravel Vapor - Debug Endpoint request timed out 2024-05-18 22:55:40 +08:00
Dillon Ngo e986247efb Laravel Vapor - Debug Endpoint request timed out 2024-05-18 22:40:01 +08:00
Dillon Ngo 81b0efea1c Laravel Vapor - Debug Endpoint request timed out 2024-05-18 22:37:23 +08:00
Dillon Ngo 82fc7b4455 Laravel Vapor - Debug Endpoint request timed out 2024-05-18 22:07:08 +08:00
Dillon Ngo 1d8d98e4d7 Laravel Vapor - Debug Endpoint request timed out 2024-05-18 21:40:06 +08:00
Dillon Ngo 29547b2915 Laravel Vapor - test reading data from S3 Bucket with production duplicated storage files 2024-05-18 20:33:53 +08:00
Dillon Ngo ae74e72a96 Laravel Vapor - Debug Endpoint request timed out 2024-05-18 20:20:06 +08:00
Dillon Ngo b90918c465 Laravel Vapor - test vue polling with refactor code from branch 51.5 2024-05-18 19:09:19 +08:00
Dillon Ngo d7f08fd9e5 Merge branch 'dillon/51.5-vue-store-update' into dillon/34.3-jenkins-vapor 2024-05-18 18:56:30 +08:00
Dillon Ngo c4a1cd4ab4 Laravel Vapor - test reading data from S3 Bucket with production duplicated storage files 2024-05-17 18:12:31 +08:00
Dillon Ngo d563fa3cb2 Laravel Vapor - test reading data from S3 Bucket with production duplicated storage files 2024-05-17 17:38:20 +08:00
Dillon Ngo 13835b43c1 Laravel Vapor - test reading data from YD API 2024-05-17 17:02:51 +08:00
Dillon Ngo 39de1fbdf0 Laravel Vapor - test uploading an excel file to S3 bucket 2024-05-17 14:22:26 +08:00
Dillon Ngo f7c2b7d5e9 Laravel Vapor - test uploading a excel file 2024-05-16 22:31:25 +08:00
Dillon Ngo 80bd8668c1 Laravel Vapor - test uploading a excel file 2024-05-16 22:00:43 +08:00
Dillon Ngo e8367c18bf Laravel Vapor - test uploading a excel file 2024-05-16 21:49:22 +08:00
Dillon Ngo b08c1159f3 Laravel Vapor - test uploading a excel file 2024-05-16 21:23:48 +08:00
Dillon Ngo 3fa9d532f8 Laravel Vapor - test downloading a status assets 2024-05-16 20:57:10 +08:00
Dillon Ngo 914ad2a8f1 Laravel Vapor - test attaching a file from S3 in an email 2024-05-16 19:52:16 +08:00
Dillon Ngo f96fcdbcb4 Laravel Vapor - test attaching a file from S3 in an email 2024-05-16 19:38:19 +08:00
Dillon Ngo a3ff963cc9 Laravel Vapor - test attaching a file from S3 in an email 2024-05-16 19:20:54 +08:00
Dillon Ngo 8355c81f20 Laravel Vapor - test attaching a file from S3 in an email 2024-05-16 02:33:23 +08:00
Dillon Ngo 9265cd494a Laravel Vapor - test attaching a file from S3 in an email 2024-05-16 01:28:43 +08:00
Dillon Ngo 83bd2a06a0 Merge branch 'master' into dillon/34.3-jenkins-vapor 2024-05-16 01:06:52 +08:00
Dillon Ngo 600fe91da0 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 17:07:19 +08:00
Dillon Ngo 496fc09f03 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 16:48:51 +08:00
Dillon Ngo 4cb7a09ea4 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 16:20:45 +08:00
Dillon Ngo b3850f1b6e Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 15:39:39 +08:00
Dillon Ngo 9f57335363 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 04:31:25 +08:00
Dillon Ngo 5f53f7110c Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 04:11:26 +08:00
Dillon Ngo ab4a83dc50 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 03:51:33 +08:00
Dillon Ngo 3b3d8f011f Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 02:39:57 +08:00
Dillon Ngo 09c099d0a4 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 02:21:02 +08:00
Dillon Ngo fc479b4420 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 01:41:08 +08:00
Dillon Ngo 7f80d2d9c5 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 01:23:14 +08:00
Dillon Ngo 0de92ded68 Laravel Vapor - test read from database export excel file to S3 bucket through a command 2024-05-15 01:03:46 +08:00
Dillon Ngo dbf537e050 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-05-03 16:59:59 +08:00
Dillon Ngo 916b0c3051 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-05-03 16:54:20 +08:00
Dillon Ngo 28e3e15b16 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-05-03 16:39:14 +08:00
Dillon Ngo 59a75cbb79 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-05-03 16:21:29 +08:00
Dillon Ngo 0b1fd84b49 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-05-03 16:06:03 +08:00
Dillon Ngo 3b454890d8 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-05-03 15:23:05 +08:00
Dillon Ngo 1784dd9003 Merge branch 'master' into dillon/34.2-jenkins-vapor 2024-05-02 11:31:41 +08:00
Dillon Ngo f56cb39822 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-05-01 09:54:56 +08:00
Dillon Ngo a7c03d7fb2 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-04-30 12:56:53 +08:00
Dillon Ngo eb9f77f620 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-04-30 12:37:40 +08:00
Dillon Ngo 849935aee3 Laravel Vapor - code amendment for changing local storage to AWS S3 storage (code sync from exchange-2.0) 2024-04-30 11:52:41 +08:00
Dillon Ngo bfdf96b4a1 Remove comments in code 2024-03-24 19:19:44 +08:00
Dillon Ngo 894248e33c Laravel Vapor - Version 2 of Commands 2024-03-21 16:29:13 +08:00
Dillon Ngo cee24a8bf9 Setup priority queue with AWS SQS 2024-03-21 15:36:00 +08:00
Dillon Ngo 09553025dc Setup priority queue with AWS SQS 2024-03-21 14:50:24 +08:00
Dillon Ngo 52934899e8 Setup priority queue with AWS SQS 2024-03-21 14:19:55 +08:00
Dillon Ngo c607eb8895 Setup priority queue with AWS SQS 2024-03-21 13:49:14 +08:00
Dillon Ngo ac1d63a2cb Setup priority queue with AWS SQS 2024-03-21 13:21:04 +08:00
Dillon Ngo 4ce92aca27 Debug Jenkinsfile 2024-03-19 19:43:14 +08:00
Dillon Ngo ddcc55ed5c Debug Jenkinsfile 2024-03-19 19:32:05 +08:00
Dillon Ngo 35ebb9aed9 Debug Jenkinsfile 2024-03-19 19:22:05 +08:00
Dillon Ngo b8b72ff2d4 Debug Jenkinsfile 2024-03-19 19:20:15 +08:00
Dillon Ngo cfa277bbb0 Debug Jenkinsfile 2024-03-19 19:15:01 +08:00
Dillon Ngo 4470a685af Update vapor.yml to setup new sqs for priority queues setup 2024-03-19 17:10:29 +08:00
Dillon Ngo 640fa3b738 Merge branch 'master' into dillon/34.1-jenkins-vapor 2024-03-19 16:53:26 +08:00
Dillon Ngo 359eba36e3 Laravel Vapor - Attempt to solve random downloading of 0KB pdf files when using docker 2024-01-04 03:38:32 +08:00
Dillon Ngo 8a99ceda4c Merge branch 'dillon/51-vue-polling-experimental-2' into dillon/34-jenkins-vapor 2024-01-04 03:03:17 +08:00
Dillon Ngo c81863811e Merge branch 'dillon/51-vue-polling-experimental-2' into dillon/34-jenkins-vapor 2024-01-03 05:40:16 +08:00
Dillon Ngo bbf61b757d Laravel Vapor - Version 2 of Commands, fix syntax inaccurate 2024-01-02 03:07:04 +08:00
Dillon Ngo f05bd50991 Laravel Vapor - Change to use private repository with Amazon Elastic Container Registry 2024-01-01 05:00:21 +08:00
Dillon Ngo 4504bf5eb0 Laravel Vapor - Change to use private repository with Amazon Elastic Container Registry 2024-01-01 04:52:23 +08:00
Dillon Ngo 9ecf0e5c9e Laravel Vapor - Change to use private repository with Amazon Elastic Container Registry 2024-01-01 04:48:17 +08:00
Dillon Ngo 2c5b9e55c5 Laravel Vapor - Change to use private repository with Amazon Elastic Container Registry 2024-01-01 04:19:01 +08:00
Dillon Ngo 9b61470d95 Laravel Vapor - Change to use private repository with Amazon Elastic Container Registry 2024-01-01 04:14:24 +08:00
Dillon Ngo ac3f4ce71f Laravel Vapor - Test run command to do housekeeping as part of deployment process 2023-12-31 22:15:36 +08:00
Dillon Ngo 1c9ce1510d Laravel Vapor - Test run command to do housekeeping as part of deployment process 2023-12-31 21:48:29 +08:00
Dillon Ngo 318995e42b Laravel Vapor - Test run command to do housekeeping as part of deployment process 2023-12-31 21:28:05 +08:00
Dillon Ngo 5a3e015b6d Laravel Vapor - Test run command to do housekeeping as part of deployment process 2023-12-31 21:08:45 +08:00
Dillon Ngo 3021ed49cd Laravel Vapor - Test run command to do housekeeping as part of deployment process 2023-12-31 05:15:08 +08:00
Dillon Ngo 45151688c9 Laravel Vapor - Test run command to do housekeeping as part of deployment process 2023-12-31 05:04:47 +08:00
Dillon Ngo 97dc8d7b68 Laravel Vapor - Fix error 400 with any api call (long term solution) 2023-12-30 19:27:05 +08:00
Dillon Ngo bfa5cee44e Merge branch 'dillon/51-vue-polling-experimental-2' into dillon/34-jenkins-vapor 2023-12-30 19:14:02 +08:00
Dillon Ngo 6ad2427989 Laravel Vapor - Fix error 400 with any api call 2023-12-30 00:28:29 +08:00
Dillon Ngo 783b7d2b91 Laravel Vapor - Fix error 400 with any api call 2023-12-30 00:12:09 +08:00
Dillon Ngo e8f5a803a6 Laravel Vapor - Sync code from exchange, dynamic path upload of documents to S3 bucket 2023-12-29 23:15:59 +08:00
Dillon Ngo 6e3286c29a Laravel Vapor - Undo Api Gateway version 2 2023-12-28 15:06:11 +08:00
Dillon Ngo 6d029e3fde Laravel Vapor - Reinstate Api Gateway version 2 2023-12-28 14:58:26 +08:00
Dillon Ngo 3ab0224094 Laravel Vapor - Reinstate Api Gateway version 2 2023-12-28 14:41:34 +08:00
Dillon Ngo b0d40591b8 Laravel Vapor - Undo Api Gateway version 2 2023-12-28 14:06:53 +08:00
Dillon Ngo 5e2b011aca Laravel Vapor - Fix missing static images 2023-12-28 13:44:01 +08:00
Dillon Ngo 1facf73c05 Laravel Vapor - Fix missing static images 2023-12-28 13:13:37 +08:00
Dillon Ngo 9882f6f634 Version 2 of Commands for Laravel Vapor 2023-12-28 02:39:22 +08:00
Dillon Ngo 69c26af01b Version 2 of Commands for Laravel Vapor 2023-12-28 02:14:17 +08:00
Dillon Ngo 2ae3ac1c59 Version 2 of Commands for Laravel Vapor 2023-12-28 02:09:42 +08:00
Dillon Ngo 52acd4c69d Version 2 of Commands for Laravel Vapor 2023-12-28 01:58:49 +08:00
Dillon Ngo c80c59aadf testing schedule tasks 2023-12-26 19:39:47 +08:00
Dillon Ngo 921f500fcd Trigger deployment 2023-12-26 04:37:24 +08:00
Dillon Ngo 3880dbd616 Merge branch 'dillon/51-vue-polling-experimental-2' into dillon/34-jenkins-vapor 2023-12-26 04:22:11 +08:00
Dillon Ngo add6de3410 Merge branch 'dillon/51-vue-polling-experimental-2' into dillon/34-jenkins-vapor 2023-12-24 22:05:57 +08:00
Dillon Ngo 12da4b4e60 testing multiple queue in sqs 2023-12-23 03:40:16 +08:00
Dillon Ngo 0ab6d2f38e testing multiple queue in sqs 2023-12-23 03:30:34 +08:00
Dillon Ngo c0368bfd19 testing multiple queue in sqs 2023-12-23 03:20:32 +08:00
Dillon Ngo eab11fa7f2 testing multiple queue in sqs 2023-12-23 02:50:27 +08:00
Dillon Ngo 328d61d044 testing multiple queue in sqs 2023-12-23 02:25:06 +08:00
Dillon Ngo ce76544ac1 testing multiple queue in sqs 2023-12-23 02:10:08 +08:00
Dillon Ngo 1d49d25f98 testing multiple queue in sqs 2023-12-23 01:56:21 +08:00
Dillon Ngo 570b6e53cc testing multiple queue in sqs 2023-12-23 01:31:41 +08:00
Dillon Ngo 7b6da3d13a Set api gateway to version 2 to see if there is any performance improvement + new certificate for ap-southeast-1 2023-12-22 16:11:45 +08:00
Dillon Ngo 28aabea1cf Set api gateway to version 2 to see if there is any performance improvement 2023-12-20 18:50:11 +08:00
Dillon Ngo a840c8b172 Increase memory to see if there is any performance improvement 2023-12-20 18:26:19 +08:00
Dillon Ngo 2bff13537d Increase memory to see if there is any performance improvement 2023-12-20 18:11:00 +08:00
Dillon Ngo b4477c5925 Increase memory to see if there is any performance improvement 2023-12-20 17:40:17 +08:00
Dillon Ngo ede9712513 Debug 2023-12-20 17:18:25 +08:00
Dillon Ngo 7157ce169a Fix typo 2023-12-20 16:22:28 +08:00
Dillon Ngo 937b70530c Merge branch 'dillon/51-vue-polling-experimental-1' into dillon/34-jenkins-vapor 2023-12-20 15:07:10 +08:00
Dillon Ngo 96796850b6 Merge branch 'dillon/51-vue-polling-experimental-1' into dillon/34-jenkins-vapor 2023-12-17 17:25:06 +08:00
Dillon Ngo bb79903eb9 Setup development.portal.izyim.com 2023-12-16 20:30:10 +08:00
Dillon Ngo c7644b5f25 Setup dev.portal.izyim.com 2023-12-16 20:10:48 +08:00
Dillon Ngo 9f601a2ce1 Setup dev.portal.izyim.com 2023-12-16 20:03:10 +08:00
Dillon Ngo ffef6356f9 Setup dev.portal.izyim.com 2023-12-16 19:57:17 +08:00
Dillon Ngo fe458f78a1 Merge branch 'dillon/34-jenkins-vapor' into vapor/production 2023-12-11 00:14:15 +08:00
Dillon Ngo 826d7288a0 Trigerring deployment 2023-12-10 23:39:42 +08:00
Dillon Ngo 4cf18d42ed Jenkinsfile update to cater for Multibranch deployment through Jenkins + staging.portal.izyim.com setup 2023-11-27 12:17:44 +08:00
Dillon Ngo 1f11ad0a09 Jenkinsfile update to cater for Multibranch deployment through Jenkins + staging.portal.izyim.com setup 2023-11-27 12:01:30 +08:00
Dillon Ngo c95b82520a Jenkinsfile update to cater for Multibranch deployment through Jenkins + staging.portal.izyim.com setup 2023-11-27 11:48:47 +08:00
Dillon Ngo 7435ad9c4a Jenkinsfile update to cater for Multibranch deployment through Jenkins + staging.portal.izyim.com setup 2023-11-27 11:46:21 +08:00
Dillon Ngo f06019d2b5 Update domain to production.portal.izyim.com 2023-11-22 15:08:40 +08:00
Dillon Ngo 52d9a6de14 Test deployment 2023-10-21 07:56:50 +08:00
Dillon Ngo 50c4ff7388 Fix error from Jenkins deployment 2023-10-21 07:18:56 +08:00
Dillon Ngo a50a0961bf Test deployment 2023-10-21 07:04:46 +08:00
Dillon 5208c654ad Jenkins Vapor initial commit 2023-09-26 20:35:53 +08:00
Dillon 883afbe04f Jenkins Vapor initial commit 2023-09-26 20:27:20 +08:00
Dillon 16c45a36d2 Jenkins Vapor initial commit 2023-09-26 20:24:15 +08:00
295 changed files with 10153 additions and 831 deletions
+4 -1
View File
@@ -39,7 +39,7 @@ MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_BUCKET=shipping-portal-localhost
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
@@ -60,6 +60,9 @@ PERFEXCRM_BASE_URL=""
PERFEXCRM_API_KEY=""
PERFEXCRM_IS_ENABLED="false"
VAPOR_ENV=local
LARAVEL_VAPOR_ENABLED=false
COMMANDS_V2_ENABLED=false
STORAGE_FEE_LAUNCH_DATE="2023-12-11 00:00:00"
SST_START_DATE="2024-04-01 00:00:00"
+4
View File
@@ -25,3 +25,7 @@ package-lock.json
public/*
/public/*
storage/framework/laravel-excel/*
.vapor/
.env.production
.env.staging
.env.development
Vendored
+118
View File
@@ -0,0 +1,118 @@
// Webhook + Gitlab git pull + Vapor
// def payload = readJSON text: "${payload}"
// String userName = payload.user_name
// String userEmail = payload.user_email
// String httpUrl = payload.project.http_url
pipeline {
agent {
docker {
args '--group-add 992 -v /var/run/docker.sock:/var/run/docker.sock'
image '303644228504.dkr.ecr.ap-southeast-1.amazonaws.com/jenkins-pipeline-agent:latest'
registryCredentialsId "ecr:ap-southeast-1:aws-ec2-instance-iam-role"
registryUrl "https://303644228504.dkr.ecr.ap-southeast-1.amazonaws.com"
}
}
environment {
HOME = '.'
}
stages {
stage('Download source code from Git') {
steps {
script{
currentBuild.description = 'Step 1 of 6 Completed'
println("GIT GIT_BRANCH: " + GIT_BRANCH)
switch(GIT_BRANCH) {
case "vapor/production":
case "vapor/staging":
case "vapor/development":
git(
url: 'https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git',
credentialsId: 'gitlab-jenkins-localhost',
branch: GIT_BRANCH
)
break
case "origin/dillon/34-jenkins-vapor":
git(
url: 'https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git',
credentialsId: 'gitlab-jenkins-localhost',
branch: 'dillon/34-jenkins-vapor'
)
break
}
currentBuild.description = 'Step 2 of 6 Completed'
}
}
}
stage('Install') {
steps {
sh 'composer update'
script{
currentBuild.description = 'Step 3 of 6 Completed'
}
}
}
stage('Tests') {
steps {
//sh 'vendor/bin/phpunit tests/Unit'
script{
currentBuild.description = 'Step 4 of 6 Completed'
}
}
}
stage('Deploy') {
steps {
script{
String gitCommitMessage = getCommitMessage()
println("GIT CommitMessage: " + gitCommitMessage)
println("GIT GIT_BRANCH: " + GIT_BRANCH)
switch(GIT_BRANCH) {
case "vapor/production":
sh "vendor/bin/vapor deploy production --message='${gitCommitMessage}'"
break
case "vapor/staging":
sh "vendor/bin/vapor deploy staging --message='${gitCommitMessage}'"
break
case "vapor/development":
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
break
case "origin/dillon/34-jenkins-vapor":
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
break
}
currentBuild.description = 'Step 5 of 6 Completed'
}
}
}
stage('Cleanup') {
steps {
script {
try {
sh 'docker image prune -a -f'
} catch (Exception e) {
echo "Error during cleanup: ${e.message}"
}
currentBuild.description = 'Step 6 of 6 Completed'
}
}
}
}
}
@NonCPS
String getCommitMessage(){
commitMessage = " "
for ( changeLogSet in currentBuild.changeSets){
for (entry in changeLogSet.getItems()){
commitMessage = entry.msg
}
}
commitMessage = commitMessage.replace("'", "`")
return commitMessage
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Classes\General;
use Illuminate\Support\Facades\Storage;
use Carbon\Carbon;
use Maatwebsite\Excel\Concerns\Exportable;
class AWSS3Helper
{
/**
* @param string $exportFileName
* @param Exportable $exportableObject
* @return string
*/
static function S3Exportable($exportFileName, $exportableObject){
//Step 1: Upload to S3
$filePathForS3 = 'temp/' . $exportFileName;
$exportableObject->store($filePathForS3, 's3');
//Step 2: Return temporary URL from S3
$temporaryUrl = Storage::disk('s3')->temporaryUrl(
$filePathForS3,
Carbon::now()->addMinutes(10)
);
return $temporaryUrl;
}
/**
* @param string $exportFileName
* @param string|resource $contents
* @return string
*/
static function S3PDF($exportFileName, $contents){
//Step 1: Upload to S3
$filePathForS3 = 'temp/' . $exportFileName;
Storage::disk('s3')->put($filePathForS3, $contents);
//Step 2: Return temporary URL from S3
$temporaryUrl = Storage::disk('s3')->temporaryUrl(
$filePathForS3,
Carbon::now()->addMinutes(10)
);
return $temporaryUrl;
}
}
@@ -16,6 +16,7 @@ use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Http\Resources\Json\ResourceCollection;
use Illuminate\Support\Facades\DB;
use App\Classes\Exceptions\JobResourceNotFoundException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
abstract class AbstractControllerLogic
@@ -65,7 +66,7 @@ abstract class AbstractControllerLogic
} catch (ErrorException|GeneralExceptions|TypeError $exception){
if ($exception instanceof JobResourceNotFoundException) {
Log::channel('vue_polling')->info(sprintf(
LogHelper::channel('vue_polling')->info(sprintf(
"Uncaught exception '%s' with message '%s' in %s:%d",
get_class($exception),
$exception->getMessage(),
@@ -17,4 +17,4 @@ class HasInvoiceStatusIn implements Filter
$query->where('type', 1)->whereIn('status', $value);
});
}
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class MarkingIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereHas('companyModules', function ($module) use ($value) {
$module->whereHas('connections', function ($connection) use ($value) {
$connection->whereIn('invitee_reference', $value);
});
});
}
}
+20 -4
View File
@@ -3,6 +3,8 @@ namespace App\Classes\General;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Storage;
use Carbon\Carbon;
class ExcelHandel
{
@@ -67,9 +69,23 @@ class ExcelHandel
public static function generateExcel($path = '', $exceldata = '', $filename = '', $extension = '')
{
$file_info = [];
$file = \Storage::disk('public')->put('excels/' . $path . '/' . $filename . '.' . $extension, $exceldata);
$file_info['original']['file'] = storage_path('app/public/excels/' . $path . '/' . $filename . '.' . $extension);
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver === 's3'){
$filePathForS3 = 'public/excels/' . $path . '/' . $filename . '.' . $extension;
Storage::disk('s3')->put($filePathForS3, $exceldata);
$temporaryUrl = Storage::disk('s3')->temporaryUrl(
$filePathForS3,
Carbon::now()->addMinutes(10)
);
$file_info['original']['file'] = $temporaryUrl; //REMINDER: This is a path to AWS S3 URL (HTTPS) as a public anonymous user, NOT an internal system path
}
else{
$file = Storage::disk('public')->put('excels/' . $path . '/' . $filename . '.' . $extension, $exceldata);
$file_info['original']['file'] = storage_path('app/public/excels/' . $path . '/' . $filename . '.' . $extension);
}
return $file_info;
}
@@ -84,4 +100,4 @@ class ExcelHandel
return true;
}
}
}
+8
View File
@@ -49,4 +49,12 @@ class Helper
static function collectionResponse(ResourceCollection $collection){
return json_decode($collection->response()->getContent(), true);
}
/**
* @param null|string $json
* @return array
*/
static function deserializeFilters(?string $json): array {
return $json !== null ? collect(json_decode($json))->toArray() : [];
}
}
+54
View File
@@ -0,0 +1,54 @@
<?php
namespace App\Classes\General;
use Illuminate\Support\Facades\Log;
class LogHelper
{
private String $channelName;
public static function channel($channelName): self
{
$logHelper = new self;
$logHelper->channelName = $channelName;
return $logHelper;
}
public function info($message)
{
$envVar = env('LARAVEL_VAPOR_ENABLED');
$isLocal = env('VAPOR_ENV') === 'local';
Log::info("LogHelper.info: {$message} channelName {$this->channelName}, envVar {$envVar}");
if ($envVar && !$isLocal) {
Log::channel($this->channelName.'_vapor')->info($message);
}
else{
Log::channel($this->channelName)->info($message);
}
}
public function warning($message)
{
$envVar = env('LARAVEL_VAPOR_ENABLED');
$isLocal = env('VAPOR_ENV') === 'local';
Log::info("LogHelper.warning: {$message} channelName {$this->channelName}, envVar {$envVar}");
if ($envVar && !$isLocal) {
Log::channel($this->channelName . '_vapor')->warning($message);
} else {
Log::channel($this->channelName)->warning($message);
}
}
public function error($message)
{
$envVar = env('LARAVEL_VAPOR_ENABLED');
$isLocal = env('VAPOR_ENV') === 'local';
Log::info("LogHelper.error: {$message} channelName {$this->channelName}, envVar {$envVar}");
if ($envVar && !$isLocal) {
Log::channel($this->channelName . '_vapor')->error($message);
} else {
Log::channel($this->channelName)->error($message);
}
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Classes\General;
use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;
class UrlHelper {
public static function getRouteParametersFromUrl($url) {
$parsedUrl = parse_url($url);
$path = $parsedUrl['path'];
$routes = Route::getRoutes();
foreach ($routes as $route) {
$request = Request::create($path, 'GET');
$route->bind($request);
if ($route->matches($request)) {
return $route->parameters();
}
}
return [];
}
}
@@ -0,0 +1,46 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\Transactions\Processors\ApproveShippingInvoiceTransactionProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Exception;
class ApproveInvoiceV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Approve Invoice Command.');
$start = new Carbon();
$invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE)->where('status', ApprovalStatus::PENDING_SUBMISSION)->get();
foreach ($invoices as $invoice) {
$packingList = $invoice->owner;
$order = $packingList->owner;
try {
(App()->make(ApproveShippingInvoiceTransactionProcessor::class))->execute($packingList);
Log::info('Invoice Approved for reference ' . $order->reference . '.');
} catch (Exception $exception) {
Log::info('Failed to Approve invoice for reference ' . $order->reference . '. Exception: ' . $exception->getMessage());
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Approve Invoice Command. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,53 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Illuminate\Support\Facades\Log;
class AuditBillplzInvoiceV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Audit Billplz Invoice.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
$transactions = Transaction::where('type', TransactionType::SHIPPING_INVOICE)->where('status', ApprovalStatus::COMPLETED)->whereHas('transactions', function($query){
return $query->where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->where('status', ApprovalStatus::REJECTED);
})->get();
$totalTransactions = count($transactions);
$counter = 1;
$totalAmount = 0;
foreach ($transactions as $transaction){
$payment_transaction = $transaction->transactions->sortByDesc('created_at')->first();
if ($payment_transaction->status === ApprovalStatus::REJECTED) {
Log::info($counter . ' of ' . $totalTransactions . '. Order Marking: '. $payment_transaction->owner->owner->owner->reference . '. Transaction Id: '. $payment_transaction->id . '. Invoice Id: '. $transaction->id . ' - Date: '.$payment_transaction->created_at->format('d-m-Y').' - Amount: '. $payment_transaction->amount);
$totalAmount += $transaction->amount;
$counter++;
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Audit Billplz Invoice. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
}
}
@@ -0,0 +1,55 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class AuditBillplzPaymentV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Audit Billplz Payment.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED])->get();
$totalTransactions = count($transactions);
$counter = 1;
$totalAmount = 0;
foreach ($transactions as $transaction){
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
if($response->successful()){
$data = $response->json();
if($data['paid']){
} else {
$totalAmount += $transaction->amount;
Log::info($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);
}
}else{
Log::info("billplz error</br>");
}
$counter++;
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Audit Billplz Payment. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
}
}
@@ -0,0 +1,64 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\PackingLists\Services\ListsPackingLists;
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Order;
use Exception;
use Illuminate\Support\Facades\Log;
class AutoGenerateInvoiceV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Auto generate invoice.');
$start = new Carbon();
$packingLists = (App()->make(ListsPackingLists::class))->execute(['does_not_have_transaction_type' => 1, 'type' => 2]);
if (count($packingLists)) {
foreach ($packingLists as $packingList) {
$order = $packingList->owner;
if (!($order instanceof Order)) {
Log::info('Failed to generate invoice for reference' . $order->reference . '. It is not an instance of Order.');
continue;
}
$companyModule = $order->companyModule;
$billingAddress = $companyModule->addresses()->where('type', \App\Classes\ValueObjects\Constants\AddressType::BILLING)->first();
$deliveryAddress = $order->addresses()->where('status', ApprovalStatus::APPROVED)->first();
$postCodes = \App\Models\SegmentConstant::whereIn('reference', ['CENTER_POSTCODE', 'OUTSTATION_POSTCODE'])->get()->pluck('value')->flatten();
if (!!$billingAddress && in_array($deliveryAddress->postcode, $postCodes->toArray())) {
try {
(App()->make(CreateInvoiceTransactionProcessor::class))->execute($packingList);
Log::info('Invoice generated for reference ' . $order->reference . '.');
} catch (Exception $exception) {
Log::info('Failed to generate invoice for reference ' . $order->reference . '. Exception: ' . $exception->getMessage());
}
}
else{
Log::info('Failed to generate invoice for reference ' . $order->reference . '. Billing Address is not defined / Postcode area is not defined.');
}
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Auto generate invoice. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,63 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class CheckDeletedInvoiceButPaidV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Check all deleted invoice but has completed payment.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
$totalAmount = 0;
$softDeletedTransactions = Transaction::onlyTrashed()->where('type', TransactionType::SHIPPING_INVOICE)->whereHas('transactions', function (Builder $query) {
$query->where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY);
})->get();
foreach ($softDeletedTransactions as $invoice) {
$invoice_payments = $invoice->transactions()->payments()->get();
foreach($invoice_payments as $invoice_payment) {
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$invoice_payment->payment_reference);
if($response->successful()){
$data = $response->json();
$orderReference = $invoice->owner->owner->reference ?? null;
if($data['paid']){
Log::info('Invoice id: ' . $invoice->id. '. Payment id: ' . $invoice_payment->id . '. Order: ' . $orderReference);
} else {
}
}else{
Log::info("billplz error</br>");
}
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Check all deleted invoice but has completed payment. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
}
}
@@ -0,0 +1,48 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\Transactions\Services\ListsGroups;
use App\Classes\Modules\Transactions\Processors\CheckStorageInvoiceTransactionProcessor;
use App\Models\Order;
use Illuminate\Support\Facades\Log;
class CheckStorageInvoicesGroupTransactionsV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Check all pending group payment with storage invoice is valid.');
$start = new Carbon();
$newfilters['order_by_updated_at_desc'] = true;
$newfilters['status_in'] = [0, 1];
$groups = (App()->make(ListsGroups::class))->execute($newfilters);
foreach ($groups as $group){
Log::info('CheckForStorageInvoiceByTransactions group: '.json_encode($group));
foreach ($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
$packingList = $invoice->owner()->first();
if($packingList){
$order = $packingList->owner()->first();
if($order instanceof Order){
$storages = (App()->make(CheckStorageInvoiceTransactionProcessor::class))->executeOrder($order);
}
}
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Check all pending group payment with storage invoice is valid. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,45 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\Orders\Services\ListsOrders;
use App\Classes\Modules\Transactions\Processors\CheckStorageInvoiceTransactionProcessor;
use App\Classes\ValueObjects\Constants\OrderType;
use Illuminate\Support\Facades\Log;
class CheckStorageInvoicesOrdersV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Check all orders for storage invoice.');
$start = new Carbon();
$orders = (App()->make(ListsOrders::class))->execute(['with_parcels' => true, 'type_in' => [OrderType::SHARED_CONTAINER, OrderType::DEDICATED_CONTAINER]]);
$count = 0;
foreach ($orders as $order){
try{
$storages = (App()->make(CheckStorageInvoiceTransactionProcessor::class))->executeOrder($order);
$count = $count + 1;
Log::info('Order '.$count);
}
catch(\Exception $ex){
Log::info('Exception '.$ex->getMessage());
break;
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Check all orders for storage invoice. ElapsedTime: ' . $elapsedTime . '.');
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class DummyJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Dummy.');
$start = new Carbon();
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Dummy. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,70 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Group;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class FixApprovedPaymentFailedGroupV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Fix all payment is approved or completed but group failed to be updated.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
// $this->outputArray = [];
$groups = Group::whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->whereHas('payment', function ($query) {
$query->whereIn('status', [2, 3]);
})->get();
foreach ($groups as $group) {
$transaction = $group->payment;
$response = Http::withBasicAuth(config('billplz.api_key') . ':', '')->get(config('billplz.base_url') . '/api/v3/bills/' . $transaction->payment_reference);
dump($transaction->payment_reference);
if ($response->successful()) {
$data = $response->json();
if ($data['paid']) {
$status = ApprovalStatus::PENDING_VERIFICATION;
if ($data['state'] === 'paid') {
$status = ApprovalStatus::APPROVED;
}
Log::info(Carbon::now() . ' : Fixing ' . $transaction->payment_reference);
(App()->make(CallbackBillplzProcessor::class))->execute($transaction, $status);
}
} else {
Log::info("billplz error");
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
// if ($groups) {
// $this->info(Carbon::now() . ' : Done . ElapsedTime: ' . $elapsedTime);
// }
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Fix all payment is approved or completed but group failed to be updated. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,67 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class FixBillplzFailedCallbackPaymentV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $transactionId;
public function __construct(int $transactionId)
{
$this->transactionId = $transactionId;
}
public function handle()
{
Log::info(Carbon::now() . ': Start job - Fix failled callback from billplz.');
$start = new Carbon();
$transaction = Transaction::where('id', $this->transactionId)->first();
Log::info('Billplz Url: '.config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
if($response->successful()){
$data = $response->json();
if($data['paid']) {
$status = ApprovalStatus::PENDING_VERIFICATION;
if($data['state'] === 'paid') {
$status = ApprovalStatus::APPROVED;
}
Log::info(Carbon::now() . ' : Fixing ' . $transaction->payment_reference);
(App()->make(CallbackBillplzProcessor::class))->execute($transaction, $status);
}
}
else{
Log::info("billplz error");
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Fix failled callback from billplz. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,56 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\Container;
use App\Models\ContainerPackingList;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class FixDuplicateContainerReferenceV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Fix Duplicate Container Reference.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
$duplicatedContainers = Container::select('reference', DB::raw('COUNT(reference) as count'))
->groupBy('reference')
->having('count', '>', 1)
->get();
foreach ($duplicatedContainers as $duplicatedContainer) {
$containers = Container::where('reference', $duplicatedContainer->reference)->get();
$containers = $containers->sortByDesc(function ($container) {
return $container->packingLists->count();
});
$firstContainer = $containers->shift();
foreach ($containers as $container) {
$firstContainer->packingLists()->syncWithoutDetaching($container->packingLists);
$container->packingLists()->detach();
Log::info('Deleted container ' . $container->id);
$container->delete();
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Fix Duplicate Container Reference. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,52 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\Transactions\Processors\CreateStorageInvoiceDocTransactionFixProcessor;
use Illuminate\Support\Facades\Log;
class FixGroupPaymentProblemV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Fix Group Payment Problem.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
/*
$group = $this->fetchesGroup->execute(['id' => 325]);
$this->info('FixGroupPaymentProblem group: '.json_encode($group));
if ($group) {
foreach ($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
$this->info('FixGroupPaymentProblem group: '.json_encode($invoice));
$pL = $invoice->owner;
$this->releaseGoodsToCustomerProcessor->execute($pL, $invoice);
}
}
*/
$order = (App()->make(FetchesOrder::class))->execute(['reference' => '729251424']);
$packingLists = $order->destinationWarehousePackages;
foreach ($packingLists as $packingList){
(App()->make(CreateStorageInvoiceDocTransactionFixProcessor::class))->execute($packingList, true);
dd(json_encode($packingList));
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Fix Group Payment Problem. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,85 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Documents\Services\CreatesDocument;
use App\Classes\Modules\Documents\Services\CreatesFiles;
use App\Classes\Modules\Jobs\DataTransferObjects\FixInvoiceV2CommandObject;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\CompanyConnection;
use App\Models\Order;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
use Illuminate\Support\Facades\Log;
class FixInvoiceV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var FixInvoiceV2CommandObject*/
private $fixInvoiceV2CommandObject;
/**
* FixInvoiceV2CommandJob constructor.
* @param FixInvoiceV2CommandObject $fixInvoiceV2CommandObject
*/
public function __construct(FixInvoiceV2CommandObject $fixInvoiceV2CommandObject)
{
$this->fixInvoiceV2CommandObject = $fixInvoiceV2CommandObject;
}
public function handle()
{
Log::info(Carbon::now() . ': Start job - Fix invoice.');
$start = new Carbon();
$connection = CompanyConnection::where('invitee_reference', $this->fixInvoiceV2CommandObject->getMarking())->first();
$company_module_id = $connection->invitee->id;
$orders = Order::where('company_module_id', $company_module_id)->get();
foreach ($orders as $order){
$invoices = $order->transactions()->where('transactions.type', TransactionType::SHIPPING_INVOICE)->get();
foreach ($invoices as $invoice){
dump($invoice->id);
$invoice->documents()->delete();
$view = 'pages.pdfs.shipping_invoice';
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
$shippingInvoiceTransactionCreatedDate = Carbon::parse($invoice->created_at);
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare) && $invoice->tax > 0) {
$view = 'pages.pdfs.shipping_invoice_sst';
}
$transaction_invoice_pdf = LaravelMpdf::loadView($view, ['invoice_transaction' => $invoice]);
$document_object = new DocumentObject(
DocumentType::SHIPPING_INVOICE,
[chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))],
'',
ApprovalStatus::COMPLETED,
'shipping_invoice'
);
/** @var Document $document */
$document = (App()->make(CreatesDocument::class))->execute($invoice, $document_object);
(App()->make(CreatesFiles::class))->execute($document, $document_object);
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Fix invoice. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\PackingLists\Processors\FetchPackingListsFromYdPortalProcessor;
use Illuminate\Support\Facades\Log;
class FixMissingPackingListV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Fix Missing PackingList.');
$start = new Carbon();
$start_date = '2024-05-05';
$end_date = '2024-05-05';
$start = $start_date ? Carbon::parse($start_date) : null;
$end = $end_date ? Carbon::parse($end_date) : null;
if (!$start || !$end) {
return;
}
(App()->make(FetchPackingListsFromYdPortalProcessor::class))->execute($start, $end);
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Fix Missing PackingList. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,68 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\PackingList;
use Illuminate\Support\Facades\Log;
class FixPackingListV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Fix PackingList.');
$start = new Carbon();
$packingLists = PackingList::whereDoesntHave('packages')->get();
if ($packingLists->isNotEmpty()) {
$restoredPackagesCount = 0;
$restoredPackagesIds = [];
// Eager loading packages for all packing lists
$packingLists->load(['packages' => function ($query) {
$query->onlyTrashed();
}]);
foreach ($packingLists as $packingList) {
$deletedPackages = $packingList->packages->filter(function ($package) use ($restoredPackagesIds) {
// Filter out packages that have already been restored
return !in_array($package->id, $restoredPackagesIds);
});
if ($deletedPackages->isNotEmpty()) {
$groupedPackages = $deletedPackages->groupBy(function ($item) {
return $item->only(['type', 'description', 'width', 'height', 'length', 'weight', 'quantity']);
});
foreach ($groupedPackages as $group) {
$latestPackage = $group->sortByDesc('created_at')->first();
// Check if the package ID is already restored before attempting to restore it
if (!in_array($latestPackage->id, $restoredPackagesIds)) {
$latestPackage->restore();
Log::info('Package ID: ' . $latestPackage->id . ' has been restored');
$restoredPackagesCount++;
$restoredPackagesIds[] = $latestPackage->id;
}
}
}
}
Log::info('Restored Packages Count: ' . $restoredPackagesCount);
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Fix PackingList. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,52 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
class HouseKeepingS3FilesV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Housekeeping temporary files in S3 Bucket.');
$start = new Carbon();
$s3 = Storage::disk('s3');
$directories = [
'temp',
];
foreach ($directories as $directory) {
$startInner = Carbon::now();
Log::info(Carbon::now() . ' [HouseKeepingS3FilesV2] Start cleaning - ' . $directory);
$objects = $s3->allFiles($directory);
foreach ($objects as $object) {
$s3->delete($object);
Log::info('[HouseKeepingS3FilesV2] Deleted object: ' . $object);
}
Log::info('[HouseKeepingS3FilesV2] All files have been deleted.');
$endInner = Carbon::now();
$elapsedTime = $startInner->diff($endInner)->format('%H:%I:%S');
Log::info(Carbon::now() . ' [HouseKeepingS3FilesV2] Process ended. ElapsedTime: ' . $elapsedTime);
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Housekeeping temporary files in S3 Bucket. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,38 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use App\Classes\Modules\Accounts\Services\ExpiresEmailVerificationAttempt;
use App\Models\UserEmailVerification;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class NewUserRegistrationExpireCheckV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - New user email verification expiration check.');
$start = new Carbon();
$attempts = UserEmailVerification::active()->twoDaysOld()->get();
Log::info('NewUser Carbon now()->subHours(48): '. Carbon::now()->subHours(48));
Log::info('NewUser Attempts count: '.count($attempts));
foreach ($attempts as $attempt){
(new ExpiresEmailVerificationAttempt())->execute($attempt);
Log::info('NewUser Expired: '.$attempt->id.', '.$attempt->created_at);
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - New user email verification expiration check. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzDataPatchProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Transaction;
use Illuminate\Support\Facades\Log;
class OneTimeTransactionFixBillplzFailedCbV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - One time fix failled callback from billplz for transaction with id 17310 cron ended.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
//Transaction fix with this one time fix command: 15205, 16803, 17310
//This transaction, 16803 has approve payment but not its owner, shipping invoice
$transaction = Transaction::whereIn('id', [17310])->first();
Log::info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 17310 cron started.');
if($transaction && $transaction->id == 17310){
Log::info(Carbon::now() . ' : 17310.');
$status = ApprovalStatus::APPROVED;
// $this->callbackBillplzProcessor->execute($transaction, $status);
(App()->make(CallbackBillplzDataPatchProcessor::class))->execute($transaction, $status);
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - One time fix failled callback from billplz for transaction with id 17310 cron ended. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,38 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use App\Classes\Modules\Accounts\Services\ExpiresPasswordReset;
use App\Models\PasswordReset;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class PasswordResetTokenExpirationV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Password reset token expiration check.');
$start = new Carbon();
$attempts = PasswordReset::active()->oneDayOld()->get();
Log::info('PasswordReset Carbon now()->subHours(24): '. Carbon::now()->subHours(24));
Log::info('PasswordReset Attempts count: '.count($attempts));
foreach ($attempts as $attempt){
(new ExpiresPasswordReset())->execute($attempt);
Log::info('PasswordReset Expired: '.$attempt->id.', '.$attempt->created_at);
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Password reset token expiration check. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Notifications\ShipmentDepartureEmail;
use App\Models\Order;
use App\Models\Container;
use Illuminate\Support\Facades\Log;
class SendContainerDepartureEmailV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Send Container Departure Email.');
$start = new Carbon();
$containers = Container::whereHas('transports', function ($transport){
return $transport->whereDate('dispatch_date', '=', Carbon::today());
})->get();
foreach ($containers as $container){
foreach ($container->packingLists as $packingList){
if(!($packingList->owner instanceof Order)) continue;
$user = $packingList->owner->companyModule->employees()->first();
if(app()->environment(['production'])) {
$user->notify(new ShipmentDepartureEmail($user, $packingList));
}
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Send Container Departure Email. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,68 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Notifications\PermitsReminderEmail;
use App\Models\PermitsReminder;
use App\Models\User;
use Illuminate\Support\Facades\Log;
class SendPermitsReminderEmailsV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Send Permits Reminders Email.');
$start = new Carbon();
$currentDateTime = now();
$startRange = $currentDateTime->subDays(3)->startOfDay();
$endRange = $currentDateTime->copy()->addDays(6)->endOfDay();
$reminders = PermitsReminder::whereDate('reminder_date', '>=', $startRange)
->whereDate('reminder_date', '<=', $endRange)
->orWhere('reminder_date', '<', now())
->pluck('model');
if ($reminders->isEmpty()) {
Log::info('No reminders expiring within the specified range.');
return;
}
Log::info($this->getTimeStamp() . 'Reminders: ' . $reminders->toJson());
$users = User::whereIn('email', $this->getEmailList())->get();
foreach ($users as $user) {
Log::info($this->getTimeStamp() . 'Reminder email sent to ' . $user->email);
if (app()->environment('production')) {
$user->notify(new PermitsReminderEmail($user, $reminders));
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Send Permits Reminders Email. ElapsedTime: ' . $elapsedTime . '.');
}
public function getTimeStamp()
{
return '[' . Carbon::now()->format('Y-m-d H:i:s') . '] - ';
}
protected function getEmailList(): array
{
return [
// 'edmond.wuiming2021@gmail.com',
'anithagurl96@gmail.com'
];
}
}
@@ -0,0 +1,57 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use App\Classes\Modules\Jobs\DataTransferObjects\ShowBillplzPaymentStatusV2CommandObject;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class ShowBillplzPaymentStatusV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var ShowBillplzPaymentStatusV2CommandObject*/
private $showBillplzPaymentStatusV2CommandObject;
/**
* ShowBillplzPaymentStatusV2CommandJob constructor.
* @param ShowBillplzPaymentStatusV2CommandObject $showBillplzPaymentStatusV2CommandObject
*/
public function __construct(ShowBillplzPaymentStatusV2CommandObject $showBillplzPaymentStatusV2CommandObject)
{
$this->showBillplzPaymentStatusV2CommandObject = $showBillplzPaymentStatusV2CommandObject;
}
public function handle()
{
Log::info(Carbon::now() . ': Start job - Show Billplz payment status.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
$billplz_id = $this->showBillplzPaymentStatusV2CommandObject->getBillplzId();
$billplz_id = explode(",", $billplz_id);
foreach ($billplz_id as $payment) {
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$payment);
if($response->successful()){
$data = $response->json();
dump($data);
}else{
Log::info("billplz error</br>");
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Show Billplz payment status. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,63 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class ShowFailediBllplzCallbackV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Show all failled callback from billplz.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
$transactions = Transaction::whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP, TransactionType::GROUP_PAYMENT])->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
$totalTransactions = count($transactions);
if ($totalTransactions) {
Log::info(Carbon::now() . ' totalTransactions : ' . $totalTransactions);
}
$counter = 1;
$totalAmount = 0;
foreach ($transactions as $transaction){
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
if($response->successful()){
$data = $response->json();
if($data['paid']){
dump($transaction->payment_reference);
dump($transaction->id);
}
}else{
Log::info("billplz error</br>");
}
$counter++;
}
// if ($totalTransactions) {
// Log::info(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
// }
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Show all failled callback from billplz. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
}
}
@@ -0,0 +1,82 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Order;
use App\Models\Transaction;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class ShowFixBillplzFailedCallbackPaymentV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Show Billplz Failled Callback.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
// $this->outputArray = [];
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
$totalTransactions = count($transactions);
$counter = 1;
$totalAmount = 0;
foreach ($transactions as $transaction){
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
if($response->successful()){
$data = $response->json();
if($data['paid']){
$totalAmount += $transaction->amount;
$invoiceStatus = null;
switch($transaction->owner->status) {
case 3:
$invoiceStatus = 'Payment Completed';
break;
case 5:
$invoiceStatus = 'Dispute in progress';
break;
case 6:
$invoiceStatus = 'Cancelled Invoice';
break;
default:
$invoiceStatus = 'Pending Payment';
}
$order = $transaction->owner->owner->owner;
if(!$order instanceof Order) {
Log::info("Error transaction id:" . $transaction->id . 'Type: ' . get_class($order));
} else {
Log::info($counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
}
} else {
// $totalAmount += $transaction->amount;
// $this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);
}
}else{
Log::info("billplz error</br>");
}
$counter++;
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Show Billplz Failled Callback. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
}
}
@@ -0,0 +1,88 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Illuminate\Support\Facades\Log;
class SuccessUpdatePaymentStatusV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Success Updated Payment Status.');
$start = new Carbon();
// ini_set('memory_limit', '-1');
// $this->outputArray = [];
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
$transactions = Transaction::where('type', TransactionType::PAYMENT)
->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->get();
foreach ($transactions as $payment) {
$invoice = $payment->owner ?? null;
if (!$invoice) {
Log::info('Payment has no owner. Payment ID: ' . $payment->id);
continue;
}
$packingList = $invoice->owner ?? null;
if (!$packingList) {
Log::info('Invoice has no owner. Invoice ID: ' . $invoice->id);
continue;
}
$order = $packingList->owner;
if (!$invoice) {
Log::info('PackingList has no owner. PackingList ID: ' . $packingList->id);
continue;
}
if ($invoice->status == ApprovalStatus::APPROVED) {
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
if(($invoice->amount - $totalPaidAmount) < 0.01) {
(App()->make(UpdatesTransactionStatus::class))->execute($invoice, ApprovalStatus::COMPLETED);
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
if(app()->environment('production')){
(App()->make(UpdateDoFromVTPortalProcessor::class))->execute($packingList);
(App()->make(UpdateDoFromYDPortalProcessor::class))->execute($packingList);
}
dump('Updated invoice ' . $invoice->id . '. Order: '. $order->reference);
} else {
Log::info('Failed Update invoice ' . $invoice->id . ' because payment not enough. Invoice Amount: ' . $invoice->amount . ' . Paid Amount: ' . $totalPaidAmount . ' . Order: '. $order->reference);
}
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Success Updated Payment Status. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,59 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use App\Models\Container;
use App\Models\Order;
use App\Models\User;
use App\Classes\Notifications\ShipmentDepartureEmail;
class TestAttachingS3FileAndSendEmailV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Test to attach a file from S3 bucket and trigger an email send.');
$start = new Carbon();
$containers = Container::whereHas('transports', function ($transport){
return $transport->whereDate('dispatch_date', '<', Carbon::today())->whereDate('dispatch_date', '>', Carbon::now()->subdays(30));
})->get();
Log::info("[TESTING] total containers: " . count($containers));
$sent = false;
foreach ($containers as $container){
if($sent){
break;
}
foreach ($container->packingLists as $packingList){
if($sent){
break;
}
if(!($packingList->owner instanceof Order)) continue;
$user = $packingList->owner->companyModule->employees()->first();
$user = User::where('email', 'dillonngoweijoon@gmail.com')->first();
Log::info("[TESTING] user: " . json_encode($user));
Log::info("[TESTING] packingList: " . json_encode($packingList));
$user->notify(new ShipmentDepartureEmail($user, $packingList));
$sent = true;
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Test to attach a file from S3 bucket and trigger an email send. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,82 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\Exports\Services\ExportsNullDebtors;
use Illuminate\Support\Facades\Storage;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Models\Company;
class TestExportExcelToS3BucketV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Test Export Excel File to S3 Bucket.');
$start = new Carbon();
Log::info('company 0');
$company = Company::where(function($query){
$query->whereNull('debtor')->orWhere('debtor', '');
})->get();
Log::info('company 1: ' . json_encode($company));
$company = Company::where(function($query){
$query->whereNull('debtor')->orWhere('debtor', '');
})->whereHas('companyModules', function($query){
$query->where('type', BusinessType::IMPORTER);
})->get();
Log::info('company 2: ' . json_encode($company));
$company = Company::where(function($query){
$query->whereNull('debtor')->orWhere('debtor', '');
})->whereHas('companyModules', function($query){
$query->where('type', BusinessType::IMPORTER);
})->whereHas('parcels', function ($query) {
$query->where('packages.status', ApprovalStatus::APPROVED);
})
->with(['companyModules', 'parcels'])
->get();
Log::info('company 3: ' . json_encode($company));
$company = Company::where(function($query){
$query->whereNull('debtor')->orWhere('debtor', '');
})->whereHas('companyModules', function($query){
$query->where('type', BusinessType::IMPORTER);
})->whereHas('parcels')->where('status', ApprovalStatus::APPROVED)->get();
Log::info('company 4: ' . json_encode($company));
$export = new ExportsNullDebtors();
$filesystemDriver = Storage::getDefaultDriver();
if ($filesystemDriver === 's3') {
$filePathForS3 = 'temp/nullDebtor.xlsx'; //documents/exports
$excelFile = $export->store($filePathForS3, 's3');
$temporaryUrl = Storage::disk('s3')->temporaryUrl(
$filePathForS3,
Carbon::now()->addMinutes(10)
);
Log::info('temporaryUrl: ' . $temporaryUrl);
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Test Export Excel File to S3 Bucket. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Classes\Jobs\Commands\V2;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\PackingLists\Processors\TestFetchPackingListsFromYdPortalProcessor;
class TestReadDataFromYDAPIV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info(Carbon::now() . ': Start job - Test to read data from YD API.');
$start = new Carbon();
(App()->make(TestFetchPackingListsFromYdPortalProcessor::class))->execute();
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
Log::info(Carbon::now() . ': End job - Test to read data from YD API. ElapsedTime: ' . $elapsedTime . '.');
}
}
@@ -0,0 +1,37 @@
<?php
namespace App\Classes\Jobs\Commands\V2\YD;
use App\Classes\Modules\PackingLists\Processors\V2\FetchContainersFromYdPortalV2Processor;
use App\Classes\Modules\PackingLists\Processors\FetchContainersUpdatesFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\FetchDeliveryUpdatesFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\FetchOrderListsFromYdPortalProcessor;
use App\Models\PackingList;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class FetchContainersFromYdPortalV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $packingList;
public function __construct(PackingList $packingList)
{
$this->packingList = $packingList;
}
public function handle()
{
Log::info('Processing FetchContainersFromYdPortalV2CommandJob');
$processor = app(FetchContainersFromYdPortalV2Processor::class);
$processor->execute($this->packingList);
}
}
@@ -0,0 +1,36 @@
<?php
namespace App\Classes\Jobs\Commands\V2\YD;
use App\Classes\Modules\PackingLists\Processors\FetchContainersFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\V2\FetchContainersUpdatesFromYdPortalV2Processor;
use App\Classes\Modules\PackingLists\Processors\FetchDeliveryUpdatesFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\FetchOrderListsFromYdPortalProcessor;
use App\Models\Container;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class FetchContainersUpdatesFromYdPortalV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $container;
public function __construct(Container $container)
{
$this->container = $container;
}
public function handle()
{
Log::info('Processing FetchContainersUpdatesFromYdPortalV2CommandJob');
$processor = app(FetchContainersUpdatesFromYdPortalV2Processor::class);
$processor->execute($this->container);
}
}
@@ -0,0 +1,36 @@
<?php
namespace App\Classes\Jobs\Commands\V2\YD;
use App\Classes\Modules\PackingLists\Processors\FetchContainersFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\FetchContainersUpdatesFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\V2\FetchDeliveryUpdatesFromYdPortalV2Processor;
use App\Classes\Modules\PackingLists\Processors\FetchOrderListsFromYdPortalProcessor;
use App\Models\PackingList;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class FetchDeliveryUpdatesFromYdPortalV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $packingListId;
public function __construct(int $packingListId)
{
$this->packingListId = $packingListId;
}
public function handle()
{
Log::info('Processing FetchDeliveryUpdatesFromYdPortalV2CommandJob');
$processor = app(FetchDeliveryUpdatesFromYdPortalV2Processor::class);
$processor->execute($this->packingListId);
}
}
@@ -0,0 +1,34 @@
<?php
namespace App\Classes\Jobs\Commands\V2\YD;
use App\Classes\Modules\PackingLists\Processors\V2\FetchOrderListsFromYdPortalV2Processor;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class FetchOrderListsFromYdPortalV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $startDate;
protected $endDate;
public function __construct(?Carbon $startDate, ?Carbon $endDate)
{
$this->startDate = $startDate;
$this->endDate = $endDate;
}
public function handle()
{
Log::info('Processing FetchOrderListsFromYdPortalV2CommandJob for start date: ' . $this->startDate. ', and end date: ' . $this->endDate);
$processor = app(FetchOrderListsFromYdPortalV2Processor::class);
$processor->execute($this->startDate, $this->endDate);
}
}
@@ -0,0 +1,34 @@
<?php
namespace App\Classes\Jobs\Commands\V2\YD;
use App\Classes\Modules\PackingLists\Processors\V2\FetchPackingListsFromYdPortalV2Processor;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class FetchPackingListsFromYdPortalV2CommandJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $startDate;
protected $endDate;
public function __construct(?Carbon $startDate, ?Carbon $endDate)
{
$this->startDate = $startDate;
$this->endDate = $endDate;
}
public function handle()
{
Log::info('Processing FetchPackingListsFromYdPortalV2CommandJob for start date: ' . $this->startDate. ', and end date: ' . $this->endDate);
$processor = app(FetchPackingListsFromYdPortalV2Processor::class);
$processor->execute($this->startDate, $this->endDate);
}
}
+9 -9
View File
@@ -3,7 +3,7 @@
namespace App\Classes\Jobs;
use App\Classes\Modules\PackingLists\Processors\ListPackingListsJobProcessor;
use App\Classes\Modules\Jobs\DataTransferObjects\ListGenericJobObject;
use App\Classes\Modules\Jobs\DataTransferObjects\JobSubmissionObject;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@@ -17,29 +17,29 @@ class ListPackingListsJob implements ShouldQueue
public $timeout = 900;
/** @var ListGenericJobObject */
private $listGenericJobObject;
/** @var JobSubmissionObject */
private $jobSubmissionObject;
/**
* ListPackingListsJob constructor.
* @param ListGenericJobObject $listGenericJobObject
* @param JobSubmissionObject $JobSubmissionObject
*/
public function __construct(ListGenericJobObject $listGenericJobObject)
public function __construct(JobSubmissionObject $jobSubmissionObject)
{
$this->listGenericJobObject = $listGenericJobObject;
$this->jobSubmissionObject = $jobSubmissionObject;
}
public function handle()
{
$rawPayload = $this->job->payload();
if(isset($rawPayload['data']['commandName'])){
$this->listGenericJobObject->setJobCommandName($rawPayload['data']['commandName']);
$this->jobSubmissionObject->setJobCommandName($rawPayload['data']['commandName']);
}
if(isset($rawPayload['data']['command'])){
$this->listGenericJobObject->setJobCommand($rawPayload['data']['command']);
$this->jobSubmissionObject->setJobCommand($rawPayload['data']['command']);
}
$result = (App()->make(ListPackingListsJobProcessor::class))->execute($this->listGenericJobObject);
$result = (App()->make(ListPackingListsJobProcessor::class))->execute($this->jobSubmissionObject);
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Classes\Jobs;
use App\Classes\Modules\Reports\Processors\MonthlyReportJobProcessor;
use App\Classes\Modules\Jobs\DataTransferObjects\JobSubmissionObject;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class MonthlyReportJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $timeout = 900;
/** @var JobSubmissionObject */
private $jobSubmissionObject;
/**
* MonthlyReportJob constructor.
* @param JobSubmissionObject $jobSubmissionObject
*/
public function __construct(JobSubmissionObject $jobSubmissionObject)
{
$this->jobSubmissionObject = $jobSubmissionObject;
}
public function handle()
{
$rawPayload = $this->job->payload();
if(isset($rawPayload['data']['commandName'])){
$this->jobSubmissionObject->setJobCommandName($rawPayload['data']['commandName']);
}
if(isset($rawPayload['data']['command'])){
$this->jobSubmissionObject->setJobCommand($rawPayload['data']['command']);
}
$result = (App()->make(MonthlyReportJobProcessor::class))->execute($this->jobSubmissionObject);
}
}
+3 -2
View File
@@ -20,6 +20,7 @@ use Illuminate\Queue\SerializesModels;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
use App\Classes\General\Helper;
use App\Classes\General\LogHelper;
class UpdatePerfexCRMInvoice implements ShouldQueue
{
@@ -47,7 +48,7 @@ class UpdatePerfexCRMInvoice implements ShouldQueue
$invoiceId = 0;
$invoiceStatus = 0;
$invoice = (App()->make(FetchesPerfexCRMInvoice::class))->execute($customer->userid,"INV-", $transaction->owner->bill_no);
Log::channel('perfex_crm')->info('UpdatePerfexCRMInvoice debug bill_no: ' . $transaction->owner->bill_no . ', Project Id: ' . $this->updatePerfexCRMInvoiceObject->getProjectId());
LogHelper::channel('perfex_crm')->info('UpdatePerfexCRMInvoice debug bill_no: ' . $transaction->owner->bill_no . ', Project Id: ' . $this->updatePerfexCRMInvoiceObject->getProjectId());
if(is_null($invoice)){
$result = (App()->make(CreatePerfexCRMInvoiceProcessor::class))->execute($transaction->owner, $this->updatePerfexCRMInvoiceObject->getIsPaid());
@@ -55,7 +56,7 @@ class UpdatePerfexCRMInvoice implements ShouldQueue
$invoiceId = $result->payload['id'];
} else {
// Log::error(json_encode('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed'));
Log::channel('perfex_crm')->info('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed');
LogHelper::channel('perfex_crm')->info('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed');
}
}
else{
+8 -2
View File
@@ -32,12 +32,12 @@ class UpdatePerfexCRMPrelude implements ShouldQueue
/**
* UpdatePerfexCRMPrelude constructor.
* @param $packingList
* @param PackingList $packingList
* @param Transaction $transaction
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
* @param bool|null $shouldCreateInvoice
*/
public function __construct($packingList, $transaction, UpdatePerfexCRMObject $updatePerfexCRMObject, ?bool $shouldCreateInvoice = false)
public function __construct(?PackingList $packingList, $transaction, UpdatePerfexCRMObject $updatePerfexCRMObject, ?bool $shouldCreateInvoice = false)
{
$this->packingList = $packingList;
$this->transaction = $transaction;
@@ -47,6 +47,12 @@ class UpdatePerfexCRMPrelude implements ShouldQueue
public function handle()
{
Log::info('UpdatePerfexCRMPrelude packingList: ' . json_encode($this->packingList));
if(env('APP_ENV') !== 'production'){
return;
}
if(is_null($this->packingList)){
$this->packingList = $this->transaction->owner->owner;
}
@@ -0,0 +1,87 @@
<?php
namespace App\Classes\Modules\Accounts\ControllersLogic;
use App\Classes\Exceptions\ResourceConflictException;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Accounts\Processors\GenerateEmailVerificationAttemptProcessor;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Http\Resources\UserResource;
use App\Models\User;
use Illuminate\Database\QueryException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class AdminAddNewMemberLogic extends AbstractControllerLogic
{
public function notification(): array
{
return [
'title' => 'Admin Updated Email',
'message' => 'Successfully updated email'
];
}
/**
* @var AssignEmployeeProcessor
*/
private $assignEmployeeProcessor;
/**
* @var GenerateEmailVerificationAttemptProcessor
*/
private $generateEmailVerificationAttemptProcessor;
/**
* AddNewMemberLogic constructor.
* @param AssignEmployeeProcessor $assignEmployeeProcessor
* @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor
*/
public function __construct(AssignEmployeeProcessor $assignEmployeeProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor)
{
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
$this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ResourceConflictException
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request): JsonResponse
{
Log::info($request->input('employeeId'));
try {
if (!$authUser = User::find($request->input('employeeId'))) {
throw new ResourceNotFoundException('User not found.');
}
$user = $authUser->replicate();
$user->email = $request->input('email');
$user->status = ApprovalStatus::PENDING_VERIFICATION;
$user->save();
} catch (QueryException $e) {
throw new ResourceConflictException('Email already exists.');
}
Log::info($request->input('email'));
if ($company = $authUser->companyModule()->first()) {
$this->assignEmployeeProcessor->execute(new EmploymentObject($company, $user));
}
$this->generateEmailVerificationAttemptProcessor->execute($user);
return $this->resourceResponse(new UserResource($user));
}
}
@@ -77,11 +77,11 @@ class GeneratePasswordResetLogic extends AbstractControllerLogic
$attempt = $this->generatesPasswordReset->execute($user);
$this->passwordResetTokenExpiration::dispatch($attempt)->delay(now()->addHours(24));
// $this->passwordResetTokenExpiration::dispatch($attempt)->delay(now()->addHours(24)); //converted to schedule task
$this->sendResetPasswordEmail::dispatch($user, $attempt);
return $this->response(['email' => $object->getEmail()]);
}
}
}
}
@@ -50,7 +50,7 @@ class GenerateEmailVerificationAttemptProcessor
$attempt = $this->generatesEmailVerificationAttempt->execute($user);
$this->emailVerificationAttemptExpiration::dispatch($attempt)->delay(now()->addHours(48));
//$this->emailVerificationAttemptExpiration::dispatch($attempt)->delay(now()->addHours(48)); //converted to schedule task
$this->sendUserVerificationEmail::dispatch($user, $attempt);
@@ -15,10 +15,12 @@ use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\RemarkTypes;
use App\Http\Resources\AddressResource;
use App\Models\Address;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Carbon\Carbon;
class UpdateAddressLogic extends AbstractControllerLogic
{
@@ -102,6 +104,24 @@ class UpdateAddressLogic extends AbstractControllerLogic
$this->createRemarkProcessor->execute($address, $remarkObject);
}
if ($request->input('pickup_time_to') <= $request->input('pickup_time_from')) {
$pickupTimeFrom = Carbon::parse($request->input('pickup_time_from'));
$request->merge([
'pickup_time_to' => $pickupTimeFrom->addHour()->format('H:i') // Format to hh:mm
]);
}
$addressExtraFields = [
'property_type' => $request->input('property_type'),
'receive_goods_working_hours' => $request->input('receive_goods_working_hours'),
'receive_goods_after_hours' => $request->input('receive_goods_after_hours'),
'receive_goods_on_saturday' => $request->input('receive_goods_on_saturday'),
];
$address->addressExtraFields()->delete();
$addressExtraFieldsObject = new RemarkObject(json_encode($addressExtraFields), Auth()->user()->id, RemarkTypes::ADDRESS_EXTRA_COLUMNS);
$remark = $this->createRemarkProcessor->execute($address, $addressExtraFieldsObject);
return $this->resourceResponse(new AddressResource($address));
}
@@ -0,0 +1,140 @@
<?php
namespace App\Classes\Modules\Billplzs\Processors;
use Illuminate\Http\Request;
use App\Models\Wallet;
use App\Models\Group;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\Modules\Transactions\Processors\CreatePaymentTransactionProcessor;
use App\Classes\Modules\Transactions\Processors\ReleaseGoodsToCustomerProcessor;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\Modules\Wallets\Services\UpdatesWalletBalance;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use Illuminate\Support\Facades\Log;
//Date: 20240817
//This Processor is used for one time data patching with OneTimeTransactionFixBillplzFailedCallback.php
class CallbackBillplzDataPatchProcessor
{
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus;
/** @var UpdateDoFromVTPortalProcessor */
private $updateDoFromVTPortalProcessor;
/** @var UpdateDoFromYDPortalProcessor */
private $updateDoFromYDPortalProcessor;
/** @var UpdatesWalletBalance */
private $updatesWalletBalance;
/** @var CreatePaymentTransactionProcessor */
private $createPaymentTransactionProcessor;
/** @var ReleaseGoodsToCustomerProcessor */
private $releaseGoodsToCustomerProcessor;
/**
* CallbackBillplzDataPatchProcessor constructor.
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
* @param UpdatesWalletBalance $updatesWalletBalance
* @param CreatePaymentTransactionProcessor $createPaymentTransactionProcessor
* @param ReleaseGoodsToCustomerProcessor $releaseGoodsToCustomerProcessor
*/
public function __construct(UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, UpdatesWalletBalance $updatesWalletBalance, CreatePaymentTransactionProcessor $createPaymentTransactionProcessor, ReleaseGoodsToCustomerProcessor $releaseGoodsToCustomerProcessor)
{
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
$this->updatesWalletBalance = $updatesWalletBalance;
$this->createPaymentTransactionProcessor = $createPaymentTransactionProcessor;
$this->releaseGoodsToCustomerProcessor = $releaseGoodsToCustomerProcessor;
}
/**
* @param Request $request
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute($transaction, $status)
{
$invoice = $transaction->owner;
$packingList = $invoice->owner;
$proceed = $this->checkForGroupPayment($transaction);
if(!$proceed) return false;
$this->updatesTransactionStatus->execute($transaction, $status);
Log::info('CallbackBillplzDataPatchProcessor 1');
// check if is wallet top up
if ($transaction->owner instanceof Wallet && $status === ApprovalStatus::APPROVED) {
Log::info('CallbackBillplzDataPatchProcessor 2');
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
$group = Group::where('reference', $transaction->payment_reference)->first();
// check if is group payment
if ($group) {
foreach ($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
Log::info('CallbackBillplzDataPatchProcessor 3: '.json_encode($invoice));
//if($invoice->status !== ApprovalStatus::COMPLETED){
// $paymentTransaction = $this->createPaymentTransactionProcessor->execute($invoice, PaymentMethodType::WALLET, null, false);
// if($paymentTransaction && $paymentTransaction->status == ApprovalStatus::APPROVED){
$pL = $invoice->owner;
$this->releaseGoodsToCustomerProcessor->execute($pL, $invoice, true);
//}
//}
}
$group->status = $status;
$group->save();
}
}
if (!$transaction->owner instanceof Wallet) {
Log::info('CallbackBillplzDataPatchProcessor 3');
$this->releaseGoodsToCustomerProcessor->execute($packingList, $invoice);
}
return true;
}
private function checkForGroupPayment($transaction){
//This check is targetting group payment that expired and soft deleted
//command:check-storage-invoices must already run for this part of the code to work properly
$group = Group::withTrashed()->where('reference', $transaction->payment_reference)->first();
if ($group) {
$totalAmountToBePaid = 0;
$actualAmountPaid = $transaction->amount;
foreach ($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
if($invoice->status !== ApprovalStatus::COMPLETED){
$totalAmountToBePaid += $invoice->amount;
}
}
if(($totalAmountToBePaid - $actualAmountPaid) < 0.01){
}
else{
Log::channel('storage_invoices')->info('Total amount from current transaction: '.$totalAmountToBePaid);
Log::channel('storage_invoices')->info('Total amount from paid transaction: '.$transaction->amount);
return false;
}
}
return true;
}
}
@@ -2,6 +2,7 @@
namespace App\Classes\Modules\Billplzs\Processors;
use App\Classes\General\LogHelper;
use Illuminate\Http\Request;
use App\Models\Wallet;
use App\Models\Group;
@@ -36,7 +37,7 @@ class CallbackBillplzProcessor
private $releaseGoodsToCustomerProcessor;
/**
* CreateUserProcessor constructor.
* CallbackBillplzProcessor constructor.
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
@@ -121,8 +122,8 @@ class CallbackBillplzProcessor
}
else{
Log::channel('storage_invoices')->info('Total amount from current transaction: '.$totalAmountToBePaid); //cief todo: to be removed
Log::channel('storage_invoices')->info('Total amount from paid transaction: '.$transaction->amount); //cief todo: to be removed
LogHelper::channel('storage_invoices')->info('Total amount from current transaction: '.$totalAmountToBePaid);
LogHelper::channel('storage_invoices')->info('Total amount from paid transaction: '.$transaction->amount);
return false;
}
}
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Billplzs\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
class DeletesBillplzBill
@@ -16,7 +17,7 @@ class DeletesBillplzBill
public function execute(string $billID) {
try{
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->delete(config('billplz.base_url').'/api/v3/bills/'.$billID);
Log::channel('storage_invoices')->info('DeletesBillplzBill response: '.json_encode($response));
LogHelper::channel('storage_invoices')->info('DeletesBillplzBill response: '.json_encode($response));
if($response->successful()){
$data = $response->json();
@@ -54,11 +54,20 @@ class RenderDocumentLogic extends AbstractControllerLogic
$this->canRenderDocument->passes();
if(!Storage::disk('documents')->exists($file))
{
throw new ResourceNotFoundException();
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver === 's3'){
if(!Storage::disk('s3')->exists($file))
{
throw new ResourceNotFoundException();
}
return $this->response(['src' => explode('.', $file)[1] == 'pdf' ? chunk_split(base64_encode(Storage::disk('s3')->get($file))) : Storage::disk('s3')->get($file) ]);
}
else{
if(!Storage::disk('documents')->exists($file))
{
throw new ResourceNotFoundException();
}
return $this->response(['src' => explode('.', $file)[1] == 'pdf' ? chunk_split(base64_encode(Storage::disk('documents')->get($file))) : Storage::disk('documents')->get($file) ]);
}
return $this->response(['src' => explode('.', $file)[1] == 'pdf' ? chunk_split(base64_encode(Storage::disk('documents')->get($file))) : Storage::disk('documents')->get($file) ]);
}
}
}
@@ -98,13 +98,17 @@ class ConvertsBase64ToFile
* @throws MalformedRequestException
*/
private function generateFile(FileObject $file, string $suffix = '') {
$filePath = $this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
Storage::disk('documents')->put($filePath, $file->getDecodedData());
return $filePath;
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver === 's3'){
$filePath = 'documents/'.$this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
Storage::put($filePath, $file->getDecodedData(), 's3');
return $filePath;
}
else{
$filePath = $this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
Storage::disk('documents')->put($filePath, $file->getDecodedData());
return $filePath;
}
}
/**
@@ -3,14 +3,17 @@
namespace App\Classes\Modules\Exports\ControllersLogic;
use App\Classes\General\Abstracts\Abstract2ControllerLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Exports\Services\ExportsFeedback;
use App\Classes\Modules\Exports\Standards\Rules\CanExportFeedback;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Maatwebsite\Excel\Excel;
use App\Classes\General\AWSS3Helper;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\JsonResponse;
class ExportFeedbackDataLogic extends Abstract2ControllerLogic
class ExportFeedbackDataLogic extends AbstractControllerLogic
{
/**
* @return array
@@ -44,14 +47,17 @@ class ExportFeedbackDataLogic extends Abstract2ControllerLogic
* @param Request $request
* @return Response
*/
public function logic(Request $request) : BinaryFileResponse
public function logic(Request $request) : JsonResponse
{
$this->canExportFeedback->passes();
$response = $this->exportsFeedback->download('feedback.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
$exportFileName = 'feedback.xls';
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver === 's3'){
return $this->response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $this->exportsFeedback) ]);
}
return $response;
return $this->response([ 'src' => null ]);
}
}
@@ -0,0 +1,67 @@
<?php
namespace App\Classes\Modules\Exports\ControllersLogic;
use App\Classes\General\Abstracts\Abstract2ControllerLogic;
use App\Classes\Modules\Exports\Services\ExportsFeedback;
use App\Classes\Modules\Exports\Standards\Rules\CanExportFeedback;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Maatwebsite\Excel\Excel;
use App\Classes\General\AWSS3Helper;
use Illuminate\Support\Facades\Storage;
class ExportFeedbackDataReturnsBinaryLogic extends Abstract2ControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Feedback',
'message' => 'You have successfully exported feedback data'
];
}
/** @var ExportsFeedback */
private $exportsFeedback;
/** @var CanExportFeedback */
private $canExportFeedback;
/**
* ExportFeedbackDataLogic constructor.
* @param ExportsFeedback $exportsFeedback
* @param CanExportFeedback $canExportFeedback
*/
public function __construct(ExportsFeedback $exportsFeedback, CanExportFeedback $canExportFeedback)
{
$this->exportsFeedback = $exportsFeedback;
$this->canExportFeedback = $canExportFeedback;
}
/**
* @param Request $request
* @return Response
*/
public function logic(Request $request) : BinaryFileResponse
{
$this->canExportFeedback->passes();
$exportFileName = 'feedback.xls';
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver === 's3'){
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $this->exportsFeedback) ]);
}
else{
$response = $this->exportsFeedback->download($exportFileName, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
}
return $response;
}
}
@@ -3,15 +3,16 @@
namespace App\Classes\Modules\Exports\ControllersLogic;
use App\Classes\General\Abstracts\Abstract2ControllerLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Exports\Standards\Rules\CanExportPackingList;
use App\Classes\Modules\Exports\Services\ExportsOnHoldPackingList;
use App\Classes\Modules\Exports\Services\ExportsPendingArrangementDeliveryList;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Maatwebsite\Excel\Excel;
use Illuminate\Support\Facades\Storage;
use App\Classes\General\AWSS3Helper;
use Illuminate\Http\JsonResponse;
class ExportPackingListLogic extends Abstract2ControllerLogic
class ExportPackingListLogic extends AbstractControllerLogic
{
/**
* @return array
@@ -50,19 +51,24 @@ class ExportPackingListLogic extends Abstract2ControllerLogic
* @param Request $request
* @return Response
*/
public function logic(Request $request) : BinaryFileResponse
public function logic(Request $request) : JsonResponse
{
$this->canExportPackingList->passes();
$isSetPendingArrangement = $request->header('PendingArrangement');
if($isSetPendingArrangement){
$response = $this->exportsPendingArrangementDeliveryList->download('packing-list-delivery.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
}
else {
$response = $this->exportsOnHoldPackingList->download('packing-list-on-hold.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver === 's3'){
if($isSetPendingArrangement){
$exportFileName = 'packing-list-delivery.xls';
return $this->response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $this->exportsPendingArrangementDeliveryList) ]);
}
else{
$exportFileName = 'packing-list-on-hold.xls';
return $this->response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $this->exportsOnHoldPackingList) ]);
}
}
ob_end_clean();
return $response;
return $this->response([ 'src' => null ]);
}
}
@@ -0,0 +1,84 @@
<?php
namespace App\Classes\Modules\Exports\ControllersLogic;
use App\Classes\General\Abstracts\Abstract2ControllerLogic;
use App\Classes\Modules\Exports\Standards\Rules\CanExportPackingList;
use App\Classes\Modules\Exports\Services\ExportsOnHoldPackingList;
use App\Classes\Modules\Exports\Services\ExportsPendingArrangementDeliveryList;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Maatwebsite\Excel\Excel;
use Illuminate\Support\Facades\Storage;
use App\Classes\General\AWSS3Helper;
class ExportPackingListReturnsBinaryLogic extends Abstract2ControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved PackingList',
'message' => 'You have successfully exported PackingList'
];
}
/** @var ExportsOnHoldPackingList */
private $exportsOnHoldPackingList;
/** @var ExportsPendingArrangementDeliveryList */
private $exportsPendingArrangementDeliveryList;
/** @var CanExportPackingList */
private $canExportPackingList;
/**
* ExportPackingListLogic constructor.
* @param ExportsPendingArrangementDeliveryList $exportsPendingArrangementDeliveryList
* @param ExportsOnHoldPackingList $exportsOnHoldPackingList
* @param CanExportPackingList $canExportPackingList
*/
public function __construct(ExportsPendingArrangementDeliveryList $exportsPendingArrangementDeliveryList, ExportsOnHoldPackingList $exportsOnHoldPackingList, CanExportPackingList $canExportPackingList)
{
$this->exportsPendingArrangementDeliveryList = $exportsPendingArrangementDeliveryList;
$this->exportsOnHoldPackingList = $exportsOnHoldPackingList;
$this->canExportPackingList = $canExportPackingList;
}
/**
* @param Request $request
* @return Response
*/
public function logic(Request $request) : BinaryFileResponse
{
$this->canExportPackingList->passes();
$isSetPendingArrangement = $request->header('PendingArrangement');
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver === 's3'){
if($isSetPendingArrangement){
$exportFileName = 'packing-list-delivery.xls';
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $this->exportsPendingArrangementDeliveryList) ]);
}
else{
$exportFileName = 'packing-list-on-hold.xls';
return response([ 'src' => AWSS3Helper::S3Exportable($exportFileName, $this->exportsOnHoldPackingList) ]);
}
}
else{
if($isSetPendingArrangement){
$response = $this->exportsPendingArrangementDeliveryList->download('packing-list-delivery.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
}
else {
$response = $this->exportsOnHoldPackingList->download('packing-list-on-hold.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
}
ob_end_clean();
return $response;
}
}
}
@@ -24,8 +24,8 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
{
$this->filters = [
"has_invoice_status_in" => [2],
"packing_list_ordered_by_invoice_date" => true,
"with_aging_column" => true
// "packing_list_ordered_by_invoice_date" => true,
// "with_aging_column" => true
];
}
@@ -39,6 +39,7 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
'Invoice Date',
'Days',
'Amount',
'Credit Term Customer',
];
}
@@ -55,9 +56,16 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
$invDate = 'n/a';
$invNo = 'n/a';
$days = 'n/a';
$isCreditTermCustomer = false;
if ($list->owner instanceof Order) {
$inviterPivotInviteeReference = $list->owner->companyModule->inviters()->withPivot('invitee_reference')->first();
$companyModule = $list->owner->companyModule;
$segment = $companyModule->connections()->first()->segments()->where('name', 'Credit Term Customer')->first();
if ($segment) {
$isCreditTermCustomer = true;
}
if ($inviterPivotInviteeReference) {
$marking = $inviterPivotInviteeReference->pivot->invitee_reference;
@@ -87,6 +95,7 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
$invDate,
$days,
$amt,
$isCreditTermCustomer ? 'TRUE' : 'FALSE',
];
}
@@ -52,7 +52,8 @@ class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping,
])
->where('type', '=', 1)
->where('status', '=', 2)
->where('owner_type', Order::class);
->where('owner_type', Order::class)
->whereBetween('created_at', [Carbon::now()->subMonths(12), Carbon::now()]); //Limit, 'expensive' query
if (!is_null($this->start_date) && !is_null($this->end_date)) {
$query->whereHas('transports', function ($q) {
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\CompanyModule;
use Carbon\Carbon;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
@@ -29,7 +30,7 @@ class ExportsCustomersOrderLatestDate implements FromQuery, WithHeadingRow, With
*/
public function query()
{
return CompanyModule::where('type', '=', 1);
return CompanyModule::where('type', '=', 1)->whereBetween('created_at', [Carbon::now()->subMonths(12), Carbon::now()]); //Limit, 'expensive' query;
}
/**
@@ -57,4 +58,4 @@ class ExportsCustomersOrderLatestDate implements FromQuery, WithHeadingRow, With
$order ? $order->drop_date : ''
];
}
}
}
@@ -0,0 +1,108 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Group;
use App\Models\Transaction;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Illuminate\Http\Request;
use Carbon\Carbon;
class ExportsGroupTransactions implements
FromQuery,
WithHeadings,
WithHeadingRow,
WithMapping,
ShouldAutoSize
{
use Exportable;
private $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function headings(): array
{
return [
'DocNo',
'DocDate',
'PaymentDate',
'DebtorCode',
'Ref',
'ShipInfo',
'AccNo',
'DetailDescription',
'FurtherDescription',
'ProjNo',
'DeptNo',
'Qty',
'UnitPrice',
'TaxType',
'TaxableAmt',
'TaxRate'
];
}
public function query()
{
$start_date = $this->parseDate($this->request->input('startDate'));
$end_date = $this->parseDate($this->request->input('endDate'));
return Group::when($start_date && $end_date, function ($query) use ($start_date, $end_date) {
$query->whereBetween('created_at', [
$start_date->startOfDay(),
$end_date->endOfDay()
]);
})
->when($start_date && !$end_date, function ($query) use ($start_date) {
$query->where('created_at', '>=', $start_date->startOfDay());
})
->when(!$start_date && $end_date, function ($query) use ($end_date) {
$query->where('created_at', '<=', $end_date->endOfDay());
});
}
private function parseDate($date)
{
return $date ? Carbon::parse($date)->startOfDay() : null;
}
public function map($transaction): array
{
$company = $transaction->receiverCompany;
return [
'<<New>>', //'DocNo',
'', //'DocDate',
$transaction->created_at->format('m/d/Y H:m'), //'PaymentDate',
$company->debtor, //'DebtorCode',
$company->referece, //'Ref',
$company->referece, //'ShipInfo',
'500-0000', //'AccNo',
'X1 Freight Service Charge', //'DetailDescription',
'FurtherDescription', //'FurtherDescription',
'M3', //'ProjNo',
'CIEF', //'DeptNo',
'', //'Qty',
'', //'UnitPrice',
'', //'TaxType',
floatval($transaction->tax) > 0 ? number_format($transaction->tax, 2) : '0.00', //'TaxableAmt',
'', //'TaxRate'
];
}
private function getTaxType($tax_percentage)
{
return floatval($tax_percentage) > 0 ? 'SV-6' : '';
}
}
@@ -156,7 +156,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$detail->quantity,
$detail->price,
floatval($detail->tax_percentage) > 0 ? 'SV-6' : '',
floatval($detail->tax_percentage) > 0 ? $detail->amount : '0',
floatval($detail->tax_percentage) > 0 ? number_format($detail->amount, 2) : '0.00',
$detail->tax_percentage,
];
@@ -46,7 +46,8 @@ class ContainersSheet implements WithHeadings, WithHeadingRow, WithMapping, Shou
*/
public function query()
{
return Container::query();
return Container::query()
->whereBetween('created_at', [Carbon::now()->subMonths(3), Carbon::now()]); //Limit, 'expensive' query
}
/**
@@ -102,4 +103,4 @@ class ContainersSheet implements WithHeadings, WithHeadingRow, WithMapping, Shou
{
return 'Containers';
}
}
}
@@ -13,6 +13,7 @@ use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\Order;
use App\Models\PackingList;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromCollection;
@@ -52,7 +53,10 @@ class PackingListsSheet implements WithHeadings, WithHeadingRow, WithMapping, Sh
*/
public function collection()
{
$packingLists = PackingList::where('status', '=', 2)->whereIn('type', [PackingListType::WAREHOUSE_RECEIVE_LIST, PackingListType::SHIPPING_PACKING_LIST])->get();
$packingLists = PackingList::where('status', '=', 2)
->whereIn('type', [PackingListType::WAREHOUSE_RECEIVE_LIST, PackingListType::SHIPPING_PACKING_LIST])
->whereBetween('created_at', [Carbon::now()->subMonths(3), Carbon::now()]) //Limit, 'expensive' query
->get();
return $packingLists->filter(function ($packingList) {
@@ -128,4 +132,4 @@ class PackingListsSheet implements WithHeadings, WithHeadingRow, WithMapping, Sh
{
return 'Packing Lists';
}
}
}
@@ -0,0 +1,79 @@
<?php
namespace App\Classes\Modules\Jobs\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Jobs\MonthlyReportJob;
use App\Classes\Modules\Jobs\DataTransferObjects\JobSubmissionObject;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Classes\Modules\Jobs\Services\CreatesJobResult;
class SubmitJobLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Job Submission',
'message' => 'You have successfully submit a job for processing'
];
}
/** @var CreatesJobResult */
private $createsJobResult;
/**
* SubmitJobLogic constructor.
* @param CreatesJobResult $createsJobResult
*/
public function __construct(CreatesJobResult $createsJobResult)
{
$this->createsJobResult = $createsJobResult;
}
/**
* @param Request $request
* @return JsonResponse
*/
public function logic(Request $request) : JsonResponse
{
$jobId = uniqid();
$user = Auth::user();
$userInfo = (object) [
// 'email' => $user->email,
'type' => $user->type,
];
$userInfoJson = json_encode($userInfo);
$requestSignature = md5($userInfoJson . $request->fullUrl());
$jobSubmissionObject = new JobSubmissionObject(
$request->fullUrl(),
$request->all(),
$requestSignature,
null,
$jobId,
$userInfo
);
MonthlyReportJob::dispatch($jobSubmissionObject)->onQueue(env('SQS_QUEUENAME_PREFIX', '').'high_priority');
$result = [];
$result['job_id'] = $jobId;
$this->createsJobResult->execute($jobSubmissionObject);
return $this->response(['data' => $result]);
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Classes\Modules\Jobs\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
class FixInvoiceV2CommandObject implements DataTransferObject
{
/** @var string */
private $marking;
public function __construct(string $marking)
{
$this->marking = $marking;
}
/**
* @return string
*/
public function getMarking(): string
{
return $this->marking;
}
}
@@ -4,7 +4,7 @@ namespace App\Classes\Modules\Jobs\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
class ListGenericJobObject implements DataTransferObject
class JobSubmissionObject implements DataTransferObject
{
/** @var string */
private $name;
@@ -0,0 +1,26 @@
<?php
namespace App\Classes\Modules\Jobs\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
class ShowBillplzPaymentStatusV2CommandObject implements DataTransferObject
{
/** @var string */
private $billplzId;
public function __construct(string $billplzId)
{
$this->billplzId = $billplzId;
}
/**
* @return string
*/
public function getBillplzId(): string
{
return $this->billplzId;
}
}
@@ -6,7 +6,7 @@ namespace App\Classes\Modules\Jobs\Processors;
use App\Classes\Modules\Jobs\Services\UpdatesJobResult;
use App\Classes\Modules\Jobs\Services\FetchesJobResult;
use App\Classes\Exceptions\JobResourceNotFoundException;
use App\Classes\Modules\Jobs\DataTransferObjects\ListGenericJobObject;
use App\Classes\Modules\Jobs\DataTransferObjects\JobSubmissionObject;
use App\Classes\Modules\Jobs\DataTransferObjects\UpdateJobResultObject;
class UpdateJobResultProcessor
@@ -30,14 +30,14 @@ class UpdateJobResultProcessor
}
/**
* @param ListGenericJobObject $listGenericJobObject
* @param JobSubmissionObject $jobSubmissionObject
* @param array $resultCurrent
* @return void
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\JobResourceNotFoundException
*/
public function execute(ListGenericJobObject $listGenericJobObject, $resultCurrent) {
$jobResultCurrent = $this->fetchesJobResult->execute(['job_id' => $listGenericJobObject->getJobId()]);
public function execute(JobSubmissionObject $jobSubmissionObject, $resultCurrent) {
$jobResultCurrent = $this->fetchesJobResult->execute(['job_id' => $jobSubmissionObject->getJobId()]);
$resultCurrentJson = json_encode($resultCurrent);
$resultSignatureCurrent = md5($resultCurrentJson);
@@ -45,10 +45,10 @@ class UpdateJobResultProcessor
$jobResultExisting = $this->fetchesJobResult->execute(['request_signature' => $jobResultCurrent->request_signature, 'result_not_null' => true, 'order_by_id_desc' => true]);
$resultSignatureExisting = $jobResultExisting->result_signature;
//if($resultSignatureExisting != $resultSignatureCurrent){
$this->updateJobResult($jobResultCurrent, $resultCurrentJson, $resultSignatureCurrent, $listGenericJobObject->getJobCommandName(), $listGenericJobObject->getJobCommand());
$this->updateJobResult($jobResultCurrent, $resultCurrentJson, $resultSignatureCurrent, $jobSubmissionObject->getJobCommandName(), $jobSubmissionObject->getJobCommand());
//}
} catch (JobResourceNotFoundException $exception){
$this->updateJobResult($jobResultCurrent, $resultCurrentJson, $resultSignatureCurrent, $listGenericJobObject->getJobCommandName(), $listGenericJobObject->getJobCommand());
$this->updateJobResult($jobResultCurrent, $resultCurrentJson, $resultSignatureCurrent, $jobSubmissionObject->getJobCommandName(), $jobSubmissionObject->getJobCommand());
}
}
@@ -4,22 +4,22 @@ namespace App\Classes\Modules\Jobs\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Models\JobResult;
use App\Classes\Modules\Jobs\DataTransferObjects\ListGenericJobObject;
use App\Classes\Modules\Jobs\DataTransferObjects\JobSubmissionObject;
class CreatesJobResult extends AbstractUpdateRecord
{
/**
* @param ListGenericJobObject $listGenericJobObject
* @param JobSubmissionObject $jobSubmissionObject
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(ListGenericJobObject $listGenericJobObject)
public function execute(JobSubmissionObject $jobSubmissionObject)
{
$model = new JobResult();
$model->job_id = $listGenericJobObject->getJobId();
$model->request_signature = $listGenericJobObject->getRequestSignature();
$model->result_signature = $listGenericJobObject->getResultSignature();
$model->url = $listGenericJobObject->getName();
$model->job_id = $jobSubmissionObject->getJobId();
$model->request_signature = $jobSubmissionObject->getRequestSignature();
$model->result_signature = $jobSubmissionObject->getResultSignature();
$model->url = $jobSubmissionObject->getName();
return $this->handler($model);
}
@@ -0,0 +1,77 @@
<?php
namespace App\Classes\Modules\Orders\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\Orders\Standards\Rules\CanFetchOrder;
use App\Http\Resources\OrderPackagesBaseResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchOrderPackagesLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Order Packages',
'message' => 'You have successfully retrieved an order packages'
];
}
/** @var CanFetchOrder */
private $canFetchOrder;
/** @var FetchesOrder */
private $fetchesOrder;
/**
* FetchOrderPackagesLogic constructor.
* @param CanFetchOrder $canFetchOrder
* @param FetchesOrder $fetchesOrder
*/
public function __construct(CanFetchOrder $canFetchOrder, FetchesOrder $fetchesOrder)
{
$this->canFetchOrder = $canFetchOrder;
$this->fetchesOrder = $fetchesOrder;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request) : JsonResponse
{
$this->canFetchOrder->passes();
$query = $this->fetchesOrder->execute(['reference' => $request->route('id'), 'with_packing_lists' => true]);
$filters = json_decode($request->input('filters'), true);
if(isset($filters['include_packages_origin_warehouse'])){
$query->include_packages_origin_warehouse = $filters['include_packages_origin_warehouse'];
}
if(isset($filters['include_packages_in_transit'])){
$query->include_packages_in_transit = $filters['include_packages_in_transit'];
}
if(isset($filters['include_packages_destination_warehouse'])){
$query->include_packages_destination_warehouse = $filters['include_packages_destination_warehouse'];
}
if(isset($filters['include_packages_delivery'])){
$query->include_packages_delivery = $filters['include_packages_delivery'];
}
if(isset($filters['include_packages_received'])){
$query->include_packages_received = $filters['include_packages_received'];
}
return $this->resourceResponse(new OrderPackagesBaseResource($query));
}
}
@@ -7,10 +7,12 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Orders\Services\ListsOrders;
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
use App\Classes\ValueObjects\Constants\OrderType;
use App\Http\Resources\OrderBaseResource;
use App\Http\Resources\OrderV2Resource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class ListOrdersV2Logic extends AbstractControllerLogic
{
@@ -47,8 +49,23 @@ class ListOrdersV2Logic extends AbstractControllerLogic
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::SHARED_CONTAINER, OrderType::DEDICATED_CONTAINER]]));
return $this->collectionResponse(OrderV2Resource::collection($query));
$filters = json_decode($request->input('filters'), true);
//cief todo: to be reviewed
foreach ($query->items() as $item) {
if(isset($filters['include_invoices'])){
$item['include_invoices'] = $filters['include_invoices'];
}
if(isset($filters['include_parcels'])){
$item['include_parcels'] = $filters['include_parcels'];
}
}
return $this->collectionResponse(OrderBaseResource::collection($query));
//return $this->collectionResponse(OrderV2Resource::collection($query));
}
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Orders\Processors;
use App\Classes\Exceptions\InternalServerErrorException;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\General\LogHelper;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\Addresses\Services\FetchesAddress;
@@ -38,7 +39,7 @@ class UpdateDoFromYDPortalProcessor
*/
public function execute(PackingList $packingList) {
Log::info('Trying to Call UpdateDoFromYDPortalProcessor');
Log::channel('storage_invoices')->info('UpdateDoFromYDPortalProcessor: '.json_encode($packingList));
LogHelper::channel('storage_invoices')->info('UpdateDoFromYDPortalProcessor: '.json_encode($packingList));
if(!app()->environment(['production'])){
return;
@@ -6,7 +6,7 @@ namespace App\Classes\Modules\PackingLists\ControllersLogic\Containers;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
use App\Classes\Modules\PackingLists\Standards\Rules\Containers\CanFetchContainer;
use App\Http\Resources\ContainerResource;
use App\Http\Resources\ContainerBaseResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -54,7 +54,7 @@ class FetchContainerLogic extends AbstractControllerLogic
$query = $this->fetchesContainer->execute(['id' => $request->route('id'), 'with_packing_lists' => true]);
return $this->resourceResponse(new ContainerResource($query));
return $this->resourceResponse(new ContainerBaseResource($query));
}
@@ -4,8 +4,9 @@
namespace App\Classes\Modules\PackingLists\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\General\Helper;
use App\Classes\Jobs\ListPackingListsJob;
use App\Classes\Modules\Jobs\DataTransferObjects\ListGenericJobObject;
use App\Classes\Modules\Jobs\DataTransferObjects\JobSubmissionObject;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
@@ -55,7 +56,7 @@ class ListPackingListsJobLogic extends AbstractControllerLogic
$requestSignature = md5($userInfoJson . $request->fullUrl());
$listGenericJobObject = new ListGenericJobObject(
$jobSubmissionObject = new JobSubmissionObject(
$request->fullUrl(),
$request->all(),
$requestSignature,
@@ -64,13 +65,13 @@ class ListPackingListsJobLogic extends AbstractControllerLogic
$userInfo
);
ListPackingListsJob::dispatch($listGenericJobObject)->onQueue('high_priority');
ListPackingListsJob::dispatch($jobSubmissionObject)->onQueue(env('SQS_QUEUENAME_PREFIX', '').'high_priority');
$result = [];
$result['job_id'] = $jobId;
$this->createsJobResult->execute($listGenericJobObject);
$this->createsJobResult->execute($jobSubmissionObject);
return $this->response(['data' => $result]);
}
@@ -6,11 +6,12 @@ namespace App\Classes\Modules\PackingLists\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PackingLists\Services\ListsPackingLists;
use App\Classes\Modules\PackingLists\Standards\Rules\CanListPackingLists;
use App\Http\Resources\PackingListBaseResource;
use App\Http\Resources\PackingListResource;
use App\Http\Resources\PackingListWithStorageResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class ListPackingListsLogic extends AbstractControllerLogic
{
@@ -54,14 +55,54 @@ class ListPackingListsLogic extends AbstractControllerLogic
$query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters')));
if($request->input('storages')){
foreach ($query->items() as $item) {
$data = json_encode($request->input('storages'));
Log::info("ListPackingListsLogic storages A");
// if($request->input('storages')){
// Log::info("ListPackingListsLogic storages B");
// foreach ($query->items() as $item) {
// $item['storages'] = $request->input('storages');
// }
// return $this->collectionResponse(PackingListWithStorageResource::collection($query));
// }
$filters = json_decode($request->input('filters'), true);
$useNew = false;
foreach ($query->items() as $item) {
//from middleware
if($request->input('storages')){
$item['storages'] = $request->input('storages');
}
return $this->collectionResponse(PackingListWithStorageResource::collection($query));
//from front end component
if(isset($filters['include_packages'])){
//'include_packages' filter is an attempt to reduce the request-response time to only load basic information unless explicitly indicated to be included
$item['include_packages'] = $filters['include_packages'];
$useNew = true;
}
if(isset($filters['include_receive_packing_list'])){
//'include_receive_packing_list' filter is an attempt to reduce the request-response time to only load basic information unless explicitly indicated to be included
$item['include_receive_packing_list'] = $filters['include_receive_packing_list'];
$useNew = true;
}
if(isset($filters['include_shipping_transaction'])){
$item['include_shipping_transaction'] = $filters['include_shipping_transaction'];
$useNew = true;
}
if(isset($filters['include_suspended_invoice'])){
$item['include_suspended_invoice'] = $filters['include_suspended_invoice'];
$useNew = true;
}
}
else{
return $this->collectionResponse(PackingListResource::collection($query));
if($useNew){
return $this->collectionResponse(PackingListBaseResource::collection($query));
}
//Fallback
return $this->collectionResponse(PackingListResource::collection($query));
}
}
@@ -6,11 +6,12 @@ namespace App\Classes\Modules\PackingLists\Processors;
use App\Classes\Modules\PackingLists\Services\ListsPackingLists;
use App\Classes\Modules\Jobs\Processors\UpdateJobResultProcessor;
use App\Classes\General\Helper;
use App\Classes\Modules\Jobs\DataTransferObjects\ListGenericJobObject;
use App\Classes\Modules\Jobs\DataTransferObjects\JobSubmissionObject;
use App\Http\Middleware\CheckForStorageInvoiceByPackingLists;
use App\Http\Resources\ListPackingListJobResource;
use App\Http\Resources\ListPackingListDetailsJobResource;
use App\Http\Resources\ListPackingListJobWithStorageResource;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Log;
class ListPackingListsJobProcessor
@@ -38,24 +39,31 @@ class ListPackingListsJobProcessor
}
/**
* @param ListGenericJobObject $listGenericJobObject
* @param JobSubmissionObject $jobSubmissionObject
* @return void
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\JobResourceNotFoundException
*/
public function execute(ListGenericJobObject $listGenericJobObject) {
// $query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page'], 'with_containers_packages' => true]);
$query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page']]);
// $query = $this->listsPackingLists->execute(array_merge($this->listsPackingLists->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page'], 'with_containers_packages' => true]));
public function execute(JobSubmissionObject $jobSubmissionObject) {
//$query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($jobSubmissionObject->getPayload()['filters']), ['page' => $jobSubmissionObject->getPayload()['page'], 'with_containers_packages' => true]);
//$query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($jobSubmissionObject->getPayload()['filters']), ['page' => (int)$jobSubmissionObject->getPayload()['page']]);
//$query = $this->listsPackingLists->execute(array_merge($this->listsPackingLists->deserializeFilters($jobSubmissionObject->getPayload()['filters']), ['page' => $jobSubmissionObject->getPayload()['page'], 'with_containers_packages' => true]));
$filtersArray = json_decode($listGenericJobObject->getPayload()['filters'], true);
$query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($jobSubmissionObject->getPayload()['filters']));
$page = (int)$jobSubmissionObject->getPayload()['page'];
Paginator::currentPageResolver(function () use ($page) {
return $page;
});
$filtersArray = json_decode($jobSubmissionObject->getPayload()['filters'], true);
$storages = [];
if(isset($filtersArray['check_for_storage_invoice']))
{
$myRequest = new \Illuminate\Http\Request();
$myRequest->setMethod('POST');
$myRequest->request->add($listGenericJobObject->getPayload());
$myRequest->request->add($jobSubmissionObject->getPayload());
$next = function ($request) {
return $request;
};
@@ -65,22 +73,22 @@ class ListPackingListsJobProcessor
}
foreach ($query->items() as &$item) {
$item['userInfo'] = $listGenericJobObject->getUserInfo();
$item['userInfo'] = $jobSubmissionObject->getUserInfo();
$item['storages'] = $storages;
}
if(isset($filtersArray['does_not_have_transaction_type'])){ //For Payment and Billing page > Pending Invoice tab
$resultCurrent = Helper::collectionResponse(ListPackingListDetailsJobResource::collection($query));
$this->updateJobResultProcessor->execute($listGenericJobObject, $resultCurrent);
$this->updateJobResultProcessor->execute($jobSubmissionObject, $resultCurrent);
}
else{
if($storages){ //For Payment and Billing page > Pending Payment tab, Paid Invoice tab
$resultCurrent = Helper::collectionResponse(ListPackingListJobWithStorageResource::collection($query));
$this->updateJobResultProcessor->execute($listGenericJobObject, $resultCurrent);
$this->updateJobResultProcessor->execute($jobSubmissionObject, $resultCurrent);
}
else{
$resultCurrent = Helper::collectionResponse(ListPackingListJobResource::collection($query));
$this->updateJobResultProcessor->execute($listGenericJobObject, $resultCurrent);
$this->updateJobResultProcessor->execute($jobSubmissionObject, $resultCurrent);
}
}
}
@@ -0,0 +1,175 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
// use App\Classes\Modules\Steps\Services\CreatesStep;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
// use App\Classes\Modules\Transports\Services\CreatesTransport;
// use App\Classes\Modules\Unity\Processors\ActivateContractProcessor;
// use App\Classes\Modules\Unity\Processors\AssignContractEntityProcessor;
// use App\Classes\Modules\Unity\Processors\CreateContractEntityProcessor;
// use App\Classes\Modules\Unity\Services\CreatesContract;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\Order;
use App\Models\PackingList;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class TestFetchPackingListsFromYdPortalProcessor
{
/** @var FetchesDataFromYDPortal */
private $fetchesDataFRomYDPortal;
/** @var FetchesOrder */
private $fetchesOrder;
// /** @var CreatePackingListProcessor */
// private $createPackingListProcessor;
// /** @var CreatePackageProcessor */
// private $createPackageProcessor;
// /** @var CreatesTransport */
// private $createsTransport;
/** @var FetchesPackingList */
private $fetchesPackingList;
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
// /** @var CreatesContract */
// private $unityCreateContract;
// /** @var AssignContractEntityProcessor */
// private $unityAssignContractEntity;
// /** @var CreateContractEntityProcessor */
// private $unityCreateContractEntity;
// /** @var CreatesStep */
// private $createsStep;
// /** @var ActivateContractProcessor */
// private $unityActivateContract;
/**
* @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal
* @param FetchesOrder $fetchesOrder
* @param CreatePackingListProcessor $createPackingListProcessor
* @param CreatePackageProcessor $createPackageProcessor
* @param CreatesTransport $createsTransport
* @param FetchesPackingList $fetchesPackingList
* @param FetchesCompanyModule $fetchesCompanyModule
* @param CreatesContract $unityCreateContract
* @param AssignContractEntityProcessor $unityAssignContractEntity
* @param CreateContractEntityProcessor $unityCreateContractEntity
* @param CreatesStep $createsStep
* @param ActivateContractProcessor $unityActivateContract
*/
public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, FetchesOrder $fetchesOrder, FetchesPackingList $fetchesPackingList, FetchesCompanyModule $fetchesCompanyModule)
{
$this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal;
$this->fetchesOrder = $fetchesOrder;
// $this->createPackingListProcessor = $createPackingListProcessor;
// $this->createPackageProcessor = $createPackageProcessor;
// $this->createsTransport = $createsTransport;
$this->fetchesPackingList = $fetchesPackingList;
$this->fetchesCompanyModule = $fetchesCompanyModule;
// $this->unityCreateContract = $unityCreateContract;
// $this->unityAssignContractEntity = $unityAssignContractEntity;
// $this->unityCreateContractEntity = $unityCreateContractEntity;
// $this->createsStep = $createsStep;
// $this->unityActivateContract = $unityActivateContract;
}
/**
* @param Carbon|null $start
* @param Carbon|null $end
* @return void
* @throws GuzzleException
*/
public function execute(?Carbon $start = null, ?Carbon $end = null)
{
$from = $end ? Carbon::today()->diff($end)->days : 0;
$to = $start ? Carbon::today()->diff($start)->days : 10;
for ($x = $from; $x <= $to; $x++) {
try {
$startDate = Carbon::today()->subDays($x);
$startLimit = Carbon::parse('01-12-2021');
if($startDate->isBefore($startLimit)){
$startDate = $startLimit;
}
$endDate = Carbon::today()->subDays($x - 1);
$orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [
'begintime' => $startDate->timestamp,
'endtime' => $endDate->timestamp,
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
if(!$rows->data) continue;
foreach($rows->data as $row){
if(!is_numeric($row->goodcount)) continue;
$time_start = microtime(true);
Log::info('[YD] row: ' . json_encode($row));
$receiveDate = Carbon::parse(substr(preg_replace("/[^0-9]/", "", $row->expressno), 0, 8));
Log::info('[YD] receiveDate: ' . $receiveDate);
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
Log::info('[YD] receiveDate: ' . $receiveDate);
$orderNumber = $customerno[array_key_last($customerno)];
Log::info('[YD] orderNumber: ' . $orderNumber);
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
Log::info('[YD] fetchesOrder 1: ' . $order);
} catch (ResourceNotFoundException $exception) {
try {
$order = $this->fetchesOrder->execute(['reference' => substr($orderNumber, -9)]);
Log::info('[YD] fetchesOrder 2: ' . $order);
} catch (ResourceNotFoundException $exception) {
$order = $this->fetchesCompanyModule->execute(['id' => 1]);
Log::info('[YD] fetchesCompanyModule 1: ' . $order);
}
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start)/60;
echo 'successful => <b>Total Execution Time:</b> '.$execution_time.' Mins<br>';
}
} catch (\Exception $exception) {
Log::debug($exception);
}
}
}
}
@@ -0,0 +1,172 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors\V2;
use App\Classes\Exceptions\AccessForbiddenException;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\RequestValidationException;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\PackingLists\Processors\CreateContainerProcessor;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
use App\Classes\Modules\Steps\Services\CreatesStep;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\Modules\Unity\Processors\ActivateContractProcessor;
use App\Classes\Modules\Unity\Processors\AssignContractEntityProcessor;
use App\Classes\Modules\Unity\Processors\CreateContractEntityProcessor;
use App\Classes\Modules\Unity\Services\CreatesContract;
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
use App\Classes\Modules\PerfexCRM\Processors\PackingListToPerfexCRMProcessor;
use App\Classes\Notifications\ShipmentDepartureEmail;
use App\Classes\Notifications\ShipmentRescheduleEmail;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Classes\ValueObjects\Constants\WarehouseReferences;
use App\Classes\ValueObjects\Constants\PerfexCRMTasksYDStages;
use App\Models\Container;
use App\Models\Order;
use App\Models\PackingList;
use App\Models\Transport;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class FetchContainersFromYdPortalV2Processor
{
/** @var FetchesDataFromYDPortal */
private $fetchesDataFRomYDPortal;
/** @var CreatesTransport */
private $createsTransport;
/** @var CreatesSchedule */
private $createsSchedule;
/** @var FetchesContainer */
private $fetchesContainer;
/** @var CreateContainerProcessor */
private $createContainerProcessor;
/** @var PackingListToPerfexCRMProcessor */
private $packingListToPerfexCRMProcessor;
/**
* @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
* @param FetchesContainer $fetchesContainer
* @param CreateContainerProcessor $createContainerProcessor
* @param PackingListToPerfexCRMProcessor $packingListToPerfexCRMProcessor
*/
public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule, FetchesContainer $fetchesContainer, CreateContainerProcessor $createContainerProcessor, PackingListToPerfexCRMProcessor $packingListToPerfexCRMProcessor)
{
$this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal;
$this->createsTransport = $createsTransport;
$this->createsSchedule = $createsSchedule;
$this->fetchesContainer = $fetchesContainer;
$this->createContainerProcessor = $createContainerProcessor;
$this->packingListToPerfexCRMProcessor = $packingListToPerfexCRMProcessor;
}
/**
* @param PackingList $packingList
* @return void
* @throws MalformedRequestException
* @throws AccessForbiddenException
* @throws RequestValidationException
*/
public function execute(PackingList $packingList)
{
Log::info('FetchContainersFromYdPortalV2Processor starts with packingList id '. $packingList->id);
// return;
$time_start = microtime(true);
$containerReference = null;
$loadingDate = null;
$etd = null;
$eta = null;
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
'trakingno' => $packingList->reference
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
if(!$rows->data){
return;
}
foreach (array_reverse($rows->data) as $trackingRow) {
if (strpos($trackingRow->tracking, '货物装柜完成。') !== false) {
$tracking = explode(':', $trackingRow->tracking);
$containerReference = explode('预计到港时间', $tracking[1])[0];
$loadingDate = Carbon::parse($trackingRow->trackingtime);
$etd = Carbon::parse($tracking[2])->subDays(5);
$eta = Carbon::parse($tracking[2]);
}
}
if($containerReference) {
try {
$container = $this->fetchesContainer->execute(['reference' => $containerReference]);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
} catch (ResourceNotFoundException $exception){
if(!($packingList->owner instanceof Order)) return;
$originWarehouse = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee;
$containerObject = new ContainerObject($containerReference, '', '', ContainerTypes::FORTY_FEET_DRY_CONTAINER, $loadingDate, ApprovalStatus::PENDING_VERIFICATION);
/** @var Container $container */
$container = $this->createContainerProcessor->execute($containerObject, $originWarehouse);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
if(config('perfexcrm.is_enabled') == 'true'){
$this->packingListToPerfexCRMProcessor->execute($packingList, PerfexCRMTasksYDStages::LOAD_CONTAINER);
}
$transport = $container->transports()->first();
if(!$transport){
$transportObject = new TransportObject(TransportType::SEA, null, null, $etd, null, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $container);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $eta, ApprovalStatus::APPROVED));
}
}
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start)/60;
echo 'successful => <b>Total Execution Time:</b> '.$execution_time.' Mins<br>';
Log::info('FetchContainersFromYdPortalV2Processor ends with packingList id '. $packingList->id . ' => Total Execution Time: '.$execution_time.' Mins.');
}
}
@@ -0,0 +1,201 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors\V2;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
use App\Classes\Modules\PerfexCRM\Processors\PackingListToPerfexCRMProcessor;
use App\Classes\Notifications\ShipmentRescheduleEmail;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PerfexCRMTasksYDStages;
use App\Models\Container;
use App\Models\Order;
use App\Models\PackingList;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
class FetchContainersUpdatesFromYdPortalV2Processor
{
/** @var FetchesDataFromYDPortal */
private $fetchesDataFRomYDPortal;
/** @var UpdatesContractObligation */
private $updatesContractObligations;
/** @var CreatesSchedule */
private $createsSchedule;
/** @var PackingListToPerfexCRMProcessor */
private $packingListToPerfexCRMProcessor;
/**
* @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal
* @param UpdatesContractObligation $updatesContractObligations
* @param CreatesSchedule $createsSchedule
* @param PackingListToPerfexCRMProcessor $packingListToPerfexCRMProcessor
*/
public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, UpdatesContractObligation $updatesContractObligations, CreatesSchedule $createsSchedule, PackingListToPerfexCRMProcessor $packingListToPerfexCRMProcessor)
{
$this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal;
$this->updatesContractObligations = $updatesContractObligations;
$this->createsSchedule = $createsSchedule;
$this->packingListToPerfexCRMProcessor = $packingListToPerfexCRMProcessor;
}
/**
* @param Container $container
* @return void
* @throws MalformedRequestException
*/
public function execute(Container $container)
{
Log::info('FetchContainersUpdatesFromYdPortalV2Processor starts with container id ' . $container->id);
// return;
$time_start = microtime(true);
$packingList = $container->packingLists()->first();
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
'trakingno' => $packingList->reference
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
if(!$rows->data){
return;
}
$unstuffingDate = null;
$delayDate = null;
$checkShipSailDate = null;
$checkShipArrivalDate = null;
foreach (array_reverse($rows->data) as $trackingRow) {
$rescheduleETD = strpos($trackingRow->remark, '开') || strpos($trackingRow->remark, '到港');
$rescheduleETA = strpos($trackingRow->remark, '到港');
if (($rescheduleETD !== false || $rescheduleETA !== false) && strpos($trackingRow->tracking, '货物装柜完成。') === false) {
preg_match_all('/([0-9]+.{3})/', $trackingRow->remark, $matches);
$dates = collect();
foreach($matches[0] as $date){
try {
$dates->push(Carbon::parse(str_replace('.', '/', $date).Carbon::now()->format('Y')));
} catch (\Exception $exception) {
continue;
}
}
$rescheduleDate = $dates->sortDesc()->first();
if(!$delayDate || $rescheduleDate > $delayDate){
/** @var Carbon $delayDate */
$delayDate = $rescheduleDate;
if($rescheduleETA === false && $delayDate) {
$delayDate = $delayDate->addDays('5');
}
}
}
if ($trackingRow->tracking === '到港') {
$delayDate = Carbon::parse($trackingRow->trackingtime);
$checkShipArrivalDate = Carbon::parse($trackingRow->trackingtime);
}
if ($trackingRow->tracking === '已开船') {
$delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
$checkShipSailDate = Carbon::parse($trackingRow->trackingtime);
}
if ($trackingRow->tracking === '货物已进目的港仓库') {
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
}
dump($delayDate, $unstuffingDate);
if($checkShipSailDate){
//check if ship has sailed
if($checkShipSailDate->isPast()){
foreach ($container->packingLists as $packingList){
if(config('perfexcrm.is_enabled') == 'true'){
$this->packingListToPerfexCRMProcessor->execute($packingList, PerfexCRMTasksYDStages::SHIP_SAILED);
}
}
}
}
if($checkShipArrivalDate){
//check if ship has arrived at destination
if($checkShipArrivalDate->isPast()){
foreach ($container->packingLists as $packingList){
if(config('perfexcrm.is_enabled') == 'true'){
$this->packingListToPerfexCRMProcessor->execute($packingList, PerfexCRMTasksYDStages::SHIP_ARRIVED);
}
}
}
}
if($delayDate){
$transport = $container->transports()->first();
if(!$transport->schedules()->whereDate('eta', '>=', $delayDate)->first()) {
$etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd;
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED));
foreach ($container->packingLists as $packingList){
if(!($packingList->owner instanceof Order)) continue;
$user = $packingList->owner->companyModule->employees()->first();
if(app()->environment(['production'])) {
$user->notify(new ShipmentRescheduleEmail($user, $packingList));
}
}
}
}
if($unstuffingDate){
$container->update(['status' => ApprovalStatus::COMPLETED]);
$container->transports()->first()->update(['drop_date' => $unstuffingDate, 'status' => ApprovalStatus::COMPLETED]);
/** @var PackingList $packingList */
foreach($container->packingLists as $packingList){
if($packingList->status === ApprovalStatus::PENDING_VERIFICATION){
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
}
if(!($packingList->owner instanceof Order)) continue;
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
foreach($packingList->steps()->where('reference', '!=', 'DELIVERY')->get() as $step){
$this->updatesContractObligations->execute($signature, $step->obligation_hash_id);
$step->update(['status' => ApprovalStatus::COMPLETED]);
}
if(config('perfexcrm.is_enabled') == 'true'){
$this->packingListToPerfexCRMProcessor->execute($packingList, PerfexCRMTasksYDStages::UNSTUFFING);
}
}
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start)/60;
echo 'successful => <b>Total Execution Time:</b> '.$execution_time.' Mins<br>';
Log::info('FetchContainersUpdatesFromYdPortalV2Processor ends with container id ' . $container->id . ' => Total Execution Time: '.$execution_time.' Mins.');
}
}
@@ -0,0 +1,121 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors\V2;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
use App\Classes\Modules\PerfexCRM\Processors\PackingListToPerfexCRMProcessor;
use App\Classes\ValueObjects\Constants\PerfexCRMTasksYDStages;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Classes\ValueObjects\Constants\WarehouseReferences;
use App\Models\CompanyModule;
use App\Models\Order;
use App\Models\PackingList;
use App\Models\Transport;
use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class FetchDeliveryUpdatesFromYdPortalV2Processor
{
/** @var UpdatesContractObligation */
private $updatesContractObligations;
/** @var CreatesTransport */
private $createsTransport;
/** @var CreatesSchedule */
private $createsSchedule;
/** @var PackingListToPerfexCRMProcessor */
private $packingListToPerfexCRMProcessor;
/**
* @param UpdatesContractObligation $updatesContractObligations
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
* @param PackingListToPerfexCRMProcessor $packingListToPerfexCRMProcessor
*/
public function __construct(UpdatesContractObligation $updatesContractObligations, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule, PackingListToPerfexCRMProcessor $packingListToPerfexCRMProcessor)
{
$this->updatesContractObligations = $updatesContractObligations;
$this->createsTransport = $createsTransport;
$this->createsSchedule = $createsSchedule;
$this->packingListToPerfexCRMProcessor = $packingListToPerfexCRMProcessor;
}
/**
* @param int $packingListId
* @return void
* @throws MalformedRequestException
* @throws GuzzleException
*/
public function execute(int $packingListId)
{
$packingList = PackingList::where('id', $packingListId)->first();
Log::info('FetchDeliveryUpdatesFromYdPortalV2Processor starts with packingList id ' . json_encode($packingList) );
// return;
if(!$packingList->reference) return;
$time_start = microtime(true);
$deliveryDate = null;
try {
$client = new \GuzzleHttp\Client(['cookies' => true, 'headers' => ['Cookie' => 'utc_offset=480']]);
$request = $client->request('get', 'https://main.universe.com.my/Tracking/User/Paging?sEcho=1&sTrackingNo='.$packingList->reference.'&sOrgId=sti', ['timeout' => 3]);
$deliveryTracking = json_decode($request->getBody()->getContents());
foreach (array_reverse($deliveryTracking->aaData) as $trackingRow) {
$trackingDate = Carbon::createFromFormat('d/m/y H:i', $trackingRow->LocalDateTime);
if (Str::contains($trackingRow->PublicDescription, ['delivered'])) {
$deliveryDate = $trackingDate;
}
}
} catch (\Exception $exception){
dump($exception);
Log::debug('failed to fetch delivery tracking');
}
if($deliveryDate){
$packingList->status = ApprovalStatus::COMPLETED;
$packingList->save();
$deliveryDate = Carbon::parse($deliveryDate);
$transportObject = new TransportObject(TransportType::LAND, null, null, $deliveryDate, $deliveryDate, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $packingList);
$this->createsSchedule->execute($transport, new ScheduleObject($deliveryDate, $deliveryDate, ApprovalStatus::APPROVED));
if(!($packingList->owner instanceof Order)) return;
$deliveryStep = $packingList->steps()->where('reference', '=', 'LAST_MILE_DELIVERY')->first();
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
$this->updatesContractObligations->execute($signature, $deliveryStep->obligation_hash_id);
$deliveryStep->update(['status' => ApprovalStatus::COMPLETED]);
if(config('perfexcrm.is_enabled') == 'true'){
$this->packingListToPerfexCRMProcessor->execute($packingList, PerfexCRMTasksYDStages::DELIVERY);
}
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start)/60;
echo 'successful => <b>Total Execution Time:</b> '.$execution_time.' Mins<br>';
Log::info('FetchDeliveryUpdatesFromYdPortalV2Processor ends with packingList id '. $packingList->id . ' => Total Execution Time: '.$execution_time.' Mins.');
}
}
@@ -0,0 +1,483 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors\V2;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\PackingLists\Processors\CreatePackingListProcessor;
use App\Classes\Modules\PackingLists\Processors\CreatePackageProcessor;
use App\Classes\Modules\PackingLists\Processors\CreateContainerProcessor;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
use App\Classes\Modules\Steps\Services\CreatesStep;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\Modules\Unity\Processors\ActivateContractProcessor;
use App\Classes\Modules\Unity\Processors\AssignContractEntityProcessor;
use App\Classes\Modules\Unity\Processors\CreateContractEntityProcessor;
use App\Classes\Modules\Unity\Services\CreatesContract;
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
use App\Classes\Notifications\ShipmentRescheduleEmail;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\Container;
use App\Models\Order;
use App\Models\PackingList;
use App\Models\Transport;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class FetchOrderListsFromYdPortalV2Processor
{
/** @var FetchesDataFromYDPortal */
private $fetchesDataFRomYDPortal;
/** @var FetchesOrder */
private $fetchesOrder;
/** @var UpdatesContractObligation */
private $updatesContractObligations;
/** @var CreatePackingListProcessor */
private $createPackingListProcessor;
/** @var CreatePackageProcessor */
private $createPackageProcessor;
/** @var CreatesTransport */
private $createsTransport;
/** @var CreatesSchedule */
private $createsSchedule;
/** @var FetchesContainer */
private $fetchesContainer;
/** @var FetchesPackingList */
private $fetchesPackingList;
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
/** @var CreateContainerProcessor */
private $createContainerProcessor;
/** @var CreatesContract */
private $unityCreateContract;
/** @var AssignContractEntityProcessor */
private $unityAssignContractEntity;
/** @var CreateContractEntityProcessor */
private $unityCreateContractEntity;
/** @var CreatesStep */
private $createsStep;
/** @var ActivateContractProcessor */
private $unityActivateContract;
/**
* @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal
* @param FetchesOrder $fetchesOrder
* @param UpdatesContractObligation $updatesContractObligations
* @param CreatePackingListProcessor $createPackingListProcessor
* @param CreatePackageProcessor $createPackageProcessor
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
* @param FetchesContainer $fetchesContainer
* @param FetchesPackingList $fetchesPackingList
* @param FetchesCompanyModule $fetchesCompanyModule
* @param CreateContainerProcessor $createContainerProcessor
* @param CreatesContract $unityCreateContract
* @param AssignContractEntityProcessor $unityAssignContractEntity
* @param CreateContractEntityProcessor $unityCreateContractEntity
* @param CreatesStep $createsStep
* @param ActivateContractProcessor $unityActivateContract
*/
public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, FetchesOrder $fetchesOrder, UpdatesContractObligation $updatesContractObligations, CreatePackingListProcessor $createPackingListProcessor, CreatePackageProcessor $createPackageProcessor, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule, FetchesContainer $fetchesContainer, FetchesPackingList $fetchesPackingList, FetchesCompanyModule $fetchesCompanyModule, CreateContainerProcessor $createContainerProcessor, CreatesContract $unityCreateContract, AssignContractEntityProcessor $unityAssignContractEntity, CreateContractEntityProcessor $unityCreateContractEntity, CreatesStep $createsStep, ActivateContractProcessor $unityActivateContract)
{
$this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal;
$this->fetchesOrder = $fetchesOrder;
$this->updatesContractObligations = $updatesContractObligations;
$this->createPackingListProcessor = $createPackingListProcessor;
$this->createPackageProcessor = $createPackageProcessor;
$this->createsTransport = $createsTransport;
$this->createsSchedule = $createsSchedule;
$this->fetchesContainer = $fetchesContainer;
$this->fetchesPackingList = $fetchesPackingList;
$this->fetchesCompanyModule = $fetchesCompanyModule;
$this->createContainerProcessor = $createContainerProcessor;
$this->unityCreateContract = $unityCreateContract;
$this->unityAssignContractEntity = $unityAssignContractEntity;
$this->unityCreateContractEntity = $unityCreateContractEntity;
$this->createsStep = $createsStep;
$this->unityActivateContract = $unityActivateContract;
}
/**
* @param Carbon $startDate
* @param Carbon $endDate
* @return void
* @throws GuzzleException
*/
public function execute(Carbon $startDate = null, Carbon $endDate = null)
{
Log::info('FetchOrderListsFromYdPortalV2Processor starts for start date: ' . $startDate . ', and end date: ' . $endDate);
// return;
try {
$orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [
'begintime' => $startDate->timestamp,
'endtime' => $endDate->timestamp,
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
Log::info('FetchOrderListsFromYdPortalV2Processor response: ' . json_encode($rows));
if(!$rows->data) return;
foreach($rows->data as $row){
$time_start = microtime(true);
$containerReference = null;
$loadingDate = null;
$unstuffingDate = null;
$deliveryDate = null;
$etd = null;
$eta = null;
$delayDate = null;
$status = $row->status;
if($status >= 3){
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
'trakingno' => $row->expressno
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
if(!$rows){
continue;
}
foreach (array_reverse($rows->data) as $trackingRow) {
if ($trackingRow->tracking === '货物已送达仓库准备入库中') {
$receiveDate = Carbon::parse($trackingRow->trackingtime);
}
if (strpos($trackingRow->tracking, '货物装柜完成。') !== false) {
$tracking = explode(':', $trackingRow->tracking);
$containerReference = explode('预计到港时间', $tracking[1])[0];
$loadingDate = Carbon::parse($trackingRow->trackingtime);
$etd = Carbon::parse($tracking[2])->subDays(5);
$eta = Carbon::parse($tracking[2]);
}
$rescheduleETD = strpos($trackingRow->remark, '开') || strpos($trackingRow->remark, '到港');
$rescheduleETA = strpos($trackingRow->remark, '到港');
if (($rescheduleETD !== false || $rescheduleETA !== false) && strpos($trackingRow->tracking, '货物装柜完成。') === false) {
preg_match_all('/([0-9]+.{3})/', $trackingRow->remark, $matches);
$dates = collect();
foreach($matches[0] as $date){
try {
$dates->push(Carbon::parse(str_replace('.', '/', $date).Carbon::now()->format('Y')));
} catch (\Exception $exception) {
continue;
}
}
$rescheduleDate = $dates->sortDesc()->first();
if(!$delayDate || $rescheduleDate > $delayDate){
/** @var Carbon $delayDate */
$delayDate = $rescheduleDate;
if($rescheduleETA === false && $delayDate) {
$delayDate = $delayDate->addDays('5');
}
}
}
if ($trackingRow->tracking === '到港') {
$delayDate = Carbon::parse($trackingRow->trackingtime);
}
if ($trackingRow->tracking === '已开船') {
$delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
}
if ($trackingRow->tracking === '货物已进目的港仓库') {
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
if (Str::contains($trackingRow->tracking, ['派送中', '已签收', '签收完成', ' 第三方提货', '货物已派送完成', '派送', 'delivery', 'delivered'])) {
$deliveryDate = Carbon::parse($trackingRow->trackingtime);
}
}
}
if($status >= 5){
$client = new \GuzzleHttp\Client(['cookies' => true, 'headers' => ['Cookie' => 'utc_offset=480']]);
try {
$request = $client->request('get', 'https://main.universe.com.my/Tracking/User/Paging?sEcho=1&sTrackingNo='.$row->expressno.'&sOrgId=sti');
$deliveryTracking = json_decode($request->getBody()->getContents());
foreach (array_reverse($deliveryTracking->aaData) as $trackingRow) {
$trackingDate = Carbon::createFromFormat('d/m/y H:i', $trackingRow->LocalDateTime);
if (Str::contains($trackingRow->PublicDescription, ['accepted/picked'])){
$unstuffingDate = $trackingDate;
}
if (Str::contains($trackingRow->PublicDescription, ['delivered'])) {
$deliveryDate = $trackingDate;
}
}
} catch (\Exception $exception){
Log::debug('failed to fetch delivery tracking');
}
}
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
$orderNumber = $customerno[array_key_last($customerno)];
$allow_contract = true;
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
} catch (ResourceNotFoundException $exception) {
try {
$order = $this->fetchesOrder->execute(['reference' => substr($orderNumber, -9)]);
} catch (ResourceNotFoundException $exception) {
$order = $this->fetchesCompanyModule->execute(['id' => 1]);
$allow_contract = false;
}
}
$packingListReference = $row->expressno;
try{
$packingList = $this->fetchesPackingList->execute(['reference' => $row->expressno, 'type' => PackingListType::SHIPPING_PACKING_LIST]);
$packingList->packages()->delete();
$replica = $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
if($replica) $replica->packages()->delete();
$warehouseReceiveList = $this->fetchesPackingList->execute(['reference' => $row->expressno, 'type' => PackingListType::WAREHOUSE_RECEIVE_LIST]);
$warehouseReceiveList->packages()->delete();
$replica = $warehouseReceiveList->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA)->first();
if($replica) $replica->packages()->delete();
} catch (ResourceNotFoundException $exception) {
if (!$allow_contract) {
$appointee_id = 2307;
} else {
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
}
$warehouseReceiveObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::WAREHOUSE_RECEIVE_LIST, $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
/** @var PackingList $warehouseReceiveList */
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
$transportObject = new TransportObject(TransportType::LAND, null, $row->kuaidilist, Carbon::parse($receiveDate), Carbon::parse($receiveDate), $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
$transport = $this->createsTransport->execute($transportObject, $warehouseReceiveList);
if ($allow_contract) {
$contract = $this->unityCreateContract->execute();
$contractReference = $contract->hash_id;
$contractObligations = $contract->contract_obligation_list;
$this->unityActivateContract->execute($contractReference);
$supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id;
$supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId);
$order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->update(['entity_hash_id' => $supervisorContractEntity->hash_id, 'entity_signature' => $supervisorContractEntity->entity_signature_hash_id]);
$importerContractEntity = $this->unityCreateContractEntity->execute($contractReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->appointee->unity_hash_id);
$order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]);
$this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
}
$packingListObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::SUSPENDED, !$allow_contract ? null : $contractReference);
/** @var PackingList $packingList */
$packingList = $this->createPackingListProcessor->execute($packingListObject, $order);
if ($allow_contract) {
foreach ($contractObligations as $obligation) {
$stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id);
$this->createsStep->execute($packingList, $stepObject);
}
}
}
foreach($row->deliverysize as $package) {
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $package->width, (float) $package->height, (float) $package->length, 0, (float) $package->num, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
if(!count($row->deliverysize)){
$measurement = round(((float) $row->volume / (float) $row->goodcount) ** (1/3) * 100, 2);
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $measurement, (float) $measurement, (float) $measurement, 0, (float) $row->goodcount, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
$weightCbm = (float) $row->weight / 500;
$overWeightCbm = $weightCbm - $packingList->packages()->sum(DB::raw('(width/100) * (height/100) * (length/100) * quantity'));
if($overWeightCbm > 0){
$measurement = round($overWeightCbm ** (1/3) * 100, 2);
$packageObject = new PackageObject(PackageType::OVER_WEIGHT, 'Overweight CBM', (float) $measurement, (float) $measurement, (float) $measurement, 0, 1, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
if($order instanceof Order){
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
if(!in_array($marking, ['1290CSW', '8997ITB', '3992WHE', '962LOW', '1152AAT'])){
$this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/confirmsendorder.ashx', 'GET', [
'expressno' => $row->expressno
]);
}
}
if($containerReference) {
try {
$container = $this->fetchesContainer->execute(['reference' => $containerReference]);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
} catch (ResourceNotFoundException $exception){
if (!$allow_contract) {
$appointee_id = 2307;
}
else {
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id;
}
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $appointee_id]);
$containerObject = new ContainerObject($containerReference, '', '', ContainerTypes::FORTY_FEET_DRY_CONTAINER, $loadingDate, ApprovalStatus::PENDING_VERIFICATION);
/** @var Container $container */
$container = $this->createContainerProcessor->execute($containerObject, $originWarehouse);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
$transport = $container->transports()->first();
if(!$transport){
$transportObject = new TransportObject(TransportType::SEA, null, null, $etd, null, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $container);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $eta, ApprovalStatus::APPROVED));
}
}
if($delayDate){
$delayDate = $delayDate;
$transport = $container->transports()->first();
if(!$transport->schedules()->whereDate('eta', '>=', $delayDate)->first()) {
$etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd;
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED));
foreach ($container->packingLists as $packingList){
if(!($packingList->owner instanceof Order)) continue;
$user = $packingList->owner->companyModule->employees()->first();
if(app()->environment(['production'])) {
$user->notify(new ShipmentRescheduleEmail($user, $packingList));
}
}
}
}
if($unstuffingDate && $container->status !== ApprovalStatus::COMPLETED){
$container->update(['status' => ApprovalStatus::COMPLETED]);
$container->transports()->first()->update(['drop_date' => $unstuffingDate, 'status' => ApprovalStatus::COMPLETED]);
/** @var PackingList $packingList */
foreach($container->packingLists as $packingList){
if($packingList->status === ApprovalStatus::PENDING_VERIFICATION){
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
}
if ($allow_contract) {
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
foreach($packingList->steps()->where('reference', '!=', 'DELIVERY')->get() as $step){
$this->updatesContractObligations->execute($signature, $step->obligation_hash_id);
$step->update(['status' => ApprovalStatus::COMPLETED]);
}
}
}
}
}
if($deliveryDate && !$packingList->transports()->exists()){
$packingList->status = ApprovalStatus::COMPLETED;
$packingList->save();
$deliveryDate = Carbon::parse($deliveryDate);
$transportObject = new TransportObject(TransportType::LAND, null, null, $deliveryDate, $deliveryDate, ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($transportObject, $packingList);
$this->createsSchedule->execute($transport, new ScheduleObject($deliveryDate, $deliveryDate, ApprovalStatus::APPROVED));
if ($allow_contract) {
$deliveryStep = $packingList->steps()->where('reference', '=', 'LAST_MILE_DELIVERY')->first();
$signature = $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->entity_sigiture;
$this->updatesContractObligations->execute($signature, $deliveryStep->obligation_hash_id);
$deliveryStep->update(['status' => ApprovalStatus::COMPLETED]);
}
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start)/60;
echo '<b>Total Execution Time:</b> '.$execution_time.' Mins';
echo 'successful';
}
} catch (\Exception $exception) {
Log::info('FetchOrderListsFromYdPortalV2Processor exception: ' . $exception);
}
Log::info('FetchOrderListsFromYdPortalV2Processor ends for start date: ' . $startDate . ', and end date: ' . $endDate);
}
}
@@ -0,0 +1,268 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors\V2;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Orders\Services\FetchesDataFromYDPortal;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Steps\DataTransferObjects\StepsObject;
use App\Classes\Modules\Steps\Services\CreatesStep;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\Modules\Unity\Processors\ActivateContractProcessor;
use App\Classes\Modules\Unity\Processors\AssignContractEntityProcessor;
use App\Classes\Modules\Unity\Processors\CreateContractEntityProcessor;
use App\Classes\Modules\PackingLists\Processors\CreatePackingListProcessor;
use App\Classes\Modules\PackingLists\Processors\CreatePackageProcessor;
use App\Classes\Modules\Unity\Services\CreatesContract;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\Order;
use App\Models\PackingList;
use Carbon\Carbon;
use DateTime;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class FetchPackingListsFromYdPortalV2Processor
{
/** @var FetchesDataFromYDPortal */
private $fetchesDataFRomYDPortal;
/** @var FetchesOrder */
private $fetchesOrder;
/** @var CreatePackingListProcessor */
private $createPackingListProcessor;
/** @var CreatePackageProcessor */
private $createPackageProcessor;
/** @var CreatesTransport */
private $createsTransport;
/** @var FetchesPackingList */
private $fetchesPackingList;
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
/** @var CreatesContract */
private $unityCreateContract;
/** @var AssignContractEntityProcessor */
private $unityAssignContractEntity;
/** @var CreateContractEntityProcessor */
private $unityCreateContractEntity;
/** @var CreatesStep */
private $createsStep;
/** @var ActivateContractProcessor */
private $unityActivateContract;
/**
* @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal
* @param FetchesOrder $fetchesOrder
* @param CreatePackingListProcessor $createPackingListProcessor
* @param CreatePackageProcessor $createPackageProcessor
* @param CreatesTransport $createsTransport
* @param FetchesPackingList $fetchesPackingList
* @param FetchesCompanyModule $fetchesCompanyModule
* @param CreatesContract $unityCreateContract
* @param AssignContractEntityProcessor $unityAssignContractEntity
* @param CreateContractEntityProcessor $unityCreateContractEntity
* @param CreatesStep $createsStep
* @param ActivateContractProcessor $unityActivateContract
*/
public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, FetchesOrder $fetchesOrder, CreatePackingListProcessor $createPackingListProcessor, CreatePackageProcessor $createPackageProcessor, CreatesTransport $createsTransport, FetchesPackingList $fetchesPackingList, FetchesCompanyModule $fetchesCompanyModule, CreatesContract $unityCreateContract, AssignContractEntityProcessor $unityAssignContractEntity, CreateContractEntityProcessor $unityCreateContractEntity, CreatesStep $createsStep, ActivateContractProcessor $unityActivateContract)
{
$this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal;
$this->fetchesOrder = $fetchesOrder;
$this->createPackingListProcessor = $createPackingListProcessor;
$this->createPackageProcessor = $createPackageProcessor;
$this->createsTransport = $createsTransport;
$this->fetchesPackingList = $fetchesPackingList;
$this->fetchesCompanyModule = $fetchesCompanyModule;
$this->unityCreateContract = $unityCreateContract;
$this->unityAssignContractEntity = $unityAssignContractEntity;
$this->unityCreateContractEntity = $unityCreateContractEntity;
$this->createsStep = $createsStep;
$this->unityActivateContract = $unityActivateContract;
}
/**
* @param Carbon $startDate
* @param Carbon $endDate
* @return void
* @throws GuzzleException
*/
public function execute(Carbon $startDate = null, Carbon $endDate = null)
{
Log::info('FetchPackingListsFromYdPortalV2Processor starts for start date: ' . $startDate . ', and end date: ' . $endDate);
// return;
try {
$orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [
'begintime' => $startDate->timestamp,
'endtime' => $endDate->timestamp,
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
Log::info('FetchPackingListsFromYdPortalV2Processor response: ' . json_encode($rows));
if(!$rows->data) return;
foreach($rows->data as $row){
if(!is_numeric($row->goodcount)) continue;
$time_start = microtime(true);
$receiveDate = Carbon::parse(substr(preg_replace("/[^0-9]/", "", $row->expressno), 0, 8));
// $customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
$customerno = $row->customerno;
// Check if $customerno contains '正确唛头YD' and extract the part after it
if (strpos($customerno, '正确唛头YD') !== false) {
$customerno = explode('正确唛头YD', $customerno)[1];
}
$customerno = preg_split('/[-()\/]/', $customerno);
$orderNumber = $customerno[array_key_last($customerno)];
$allow_contract = true;
try {
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
} catch (ResourceNotFoundException $exception) {
try {
$order = $this->fetchesOrder->execute(['reference' => substr($orderNumber, -9)]);
} catch (ResourceNotFoundException $exception) {
$order = $this->fetchesCompanyModule->execute(['id' => 1]);
$allow_contract = false;
}
}
$packingListReference = $row->expressno;
try{
$packingList = $this->fetchesPackingList->execute(['reference' => $row->expressno, 'type' => PackingListType::SHIPPING_PACKING_LIST]);
$packingList->packages()->delete();
$replica = $packingList->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST_REPLICA)->first();
if($replica) $replica->packages()->delete();
$warehouseReceiveList = $this->fetchesPackingList->execute(['reference' => $row->expressno, 'type' => PackingListType::WAREHOUSE_RECEIVE_LIST]);
$warehouseReceiveList->packages()->delete();
$replica = $warehouseReceiveList->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA)->first();
if($replica) $replica->packages()->delete();
} catch (ResourceNotFoundException $exception) {
if (!$allow_contract) {
$appointee_id = 2307;
} else {
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
}
$warehouseReceiveObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::WAREHOUSE_RECEIVE_LIST, $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
/** @var PackingList $warehouseReceiveList */
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
$transportObject = new TransportObject(TransportType::LAND, null, $row->kuaidilist, Carbon::parse($receiveDate), Carbon::parse($receiveDate), $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
$transport = $this->createsTransport->execute($transportObject, $warehouseReceiveList);
if ($allow_contract) {
$contract = $this->unityCreateContract->execute();
$contractReference = $contract->hash_id;
$contractObligations = $contract->contract_obligation_list;
$this->unityActivateContract->execute($contractReference);
$supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id;
$supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId);
$order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->update(['entity_hash_id' => $supervisorContractEntity->hash_id, 'entity_signature' => $supervisorContractEntity->entity_signature_hash_id]);
$importerContractEntity = $this->unityCreateContractEntity->execute($contractReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->appointee->unity_hash_id);
$order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]);
$this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
}
$packingListObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::SUSPENDED, !$allow_contract ? null : $contractReference);
/** @var PackingList $packingList */
$packingList = $this->createPackingListProcessor->execute($packingListObject, $order);
if ($allow_contract) {
foreach ($contractObligations as $obligation) {
$stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id);
$this->createsStep->execute($packingList, $stepObject);
}
}
}
foreach($row->deliverysize as $package) {
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $package->width, (float) $package->height, (float) $package->length, 0, (float) $package->num, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
if(!count($row->deliverysize)){
$measurement = round(((float) $row->volume / (float) $row->goodcount) ** (1/3) * 100, 2);
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $measurement, (float) $measurement, (float) $measurement, 0, (float) $row->goodcount, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
$weightCbm = (float) $row->weight / 500;
$overWeightCbm = $weightCbm - $packingList->packages()->sum(DB::raw('(width/100) * (height/100) * (length/100) * quantity'));
if($overWeightCbm > 0){
$measurement = round($overWeightCbm ** (1/3) * 100, 2);
$packageObject = new PackageObject(PackageType::OVER_WEIGHT, 'Overweight CBM', (float) $measurement, (float) $measurement, (float) $measurement, 0, 1, ApprovalStatus::APPROVED);
$this->createPackageProcessor->execute($packageObject, $packingList);
}
if($order instanceof Order){
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
if(!in_array($marking, ['1290CSW', '8997ITB', '3992WHE', '962LOW', '1152AAT'])){
$this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/confirmsendorder.ashx', 'GET', [
'expressno' => $row->expressno
]);
}
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start)/60;
echo 'successful => <b>Total Execution Time:</b> '.$execution_time.' Mins<br>';
Log::info('FetchPackingListsFromYdPortalV2Processor ends => Total Execution Time: '.$execution_time.' Mins.');
}
} catch (\Exception $exception) {
Log::debug($exception);
Log::info('FetchPackingListsFromYdPortalV2Processor exception: ' . $exception);
}
Log::info('FetchPackingListsFromYdPortalV2Processor ends for start date: ' . $startDate . ', and end date: ' . $endDate);
}
}
@@ -142,4 +142,43 @@ class UpdatePerfexCRMObject implements DataTransferObject
{
$this->invoiceId = $invoiceId;
}
public function toArray(): array
{
return [
'companyName' => $this->companyName,
'companyReference' => $this->companyReference,
'contactName' => $this->contactName,
'contactEmail' => $this->contactEmail,
'bookingMarking' => $this->bookingMarking,
'projectName' => $this->projectName,
'projectStatus' => $this->projectStatus,
'invoiceId' => $this->invoiceId,
'milestoneNames' => $this->milestoneNames,
'tasks' => $this->tasks,
];
}
public function toJson(): string
{
return json_encode($this->toArray());
}
public static function fromJson(string $json): self
{
$data = json_decode($json, true);
return new self(
$data['companyName'],
$data['companyReference'],
$data['contactName'],
$data['contactEmail'],
$data['bookingMarking'],
$data['projectName'],
$data['projectStatus'],
$data['invoiceId'],
$data['milestoneNames'],
$data['tasks']
);
}
}
@@ -9,6 +9,7 @@ use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMInvoice;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\FetchPerfexCRMInvoiceObject;
use Illuminate\Support\Facades\Log;
use App\Classes\General\Helper;
use App\Classes\General\LogHelper;
class FetchPerfexCRMInvoiceProcessor
{
@@ -61,7 +62,7 @@ class FetchPerfexCRMInvoiceProcessor
$invoiceId = $result->payload['id'];
} else {
$log['message'] = 'FetchPerfexCRMInvoiceProcessor failed for transaction > bill_no: '.$number;
Log::channel('perfex_crm')->info($log);
LogHelper::channel('perfex_crm')->info($log);
}
}
else{
@@ -9,6 +9,7 @@ use App\Models\PackingList;
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
use App\Classes\ValueObjects\Constants\PerfexCRMTasksYDStages;
use App\Classes\ValueObjects\Constants\PerfexCRMTaskStatus;
use App\Models\DelayedJob;
use Illuminate\Support\Facades\Log;
class PackingListToPerfexCRMProcessor
@@ -92,7 +93,24 @@ class PackingListToPerfexCRMProcessor
private function dispatchUpdateJob(PackingList $packingList, UpdatePerfexCRMObject $updatePerfexCRMObject)
{
UpdatePerfexCRMPrelude::dispatch($packingList, null, $updatePerfexCRMObject, false);
/**
* @param $packingList
* @param Transaction $transaction
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
* @param bool|null $shouldCreateInvoice
*/
DelayedJob::create([
'job_class' => UpdatePerfexCRMPrelude::class,
'parameters' => json_encode([
'packingList' => $packingList,
'transaction' => null,
'updatePerfexCRMObject' => $updatePerfexCRMObject->toArray(),
'shouldCreateInvoice' => false,
]),
'execute_at' => now()->addMinute(1),
]);
//UpdatePerfexCRMPrelude::dispatch($packingList, null, $updatePerfexCRMObject, false);
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
class ConvertsPerfexCRMLeadToCustomer
@@ -25,7 +26,7 @@ class ConvertsPerfexCRMLeadToCustomer
return (object) $data;
}else{
Log::channel('perfex_crm')->info('ConvertsPerfexCRMLeadToCustomer: '.$response);
LogHelper::channel('perfex_crm')->info('ConvertsPerfexCRMLeadToCustomer: '.$response);
return null;
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
class CreatesPerfexCRMCustomer
@@ -28,7 +29,7 @@ class CreatesPerfexCRMCustomer
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info('CreatesPerfexCRMCustomer: '.$response);
LogHelper::channel('perfex_crm')->info('CreatesPerfexCRMCustomer: '.$response);
return null;
}
}
@@ -6,6 +6,7 @@ use App\Classes\Modules\PerfexCRM\DataTransferObjects\CustomerContactObject;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
class CreatesPerfexCRMCustomerContact
@@ -35,7 +36,7 @@ class CreatesPerfexCRMCustomerContact
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info('CreatesPerfexCRMCustomerContact: '.$response);
LogHelper::channel('perfex_crm')->info('CreatesPerfexCRMCustomerContact: '.$response);
return null;
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
class CreatesPerfexCRMCustomerProject
@@ -34,7 +35,7 @@ class CreatesPerfexCRMCustomerProject
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info('CreatesPerfexCRMCustomerProject: '.$response);
LogHelper::channel('perfex_crm')->info('CreatesPerfexCRMCustomerProject: '.$response);
return null;
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePerfexCRMObject;
@@ -54,7 +55,7 @@ class CreatesPerfexCRMInvoice
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info('CreatesPerfexCRMInvoice: '.$response);
LogHelper::channel('perfex_crm')->info('CreatesPerfexCRMInvoice: '.$response);
return null;
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePaymentPerfexCRMObject;
@@ -34,7 +35,7 @@ class CreatesPerfexCRMInvoicePayment
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info('CreatesPerfexCRMInvoicePayment: '.$response);
LogHelper::channel('perfex_crm')->info('CreatesPerfexCRMInvoicePayment: '.$response);
return null;
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateLeadPerfexCRMObject;
@@ -41,7 +42,7 @@ class CreatesPerfexCRMLead
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info('CreatesPerfexCRMLead: '.$response);
LogHelper::channel('perfex_crm')->info('CreatesPerfexCRMLead: '.$response);
return null;
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
class CreatesPerfexCRMMilestone
@@ -37,7 +38,7 @@ class CreatesPerfexCRMMilestone
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info('CreatesPerfexCRMMilestone: '.$response);
LogHelper::channel('perfex_crm')->info('CreatesPerfexCRMMilestone: '.$response);
return null;
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
class CreatesPerfexCRMSupportTicket
@@ -34,7 +35,7 @@ class CreatesPerfexCRMSupportTicket
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info($response);
LogHelper::channel('perfex_crm')->info($response);
return null;
}
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Exceptions\ConnectionErrorException;
use App\Classes\General\LogHelper;
use Illuminate\Support\Facades\Log;
use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateTaskPerfexCRMObject;
@@ -58,7 +59,7 @@ class CreatesPerfexCRMTask
$data = $response->json();
return (object) $data;
}else{
Log::channel('perfex_crm')->info('CreatesPerfexCRMTask: '.$response);
LogHelper::channel('perfex_crm')->info('CreatesPerfexCRMTask: '.$response);
return null;
}
}

Some files were not shown because too many files have changed in this diff Show More