Compare commits

..

614 Commits

Author SHA1 Message Date
Dillon 25cc1ffc42 Debug Pipeline Failed 2023-05-08 16:00:35 +08:00
Dillon 358dcfa81a Debug Pipeline Failed 2023-05-08 15:51:00 +08:00
Dillon 0570fef268 Debug Pipeline Failed 2023-05-08 15:43:17 +08:00
Dillon 1d3042728c Debug Pipeline Failed 2023-05-08 15:38:26 +08:00
Dillon bdc71c3ab6 Debug Pipeline Failed 2023-05-08 14:58:33 +08:00
Dillon 902c72b225 Debug Pipeline Failed 2023-05-08 14:32:19 +08:00
Dillon fafa3be998 Debug Pipeline Failed 2023-05-08 14:24:16 +08:00
Dillon 96ff2f5e15 Debug Pipeline Failed 2023-05-08 14:03:03 +08:00
Dillon bb1daa48a4 Debug Pipeline Failed 2023-05-08 13:46:32 +08:00
Dillon 758624b29c Debug Pipeline Failed 2023-05-08 13:36:45 +08:00
Dillon ffb5edc6e9 Debug Pipeline Failed 2023-05-08 13:24:50 +08:00
Dillon 6902dc36c0 Debug Pipeline Failed 2023-05-08 13:14:02 +08:00
Dillon c853b6dfea Debug Pipeline Failed 2023-05-08 13:05:27 +08:00
Dillon df1cb83aa2 Debug Pipeline Failed 2023-05-08 12:24:17 +08:00
Dillon d09a8a8b8d Debug Pipeline Failed 2023-05-08 12:20:10 +08:00
Dillon 8347b2c1db Debug Pipeline Failed 2023-05-08 10:08:51 +08:00
Dillon 37570193e7 Debug Pipeline Failed 2023-05-08 10:00:24 +08:00
Dillon c0fdb44996 Debug Pipeline Failed 2023-05-08 09:49:57 +08:00
Dillon a7429554f6 Debug Pipeline Failed 2023-05-08 09:26:45 +08:00
Dillon dcfb73c952 Laravel Vapor Initial Commit 2023-05-08 09:17:06 +08:00
Dillon 41db8f57f5 Merge branch 'dillon/crisp-help-menu-2' into development 2023-05-04 15:42:53 +08:00
Dillon 18579d5c1d Implement help menu on new order profile version 2 component 2023-05-04 15:42:16 +08:00
Dillon 1060401128 Merge branch 'dillon/crisp-help-menu' into dillon/crisp-help-menu-2 2023-05-04 15:39:54 +08:00
Dillon 3497de9727 Merge branch 'dillon/crisp-help-menu' into development 2023-05-04 15:23:54 +08:00
Dillon 5b00b7b45f Help Menu prototype v0.1 2023-05-04 15:19:04 +08:00
edmondlang 965dfb3098 Merge branch 'multi-payment-final' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php
#	app/Classes/ValueObjects/Constants/TransactionType.php
#	routes/web.php
2023-04-28 18:26:33 +08:00
edmondlang e7c0e17ee4 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final
# Conflicts:
# app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php
# app/Classes/ValueObjects/Constants/TransactionType.php
# routes/api.php
# routes/web.php
2023-04-28 18:20:42 +08:00
edmondlang 569273c058 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final
# Conflicts:
#	app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php
#	app/Classes/ValueObjects/Constants/TransactionType.php
#	routes/api.php
#	routes/web.php
2023-04-28 18:20:21 +08:00
edmondlang 80f229c6ec temporary disable manual trasnfer for group payment 2023-04-28 18:16:48 +08:00
Omair Saleh 56b6b59967 fix small bugs 2023-04-28 15:25:18 +08:00
edmondlang d6fad96d4d add robot.txt 2023-04-28 00:17:00 +08:00
edmondlang 299d5fd4fe fix bug no contact found 2023-04-27 00:13:51 +08:00
edmondlang d56abc78f7 fix bug no contact found 2023-04-27 00:11:48 +08:00
edmondlang b3b7b67c66 show undefined country code 2023-04-27 00:09:29 +08:00
edmondlang d6f29976c7 change order page list order filter to increase loading speed 2023-04-27 00:04:20 +08:00
edmondlang 351447b1fc Merge branch 'list-order-v2' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-25 23:40:47 +08:00
edmondlang 2bc43cbc8f list order v2 2023-04-25 23:40:27 +08:00
Omair Saleh e0a02c7051 update foshan map png 2023-04-20 00:01:38 +08:00
Omair Saleh 34a08563f3 Merge remote-tracking branch 'origin/master' 2023-04-19 23:57:31 +08:00
Omair Saleh 9df1e158a4 disable temporary include new columns to invoice export for chasing payment 2023-04-19 23:55:31 +08:00
edmondlang 33cd313950 foshan-warehouse image 2023-04-19 23:53:16 +08:00
EDMOND MING 2af5035e99 Delete foshan-map.png 2023-04-19 15:52:26 +00:00
Omair Saleh acb7337b4a temporary include new columns to invoice export for chasing payment 2023-04-19 15:41:19 +08:00
Omair Saleh 0a9bc29202 temporary include new columns to invoice export for chasing payment 2023-04-19 15:33:16 +08:00
Omair Saleh 1568c7272a temporary include new columns to invoice export for chasing payment 2023-04-19 15:31:12 +08:00
Omair Saleh 14f0560055 Merge remote-tracking branch 'origin/master' 2023-04-19 15:27:06 +08:00
Omair Saleh fc339f1dec temporary include new columns to invoice export for chasing payment 2023-04-19 15:26:45 +08:00
edmondlang 3378d37ffb Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-19 12:53:50 +08:00
edmondlang 77f7e86a5f fix bug date error in update announcement function in settings page 2023-04-19 12:52:46 +08:00
edmondlang 6970908b75 update generate PDF controller 2023-04-19 12:34:01 +08:00
edmondlang 3f31d2d578 add foshan map 2023-04-19 00:32:22 +08:00
edmondlang fff3d948d0 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	app/Classes/Modules/Orders/ControllersLogic/CreateOrderLogic.php
2023-04-18 23:44:36 +08:00
edmondlang 8d8c468b09 foshan-warehouse 2023-04-18 23:42:49 +08:00
Dillon Ngo 557ab483f8 Merge branch 'dillon/improvement-1' into 'master'
Reduce flooding of logs from Perfex CRM

See merge request CIEFWorldwideSdnBhd/shipping-portal!162
2023-04-15 14:02:03 +00:00
Dillon c181882145 Merge branch 'dillon/improvement-1' into development 2023-04-15 21:57:58 +08:00
Dillon 4b0b88b5d8 Reduce flooding of logs from Perfex CRM 2023-04-15 21:46:26 +08:00
edmondlang 1960cff426 create a cron job to fix all billplz failed callback for all the success payments. 2023-04-14 11:39:24 +08:00
edmondlang 0402fc67e2 update package loading animation 2023-04-13 22:57:46 +08:00
edmondlang 4089683ab7 remove all css comments 2023-04-13 22:53:12 +08:00
edmondlang 3fdd2a2b56 update package loading animation 2023-04-13 22:46:41 +08:00
edmondlang 2a333f7d19 Merge branch 'order-v2' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-13 16:09:37 +08:00
edmondlang 76193eeb9f update order v2 2023-04-13 16:09:18 +08:00
edmondlang 8f8622aa10 Merge branch 'order-v2' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-13 16:05:38 +08:00
edmondlang a696e1dab9 change all order to v2 link 2023-04-13 16:05:20 +08:00
edmondlang f88936c873 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-13 16:01:45 +08:00
edmondlang c9642bd8f5 update order v2 page 2023-04-13 16:01:12 +08:00
DESKTOP-5I7S92L\nicho a3d26bfb63 uncomment order package code 2023-04-13 12:20:49 +08:00
DESKTOP-5I7S92L\nicho 094f995dcf orde v2 include packages 2023-04-13 12:18:22 +08:00
edmondlang 1a5db25285 update show duplicated invoice logic 2023-04-12 12:15:06 +08:00
edmondlang 2bb4afe426 update show duplicated invoice logic 2023-04-12 11:58:10 +08:00
edmondlang f7a9b2332c enable customer 769SMC summary in 2 different year 2022 and 2023 2023-04-11 11:39:22 +08:00
Dillon Ngo fa0c97b1da Merge branch 'dillon/accounting-bank-mapping' into 'master'
New route, middleware, token table, filters for query to allow  third party to access api

See merge request CIEFWorldwideSdnBhd/shipping-portal!161
2023-04-06 15:19:15 +00:00
Dillon 20f3004e22 Merge branch 'dillon/accounting-bank-mapping' into development 2023-04-06 22:59:39 +08:00
Dillon 43cd6f35be New route, middleware, token table, filters for query to allow third party to access api 2023-04-06 22:57:50 +08:00
edmondlang fd4bbe5d4f Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-06 19:25:35 +08:00
edmondlang 697c02ac8a delete packing list by package id 2023-04-06 19:22:40 +08:00
edmondlang 3dd9dfe361 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into delete-packing-list 2023-04-06 18:52:48 +08:00
edmondlang 7c50dfbfc3 update 769SMC summary 2023-04-06 17:30:02 +08:00
edmondlang a630b49867 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-06 14:25:33 +08:00
edmondlang e77e513bef support page update 2023-04-06 14:24:56 +08:00
DESKTOP-5I7S92L\nicho e173a9ddd3 support update 2023-04-06 14:00:41 +08:00
edmondlang 75ce5bd752 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-06 00:08:24 +08:00
edmondlang c40d563372 add support at menu 2023-04-06 00:08:06 +08:00
edmondlang abb7bc2e4c Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-04-05 23:50:22 +08:00
edmondlang 7f0de1c1e4 support page 2023-04-05 23:49:23 +08:00
edmondlang c5477890d6 oder v2 2023-04-05 20:27:22 +08:00
edmondlang 26027f5f3f order profile v2 2023-04-05 19:13:17 +08:00
edmondlang a28f735d8f order v2 2023-04-05 19:12:07 +08:00
DESKTOP-5I7S92L\nicho 225abaacb8 order v2 2023-04-05 16:38:28 +08:00
DESKTOP-5I7S92L\nicho 70fc8285f8 order v2 2023-04-05 16:21:53 +08:00
DESKTOP-5I7S92L\nicho 1f6eaa65a5 order v2 2023-04-05 16:02:10 +08:00
DESKTOP-5I7S92L\nicho 7e2428957e delete packing list 2023-04-05 15:18:46 +08:00
edmondlang 069c3cea35 Showing Billplz payment status 2023-04-02 12:09:44 +08:00
edmondlang 857003b25b update code conflict 2023-04-02 11:45:58 +08:00
edmondlang 551119e313 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	app/Classes/ValueObjects/Constants/TransactionType.php
#	routes/web.php
2023-04-02 11:41:55 +08:00
edmondlang 07998c6850 super admin delete invoice/transaction 2023-04-02 11:25:50 +08:00
Dillon Ngo cd3e955f3e Merge branch 'dillon/debug-and-fixes-2' into 'master'
Another attempt to solve invoice without projectId, rewriting job chaining one after another

See merge request CIEFWorldwideSdnBhd/shipping-portal!160
2023-04-01 16:28:55 +00:00
edmondlang 869397056c final-duplicated-invoice-debug 2023-04-01 19:36:43 +08:00
edmondlang c58cdde254 final-duplicated-invoice-debug 2023-04-01 19:35:47 +08:00
edmondlang 982a7c1d44 final-duplicated-invoice-debug 2023-04-01 19:34:30 +08:00
edmondlang c976319521 final-duplicated-invoice-debug 2023-04-01 19:19:48 +08:00
edmondlang 145bf3263a final-duplicated-invoice-debug 2023-04-01 18:51:37 +08:00
edmondlang 57eb1e147d final-duplicated-invoice-debug 2023-04-01 18:48:34 +08:00
edmondlang e1c69f2de4 final-duplicated-invoice-debug 2023-04-01 18:35:15 +08:00
edmondlang 90b2bffd19 final-duplicated-invoice-debug 2023-04-01 18:31:02 +08:00
edmondlang 562815f9fe final-duplicated-invoice-debug 2023-04-01 18:27:04 +08:00
edmondlang 401db91437 final-duplicated-invoice-debug 2023-04-01 18:20:22 +08:00
edmondlang 0d1a623512 final-duplicated-invoice-debug 2023-04-01 17:36:59 +08:00
edmondlang 548a50c14a final-duplicated-invoice-debug 2023-04-01 17:33:51 +08:00
edmondlang 299512ec08 final-duplicated-invoice-debug 2023-04-01 17:29:28 +08:00
edmondlang 7241db7743 final-duplicated-invoice-debug 2023-04-01 17:27:13 +08:00
edmondlang ce24deea18 final-duplicated-invoice-debug 2023-04-01 17:11:07 +08:00
edmondlang c4642c2042 final-duplicated-invoice-debug 2023-04-01 17:06:37 +08:00
edmondlang 3871d8c010 clean up web routes 2023-04-01 16:01:20 +08:00
edmondlang cb65a1f29b fix bug billplz failed callback 2023-03-31 21:24:43 +08:00
edmondlang b1b13d7cbf fix bug billplz failed callback 2023-03-31 21:21:26 +08:00
Omair Saleh f6fa2fcf51 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	routes/web.php
2023-03-31 15:44:13 +08:00
Omair Saleh 6c00a57446 smc summary report 2023-03-31 15:43:04 +08:00
edmondlang b567f50711 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-31 00:42:03 +08:00
edmondlang 48445020fb adjust warehouse contact ui 2023-03-31 00:41:45 +08:00
edmondlang 395b15af90 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	routes/api.php
2023-03-31 00:32:46 +08:00
edmondlang 46f1368a92 ui and api to update warehouse contact 2023-03-31 00:29:15 +08:00
edmondlang 82a16a5d9d update address 2023-03-30 17:26:19 +08:00
edmondlang 833ffdab8d Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-30 15:18:00 +08:00
edmondlang 23002f61da update admin role type 2023-03-30 15:13:41 +08:00
edmondlang 2f6a30a512 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-30 14:38:15 +08:00
edmondlang 2355c74b65 update customer/summary/monthly to 2023 records 2023-03-30 14:22:10 +08:00
edmondlang bd81560c3d remove console.log 2023-03-30 14:21:31 +08:00
edmondlang 575491e500 search admin in settings 2023-03-30 14:18:22 +08:00
edmondlang 4c433f74f1 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-30 12:53:00 +08:00
edmondlang 1c703489b9 update admin role type 2023-03-30 12:47:02 +08:00
DESKTOP-5I7S92L\nicho 30ef3a7e41 fix call API bug for changeAdminRoleTypeForm 2023-03-30 12:35:30 +08:00
DESKTOP-5I7S92L\nicho f9b1289d28 call api 2023-03-30 12:28:45 +08:00
edmondlang 9fe49d8658 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into update-admin-role-type 2023-03-30 12:16:04 +08:00
DESKTOP-5I7S92L\nicho e265b069d2 change button color to transparent 2023-03-30 12:12:35 +08:00
edmondlang f90818dbca updates user name and admin type api 2023-03-30 12:06:33 +08:00
DESKTOP-5I7S92L\nicho bfd490854d change admin role type 2023-03-30 11:53:54 +08:00
Dillon 852da05e24 Merge branch 'dillon/debug-and-fixes-2' into development 2023-03-30 06:00:12 +08:00
Dillon 94d96c96ea Another attempt to solve invoice without projectId, rewriting job chaining one after another 2023-03-30 05:58:26 +08:00
edmondlang feaab3cd8e check billplz failed callback 2023-03-30 00:37:09 +08:00
edmondlang 094801abbe check billplz failed callback 2023-03-30 00:35:59 +08:00
edmondlang 275d8880d9 check billplz failed callback 2023-03-30 00:30:12 +08:00
edmondlang 98843d0688 check billplz failed callback 2023-03-30 00:07:21 +08:00
edmondlang 317f4c2351 check billplz failed callback 2023-03-29 23:39:58 +08:00
edmondlang 83c7d70551 check billplz failed callback 2023-03-29 23:29:05 +08:00
Dillon Ngo 20099c416f Merge branch 'dillon/debug-and-fixes-2' into 'master'
New merge request From dillon/debug-and-fixes-2 into master

See merge request CIEFWorldwideSdnBhd/shipping-portal!159
2023-03-29 13:35:13 +00:00
Dillon 03b26e2af9 Typo error a to quick fix for update a CRM project 2023-03-29 13:14:49 +08:00
Dillon Ngo eb399dcbae Merge branch 'dillon/debug-and-fixes-2' into 'master'
New merge request From dillon/debug-and-fixes-2 into master

See merge request CIEFWorldwideSdnBhd/shipping-portal!158
2023-03-28 16:03:34 +00:00
Dillon d602200140 A quick fix 2023-03-29 00:01:48 +08:00
Dillon Ngo 84028b5ed7 Merge branch 'dillon/crm-create-task-3-26' into 'master'
New merge request From dillon/crm-create-task-3-26 into master

See merge request CIEFWorldwideSdnBhd/shipping-portal!157
2023-03-28 15:56:51 +00:00
Dillon 1658b65484 A quick fix 2023-03-28 23:42:59 +08:00
Dillon 8e9ff0cad5 Merge branch 'dillon/crm-create-task-3-26' into development 2023-03-28 23:36:35 +08:00
Dillon 78ceb62dec Sync code fix from exchange 2023-03-28 23:35:49 +08:00
edmondlang acee1a7884 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-28 16:17:14 +08:00
edmondlang 27190868b4 change company type 2023-03-28 16:15:07 +08:00
edmondlang b897b00703 change company type 2023-03-28 15:53:14 +08:00
edmondlang 842614700a multi payment final 2023-03-28 15:38:16 +08:00
DESKTOP-5I7S92L\nicho cd93deac26 change company type 2023-03-28 15:35:13 +08:00
edmondlang a0ca37ec16 multi payment final 2023-03-27 23:47:59 +08:00
edmondlang 08b2ba1c63 multi invoice payment 2023-03-27 19:37:31 +08:00
edmondlang c7f8831555 multi payment 2023-03-27 18:11:40 +08:00
edmondlang df31b801f3 multi invoice payment 2023-03-27 18:11:11 +08:00
edmondlang 946c9b6e3d Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final 2023-03-26 22:49:07 +08:00
edmondlang 0079d745ba Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-26 22:48:42 +08:00
edmondlang 0d0e147647 update dummy data seeder generate and approve invoice 2023-03-26 22:48:12 +08:00
edmondlang bafc23bf6f Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final 2023-03-26 21:50:33 +08:00
edmondlang efba270ea5 update dummy seeder data - postcode 2023-03-26 21:50:14 +08:00
edmondlang 2d13f69be6 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final
# Conflicts:
#	app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php
2023-03-26 21:39:15 +08:00
edmondlang 69da484b72 update dummy seeder data - state charges, so the invoice total wont be in 0 2023-03-26 21:37:54 +08:00
edmondlang cb184c8f50 multi payment final 2023-03-26 21:36:52 +08:00
Dillon 0bd3464184 Merge branch 'dillon/crm-create-task-3-26' into development 2023-03-25 14:20:49 +08:00
Dillon b25adef107 Fix another error from production logs 2023-03-25 14:20:38 +08:00
Dillon 7ec1bc65a5 Merge branch 'dillon/crm-create-task-3-26' into development 2023-03-25 02:18:03 +08:00
Dillon 329aa4b496 Minor cleanup 2023-03-25 02:17:51 +08:00
Dillon c401d1e0d5 Merge branch 'development' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-24 15:15:32 +08:00
Dillon a2983ec9f1 Merge branch 'dillon/crm-create-task-3-26' into development 2023-03-24 15:15:15 +08:00
Dillon a05609081b minor code streamline 2023-03-24 15:15:05 +08:00
Martin Maina Kiragu 2421640c0a Merge branch 'feature/dashboard_optimization' into 'development'
Feature/dashboard optimization

See merge request CIEFWorldwideSdnBhd/shipping-portal!156
2023-03-24 03:48:40 +00:00
Martin Kiragu 7dae2228f6 fix ide-autospace formatting 2023-03-24 06:34:04 +03:00
Martin Kiragu 75039466ab fix ide-autospace formatting 2023-03-24 06:28:53 +03:00
Martin Kiragu f3df5fbe9f fix ide-autospace formatting 2023-03-24 06:13:35 +03:00
Martin Kiragu 362e47aaa0 fix ide-autospace formatting 2023-03-24 06:04:28 +03:00
Martin Kiragu ba26cda598 switched the Modal resources to Transformers for /document/lists endpoint 2023-03-24 05:51:32 +03:00
Dillon 8995a567d5 Merge branch 'dillon/crm-create-task-3-26' into development 2023-03-24 03:16:47 +08:00
Dillon 9d442c8cc4 CRM Task with dynamic data 2023-03-24 03:14:57 +08:00
Dillon 5eeec7806b Merge branch 'dillon/crm-create-task-3-26' into development 2023-03-23 04:31:47 +08:00
Dillon f5df1adff8 Fix a problem with new registration uploadin documentg 2023-03-23 04:31:35 +08:00
Dillon fd46a4fb7f Merge branch 'dillon/crm-create-task-3-26' into development 2023-03-23 04:18:38 +08:00
Dillon 119e58c1c9 Added new task, new task details such as priority and due date + some cleanup 2023-03-23 04:18:17 +08:00
Dillon 1100267316 Merge branch 'dillon/crm-create-task-3-26' into development 2023-03-22 22:23:43 +08:00
Dillon b08ba3e716 Exchange - changes code sync 2023-03-22 22:19:31 +08:00
edmondlang 2169f09ffe billplz failed callback payment 2023-03-22 19:36:26 +08:00
edmondlang 1dfbc71302 billplz failed callback payment 2023-03-22 13:50:11 +08:00
edmondlang e133f1fab8 Merge branch 'multi-payment-final' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-21 17:38:35 +08:00
edmondlang b2a986b838 update multi payment bill plz call back 2023-03-21 17:38:12 +08:00
edmondlang 57cdedbdd0 update billplz callback logic 2023-03-21 16:58:12 +08:00
edmondlang 5d5892ce07 Merge branch 'multi-payment-final' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	routes/transaction.php
2023-03-21 14:13:20 +08:00
edmondlang 160fa2b2d9 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final 2023-03-21 14:11:59 +08:00
edmondlang e0d0dccb4c multi payment final 2023-03-21 14:11:42 +08:00
edmondlang fea03de5bd audit billplz invoice 2023-03-21 13:08:05 +08:00
edmondlang 75babc9f38 audit billplz invoice 2023-03-21 13:03:27 +08:00
edmondlang a36f7123e8 audit billplz invoice 2023-03-21 12:56:53 +08:00
edmondlang f47c7ebc50 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final 2023-03-21 11:11:33 +08:00
Dillon Ngo fad56e30dc Merge branch 'dillon/debug-and-fixes-1' into 'master'
Fix a problem in invoice where rounding issue cause an invoice that is fully...

See merge request CIEFWorldwideSdnBhd/shipping-portal!154
2023-03-20 14:17:04 +00:00
Dillon Ngo 6b56899004 Merge branch 'dillon/crm-invoice-update-23' into 'master'
Dillon/crm invoice update 23

See merge request CIEFWorldwideSdnBhd/shipping-portal!155
2023-03-20 14:16:13 +00:00
edmondlang b26700ea6f Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-20 18:08:50 +08:00
edmondlang 37444e6e30 update billing question display position 2023-03-20 18:05:29 +08:00
Dillon 589c2e01d9 Merge branch 'dillon/debug-and-fixes-1' into development 2023-03-19 22:32:53 +08:00
Dillon 32591273f8 Fix a problem in invoice where rounding issue cause an invoice that is fully paid to appear partially paid 2023-03-19 22:21:10 +08:00
Dillon f73b1d7fe3 Fix a problem at CRM where downloading of invoice in PDF throws errors 2023-03-19 22:20:49 +08:00
Dillon 9cf6058a65 Merge branch 'dillon/debug-and-fixes-1' into development 2023-03-19 17:34:52 +08:00
Dillon 0d4f7e0ed5 Another attempt to fix an error where invoice created at crm has no project id 2023-03-19 17:34:34 +08:00
Dillon ff4d81966c Merge branch 'dillon/debug-and-fixes-1' into development 2023-03-19 16:39:40 +08:00
Dillon 9786198ca2 Fix Error: BadMethodCallException: Call to undefined method 2023-03-19 16:31:30 +08:00
Martin Kiragu a4891aa0de added a debugber optional paramenter for addational resource on ListDocument resource 2023-03-19 06:31:44 +03:00
Martin Kiragu 05ba0ba6fd update fix conflicts 2023-03-19 04:41:40 +03:00
Martin Kiragu 9217970237 update helpers 2023-03-19 04:38:24 +03:00
Dillon 828f424cfd Merge branch 'dillon/crm-invoice-update-23' into development 2023-03-19 04:50:46 +08:00
Dillon 76a9af2dc8 Fix a problem of a mismatch in data update for invoice 2023-03-19 04:50:12 +08:00
Dillon 057ca8480b Merge branch 'dillon/crm-invoice-update-23' into development 2023-03-19 04:30:36 +08:00
Dillon 3dcf3cff10 Update CRM invoice due date 2023-03-19 04:29:50 +08:00
edmondlang d07901f31b Merge branch 'multi-payment-final' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php
#	routes/web.php
2023-03-18 23:36:37 +08:00
edmondlang f30a0cf7ee wallet top up logic 2023-03-18 23:34:38 +08:00
edmondlang f2a02230c7 update payment redirect 2023-03-18 23:16:08 +08:00
edmondlang 2978eed61d Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final 2023-03-18 23:06:50 +08:00
Dillon Ngo 37da620927 Merge branch 'dillon/debug-and-fixes-1' into 'master'
Insert logs for debugging

See merge request CIEFWorldwideSdnBhd/shipping-portal!153
2023-03-18 08:28:57 +00:00
Dillon c22638b29e Merge branch 'dillon/debug-and-fixes-1' into development 2023-03-17 17:36:56 +08:00
Dillon 64ec76eed6 Insert logs for debugging 2023-03-17 17:28:18 +08:00
edmondlang ef3c738fb1 debug billplz payment 2023-03-15 19:58:05 +08:00
edmondlang 92b6e6dc3a debug billplz payment 2023-03-15 19:48:48 +08:00
Dillon Ngo 0d330447eb Merge branch 'dillon/crm-tasks-department' into 'master'
CRM add department custom field to tasks

See merge request CIEFWorldwideSdnBhd/shipping-portal!152
2023-03-14 12:41:49 +00:00
Omair Saleh daeb376aa5 billplz audit 2023-03-13 16:05:41 +08:00
Omair Saleh f4d81cbde9 Merge remote-tracking branch 'origin/master' 2023-03-13 16:03:18 +08:00
Omair Saleh 0fd3584af2 billplz audit 2023-03-13 16:03:05 +08:00
Martin Kiragu c292bfd1e0 extract repeated queries on MonthlyReport Controller and Add a global Library helper.php file 2023-03-13 09:21:51 +03:00
edmondlang c76c50466d multi payment final ui 2023-03-13 13:43:28 +08:00
edmondlang b4437c8907 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final
# Conflicts:
#	routes/web.php
2023-03-13 12:12:26 +08:00
edmondlang a2f70f266d billplz audit 2023-03-13 06:57:19 +08:00
Omair Saleh 432ce2d14a billplz audit 2023-03-13 01:42:14 +08:00
edmondlang 715384f4a4 audit billplz 2023-03-13 00:42:44 +08:00
edmondlang 8277b9d0fd fix bug unsuccessfull payment can went through 2023-03-13 00:32:59 +08:00
edmondlang e7942731ad revert call back bill plz logic 2023-03-13 00:10:26 +08:00
edmondlang 85942eff1d Merge branch 'multi-payment-final' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-12 23:27:57 +08:00
edmondlang 5db9d79cc1 multi payment final - payment fail - redirect and show error 2023-03-12 23:27:21 +08:00
edmondlang d69896f807 Merge branch 'multi-payment-final' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-12 23:13:58 +08:00
edmondlang dff001c9b5 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final 2023-03-12 23:13:21 +08:00
edmondlang 2353c637d7 multi payment final - finish top up and trsanction history 2023-03-12 23:13:03 +08:00
Dillon 2c5c97488f Merge branch 'dillon/crm-tasks-department' into development 2023-03-12 17:38:48 +08:00
Dillon 4769541535 CRM add department custom field to tasks 2023-03-12 17:37:49 +08:00
Dillon Ngo fe8b6d0518 Merge branch 'dillon/crm-create-task-2' into 'master'
Add in missing update project function

See merge request CIEFWorldwideSdnBhd/shipping-portal!151
2023-03-11 11:45:11 +00:00
Dillon 5934fbcb6c Add in missing update project function 2023-03-11 19:43:30 +08:00
Dillon Ngo c078a879d2 Merge branch 'dillon/crm-feed-improvement-1' into 'master'
Dillon/crm feed improvement 1

See merge request CIEFWorldwideSdnBhd/shipping-portal!150
2023-03-11 08:56:40 +00:00
Dillon Ngo c58f2e55d7 Merge branch 'dillon/crm-create-task-2' into 'master'
Dillon/crm create task 2

See merge request CIEFWorldwideSdnBhd/shipping-portal!149
2023-03-11 08:56:25 +00:00
edmondlang eea8708b76 migrate wallets and create function for regenerates invoice 2023-03-11 16:48:54 +08:00
Dillon 99e38b96ce Merge branch 'dillon/crm-create-task-2' into development 2023-03-11 16:34:04 +08:00
Dillon 45c94321b1 Fix a problem in invoice item where the amount cannot be 0 2023-03-11 16:32:49 +08:00
Dillon 81a00a8195 Merge branch 'dillon/crm-create-task-2' into development 2023-03-10 21:14:00 +08:00
Dillon 4fbe771dce Fix a problem with task name in CRM must be unique 2023-03-10 21:12:43 +08:00
edmondlang 9f8ba5163c fix list admin user 2023-03-10 19:23:01 +08:00
Dillon dbab7a9f8c Merge branch 'dillon/crm-feed-improvement-1' into development 2023-03-10 17:59:34 +08:00
Dillon b06cef4045 Feedback from user on crm leads registration 2023-03-10 17:58:13 +08:00
Dillon 046676d174 Merge branch 'dillon/crm-create-task-2' into development 2023-03-10 02:52:53 +08:00
Dillon 1c072d7b96 CRM create all remaining tasks according to documentation 2023-03-10 02:41:41 +08:00
edmondlang eeb7bb77bb delete duplicated invoice 2023-03-09 12:46:00 +08:00
edmondlang 2de60c8262 test delete duplicated invoice 2023-03-09 12:44:36 +08:00
edmondlang c8a2ce71e1 test delete duplicated invoice 2023-03-09 12:39:28 +08:00
edmondlang 7e04580be0 update show duplicated invoice 2023-03-09 12:34:37 +08:00
edmondlang 3d15a8e312 delete duplicate invoice logic 2023-03-09 10:21:40 +08:00
edmondlang 9936e42574 update show duplicated invoice 2023-03-09 10:15:20 +08:00
edmondlang 16ffec01d4 fix missing invoices 2023-03-09 09:28:45 +08:00
edmondlang 7959f8c83c fix missing invoices 2023-03-08 22:02:03 +08:00
edmondlang 16b5660f12 fix duplicated packing list 2023-03-08 15:33:17 +08:00
edmondlang 2b4f1ad570 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-08 14:34:36 +08:00
edmondlang 023954db70 fix duplicated packing list 2023-03-08 14:32:10 +08:00
edmondlang 535b8a59b9 fix invoice drop date 2023-03-08 11:48:38 +08:00
omair saleh dc4d7004a3 Merge branch 'dillon/crm-create-invoice' into 'master'
Dillon/crm create invoice

See merge request CIEFWorldwideSdnBhd/shipping-portal!148
2023-03-07 15:16:46 +00:00
Dillon bcb78f2392 undo debug logs 2023-03-06 16:00:58 +08:00
Dillon 345a62fec6 debug 2023-03-06 15:54:57 +08:00
Dillon 6257b11a6e Merge branch 'dillon/crm-create-invoice' into development 2023-03-06 15:13:17 +08:00
Dillon 128c8083c3 CRM tie invoice to project 2023-03-06 15:12:55 +08:00
Dillon 4b124ca96d Merge branch 'dillon/crm-create-invoice' into development 2023-03-05 20:30:04 +08:00
Dillon d52131d9df CRM create invoice 2023-03-05 20:28:48 +08:00
Martin Kiragu 4b25764fb3 Merge branch 'development' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-03 06:29:16 +03:00
Martin Kiragu 422a0af465 move all UI related tests to codeception tets 2023-03-03 06:28:45 +03:00
edmondlang c73d65343b Merge branch 'update-create-dilivery-address' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-02 23:38:33 +08:00
edmondlang 9e5784b6ec update force create order delivery address 2023-03-02 23:38:12 +08:00
edmondlang 9a863e2143 Merge branch 'update-create-dilivery-address' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-02 23:18:12 +08:00
edmondlang 8024865d5d create order with force enter billing address 2023-03-02 23:17:42 +08:00
edmondlang 579dd02ebf update allow user to edit billing address 2023-03-02 22:20:08 +08:00
Martin Kiragu 66abe81e73 Merge remote-tracking branch 'origin/development' into development 2023-03-02 12:24:07 +03:00
Martin Kiragu ca178e1b31 add HasFactory facade to Users model 2023-03-02 12:23:49 +03:00
edmondlang e52a27aedb Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-02 17:06:55 +08:00
edmondlang 1e6ac000ac fix invoice command 2023-03-02 17:06:29 +08:00
Martin Kiragu 6c2c28fb31 rerun UI build on the test job 2023-03-02 11:58:09 +03:00
Martin Kiragu 049da351ef Merge remote-tracking branch 'origin/development' into development 2023-03-02 11:28:03 +03:00
Martin Kiragu 0ce8709f70 reduplicate mysql service for unit test job 2023-03-02 11:27:25 +03:00
edmondlang 1e5609bb1b Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-02 16:26:11 +08:00
edmondlang 0802198c97 update allow user to edit billing address 2023-03-02 16:25:51 +08:00
edmondlang 8e7970a925 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-03-02 16:16:23 +08:00
edmondlang 2421f6dcf0 allow user to edit billing address 2023-03-02 16:15:51 +08:00
Martin Kiragu 06b2c5166d remove dependencies test and add reruns 2023-03-02 11:01:10 +03:00
Martin Kiragu 6ba3b873a2 add building assets and dependencies test 2023-03-02 10:47:45 +03:00
Martin Kiragu 623fb1609b switch dependencies with an installation rerun 2023-03-02 10:29:40 +03:00
Martin Kiragu 24be20a60d switch dependencies with an installation rerun 2023-03-02 10:17:30 +03:00
Martin Kiragu 3535201481 remove test dependency injection 2023-03-02 10:04:09 +03:00
Martin Kiragu cdefd48d26 remove pdo echo 2023-03-02 09:50:44 +03:00
Martin Kiragu 45fbcf1447 pdo addition 2023-03-02 09:42:49 +03:00
Martin Kiragu 53805f3608 add database test 2023-03-02 09:20:02 +03:00
Martin Kiragu 99e90ad357 update remove pdo and mysql extension 2023-03-02 09:03:28 +03:00
Martin Kiragu 5edb9b5cfe add node and gulp builds 2023-03-02 08:58:23 +03:00
Martin Kiragu 86a5a3b2d9 add migration and seeder 2023-03-02 08:37:38 +03:00
Martin Kiragu a6590e3b81 test set up on the set up job 2023-03-02 08:31:14 +03:00
Martin Kiragu b1bb2b9f33 add .env.example to the env file 2023-03-02 08:25:04 +03:00
omair saleh 127a13c59c Merge branch 'dillon/crm-create-task' into 'master'
Add new tasks post payment into CRM + Add task append to lead

See merge request CIEFWorldwideSdnBhd/shipping-portal!146
2023-03-02 00:25:56 +00:00
Dillon 9318e7471f Merge branch 'dillon/crm-create-task' into development 2023-03-01 12:36:15 +08:00
Dillon ba2bd59b04 Add new tasks post payment into CRM + Add task append to lead 2023-03-01 12:29:47 +08:00
Martin Maina Kiragu e19ba1c9f3 Merge branch 'feature/TDD' into 'development'
Feature/tdd

See merge request CIEFWorldwideSdnBhd/shipping-portal!140
2023-03-01 03:54:54 +00:00
edmondlang 8cffae079b test approve invoice 2023-02-28 14:46:04 +08:00
edmondlang 594b25b71b temporary disable all other cron on development server 2023-02-28 14:29:04 +08:00
edmondlang d142a86683 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-28 14:23:11 +08:00
edmondlang 981ec9bbeb approve invoice function for testing 2023-02-28 14:22:32 +08:00
edmondlang b293542321 disable user to generate invoice on web link 2023-02-28 14:12:24 +08:00
Omair Saleh 18593cb959 fix duplicated invoices 2023-02-28 12:58:53 +08:00
Omair Saleh e2d1426d19 fix duplicated invoices 2023-02-28 12:58:18 +08:00
Omair Saleh d31deeb112 fix duplicated invoices 2023-02-28 12:50:52 +08:00
Omair Saleh d61a0c2104 fix duplicated invoices 2023-02-28 12:03:17 +08:00
edmondlang cbda7aa6ba delete duplicated invoice 2023-02-27 19:29:24 +08:00
edmondlang b5027c81f8 delete duplicated invoice 2023-02-27 19:26:26 +08:00
edmondlang e83e53a1d7 delete duplicated invoice 2023-02-27 19:21:25 +08:00
edmondlang 4058456797 delete duplicated invoice 2023-02-27 19:18:43 +08:00
edmondlang d03e34a1f4 delete duplicated invoice 2023-02-27 19:15:36 +08:00
edmondlang 5d79d5808a delete duplicated invoice for order marking 165005587 only 2023-02-27 16:17:47 +08:00
edmondlang 935f3e9bf5 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-27 15:59:49 +08:00
edmondlang e4464c3eb4 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal 2023-02-27 15:57:08 +08:00
edmondlang e227abac59 check duplicated invoice 2023-02-27 15:56:29 +08:00
omair saleh 997a9da276 Merge branch 'dillon/crm-integration' into 'master'
Dockerising shipping-portal usign the same setting from exchange-2.0.

See merge request CIEFWorldwideSdnBhd/shipping-portal!145
2023-02-27 05:14:32 +00:00
edmondlang a810fcad59 show duplicated invoice 2023-02-27 13:07:54 +08:00
edmondlang 9f4b04b9fb update show duplicated invoice 2023-02-27 12:57:46 +08:00
edmondlang 085692485a show duplicated invoice 2023-02-27 12:42:35 +08:00
edmondlang dedd6464f4 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-24 18:08:22 +08:00
edmondlang 6b5ae9b0b7 export invoice for PAID INVOICE and PENDING PAYMENT 2023-02-24 18:06:39 +08:00
edmondlang 38aba65178 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-23 14:53:41 +08:00
edmondlang eb92a76a0b update invoice search function 2023-02-23 14:53:21 +08:00
Dillon 091119c244 Merge branch 'dillon/crm-integration' into development 2023-02-22 18:09:51 +08:00
Dillon 2b20160334 User feedback fix and enhancement on crm integration 2023-02-22 18:09:34 +08:00
Dillon 4d095b5459 Merge branch 'development' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-22 17:10:08 +08:00
Dillon 1c50181132 Merge branch 'dillon/crm-integration' into development 2023-02-22 10:37:19 +08:00
Dillon 8a29f10ef3 Include company name and phone number into lead during regirstration 2023-02-22 10:36:35 +08:00
edmondlang 9e26c470f5 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-21 23:54:08 +08:00
edmondlang a1bc3aa652 update PAYMENT AND BILLING invoice per_page to 5 2023-02-21 23:53:49 +08:00
edmondlang 4c0bf164a0 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-21 23:43:18 +08:00
edmondlang e5af2bf171 Merge branch 'auto-generate-invoice' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal 2023-02-21 23:42:58 +08:00
edmondlang 2443575744 correct typo 2023-02-21 23:42:37 +08:00
edmondlang 8ab7f72e90 reverse invoice search function 2023-02-21 23:42:00 +08:00
edmondlang 5772e30575 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-21 23:41:19 +08:00
edmondlang 864bbc70b6 update invoice search function 2023-02-21 23:40:02 +08:00
edmondlang c439bb5d61 invoice search function 2023-02-21 23:31:20 +08:00
edmondlang 82b99a40cf update admin payments billing section component 2023-02-21 19:57:08 +08:00
edmondlang 4b2daa62d7 test auto generate invoice function 2023-02-21 17:32:20 +08:00
edmondlang 2bd8700a61 Merge branch 'auto-generate-invoice' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-21 16:50:42 +08:00
edmondlang 272ce5fa39 auto generate invoice 2023-02-21 16:50:14 +08:00
edmondlang c16a49d55c update regenerate invoice by web route 2023-02-21 16:07:32 +08:00
edmondlang ad7e77c169 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-21 15:01:09 +08:00
edmondlang c85b603b81 Nana from the Digital marketing department has requested to remove the wechat_id in registration 2023-02-21 15:00:52 +08:00
Omair Saleh 6c6b104dff fix bug when container schedule has issue 2023-02-21 14:19:28 +08:00
Omair Saleh 430b26def0 Merge remote-tracking branch 'origin/master' 2023-02-21 14:15:07 +08:00
Omair Saleh 2d9482feb6 fix bug when container schedule has issue 2023-02-21 14:14:38 +08:00
edmondlang 615e3e7683 update export-customer-order 2023-02-21 09:58:47 +08:00
edmondlang 32936af538 update export-customer-order 2023-02-20 22:14:09 +08:00
edmondlang 7f4fdf0191 update export-customer-order 2023-02-20 20:31:52 +08:00
edmondlang 1c4d9520f9 update export-customer-order 2023-02-20 20:23:02 +08:00
edmondlang 6c7685dac2 update export-customer-order 2023-02-20 20:17:48 +08:00
edmondlang e95c41bd3e Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-20 19:51:11 +08:00
edmondlang 4653e8403b export-customer-order 2023-02-20 19:50:53 +08:00
edmondlang 903269e714 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-20 18:22:48 +08:00
edmondlang a648a11567 Nana from the Digital marketing department has requested to remove the text 2023-02-20 18:22:21 +08:00
edmondlang 4120a50559 commented on the web routes and api routes to test on the crm 2023-02-18 23:09:24 +08:00
Dillon 88b31f2d3f Merge branch 'dillon/crm-integration' into development 2023-02-18 21:08:08 +08:00
Dillon cb8d808562 done debugging, undo changes 2023-02-18 21:07:50 +08:00
Dillon a2f9bf83ce Merge branch 'dillon/crm-integration' into development 2023-02-18 20:29:57 +08:00
Dillon 130aca262a debug 2023-02-18 20:29:49 +08:00
Dillon dd2ac4c966 Merge branch 'dillon/crm-integration' into development 2023-02-18 20:09:08 +08:00
Dillon 06ab1be86e debug 2023-02-18 20:08:53 +08:00
Omair Saleh a78ed8271f auto generate invoices 2023-02-17 13:56:42 +08:00
Omair Saleh 16ce06ba7e auto generate invoices 2023-02-17 13:49:02 +08:00
Omair Saleh 5335b8affb auto generate invoices 2023-02-17 13:48:26 +08:00
Omair Saleh 6d1153298c auto generate invoices 2023-02-17 13:47:34 +08:00
Omair Saleh 8f65767996 auto generate invoices 2023-02-17 13:47:02 +08:00
Omair Saleh 4bba550b9e auto generate invoices 2023-02-17 13:46:16 +08:00
Omair Saleh b33b780563 auto generate invoices 2023-02-17 13:45:00 +08:00
Omair Saleh 342285247a auto generate invoices 2023-02-17 13:41:04 +08:00
Omair Saleh 0c82aa17fc auto generate invoices 2023-02-17 13:40:13 +08:00
Omair Saleh ed36b85a3d auto generate invoices 2023-02-17 13:20:55 +08:00
Omair Saleh 4f8e9fbd5f auto generate invoices 2023-02-17 13:10:02 +08:00
Omair Saleh ee575c21ea auto generate invoices 2023-02-17 13:06:52 +08:00
Omair Saleh f4f8c34cb9 auto generate invoices 2023-02-17 13:04:05 +08:00
Omair Saleh 7cb27a6114 auto generate invoices 2023-02-17 13:02:18 +08:00
Omair Saleh 2f4b568c9a auto generate invoices 2023-02-17 12:53:35 +08:00
Omair Saleh a23e0b35a2 auto generate invoices 2023-02-17 12:53:10 +08:00
Omair Saleh 598ca3807e auto generate invoices 2023-02-17 12:52:39 +08:00
Omair Saleh 0654f0335b auto generate invoices 2023-02-17 12:51:15 +08:00
Omair Saleh e4610e1a53 auto generate invoices 2023-02-17 12:50:37 +08:00
Omair Saleh 38ae8f72eb auto generate invoices 2023-02-17 12:49:55 +08:00
Omair Saleh cbdd4e8137 auto generate invoices 2023-02-17 12:49:27 +08:00
Omair Saleh c4d2b4e476 auto generate invoices 2023-02-17 12:48:48 +08:00
Omair Saleh 7eab58b45e auto generate invoices 2023-02-17 12:47:58 +08:00
Omair Saleh a9b21e9566 auto generate invoices 2023-02-17 12:47:19 +08:00
Omair Saleh 9aec5a71f1 auto generate invoices 2023-02-17 12:46:37 +08:00
Omair Saleh 771b10ffc9 auto generate invoices 2023-02-17 12:35:12 +08:00
Omair Saleh a9d4806a4a auto generate invoices 2023-02-17 12:34:06 +08:00
Omair Saleh 0d0048eb6c debug yd api 2023-02-17 11:11:51 +08:00
Omair Saleh d5f3e9ba71 debug yd api 2023-02-17 11:04:32 +08:00
Omair Saleh 5144e940f2 debug yd api 2023-02-17 10:58:35 +08:00
Omair Saleh 8dac196cb9 debug yd api 2023-02-17 10:58:02 +08:00
Omair Saleh e1bc996efb debug yd api 2023-02-17 10:56:53 +08:00
Omair Saleh ed7019f75e debug yd api 2023-02-17 10:56:25 +08:00
Omair Saleh 0f0a32488a debug yd api 2023-02-17 10:55:46 +08:00
Omair Saleh b3cc805e78 debug yd api 2023-02-17 10:55:00 +08:00
Omair Saleh fd8a09d443 debug yd api 2023-02-17 10:54:22 +08:00
Omair Saleh 8d5603c756 debug yd api 2023-02-17 10:53:58 +08:00
Omair Saleh c3de10f676 debug yd api 2023-02-17 10:53:06 +08:00
Omair Saleh 80a47f05f7 debug yd api 2023-02-17 10:52:18 +08:00
Omair Saleh 53cc2ee493 debug yd api 2023-02-17 10:49:30 +08:00
Omair Saleh fadef468bb debug yd api 2023-02-17 10:46:37 +08:00
Omair Saleh 3f0028aaf1 debug yd api 2023-02-17 10:43:47 +08:00
Omair Saleh 7ea7db9f49 debug yd api 2023-02-17 10:41:41 +08:00
Omair Saleh 7a95741af9 debug yd api 2023-02-17 10:39:36 +08:00
Omair Saleh 75c7772d98 debug yd api 2023-02-17 10:38:03 +08:00
Omair Saleh 851489bd12 debug yd api 2023-02-17 10:36:38 +08:00
Omair Saleh 666b5a7791 debug yd api 2023-02-17 10:35:07 +08:00
Omair Saleh a1461f899b debug yd api 2023-02-17 10:34:32 +08:00
Omair Saleh 2fda9e0c46 debug yd api 2023-02-17 10:33:58 +08:00
Omair Saleh ec2b46b192 debug yd api 2023-02-17 10:33:38 +08:00
Omair Saleh 833c4c5905 debug yd api 2023-02-17 10:33:05 +08:00
Omair Saleh 1aea633375 debug yd api 2023-02-17 10:32:41 +08:00
Omair Saleh cc90c16d9a debug yd api 2023-02-17 10:32:09 +08:00
Omair Saleh 10af83056a debug yd api 2023-02-17 10:31:39 +08:00
Omair Saleh cd930dbaf0 debug yd api 2023-02-17 10:30:46 +08:00
Omair Saleh 2bf3e38ced debug yd api 2023-02-17 10:07:17 +08:00
Omair Saleh 5f4010bb50 debug yd api 2023-02-17 10:03:54 +08:00
Dillon c88f6890d6 Merge branch 'dillon/crm-integration' into development 2023-02-17 09:24:38 +08:00
Dillon 53d076c7e5 CRM integration MVP Phase 1 - minor cleanup 2023-02-17 09:24:13 +08:00
Dillon 1b84ccf60e CRM integration MVP Phase 1 2023-02-17 09:06:18 +08:00
Omair Saleh 5955c1a633 debug yd api 2023-02-17 08:26:13 +08:00
Omair Saleh 7ece4f6470 debug yd api 2023-02-17 06:49:26 +08:00
Omair Saleh e0e82634d3 debug yd api 2023-02-17 06:47:16 +08:00
Omair Saleh 988e798cf1 debug yd api 2023-02-17 06:46:36 +08:00
Omair Saleh 4ce8440724 debug yd api 2023-02-17 06:45:35 +08:00
Omair Saleh e2f5097882 debug yd api 2023-02-17 06:44:56 +08:00
Omair Saleh 9f96caad7c debug yd api 2023-02-17 06:44:33 +08:00
Omair Saleh 3046530f71 debug yd api 2023-02-17 06:43:25 +08:00
Omair Saleh 84a6cb85dd debug yd api 2023-02-17 06:42:33 +08:00
Omair Saleh c86ea9cee4 debug yd api 2023-02-17 06:38:21 +08:00
Omair Saleh ac15f76c4f debug yd api 2023-02-17 06:36:26 +08:00
Omair Saleh 1fc176296e debug yd api 2023-02-17 06:35:29 +08:00
Omair Saleh 3f911f145a debug yd api 2023-02-17 05:45:19 +08:00
Omair Saleh d5c28df748 debug yd api 2023-02-17 05:19:04 +08:00
Omair Saleh 9bfe943898 debug yd api 2023-02-17 05:02:39 +08:00
Omair Saleh dbcbabec93 Merge remote-tracking branch 'origin/master' 2023-02-17 03:39:22 +08:00
Omair Saleh e24cdd82d4 debug yd api 2023-02-17 03:35:43 +08:00
edmondlang bf4b3fa97f Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-16 23:13:22 +08:00
edmondlang 01854a3292 update change company name 2023-02-16 23:09:47 +08:00
edmondlang 6bcea5a8f1 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-16 16:53:12 +08:00
Omair Saleh 679bae6fe8 debug yd api 2023-02-16 16:41:17 +08:00
Omair Saleh f567995202 debug yd api 2023-02-16 16:40:17 +08:00
Omair Saleh 35b3cb4515 debug yd api 2023-02-16 16:39:17 +08:00
Omair Saleh 196cf3d58a debug yd api 2023-02-16 16:32:20 +08:00
Omair Saleh b12a862903 debug yd api 2023-02-16 16:27:53 +08:00
Omair Saleh f586314cd8 debug yd api 2023-02-16 16:24:42 +08:00
Omair Saleh 16f41482ad debug yd api 2023-02-16 16:19:47 +08:00
Omair Saleh 95866b0789 debug yd api 2023-02-14 14:50:45 +08:00
Omair Saleh fb2ba2a3c7 debug yd api 2023-02-14 14:50:03 +08:00
Omair Saleh 3041144968 debug yd api 2023-02-14 14:47:59 +08:00
Omair Saleh 2efdb33b71 debug yd api 2023-02-14 14:47:21 +08:00
Omair Saleh 5716050694 debug yd api 2023-02-14 14:46:51 +08:00
Omair Saleh e22c7c7e8b debug yd api 2023-02-14 14:46:31 +08:00
Omair Saleh d9972a8a95 debug yd api 2023-02-14 14:45:49 +08:00
Omair Saleh 6dbafde89c debug yd api 2023-02-14 14:45:06 +08:00
Omair Saleh 680ddd5066 debug yd api 2023-02-14 14:44:19 +08:00
Omair Saleh f6b5eb3098 debug yd api 2023-02-14 14:43:15 +08:00
Omair Saleh 82f8cae4a8 debug yd api 2023-02-14 14:41:22 +08:00
Omair Saleh 4c868de356 debug yd api 2023-02-14 14:40:30 +08:00
Omair Saleh c44278fe26 debug yd api 2023-02-14 14:38:59 +08:00
Omair Saleh 43c8530e6d debug yd api 2023-02-14 14:37:32 +08:00
Martin Maina Kiragu 2704ec1665 Merge branch 'feature/pipeline' into 'development'
Update .gitlab-ci.yml file

See merge request CIEFWorldwideSdnBhd/shipping-portal!144
2023-02-13 07:28:57 +00:00
Martin Maina Kiragu 0c636d2156 remove spaces on Export warehouse service 2023-02-13 05:17:03 +00:00
Martin Kiragu 1270ba3f43 delete the code ide-helper file 2023-02-13 08:08:06 +03:00
Martin Kiragu f2c32c5024 fix more spaces 2023-02-13 08:07:11 +03:00
Martin Kiragu ccb3bde260 clean up spaces on my branch 2023-02-13 08:01:23 +03:00
Martin Kiragu a7eb14c2b7 Merge branch 'feature/TDD' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into feature/TDD 2023-02-13 07:37:01 +03:00
Martin Kiragu abac96b1e5 revert all models changes 2023-02-13 07:36:40 +03:00
Martin Maina Kiragu ecb48c8897 Merge branch 'master' into 'feature/TDD'
# Conflicts:
#   config/app.php
2023-02-13 04:24:32 +00:00
Martin Maina Kiragu 2686229a0f Merge branch 'master' into 'feature/pipeline'
# Conflicts:
#   config/app.php
2023-02-13 04:12:19 +00:00
Martin Kiragu 558fa7ae52 remove migration and seeder 2023-02-13 06:49:08 +03:00
Martin Kiragu 88e2136c07 add cp .env 2023-02-13 06:47:58 +03:00
Martin Kiragu 70cdcded9b generate key, run migration and database seeder 2023-02-13 06:40:02 +03:00
Martin Kiragu 4022b640f9 test by rerunning the install 2023-02-13 06:31:05 +03:00
Martin Kiragu 0d780074b8 vender test to php 2023-02-13 06:23:53 +03:00
Martin Kiragu 078f675a7f add codeception and change vender test to php 2023-02-13 06:20:42 +03:00
Martin Kiragu 2b48a86f98 comment the Meneses\LaravelMpdf\LaravelMpdfServiceProvider 2023-02-13 06:11:41 +03:00
Martin Maina Kiragu 19f3aa18fc Update .gitlab-ci.yml file
add libzip
2023-02-13 03:07:34 +00:00
Martin Maina Kiragu 2b4c932fc8 Update .gitlab-ci.yml file
add libzip
2023-02-13 03:05:29 +00:00
Martin Maina Kiragu 89f0ca651a Update .gitlab-ci.yml file
add libzip
2023-02-13 03:01:07 +00:00
Martin Maina Kiragu c9fc5938c6 Update .gitlab-ci.yml file
add libzip
2023-02-13 02:55:41 +00:00
Martin Maina Kiragu 2ad8235c1b Update .gitlab-ci.yml file
add libzip
2023-02-13 02:53:22 +00:00
Martin Maina Kiragu dbf8301cb9 Update .gitlab-ci.yml file
add libzip
2023-02-13 02:49:27 +00:00
Martin Maina Kiragu 7d582c6bca Update .gitlab-ci.yml file
add libzip
2023-02-13 02:48:30 +00:00
Martin Maina Kiragu 3c4b6afcb2 Update .gitlab-ci.yml file
add zip
2023-02-13 02:46:21 +00:00
Martin Maina Kiragu e4bc56d188 Update .gitlab-ci.yml file 2023-02-13 02:44:10 +00:00
Martin Maina Kiragu 9a448d5a3d Update .gitlab-ci.yml file 2023-02-13 02:41:24 +00:00
Martin Maina Kiragu 5c1074b244 Update .gitlab-ci.yml file 2023-02-13 02:38:49 +00:00
Martin Maina Kiragu 49fcdfd89e Update .gitlab-ci.yml file 2023-02-13 02:36:51 +00:00
Martin Maina Kiragu c900759234 Update .gitlab-ci.yml file 2023-02-13 02:30:15 +00:00
Martin Maina Kiragu cd3b47ab1a Update .gitlab-ci.yml file 2023-02-13 02:26:31 +00:00
Martin Maina Kiragu c5f95cdf61 Update .gitlab-ci.yml file 2023-02-13 02:22:31 +00:00
Martin Maina Kiragu cc428a92b8 Update .gitlab-ci.yml file 2023-02-13 02:08:09 +00:00
Martin Maina Kiragu 97bac45612 Update .gitlab-ci.yml file 2023-02-13 02:03:30 +00:00
Martin Maina Kiragu 8048396a88 Update .gitlab-ci.yml file 2023-02-13 01:59:14 +00:00
Martin Maina Kiragu 400ec31235 Update .gitlab-ci.yml file 2023-02-13 01:54:53 +00:00
Martin Maina Kiragu 4d9346c62c Update .gitlab-ci.yml file 2023-02-13 01:49:47 +00:00
Martin Maina Kiragu 94fd2069e8 Update .gitlab-ci.yml file 2023-02-13 01:43:41 +00:00
Martin Maina Kiragu 1f401eb347 Update .gitlab-ci.yml file 2023-02-13 01:39:09 +00:00
Martin Maina Kiragu 80e282bda0 Update .gitlab-ci.yml file 2023-02-13 01:35:00 +00:00
Martin Maina Kiragu 65cd6aae3c Update .gitlab-ci.yml file 2023-02-13 01:33:05 +00:00
Martin Maina Kiragu eba2a30024 Update .gitlab-ci.yml file 2023-02-13 01:28:16 +00:00
Martin Maina Kiragu c103deb2a7 Update .gitlab-ci.yml file 2023-02-13 01:25:16 +00:00
Martin Maina Kiragu dcef782587 Update .gitlab-ci.yml file
--update to php 7.4
2023-02-13 01:22:54 +00:00
Martin Maina Kiragu 10e7da4673 Update .gitlab-ci.yml file 2023-02-13 01:15:20 +00:00
Martin Kiragu faff35f241 update the pipeline with master branch code 2023-02-13 04:07:33 +03:00
Martin Maina Kiragu e2c1562f19 Update .gitlab-ci.yml file 2023-02-13 00:57:12 +00:00
Martin Maina Kiragu df35ceb798 Update .gitlab-ci.yml file 2023-02-13 00:51:03 +00:00
Martin Maina Kiragu cdb81a0bf4 Update .gitlab-ci.yml file 2023-02-13 00:48:41 +00:00
Martin Maina Kiragu f1b1955190 Update .gitlab-ci.yml file 2023-02-13 00:42:05 +00:00
Martin Maina Kiragu 860632b7a3 Update .gitlab-ci.yml file 2023-02-13 00:39:49 +00:00
Martin Maina Kiragu bde7a61fb4 Update .gitlab-ci.yml file 2023-02-13 00:35:42 +00:00
edmondlang 198e0674bd Merge branch 'update-laravelmpdf' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal 2023-02-10 23:10:34 +08:00
edmondlang b6600c5168 Merge branch 'update-laravelmpdf' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-10 20:56:42 +08:00
edmondlang 7d09205817 update laravel mpdf 2023-02-10 20:55:32 +08:00
edmondlang 5f5dbeb3d1 update ExportsWarehousePackingList to only johor state 2023-02-08 18:59:09 +08:00
edmondlang 67a877ca15 update laravel mpdf 2023-02-07 23:54:33 +08:00
edmondlang 25f38ef7fe Merge branches 'development' and 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-07 23:40:38 +08:00
edmondlang 88e7bf44b5 update code on the prefix 'NX' 2023-02-07 23:40:24 +08:00
edmondlang ddeb44b920 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-07 23:32:35 +08:00
edmondlang 86461c19a1 add export function - export/packing-list-warehouse/guangzhou2-to-johor
add warehouse prefix 'NX/'
2023-02-07 23:32:18 +08:00
Martin Maina Kiragu 02be710203 Update .gitlab-ci.yml file try php 7.3 2023-02-06 16:14:50 +00:00
Martin Maina Kiragu 2ffbfc9f1c Update .gitlab-ci.yml file 2023-02-06 16:12:41 +00:00
Martin Maina Kiragu 7b34f8116c Update .gitlab-ci.yml file 2023-02-06 16:09:41 +00:00
Martin Maina Kiragu 8a9b6df255 Update .gitlab-ci.yml file 2023-02-06 16:04:42 +00:00
Martin Kiragu c881dd44d6 updated action file 2023-02-06 18:38:12 +03:00
Martin Kiragu 1cfaeaf8bb add triggers 2023-02-06 18:28:46 +03:00
Martin Kiragu 914f29184d simple pipeline configuration 2023-02-06 18:23:51 +03:00
edmondlang 18d1841a30 Merge branch 'change-company-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal 2023-02-06 23:10:00 +08:00
edmondlang f510d57463 Merge branch 'change-company-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-06 23:08:03 +08:00
edmondlang 990508501d revert testing code 2023-02-06 23:07:41 +08:00
edmondlang 7833c17938 Merge branch 'change-company-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-06 23:02:43 +08:00
edmondlang dfec2073b0 update change company and debtor code 2023-02-06 23:02:02 +08:00
edmondlang 97fdffe6eb Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-06 22:46:53 +08:00
edmondlang 2300d237d3 Merge branch 'change-company-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal 2023-02-06 22:43:24 +08:00
edmondlang a62e5d95fb add debtor in company resource folder 2023-02-06 22:33:57 +08:00
edmondlang b1f2900f1c Merge branch 'change-company-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-06 22:25:33 +08:00
edmondlang ddf015dc71 Revert "work on combine invoices"
This reverts commit 2a9d4fd212.
2023-02-06 22:24:48 +08:00
edmondlang 2d8535b7f5 change company name and debtor code 2023-02-06 22:24:00 +08:00
Sheikh Ahmer 2a9d4fd212 work on combine invoices 2023-02-04 16:36:09 +05:00
Martin Kiragu 2cacc23a38 login acceptance test 2023-02-04 10:04:34 +03:00
Martin Kiragu a7fd5a038e Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into feature/TDD 2023-02-04 07:53:45 +03:00
edmondlang 626b31084f Merge branch 'wip-invoice-tab' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-02-03 16:11:48 +08:00
edmondlang 3f21802090 update customer payment billing section component 2023-02-03 16:10:57 +08:00
Martin Kiragu 4f3c25d5bd Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into feature/TDD 2023-01-29 10:51:30 +03:00
Martin Kiragu 8da942e41e updated list of all user, passwords and emails unit tests 2023-01-28 12:56:41 +03:00
edmondlang e8191df0e9 update company invoice endpoint and customer payment-and-billing page design 2023-01-28 02:19:51 +08:00
edmondlang 02064ad68e reverse commit on app.php - Meneses\LaravelMpdf\LaravelMpdfServiceProvider::class 2023-01-28 01:15:46 +08:00
Wafie 13319aacff wip-invoice-tab 2023-01-26 21:36:52 +08:00
edmondlang 996ef4205f update multi invoice combined summary 2023-01-20 17:50:19 +08:00
edmondlang b599c8a151 Merge branch 'multi-invoice-combined-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-01-20 17:15:25 +08:00
edmondlang 0aaa7f486a debug multi invoicve combines ui 2023-01-20 17:14:59 +08:00
Martin Kiragu d41f796825 fix access_token issue 2023-01-20 10:39:39 +03:00
Martin Kiragu dd612e2660 fix issues 2023-01-19 12:12:54 +03:00
Martin Kiragu c503b5e677 acceptance test set up and demo 2023-01-19 12:03:09 +03:00
Martin Kiragu 0b433cfa18 ed debug 2023-01-19 09:39:16 +03:00
Martin Kiragu 75aba8c4ac remove password related tests on auth test class 2023-01-19 09:39:16 +03:00
Martin Kiragu 81c65874a3 added the Auth tdd and a modal property autogenerator helpers 2023-01-19 09:39:15 +03:00
Martin Kiragu 79d29d9c7b Authentication TDD 2023-01-19 09:39:15 +03:00
Martin Kiragu 1e558b93af set up testig env codeception laravela and phpunit 2023-01-19 09:39:15 +03:00
edmondlang 6d3d52639e Merge branch 'multi-invoice-combined-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-01-19 00:33:37 +08:00
edmondlang 35dc74c3bb update shipping invoice 2023-01-19 00:33:09 +08:00
edmondlang a1d460aa6c Merge branch 'multi-invoice-combined-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-01-19 00:20:38 +08:00
edmondlang 0310138644 add href link to payment and billing page 2023-01-19 00:20:16 +08:00
edmondlang 5a0bc7aaea Merge branch 'multi-invoice-combined-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development
# Conflicts:
#	resources/views/pages/pdfs/shipping_invoices_combined.blade.php
2023-01-18 23:59:58 +08:00
edmondlang 7e439a38fd multi invoice combined ui 2023-01-18 23:58:26 +08:00
Martin Kiragu c7962b4231 ed debug 2023-01-18 18:34:18 +03:00
edmondlang 1c800b70ec Merge branch 'multiple-payment-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-invoice-combined-ui 2023-01-18 23:17:57 +08:00
edmondlang c614190de8 combine multi invoice with summary 2023-01-18 23:13:32 +08:00
Martin Kiragu d14bb39ae8 remove password related tests on auth test class 2023-01-18 09:11:30 +03:00
Martin Kiragu 5cc2f51c02 added the Auth tdd and a modal property autogenerator helpers 2023-01-18 08:17:05 +03:00
Martin Kiragu a185f73e8a Authentication TDD 2023-01-16 14:40:57 +03:00
edmondlang f9a9598210 Merge branch 'dillon/search-marking-by-email' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-01-15 14:20:38 +08:00
sharifcse57 d91e0e56c3 Create option: Update customer name by pop up modal 2023-01-12 22:37:59 +06:00
edmondlang 9976ccec41 Merge branch 'ChangeCompanie' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-01-11 22:39:58 +08:00
edmondlang 8bfb2d749a Merge branch 'dillon/multiple-invoices-combined' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2023-01-11 18:25:28 +08:00
Martin Kiragu 7bf9a570a1 set up testig env codeception laravela and phpunit 2023-01-11 12:44:32 +03:00
Cleison Freitas df283e54a2 Company rename endpoint. 2023-01-10 23:03:35 -03:00
edmondlang b38df170e8 Merge branch 'multiple-payment-ui' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into development 2023-01-09 22:58:10 +08:00
edmondlang 769b5dd050 multi payment ui 2023-01-09 22:57:30 +08:00
Dillon bf38ace70c Multiple invoices into one 2023-01-07 11:51:27 +08:00
edmondlang 66c008f97e Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into development 2023-01-03 13:49:15 +08:00
edmondlang 0298eb946f Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into activity-route-log-dev 2023-01-02 17:41:29 +08:00
edmondlang 70fb35e37c api and web route logs 2023-01-02 17:41:00 +08:00
edmondlang 1a30877ca9 activity route log dev 2022-12-31 11:53:41 +08:00
WAKOYA_KUMSA\waqo1 569a22c0db route activity log 2022-12-28 13:15:15 +03:00
edmondlang 851e2e1815 multi payment ui 2022-12-24 16:39:17 +08:00
edmondlang 503bc90556 multiple payment ui 2022-12-23 16:37:06 +08:00
Dillon 515c71daa7 Merge branch 'dillon/setup-docker-2' into dillon/crm-integration 2022-12-06 08:34:29 +08:00
Dillon a041a70d93 Merge branch 'dillon/setup-docker' into dillon/setup-docker-2 2022-11-16 11:07:30 +08:00
Dillon d4c9899120 Dockerising shipping-portal usign the same setting from exchange-2.0.
Update gitignore to include docker-compose.yml (same as exchange-2.0)
2022-11-02 05:56:06 +08:00
404 changed files with 20085 additions and 1635 deletions
+8 -2
View File
@@ -10,9 +10,9 @@ LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_DATABASE=shpping_portal
DB_USERNAME=root
DB_PASSWORD=
DB_PASSWORD=root
BROADCAST_DRIVER=log
CACHE_DRIVER=file
@@ -55,3 +55,9 @@ EXCHANGE_URL=https://dev.exchange.cief-malaysia.com/
MIX_EXCHANGE_URL="${EXCHANGE_URL}"
YD_API_CODE=''
JWT_SECRET=Btj63iMEleEaww6Bb2IBECkxWn7YHPhhPFluAkg9DfcQik0qDRy6QW75ABGmPT2h
PERFEXCRM_BASE_URL=""
PERFEXCRM_API_KEY=""
PERFEXCRM_IS_ENABLED="false"
+59
View File
@@ -0,0 +1,59 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:rIar2fvNeRzQdvKOgLUg03detGDMx6ym2SYFRjawrAc=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=shpping_portal
DB_USERNAME=root
DB_PASSWORD=P@ssw0rd
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
UNITY_APP_URL="https://unity.izyim.com"
EXCHANGE_URL=https://dev.exchange.cief-malaysia.com/
MIX_EXCHANGE_URL="${EXCHANGE_URL}"
YD_API_CODE=''
JWT_SECRET=Btj63iMEleEaww6Bb2IBECkxWn7YHPhhPFluAkg9DfcQik0qDRy6QW75ABGmPT2h
+5 -1
View File
@@ -2,6 +2,8 @@
/public/hot
/public/storage
/storage/*.key
/tests/_output
/tests/_support
/vendor
**/.idea/
.env
@@ -21,8 +23,10 @@ gox.iml
rebuild_docker.sh
docker/*
db/*
docker-compose.yml
package-lock.json
public/*
/public/*
storage/framework/laravel-excel/*
.vapor/
.env.production
.env.staging
+48
View File
@@ -0,0 +1,48 @@
image: php:7.4
stages:
- deploy
#jobs
#deploy
deploy:
stage: deploy
before_script:
- apt-get update -yqq
- apt-get install -yqq
- apt-get install -y libonig-dev
- apt-get install -y libxml2-dev
- apt-get install -y libzip-dev
- apt-get install -y libgd-dev
- apt-get install -y libgd-dev
# Install PDO MySQL extension
- docker-php-ext-install pdo_mysql
# Install php dependencies
- docker-php-ext-install mbstring xml zip gd
# Install composer package manager
- curl --location --output /usr/local/bin/composer https://getcomposer.org/download/latest-stable/composer.phar
- chmod +x /usr/local/bin/composer
# Install node js
- apt-get update && apt-get install -y nodejs npm
# Install docker
- apt-get update
- apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release software-properties-common
- curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
- apt-get update
- apt-get install -y docker-ce docker-ce-cli containerd.io
- service docker start
# Install gulp Js
- npm install -g gulp-cli
script:
- composer install
- vendor/bin/vapor deploy production --message="$CI_COMMIT_MESSAGE"
only:
- test
+20 -43
View File
@@ -1,62 +1,39 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
## Shipping portal documentation
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
simple documentation on how to install, run, test, commit and deploy application
## About Laravel
## creating and running unit tests
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
Required Tools
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
- Chromium Driver / selenium
- add running and setting selenium on all OS if possible
Laravel is accessible, powerful, and provides tools required for large, robust applications.
Required Packages :
## Learning Laravel
- laravel/legacy-factories
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
- codeception/codeception
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
Or Simply Run
## Laravel Sponsors
``Composer install``
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
To create a unit test
### Premium Partners
``php artisan make test: Test Example --unit``
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
Running the tests :
## Contributing
Running a single Test
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
`` php artisan test --filter Example``
## Code of Conduct
Running Unit tests -
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
`` php artisan test ``
## Security Vulnerabilities
Running Codeception tests -
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
``vendor/bin/codecept run``
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
@@ -0,0 +1,19 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class AmountExceed implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('amount', '>', $value);
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class AmountShort implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('amount', '<', $value);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class CreatedBefore implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('created_at', '<', Carbon::parse($value));
}
}
@@ -0,0 +1,18 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class DoesNotHaveGroups implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereDoesntHave('groups');
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use App\Classes\ValueObjects\Constants\TransactionType;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class DoesNotHavePaymentStatusIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereDoesntHave('transactions', function (Builder $query) use($value) {
$query->where('type', TransactionType::PAYMENT)->whereIn('status', $value);
});
}
}
@@ -15,7 +15,7 @@ class DoesNotHaveTransactionType implements Filter
public static function apply(Builder $builder, $value)
{
return $builder->whereDoesntHave('transactions', function (Builder $query) use($value) {
$query->where('type', $value);
$query->where('type', $value)->whereIn('status', [0,1,2,3]);
})->whereHas('containers', function ($query){
return $query->whereDate('loading_date', '>=', Carbon::parse('20-09-2022'));
});
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class EmailLike implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('email', 'LIKE', '%'.$value.'%');
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use App\Classes\ValueObjects\Constants\TransactionType;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class HavePaymentStatusNotIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereHas('transactions', function (Builder $query) use($value) {
$query->where('type', TransactionType::PAYMENT)->whereNotIn('status', $value);
});
}
}
@@ -0,0 +1,18 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class IdNext implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('id', '>', $value);
}
}
@@ -0,0 +1,18 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class NextMainQuestion implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('next_main_question', $value);
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use App\Models\Order;
use Illuminate\Database\Eloquent\Builder;
class OrderMarkingIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereHas('owner', function($query) use ($value) {
$query->where('reference', 'LIKE', '%' . $value . '%');
});
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class OwnerType implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('owner_type', $value);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class PaymentMethod implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('payment_method', $value);
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class QuestionId implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('question_id', $value);
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class QuestionNumber implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('question_number', $value);
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class QuestionnaireSetId implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('questionnaire_set_id', $value);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class Receiver implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('receiver', '=', $value);
}
}
@@ -0,0 +1,18 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class UserId implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('user_id', $value);
}
}
+19 -2
View File
@@ -2,8 +2,8 @@
namespace App\Classes\General;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Log;
class Helper
{
@@ -24,4 +24,21 @@ class Helper
return array_slice(get_class_methods($className), 1);
}
}
/**
* @param $log
* @return none
*/
static function debugLoggerForPerfexCRM($log){
if($log){
$message = $log['message'];
$substring = 'No data were found';
if (isset($message)) {
if (strpos($message, $substring) !== false) {
// Log::info('Message exist');
} else {
Log::info($log['message']);
}
}
}
}
}
@@ -0,0 +1,41 @@
<?php
namespace App\Classes\Jobs;
use App\Classes\Modules\PerfexCRM\Processors\CreatePerfexCRMLeadProcessor;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMLead;
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMLead;
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\PerfexCRM\DataTransferObjects\CreateLeadPerfexCRMObject;
class CreatePerfexCRMCustomer implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var CreateLeadPerfexCRMObject */
private $createLeadPerfexCRMObject;
/**
* CreatePerfexCRMCustomer constructor.
* @param CreateLeadPerfexCRMObject $createLeadPerfexCRMObject
*/
public function __construct(CreateLeadPerfexCRMObject $createLeadPerfexCRMObject)
{
$this->createLeadPerfexCRMObject = $createLeadPerfexCRMObject;
}
public function handle()
{
$lead = (App()->make(FetchesPerfexCRMLead::class))->execute($this->createLeadPerfexCRMObject->getEmail());
if(!is_null($lead)){
(App()->make(UpdatesPerfexCRMLead::class))->execute($lead, $this->createLeadPerfexCRMObject->getCompanyReference());
}
else{
(App()->make(CreatePerfexCRMLeadProcessor::class))->execute($this->createLeadPerfexCRMObject);
}
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Classes\Jobs;
use App\Classes\Modules\PerfexCRM\Processors\CreatePerfexCRMInvoiceProcessor;
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\Transaction;
class CreatePerfexCRMInvoice implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var Transaction $transaction*/
private $transaction;
/**
* CreatePerfexCRMInvoice constructor.
* @param Transaction $transaction
*/
public function __construct(Transaction $transaction)
{
$this->transaction = $transaction;
}
public function handle()
{
(App()->make(CreatePerfexCRMInvoiceProcessor::class))->execute($this->transaction);
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Classes\Jobs;
use App\Classes\Modules\PerfexCRM\Processors\CreatePerfexCRMTaskProcessor;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMLead;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateTaskPerfexCRMObject;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class CreatePerfexCRMSingleTask implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var FetchesPerfexCRMLead */
private $fetchesPerfexCRMLead;
/** @var CreateTaskPerfexCRMObject */
private $createTaskPerfexCRMObject;
/**
* CreatePerfexCRMSingleTask constructor.
* @param CreateTaskPerfexCRMObject $createTaskPerfexCRMObject
*/
public function __construct(CreateTaskPerfexCRMObject $createTaskPerfexCRMObject)
{
$this->createTaskPerfexCRMObject = $createTaskPerfexCRMObject;
}
public function handle()
{
$lead = (App()->make(FetchesPerfexCRMLead::class))->execute($this->createTaskPerfexCRMObject->getEmail());
if(!is_null($lead))
{
$this->createTaskPerfexCRMObject->setLeadId($lead->id);
(App()->make(CreatePerfexCRMTaskProcessor::class))->execute($this->createTaskPerfexCRMObject);
}
}
}
@@ -2,8 +2,12 @@
namespace App\Classes\Jobs;
use App\Classes\Modules\PackingLists\Processors\FetchContainersFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\FetchContainersUpdatesFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\FetchDeliveryUpdatesFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\FetchOrderListsFromYdPortalProcessor;
use App\Classes\Modules\PackingLists\Processors\FetchPackingListsFromYdPortalProcessor;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@@ -25,8 +29,12 @@ class FetchOrdersFromYDPortalJob implements ShouldQueue
*/
public function handle()
{
(App()->make(FetchPackingListsFromYdPortalProcessor::class))->execute();
(App()->make(FetchContainersFromYdPortalProcessor::class))->execute();
(App()->make(FetchContainersUpdatesFromYdPortalProcessor::class))->execute();
(App()->make(FetchDeliveryUpdatesFromYdPortalProcessor::class))->execute();
(App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute();
// (App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute();
}
}
+54
View File
@@ -0,0 +1,54 @@
<?php
namespace App\Classes\Jobs;
use App\Classes\Modules\PerfexCRM\Processors\UpdatePerfexCRMProcessor;
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\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
class UpdatePerfexCRM implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var UpdatePerfexCRMObject */
private $updatePerfexCRMObject;
/** @var UpdatePerfexCRMInvoice */
private $nextJob;
/** @var */
private $transaction;
/**
* UpdatePerfexCRM constructor.
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
* @param UpdatePerfexCRMInvoice $nextJob
* @param $transaction
*/
public function __construct(UpdatePerfexCRMObject $updatePerfexCRMObject, $transaction, $nextJob)
{
$this->updatePerfexCRMObject = $updatePerfexCRMObject;
$this->nextJob = $nextJob;
$this->transaction = $transaction;
}
public function handle()
{
$result = (App()->make(UpdatePerfexCRMProcessor::class))->execute($this->updatePerfexCRMObject);
if($this->nextJob != null && $this->transaction != null){
$updatePerfexCRMInvoiceOject = new UpdatePerfexCRMInvoiceObject(
$this->updatePerfexCRMObject->getContactEmail(),
$result->projectId,
$this->transaction,
true
);
/** @var UpdatePerfexCRMInvoice $nextJob */
$this->nextJob::dispatch($updatePerfexCRMInvoiceOject);
}
}
}
@@ -0,0 +1,98 @@
<?php
namespace App\Classes\Jobs;
use App\Classes\Modules\PerfexCRM\Processors\CreatePerfexCRMInvoiceProcessor;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMInvoicePayment;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMCustomer;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMInvoice;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMProject;
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMInvoice;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePaymentPerfexCRMObject;
use App\Classes\ValueObjects\Constants\PerfexCRMInvoiceStatus;
use App\Models\PackingList;
use App\Models\Transaction;
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 Carbon\Carbon;
use App\Classes\General\Helper;
class UpdatePerfexCRMInvoice implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var UpdatePerfexCRMInvoiceObject */
private $updatePerfexCRMInvoiceObject;
/**
* CreatePerfexCRMSingleTask constructor.
* @param UpdatePerfexCRMInvoiceObject $createTaskPerfexCRMObject
*/
public function __construct(UpdatePerfexCRMInvoiceObject $updatePerfexCRMInvoiceObject)
{
$this->updatePerfexCRMInvoiceObject = $updatePerfexCRMInvoiceObject;
}
public function handle()
{
//get the client id
$customer = (App()->make(FetchesPerfexCRMCustomer::class))->execute($this->updatePerfexCRMInvoiceObject->getEmail());
$transaction = $this->updatePerfexCRMInvoiceObject->getTransaction();
//get the invoice id
$invoiceId = 0;
$invoiceStatus = 0;
$invoice = (App()->make(FetchesPerfexCRMInvoice::class))->execute($customer->userid,"INV-", $transaction->owner->bill_no);
Log::error(json_encode('UpdatePerfexCRMInvoice debug $transaction->owner->bill_no: '.$transaction->owner->bill_no));
if(is_null($invoice)){
$result = (App()->make(CreatePerfexCRMInvoiceProcessor::class))->execute($transaction->owner, $this->updatePerfexCRMInvoiceObject->getIsPaid());
if ($result) {
$invoiceId = $result->payload['id'];
} else {
// Log::error(json_encode('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed'));
Helper::debugLoggerForPerfexCRM('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed');
}
}
else{
$invoiceId = $invoice->id;
$invoiceStatus = $invoice->status;
//This only run when invoice already exist and the invoice does not have a PAID status
if($invoiceStatus != PerfexCRMInvoiceStatus::PAID){
Log::error(json_encode('UpdatePerfexCRMInvoice debug $this->updatePerfexCRMInvoiceObject->getProjectId(): '.$this->updatePerfexCRMInvoiceObject->getProjectId()));
//update invoice
(App()->make(UpdatesPerfexCRMInvoice::class))->execute($invoice, $this->updatePerfexCRMInvoiceObject->getProjectId());
}
}
//create invoice payment
if($invoiceId != 0 && $invoiceStatus != PerfexCRMInvoiceStatus::PAID){
$date = Carbon::parse($transaction->created_at)->format('Y-m-d');
$invoicePaymentPerfexCRMObject = new InvoicePaymentPerfexCRMObject(
$invoiceId,
"$transaction->amount",
$date,
1,
"",
""
);
(App()->make(CreatesPerfexCRMInvoicePayment::class))->execute($invoicePaymentPerfexCRMObject);
}
}
public function delay($delay)
{
// Add delay in seconds to the job
$this->delay = $delay;
return $this;
}
}
@@ -0,0 +1,96 @@
<?php
namespace App\Classes\Jobs;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
use App\Models\PackingList;
use App\Models\Transaction;
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 UpdatePerfexCRMPrelude implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/** @var */
private $packingList;
/** @var */
private $transaction;
/** @var UpdatePerfexCRMObject */
private $updatePerfexCRMObject;
/** @var UpdatePerfexCRM */
private $nextJob1;
/** @var UpdatePerfexCRMInvoice */
private $nextJob2;
/**
* UpdatePerfexCRMPrelude constructor.
* @param $packingList
* @param $transaction
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
* @param UpdatePerfexCRM $nextJob1
* @param UpdatePerfexCRMInvoice $nextJob2
*/
public function __construct($packingList, $transaction, UpdatePerfexCRMObject $updatePerfexCRMObject, $nextJob1, $nextJob2)
{
$this->packingList = $packingList;
$this->transaction = $transaction;
$this->updatePerfexCRMObject = $updatePerfexCRMObject;
$this->nextJob1 = $nextJob1;
$this->nextJob2 = $nextJob2;
}
public function handle()
{
if(is_null($this->packingList)){
$this->packingList = $this->transaction->owner->owner;
}
$amount = 0.00;
if(!is_null($this->transaction)){
$amount = $this->transaction->amount;
}
$data = [
'amount' => number_format($amount, 2, '.', ''),
'link_order' => config('app.url').'/order/show/'.$this->packingList->owner->reference,
'link_autocount_or' => 'https://docs.google.com/spreadsheets/d/1Q3rJBGQ9Bo04HZp5WR9zbLp7pIW2kfDYsabxG7JON-4/edit#gid=2013983170',
'link_perfex' => 'https://perfex.cief-malaysia.com/admin/projects/view/89',
];
$result = $this->replacePlaceholders($this->updatePerfexCRMObject->getTasks(), $data);
$this->updatePerfexCRMObject->setTasks($result);
/** @var UpdatePerfexCRM $nextJob1 */
/** @var UpdatePerfexCRMInvoice $nextJob2 */
$this->nextJob1::dispatch($this->updatePerfexCRMObject, $this->transaction, $this->nextJob2);
}
function replacePlaceholders($template, $data, $prefix = '')
{
foreach ($template as $key => $value) {
foreach ($data as $dataKey => $dataValue) {
if (is_array($dataValue)) {
$template[$key] = $this->replacePlaceholders($template[$key], $dataValue, $dataKey);
} else {
if ($prefix != '') {
$template[$key] = str_replace('{' .$prefix. "." .$dataKey . '}', $dataValue, $template[$key]);
} else {
$template[$key] = str_replace('{' . $dataKey . '}', $dataValue, $template[$key]);
}
}
}
}
return $template;
}
}
@@ -8,23 +8,27 @@ use App\Classes\General\Services\GeneratesInitials;
use App\Classes\Modules\Accounts\Processors\AuthenticationProcessor;
use App\Classes\Modules\Accounts\Processors\CreateUserProcessor;
use App\Classes\Modules\Accounts\Processors\GenerateEmailVerificationAttemptProcessor;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\PerfexCRM\Processors\CreatePerfexCRMLeadProcessor;
use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateLeadPerfexCRMObject;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\CompanyType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Classes\Jobs\CreatePerfexCRMCustomer;
use App\Models\Company;
use App\Models\CompanyModule;
use App\Models\User;
@@ -80,6 +84,9 @@ class CreateCustomerLogic extends AbstractControllerLogic
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
/** @var CreatePerfexCRMLeadProcessor */
private $createPerfexCRMLeadProcessor;
/**
* CreateCustomerLogic constructor.
* @param CreateUserProcessor $createUserProcessor
@@ -93,8 +100,9 @@ class CreateCustomerLogic extends AbstractControllerLogic
* @param AuthenticationProcessor $authenticationProcessor
* @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor
* @param FetchesCompanyModule $fetchesCompanyModule
* @param CreatePerfexCRMLeadProcessor $createPerfexCRMLeadProcessor
*/
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, FetchesCompanyModule $fetchesCompanyModule)
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, FetchesCompanyModule $fetchesCompanyModule, CreatePerfexCRMLeadProcessor $createPerfexCRMLeadProcessor)
{
$this->createUserProcessor = $createUserProcessor;
$this->createCompanyProcessor = $createCompanyProcessor;
@@ -107,6 +115,7 @@ class CreateCustomerLogic extends AbstractControllerLogic
$this->authenticationProcessor = $authenticationProcessor;
$this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor;
$this->fetchesCompanyModule = $fetchesCompanyModule;
$this->createPerfexCRMLeadProcessor = $createPerfexCRMLeadProcessor;
}
/**
@@ -146,6 +155,18 @@ class CreateCustomerLogic extends AbstractControllerLogic
$this->uploadIdentityDocumentProcessor->execute($request, $company);
if(config('perfexcrm.is_enabled') == 'true'){
// $this->createPerfexCRMLeadProcessor->execute($request);
$createLeadPerfexCRMObject = new CreateLeadPerfexCRMObject(
$request->input('name'),
$request->input('email'),
$request->input('phone'),
$request->input('type') === CompanyType::COMPANY_BUSINESS ? $request->input('company_name') : $request->input('name'),
$connection->invitee_reference
);
CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject);
}
// $this->generateEmailVerificationAttemptProcessor->execute($user);
return $this->response($this->authenticationProcessor->execute($request));
@@ -4,7 +4,7 @@ namespace App\Classes\Modules\Accounts\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Accounts\Services\UpdatesUser;
use App\Classes\Modules\Accounts\Services\UpdatesUserFullName;
use App\Classes\Modules\Accounts\Services\FetchesUser;
use App\Classes\Modules\Accounts\Standards\Rules\CanUpdateUser;
use App\Classes\Modules\Accounts\DataTransferObjects\FullNameObject;
@@ -29,8 +29,8 @@ class UpdateUserLogic extends AbstractControllerLogic
/** @var CanUpdateUser */
private $canUpdateUser;
/** @var UpdatesUser */
private $updatesUser;
/** @var UpdatesUserFullName */
private $updatesUserFullName;
/** @var FetchesUser */
private $fetchesUser;
@@ -38,13 +38,13 @@ class UpdateUserLogic extends AbstractControllerLogic
/**
* UpdateAddressLogic constructor.
* @param CanUpdateUser $canUpdateUser
* @param UpdatesUser $updatesUser
* @param UpdatesUserFullName $updatesUserFullName
* @param FetchesUser $fetchesUSer
*/
public function __construct(CanUpdateUser $canUpdateUser, UpdatesUser $updatesUser, FetchesUser $fetchesUser)
public function __construct(CanUpdateUser $canUpdateUser, UpdatesUserFullName $updatesUserFullName, FetchesUser $fetchesUser)
{
$this->canUpdateUser = $canUpdateUser;
$this->updatesUser = $updatesUser;
$this->updatesUserFullName = $updatesUserFullName;
$this->fetchesUser = $fetchesUser;
}
@@ -64,7 +64,7 @@ class UpdateUserLogic extends AbstractControllerLogic
$query = $this->fetchesUser->execute(['id' => $request->route('id')]);
$query = $this->updatesUser->execute($query, $object);
$query = $this->updatesUserFullName->execute($query, $object);
return $this->resourceResponse(new UserResource($query));
@@ -0,0 +1,71 @@
<?php
namespace App\Classes\Modules\Accounts\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Accounts\Services\UpdatesUser;
use App\Classes\Modules\Accounts\Services\FetchesUser;
use App\Classes\Modules\Accounts\Standards\Rules\CanUpdateUser;
use App\Classes\Modules\Accounts\DataTransferObjects\FullNameObject;
use App\Classes\Modules\Accounts\DataTransferObjects\UserObject;
use App\Http\Resources\UserResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateUserRoleLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Updated Admin Role',
'message' => 'You have successfully updated the Admin Role'
];
}
/** @var CanUpdateUser */
private $canUpdateUser;
/** @var UpdatesUser */
private $updatesUser;
/** @var FetchesUser */
private $fetchesUser;
/**
* UpdateAddressLogic constructor.
* @param CanUpdateUser $canUpdateUser
* @param UpdatesUser $updatesUser
* @param FetchesUser $fetchesUSer
*/
public function __construct(CanUpdateUser $canUpdateUser, UpdatesUser $updatesUser, FetchesUser $fetchesUser)
{
$this->canUpdateUser = $canUpdateUser;
$this->updatesUser = $updatesUser;
$this->fetchesUser = $fetchesUser;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$query = $this->fetchesUser->execute(['id' => $request->route('id')]);
$object = new UserObject($query->name, $request->input('type'));
$this->canUpdateUser->passes($object);
$query = $this->updatesUser->execute($query, $object);
return $this->resourceResponse(new UserResource($query));
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Classes\Modules\Accounts\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
class UserObject implements DataTransferObject
{
/** @var string */
private $name;
/** @var int */
private $type;
/**
* FullNameObject constructor.
* @param string $name
*/
public function __construct(string $name, int $type)
{
$this->name = $name;
$this->type = $type;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @return int
*/
public function getType(): int
{
return $this->type;
}
}
@@ -3,7 +3,7 @@
namespace App\Classes\Modules\Accounts\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Accounts\DataTransferObjects\FullNameObject;
use App\Classes\Modules\Accounts\DataTransferObjects\UserObject;
use App\Models\User;
class UpdatesUser extends AbstractUpdateRecord
@@ -11,13 +11,14 @@ class UpdatesUser extends AbstractUpdateRecord
/**
* @param User $model
* @param FullNameObject $object
* @param UserObject $object
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(User $model, FullNameObject $object) {
public function execute(User $model, UserObject $object) {
$model->name = $object->getName();
$model->type = $object->getType();
return $this->handler($model);
}
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\Modules\Accounts\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Accounts\DataTransferObjects\FullNameObject;
use App\Models\User;
class UpdatesUserFullName extends AbstractUpdateRecord
{
/**
* @param User $model
* @param FullNameObject $object
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(User $model, FullNameObject $object) {
$model->name = $object->getName();
return $this->handler($model);
}
}
@@ -0,0 +1,86 @@
<?php
namespace App\Classes\Modules\Addresses\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Addresses\Services\FetchesAddress;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Http\Resources\AddressResource;
use App\Models\Address;
use App\Models\CompanyModule;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreateBillingAddressLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Created Billing Address',
'message' => 'You have successfully created a new Billing Address'
];
}
/** @var CanCreateAddress */
private $canCreateAddress;
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
/** @var CreatesAddress */
private $createsAddress;
/** @var FetchesAddress */
private $fetchesAddress;
/**
* CreateAddressLogic constructor.
* @param CanCreateAddress $canCreateAddress
* @param FetchesCompanyModule $fetchesCompanyModule
* @param CreatesAddress $createsAddress
* @param FetchesAddress $fetchesAddress
*/
public function __construct(CanCreateAddress $canCreateAddress, FetchesCompanyModule $fetchesCompanyModule, CreatesAddress $createsAddress, FetchesAddress $fetchesAddress)
{
$this->canCreateAddress = $canCreateAddress;
$this->fetchesCompanyModule = $fetchesCompanyModule;
$this->createsAddress = $createsAddress;
$this->fetchesAddress = $fetchesAddress;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request) : JsonResponse
{
$companyModule = $this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]);
$billingAddressInputed = $this->fetchesAddress->execute(['id' => $request->input('billing_address_id')]);
if ($billingAddressInputed->type !== AddressType::BILLING || $billingAddressInputed->id !== $companyModule->addresses->where('type', AddressType::BILLING)->first()->id) {
// delete all current billing address
Address::where('owner_type', CompanyModule::class)->where('owner_id', $request->input('company_module_id'))->where('type', AddressType::BILLING)->delete();
// create new billing addrress
$billingAddress = new AddressObject($billingAddressInputed->street_one, $billingAddressInputed->street_two, $billingAddressInputed->country_id, $billingAddressInputed->state_id, $billingAddressInputed->district_id, $billingAddressInputed->postcode, AddressType::BILLING, ApprovalStatus::APPROVED, $billingAddressInputed->reference);
$this->canCreateAddress->passes($billingAddress);
$this->createsAddress->execute($companyModule, $billingAddress);
}
return $this->resourceResponse(new AddressResource($billingAddressInputed));
}
}
@@ -10,7 +10,7 @@ use App\Classes\Modules\Announcements\Services\FetchesAnnouncement;
use App\Classes\Modules\Announcements\Services\UpdatesAnnouncement;
use App\Http\Resources\AnnouncementResource;
use Carbon\Carbon;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -66,8 +66,8 @@ class UpdateAnnouncementLogic extends AbstractControllerLogic
$annoucement_object = new AnnouncementObject(
$request->input('title'),
$request->input('description'),
$request->input('starting_on'),
$request->input('ending_on')
Carbon::createFromFormat('d-m-Y', $request->input('starting_on'))->format('Y-m-d H:i:s'),
Carbon::createFromFormat('d-m-Y', $request->input('ending_on'))->format('Y-m-d H:i:s')
);
$this->canUpdateAnnouncement->passes($annoucement_object);
@@ -4,28 +4,24 @@ namespace App\Classes\Modules\Billplzs\ControllersLogic;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject;
use App\Classes\Modules\Wallets\Services\UpdatesWallet;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Wallets\Services\UpdatesWalletBalance;
use App\Http\Resources\TransactionResource;
use App\Models\Booking;
use App\Models\User;
use App\Models\Wallet;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Processors\CreatePaymentTransactionProcessor;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Group;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
class CallbackBillplzLogic
{
@@ -44,6 +40,12 @@ class CallbackBillplzLogic
/** @var UpdateDoFromYDPortalProcessor */
private $updateDoFromYDPortalProcessor ;
/** @var UpdatesWalletBalance */
private $updatesWalletBalance;
/** @var CreatePaymentTransactionProcessor */
private $createPaymentTransactionProcessor;
/**
* CallbackBillplzLogic constructor.
* @param GetBillplzBill $getBillplzBill
@@ -51,14 +53,17 @@ class CallbackBillplzLogic
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
* @param CreatePaymentTransactionProcessor $createPaymentTransactionProcessor
*/
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, UpdatesWalletBalance $updatesWalletBalance, CreatePaymentTransactionProcessor $createPaymentTransactionProcessor)
{
$this->getBillplzBill = $getBillplzBill;
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
$this->updatesWalletBalance = $updatesWalletBalance;
$this->createPaymentTransactionProcessor = $createPaymentTransactionProcessor;
}
@@ -101,23 +106,51 @@ class CallbackBillplzLogic
$token = Auth::fromUser(User::find(1));
$request->headers->set('Authorization', 'Bearer '.$token);
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED);
// check if is wallet top up
if($transaction->owner instanceof Wallet && $status === ApprovalStatus::APPROVED &&!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
}
if(($invoice->amount - $transaction->amount) < 0.01) {
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
// group payment
if ($transaction->type == TransactionType::GROUP_PAYMENT && $status === ApprovalStatus::APPROVED &&!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
$group = Group::where('reference', $billplzXSignatureObject->getBillPlzId())->first();
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
foreach($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
$this->createPaymentTransactionProcessor->execute($invoice, PaymentMethodType::WALLET, null);
}
if(app()->environment('production')){
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
$group->status = $status;
$group->save();
}
$this->updatesTransactionStatus->execute($transaction, $status);
if (!$transaction->owner instanceof Wallet) {
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
if(($invoice->amount - $totalPaidAmount) < 0.01) {
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
if(app()->environment('production')){
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
}
}
}
$company_module_marking = $transaction->owner->owner->connections? $transaction->owner->owner->connections->first()->invitee_reference: null;
if ($transaction->owner instanceof Wallet) {
$company_module_marking = $transaction->owner->owner->connections? $transaction->owner->owner->connections->first()->invitee_reference: null;
} else {
$company_module_marking = $order->companyModule->connections? $order->companyModule->connections->first()->invitee_reference: null;
}
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $order->reference, 'transaction' => $transaction, 'status' => $status]);
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $order->reference ?? null, 'company_module_marking' => $company_module_marking ?? null, 'transaction' => $transaction, 'status' => $status]);
}
}
@@ -0,0 +1,88 @@
<?php
namespace App\Classes\Modules\Companies\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Companies\Services\UpdatesCompany;
use App\Classes\Modules\Companies\Services\UpdatesCompanyModuleName;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Companies\Standards\Rules\CanUpdateCompany;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Classes\Modules\Companies\Services\UpdatesCompanyDebtor;
use App\Http\Resources\CompanyResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateCompanyNameAndDebtorLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Updated Company Name and Debtor',
'message' => 'You have successfully updated the Company'
];
}
/** @var CanUpdateCompany */
private $canUpdateCompany;
/** @var UpdatesCompany */
private $updatesCompany;
/** @var FetchesCompany */
private $fetchesCompany;
/** @var UpdatesCompanyDebtor */
private $updatesCompanyDebtor;
/** @var UpdatesCompanyModuleName */
private $updatesCompanyModuleName;
/**
* UpdateCompanyControllersLogic constructor.
* @param CanUpdateCompany $canUpdateCompany
* @param UpdatesCompany $updatesCompany
* @param FetchesCompany $fetchesCompany
* @param UpdatesCompanyDebtor $updatesCompanyDebtor
* @param UpdatesCompanyModuleName $updatesCompanyModuleName
*/
public function __construct(CanUpdateCompany $canUpdateCompany, UpdatesCompany $updatesCompany, FetchesCompany $fetchesCompany, UpdatesCompanyDebtor $updatesCompanyDebtor, UpdatesCompanyModuleName $updatesCompanyModuleName)
{
$this->canUpdateCompany = $canUpdateCompany;
$this->updatesCompany = $updatesCompany;
$this->fetchesCompany = $fetchesCompany;
$this->updatesCompanyDebtor = $updatesCompanyDebtor;
$this->updatesCompanyModuleName = $updatesCompanyModuleName;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$object = new CompanyObject($request->input('name'), $request->input('reference'), $request->input('type'));
$this->canUpdateCompany->passes($object);
$query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
$this->updatesCompanyModuleName->execute($query->companyModules()->first(), $object->getName());
$query = $this->updatesCompany->execute($query, $object);
if ($request->input('debtor') || $query->first()->debtor !== null) {
$this->updatesCompanyDebtor->execute($query, $request->input('debtor'));
}
return $this->resourceResponse(new CompanyResource($query));
}
}
@@ -0,0 +1,69 @@
<?php
namespace App\Classes\Modules\Companies\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Companies\Services\UpdatesCompany;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Companies\Standards\Rules\CanUpdateCompany;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Http\Resources\CompanyResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateCompanyTypeLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Updated Company Type',
'message' => 'You have successfully updated the Company Tyoe'
];
}
/** @var CanUpdateCompany */
private $canUpdateCompany;
/** @var UpdatesCompany */
private $updatesCompany;
/** @var FetchesCompany */
private $fetchesCompany;
/**
* UpdateCompanyControllersLogic constructor.
* @param CanUpdateCompany $canUpdateCompany
* @param UpdatesCompany $updatesCompany
* @param FetchesCompany $fetchesCompany
*/
public function __construct(CanUpdateCompany $canUpdateCompany, UpdatesCompany $updatesCompany, FetchesCompany $fetchesCompany)
{
$this->canUpdateCompany = $canUpdateCompany;
$this->updatesCompany = $updatesCompany;
$this->fetchesCompany = $fetchesCompany;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
$object = new CompanyObject($query->name, $query->reference, $request->input('type'));
$this->canUpdateCompany->passes($object);
$query = $this->updatesCompany->execute($query, $object);
return $this->resourceResponse(new CompanyResource($query));
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\Modules\Companies\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Models\Company;
class UpdatesCompanyDebtor extends AbstractUpdateRecord
{
/**
* @param Company $model
* @param CompanyObject $object
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Company $model, ?string $debtor)
{
$model->debtor = $debtor;
return $this->handler($model);
}
}
@@ -0,0 +1,69 @@
<?php
namespace App\Classes\Modules\Contacts\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Contacts\Services\UpdatesContact;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Services\FetchesContact;
use App\Http\Resources\ContactResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateContactLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Updated Contact',
'message' => 'You have successfully updated the Contact'
];
}
/** @var UpdatesContact */
private $updatesContact;
/** @var FetchesContact */
private $fetchesContact;
/**
* UpdateContactLogic constructor.
* @param UpdatesContact $updatesContact
* @param FetchesContact $fetchesContact
*/
public function __construct(UpdatesContact $updatesContact, FetchesContact $fetchesContact)
{
$this->updatesContact = $updatesContact;
$this->fetchesContact = $fetchesContact;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$object = new ContactObject(
$request->input('reference'),
$request->input('phone'),
$request->input('email'),
$request->input('wechat_id')
);
// $this->canUpdateContact->passes($object);
$query = $this->fetchesContact->execute(['id' => $request->route('id')]);
$query = $this->updatesContact->execute($query, $object);
return $this->resourceResponse(new ContactResource($query));
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Classes\Modules\Contacts\Services;
use App\Classes\General\Eloquent\AbstractFetchRecord;
use Illuminate\Database\Eloquent\Builder;
use App\Models\Contact;
class FetchesContact extends AbstractFetchRecord
{
/** @var Contact */
private $repository;
/**
* FetchesContact constructor.
* @param Contact $repository
*/
public function __construct(Contact $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
public function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Classes\Modules\Contacts\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Models\Contact;
class UpdatesContact extends AbstractUpdateRecord
{
/**
* @param Contact $model
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Contact $model, ContactObject $object)
{
$model->reference = $object->getReference();
$model->phone = $object->getPhone();
$model->email = $object->getEmail();
$model->wechat_id = $object->getWechatId();
return $this->handler($model);
}
}
@@ -7,9 +7,13 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Documents\Services\ListsDocuments;
use App\Classes\Modules\Documents\Standards\Rules\CanListDocuments;
use App\Http\Resources\DocumentResource;
use App\Models\Document;
use App\Transformers\DocumentTransformer;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use League\Fractal;
class ListDocumentLogic extends AbstractControllerLogic
{
@@ -58,6 +62,11 @@ class ListDocumentLogic extends AbstractControllerLogic
return $this->collectionResponse(DocumentResource::collection($query));
/* return fractal()
->collection($query, new DocumentTransformer)
->respond(200, [], JSON_PRETTY_PRINT);*/
}
}
@@ -0,0 +1,50 @@
<?php
namespace App\Classes\Modules\Documents\Processors;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Documents\Services\CreatesDocument;
use App\Classes\Modules\Documents\Services\CreatesFiles;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Document;
use Illuminate\Http\Request;
use App\Models\QAUserAnswerSelected;
class UploadDocumentForHelpMenuProcessor
{
/** @var CreatesDocument */
private $createsDocument;
/** @var CreatesFiles */
private $createsFiles;
/**
* UploadDocumentForHelpMenuProcessor constructor.
* @param CreatesDocument $createsDocument
* @param CreatesFiles $createsFiles
*/
public function __construct(CreatesDocument $createsDocument, CreatesFiles $createsFiles)
{
$this->createsDocument = $createsDocument;
$this->createsFiles = $createsFiles;
}
/**
* @param Request $request
* @param QAUserAnswerSelected qaUserAnswerSelected
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Request $request, QAUserAnswerSelected $qaUserAnswerSelected) {
$object = new DocumentObject("HELP_MENU", $request->input('files'),
'123456', ApprovalStatus::PENDING_VERIFICATION, 'help_menu'); //cief todo: 123456 cannot be hardcoded
/** @var Document $document */
$document = $this->createsDocument->execute($qaUserAnswerSelected, $object);
$result = $this->createsFiles->execute($document, $object);
return $result;
}
}
@@ -0,0 +1,108 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Models\CompanyConnection;
use App\Models\Container;
use App\Models\Order;
use App\Models\Package;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Carbon\Carbon;
class ExportsOrderSummaryByMarking implements FromCollection, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
protected $customerMarking;
protected $dateFrom;
protected $dateTo;
public function headings(): array
{
return [
'Date',
'Container',
'Order Marking',
'Packing List Reference',
'Description',
'Quantity',
'L (cm)',
'H (cm)',
'W (cm)',
'CBM'
];
}
public function setParameters($customerMarking, $dateFrom, $dateTo)
{
$this->customerMarking = $customerMarking;
$this->dateFrom = $dateFrom;
$this->dateTo = $dateTo;
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function collection()
{
$connection = CompanyConnection::where('invitee_reference', $this->customerMarking)->first();
$company_id = $connection->invitee->company->id;
$company_module_id = $connection->invitee->id;
$packagesArray = collect();
$orders = Order::where('company_module_id', $company_module_id);
if (isset($this->dateFrom) && isset($this->dateTo)) {
$from = Carbon::createFromFormat('d-m-Y', $this->dateFrom);
$to = Carbon::createFromFormat('d-m-Y', $this->dateTo);
$orders = $orders->whereBetween('created_at', [$from, $to]);
}
$orders = $orders->get();
foreach ($orders as $order){
$packingLists = $order->packingLists;
foreach ($packingLists as $packingList){
if($packingList->packingLists->first()){
$packingList = $packingList->packingLists->first();
}
$packages = $packingList->packages;
foreach ($packages as $package){
$packagesArray->push($package);
}
}
}
return $packagesArray;
}
/**
* @param Package $package
*
* @return array
*/
public function map($package): array
{
$packinglist = ($package->packingList()->first()->owner->owner_type == Order::class) ? $package->packingList()->first(): $package->packingList->owner;
$order = $packinglist->owner;
return [
Carbon::parse($package->created_at)->format('d-m-Y'),
'',
$order->reference,
$package->packingList->reference,
$package->description,
$package->quantity,
$package->length,
$package->height,
$package->width,
((($package->length / 100) * ($package->height / 100) * ($package->width / 100)) * $package->quantity)
];
}
}
@@ -39,7 +39,12 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
'ProjNo',
'DeptNo',
'Qty',
'UnitPrice'
'UnitPrice',
// 'marking',
// 'contact person',
// 'contact number',
// 'link',
// 'amount'
];
}
@@ -60,7 +65,15 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$query = Transaction::query();
$query->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::COMPLETED]);
// paidInvoiceSection
$approvalStatus = ApprovalStatus::COMPLETED;
if ($this->request->route('section') == 'pendingPaymentSection') {
// pendingPaymentSection
$approvalStatus = ApprovalStatus::APPROVED;
}
$query->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [$approvalStatus]);
if($start_date && $end_date) {
$query->whereBetween('updated_at', [
@@ -89,6 +102,10 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$order = $transaction->owner->owner;
$company = $order->companyModule->company;
$shippingTransactionDetails = $transaction->transactionDetails()->where('reference', 'SHIPPING_FEE')->first();
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
$contact = $order->companyModule->company->contacts->first();
$userName = $order->companyModule->employees()->first();
$link = route('customer.payment-and-billing', $marking);
$furtherDescription = '';
@@ -115,7 +132,12 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$container->reference,
'CIEF',
$shippingTransactionDetails->quantity,
$shippingTransactionDetails->price
$shippingTransactionDetails->price,
// $marking,
// $contact ? $contact->phone : '',
// $userName->name,
// $link,
// $transaction->amount
];
return [
'<<New>>',
@@ -0,0 +1,55 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\Order;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Carbon\Carbon;
class ExportsWarehousePackingList implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
{
use Exportable;
public function headings(): array
{
return [
'Customer Marking',
'Order Number'
];
}
/**
* @return \Illuminate\Support\Collection|mixed
*/
public function query()
{
return Order::whereHas('addresses', function($address) {
$address->where('status', ApprovalStatus::APPROVED);
})->whereHas('packingLists', function($packingLists) {
$packingLists->where('type', PackingListType::SHIPPING_PACKING_LIST)->whereDoesntHave('transports');
});
}
/**
* @param Order $order
*
* @return array
*/
public function map($order): array
{
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
return [
$marking,
$order->reference,
];
}
}
@@ -0,0 +1,187 @@
<?php
namespace App\Classes\Modules\Groups\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Carbon\Carbon;
class GroupObject implements DataTransferObject
{
/** @var int */
private $issuer;
/** @var int */
private $receiver;
/** @var float */
private $amount;
/** @var float */
private $originalAmount;
/** @var int */
private $currencyId;
/** @var int */
private $originalCurrencyId;
/** @var float */
private $currencyRate;
/** @var float */
private $tax;
/** @var float */
private $serviceCharge;
/** @var int|null */
private $status;
/** @var string */
private $reference;
/** @var int */
private $paymentMethod;
/**
* GroupObject constructor.
* @param int $issuer
* @param int $receiver
* @param float $amount
* @param float $originalAmount
* @param int $currencyId
* @param int $originalCurrencyId
* @param float $currencyRate
* @param float $tax
* @param float $serviceCharge
* @param string $reference
* @param int|null $status
* @param int $paymentMethod
*/
public function __construct(
int $issuer,
int $receiver,
float $amount,
float $originalAmount,
int $currencyId,
int $originalCurrencyId,
float $currencyRate,
float $tax,
float $serviceCharge,
int $paymentMethod,
?string $reference,
?int $status = ApprovalStatus::PENDING_SUBMISSION
)
{
$this->issuer = $issuer;
$this->receiver = $receiver;
$this->amount = $amount;
$this->originalAmount = $originalAmount;
$this->currencyId = $currencyId;
$this->originalCurrencyId = $originalCurrencyId;
$this->currencyRate = $currencyRate;
$this->tax = $tax;
$this->serviceCharge = $serviceCharge;
$this->paymentMethod = $paymentMethod;
$this->reference = $reference;
$this->status = $status;
}
/**
* @return int
*/
public function getIssuer(): int
{
return $this->issuer;
}
/**
* @return int
*/
public function getReceiver(): int
{
return $this->receiver;
}
/**
* @return float
*/
public function getAmount(): float
{
return $this->amount;
}
/**
* @return float
*/
public function getOriginalAmount(): float
{
return $this->originalAmount;
}
/**
* @return int
*/
public function getCurrencyId(): int
{
return $this->currencyId;
}
/**
* @return int
*/
public function getOriginalCurrencyId(): int
{
return $this->originalCurrencyId;
}
/**
* @return float
*/
public function getCurrencyRate(): float
{
return $this->currencyRate;
}
/**
* @return float
*/
public function getTax(): float
{
return $this->tax;
}
/**
* @return float
*/
public function getServiceCharge(): float
{
return $this->serviceCharge;
}
/**
* @return int
*/
public function getStatus(): ?int
{
return $this->status;
}
/**
* @return string|null
*/
public function getReference(): ?string
{
return $this->reference;
}
/**
* @return int
*/
public function getPaymentMethod(): int
{
return $this->paymentMethod;
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Classes\Modules\Groups\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Groups\DataTransferObjects\GroupObject;
use App\Models\Group;
class CreatesGroup extends AbstractUpdateRecord
{
/**
* @param GroupObject $object
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(GroupObject $object) {
$model = new Group();
$model->issuer = $object->getIssuer();
$model->receiver = $object->getReceiver();
$model->amount = $object->getAmount();
$model->original_amount = $object->getOriginalAmount();
$model->currency_id = $object->getCurrencyId();
$model->original_currency_id = $object->getOriginalCurrencyId();
$model->currency_rate = $object->getCurrencyRate();
$model->tax = $object->getTax();
$model->service_charge = $object->getServiceCharge();
$model->status = $object->getStatus();
$model->reference = $object->getReference();
$model->payment_method = $object->getPaymentMethod();
return $this->handler($model);
}
}
@@ -0,0 +1,62 @@
<?php
namespace App\Classes\Modules\HelpMenu\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\HelpMenu\Standards\Rules\CanFetchHelpMenuQuestionList;
use App\Classes\Modules\HelpMenu\Processors\FetchFirstHelpMenuQuestionProcessor;
use App\Http\Resources\HelpMenuQuestionResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class FetchHelpMenuQuestionLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Help Menu First Question',
'message' => 'You have successfully retrieved a Help Menu First Question'
];
}
/** @var CanFetchHelpMenuQuestionList */
private $canFetchHelpMenuQuestionList;
/** @var FetchFirstHelpMenuQuestionProcessor */
private $fetchFirstHelpMenuQuestionProcessor;
/**
* FetchHelpMenuQuestionLogic constructor.
* @param CanFetchHelpMenuQuestionList $canFetchHelpMenuQuestionList
* @param FetchFirstHelpMenuQuestionProcessor $fetchFirstHelpMenuQuestionProcessor
*/
public function __construct(CanFetchHelpMenuQuestionList $canFetchHelpMenuQuestionList, FetchFirstHelpMenuQuestionProcessor $fetchFirstHelpMenuQuestionProcessor)
{
$this->canFetchHelpMenuQuestionList = $canFetchHelpMenuQuestionList;
$this->fetchFirstHelpMenuQuestionProcessor = $fetchFirstHelpMenuQuestionProcessor;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$this->canFetchHelpMenuQuestionList->passes();
$userId = Auth::user()->id;
$query = $this->fetchFirstHelpMenuQuestionProcessor->execute($request);
return $this->resourceResponse(new HelpMenuQuestionResource($query, $userId));
}
}
@@ -0,0 +1,124 @@
<?php
namespace App\Classes\Modules\HelpMenu\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMSupportTicket;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMCustomer;
use App\Classes\Modules\HelpMenu\Standards\Rules\CanFetchHelpMenuQuestionList;
use App\Classes\Modules\HelpMenu\Processors\SaveHelpMenuAnswerProcessor;
use App\Classes\Modules\HelpMenu\Processors\DeleteHelpMenuAnswerProcessor;
use App\Classes\Modules\HelpMenu\Processors\FetchNextHelpMenuQuestionProcessor;
use App\Classes\Modules\HelpMenu\Processors\FetchFirstHelpMenuQuestionProcessor;
use App\Http\Resources\HelpMenuQuestionResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Auth;
use App\Classes\ValueObjects\Constants\QAType;
class UpdateHelpMenuNextQuestionLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Help Menu Next Question',
'message' => 'You have successfully retrieved a Help Menu Next Question'
];
}
/** @var CanFetchHelpMenuQuestionList */
private $canFetchHelpMenuQuestionList;
/** @var SaveHelpMenuAnswerProcessor */
private $saveHelpMenuAnswerProcessor;
/** @var DeleteHelpMenuAnswerProcessor */
private $deleteHelpMenuAnswerProcessor;
/** @var FetchNextHelpMenuQuestionProcessor */
private $fetchNextHelpMenuQuestionProcessor;
/** @var FetchFirstHelpMenuQuestionProcessor */
private $fetchFirstHelpMenuQuestionProcessor;
/** @var CreatesPerfexCRMSupportTicket */
private $createsPerfexCRMSupportTicket;
/** @var FetchesPerfexCRMCustomer */
private $fetchesPerfexCRMCustomer;
/**
* UpdateHelpMenuNextQuestionLogic constructor.
* @param CanFetchHelpMenuQuestionList $canFetchHelpMenuQuestionList
* @param SaveHelpMenuAnswerProcessor $saveHelpMenuAnswerProcessor
* @param FetchNextHelpMenuQuestionProcessor $fetchNextHelpMenuQuestionProcessor
* @param FetchFirstHelpMenuQuestionProcessor $fetchFirstHelpMenuQuestionProcessor
* @param DeleteHelpMenuAnswerProcessor $deleteHelpMenuAnswerProcessor
*/
public function __construct(CanFetchHelpMenuQuestionList $canFetchHelpMenuQuestionList, SaveHelpMenuAnswerProcessor $saveHelpMenuAnswerProcessor, FetchNextHelpMenuQuestionProcessor $fetchNextHelpMenuQuestionProcessor, FetchFirstHelpMenuQuestionProcessor $fetchFirstHelpMenuQuestionProcessor, CreatesPerfexCRMSupportTicket $createsPerfexCRMSupportTicket, FetchesPerfexCRMCustomer $fetchesPerfexCRMCustomer, DeleteHelpMenuAnswerProcessor $deleteHelpMenuAnswerProcessor)
{
$this->canFetchHelpMenuQuestionList = $canFetchHelpMenuQuestionList;
$this->saveHelpMenuAnswerProcessor = $saveHelpMenuAnswerProcessor;
$this->fetchNextHelpMenuQuestionProcessor = $fetchNextHelpMenuQuestionProcessor;
$this->fetchFirstHelpMenuQuestionProcessor = $fetchFirstHelpMenuQuestionProcessor;
$this->createsPerfexCRMSupportTicket = $createsPerfexCRMSupportTicket;
$this->fetchesPerfexCRMCustomer = $fetchesPerfexCRMCustomer;
$this->deleteHelpMenuAnswerProcessor = $deleteHelpMenuAnswerProcessor;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$questionId = 0;
$userId = Auth::user()->id;
$currentQuestion = $request->question;
$questionId = $currentQuestion['id'];
$questionType = $currentQuestion['question_type'];
$this->canFetchHelpMenuQuestionList->passes();
//Delete answer
$this->deleteHelpMenuAnswerProcessor->execute($userId, $questionId, $request);
//Save answer given by user
if (!$request->has('isPrevious')) {
$this->saveHelpMenuAnswerProcessor->execute($userId, $questionId, $request);
}
//Create ticket at crm
if (!$request->has('isPrevious')) {
if($questionType == QAType::TICKET_CRM){
$email = Auth::user()->email;
$customer = $this->fetchesPerfexCRMCustomer->execute($email);
$subject = "test subject 3";
$department = 1;
$contactid = 0;
$userid = 0;
if($customer){
$contactid = $customer->id;
$userid = $customer->userid;
}
$this->createsPerfexCRMSupportTicket->execute($subject, $department, $contactid, $userid);
}
}
//Get returned question (previous or next)
$returnQuestion = $this->fetchNextHelpMenuQuestionProcessor->execute($request);
//When a questionnaire ended, return back the first question
if(is_null($returnQuestion)){
$returnQuestion = $this->fetchFirstHelpMenuQuestionProcessor->execute($request);
}
return $this->resourceResponse(new HelpMenuQuestionResource($returnQuestion, $userId));
}
}
@@ -0,0 +1,51 @@
<?php
namespace App\Classes\Modules\HelpMenu\Processors;
use App\Models\QAUserAnswerSelected;
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelected;
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelectedList;
class DeleteHelpMenuAnswerProcessor
{
/** @var FetchesHelpMenuUserAnswerSelected */
private $fetchesHelpMenuUserAnswerSelected;
/** @var FetchesHelpMenuUserAnswerSelectedList */
private $fetchesHelpMenuUserAnswerSelectedList;
/**
* DeleteHelpMenuAnswerProcessor constructor.
* @param FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected
* @param FetchesHelpMenuUserAnswerSelectedList $fetchesHelpMenuUserAnswerSelectedList
*/
public function __construct(FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected, FetchesHelpMenuUserAnswerSelectedList $fetchesHelpMenuUserAnswerSelectedList)
{
$this->fetchesHelpMenuUserAnswerSelected = $fetchesHelpMenuUserAnswerSelected;
$this->fetchesHelpMenuUserAnswerSelectedList = $fetchesHelpMenuUserAnswerSelectedList;
}
public function execute($userId, $questionId, $request){
if ($request->has('isPrevious')) {
//Get current and previous question's answer
try{
$selectedAnswer = $this->fetchesHelpMenuUserAnswerSelectedList->execute(['user_id' => $userId, 'question_id' => $questionId, 'order_by' => (object)['column' => 'id','DESC' => true]])[0];
} catch (\Exception $exception){
$selectedAnswer = null;
}
if($selectedAnswer)
{
$this->fetchesHelpMenuUserAnswerSelected->execute(['id' => $selectedAnswer['id']])->delete();
}
}
else{
//Delete all answer's belongs to the user
$currentQuestion = $request->question;
$isStart = $currentQuestion['is_start'];
if($isStart){
QAUserAnswerSelected::where('user_id', $userId)->delete();
}
}
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Classes\Modules\HelpMenu\Processors;
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuQuestion;
use ErrorException;
use Illuminate\Http\Request;
class FetchFirstHelpMenuQuestionProcessor
{
/** @var FetchesHelpMenuQuestion */
private $fetchesHelpMenuQuestion;
/**
* FetchFirstHelpMenuQuestionProcessor constructor.
* @param FetchesHelpMenuQuestion $fetchesHelpMenuQuestion
*/
public function __construct(FetchesHelpMenuQuestion $fetchesHelpMenuQuestion)
{
$this->fetchesHelpMenuQuestion = $fetchesHelpMenuQuestion;
}
public function execute(Request $request){
try {
$query = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1]);
return $query;
} catch (\Exception $exception){
throw new ErrorException($exception->getMessage(), $exception->getCode());
}
}
}
@@ -0,0 +1,93 @@
<?php
namespace App\Classes\Modules\HelpMenu\Processors;
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuQuestion;
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelected;
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelectedList;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Classes\ValueObjects\Constants\QAType;
class FetchNextHelpMenuQuestionProcessor
{
/** @var FetchesHelpMenuQuestion */
private $fetchesHelpMenuQuestion;
/** @var FetchesHelpMenuUserAnswerSelected */
private $fetchesHelpMenuUserAnswerSelected;
/** @var FetchesHelpMenuUserAnswerSelectedList */
private $fetchesHelpMenuUserAnswerSelectedList;
/**
* FetchNextHelpMenuQuestionProcessor constructor.
* @param FetchesHelpMenuQuestion $fetchesHelpMenuQuestion
* @param FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected
* @param FetchesHelpMenuUserAnswerSelectedList $fetchesHelpMenuUserAnswerSelectedList
*/
public function __construct(FetchesHelpMenuQuestion $fetchesHelpMenuQuestion, FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected, FetchesHelpMenuUserAnswerSelectedList $fetchesHelpMenuUserAnswerSelectedList)
{
$this->fetchesHelpMenuQuestion = $fetchesHelpMenuQuestion;
$this->fetchesHelpMenuUserAnswerSelected = $fetchesHelpMenuUserAnswerSelected;
$this->fetchesHelpMenuUserAnswerSelectedList = $fetchesHelpMenuUserAnswerSelectedList;
}
public function execute(Request $request){
$isEnd = 0;
$questionId = 0;
$nextQuestionNumber = 0;
$nextNestedQuestion = 0;
$nextMainQuestion= 0;
$currentQuestion = $request->question;
$questionType = QAType::DEFAULT;
$returnQuestion = null;
if ($currentQuestion && array_key_exists('id', $currentQuestion)) {
$questionId = $currentQuestion['id'];
$isEnd = $currentQuestion['is_end'];
$questionType = $currentQuestion['question_type'];
$nextNestedQuestion = $currentQuestion['next_nested_question'];
$nextMainQuestion = $currentQuestion['next_main_question'];
}
if ($request->has('answerObj')) {
$nextQuestionNumber = $request->answerObj['next_question_number'];
}
if ($request->has('isPrevious')) {
$userId = Auth::user()->id;
$previousAnswer = $this->fetchesHelpMenuUserAnswerSelectedList->execute(['user_id' => $userId, 'order_by' => (object)['column' => 'id','DESC' => true]])[0];
//Get previous question
$previousQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'id' => $previousAnswer['question_id']]);
$returnQuestion = $previousQuestion;
}
else{
//Get next question
$nextQuestion = null;
$question_number = 0;
if($nextQuestionNumber != 0){
$question_number = $nextQuestionNumber;
}
else if($nextNestedQuestion != 0){
$question_number = $nextNestedQuestion;
}
else {
$question_number = $nextMainQuestion;
}
if($isEnd){
$returnQuestion = null;
}
else if($question_number != 0){
$nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'question_number' => $question_number]);
$returnQuestion = $nextQuestion;
}
else if (array_key_exists('id', $request->input('question'))) {
$nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'id_next' => $questionId, 'next_main_question' => null]);
$returnQuestion = $nextQuestion;
}
}
return $returnQuestion;
}
}
@@ -0,0 +1,63 @@
<?php
namespace App\Classes\Modules\HelpMenu\Processors;
use App\Models\QAUserAnswerSelected;
use App\Classes\Modules\HelpMenu\Services\FetchesHelpMenuUserAnswerSelected;
use App\Classes\Modules\Documents\Processors\UploadDocumentForHelpMenuProcessor;
class SaveHelpMenuAnswerProcessor
{
/** @var FetchesHelpMenuUserAnswerSelected */
private $fetchesHelpMenuUserAnswerSelected;
/** @var UploadDocumentForHelpMenuProcessor */
private $uploadDocumentForHelpMenuProcessor;
/**
* SaveHelpMenuAnswerProcessor constructor.
* @param FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected
* @param UploadDocumentForHelpMenuProcessor $uploadDocumentForHelpMenuProcessor
*/
public function __construct(FetchesHelpMenuUserAnswerSelected $fetchesHelpMenuUserAnswerSelected, UploadDocumentForHelpMenuProcessor $uploadDocumentForHelpMenuProcessor)
{
$this->fetchesHelpMenuUserAnswerSelected = $fetchesHelpMenuUserAnswerSelected;
$this->uploadDocumentForHelpMenuProcessor = $uploadDocumentForHelpMenuProcessor;
}
public function execute($userId, $questionId, $request){
$filesUpload = $request->input('files');
$answer = null;
try{
// $answer = $this->fetchesHelpMenuUserAnswerSelected->execute(['user_id' => $userId, 'question_id' => $questionId, 'order_by' => ['column' => 'id','DESC' => 1]]);
$answer = $this->fetchesHelpMenuUserAnswerSelected->execute(['user_id' => $userId, 'question_id' => $questionId]);
} catch (\Exception $exception){
$answer = null;
}
if(is_null($answer))
{
$answer = new QAUserAnswerSelected;
}
$answer->user_id = $userId;
$answer->question_id = $questionId;
if ($request->has('answerObj')) {
$answer->answer_option_id = intval($request->answerObj['id']);
}
$answer->free_text_answer = $request->answer;
$answer->save();
if($filesUpload){
$result = $this->uploadDocumentForHelpMenuProcessor->execute($request, $answer);
$newData = array_map(function ($item) {
return [
'document_id' => $item->document_id,
'file_id' => $item->id,
];
}, $result);
$answer->free_text_answer = json_encode($newData);
$answer->save();
}
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Classes\Modules\HelpMenu\Services;
use App\Classes\General\Eloquent\AbstractFetchRecord;
use Illuminate\Database\Eloquent\Builder;
use App\Models\QAQuestions;
class FetchesHelpMenuQuestion extends AbstractFetchRecord
{
/** @var QAQuestions */
private $repository;
/**
* FetchesHelpMenuQuestion constructor.
* @param QAQuestions $repository
*/
public function __construct(QAQuestions $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
public function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Classes\Modules\HelpMenu\Services;
use App\Classes\General\Eloquent\AbstractFetchRecord;
use Illuminate\Database\Eloquent\Builder;
use App\Models\QAUserAnswerSelected;
class FetchesHelpMenuUserAnswerSelected extends AbstractFetchRecord
{
/** @var QAUserAnswerSelected */
private $repository;
/**
* FetchesHelpMenuUserAnswerSelected constructor.
* @param QAUserAnswerSelected $repository
*/
public function __construct(QAUserAnswerSelected $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
public function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Classes\Modules\HelpMenu\Services;
use App\Classes\General\Eloquent\AbstractListRecord;
use Illuminate\Database\Eloquent\Builder;
use App\Models\QAUserAnswerSelected;
class FetchesHelpMenuUserAnswerSelectedList extends AbstractListRecord
{
/** @var QAUserAnswerSelected */
private $repository;
/**
* FetchesHelpMenuUserAnswerSelectedList constructor.
* @param QAUserAnswerSelected $repository
*/
public function __construct(QAUserAnswerSelected $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
public function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -0,0 +1,37 @@
<?php
namespace App\Classes\Modules\HelpMenu\Standards\Rules;
use App\Classes\General\Abstracts\AbstractRule;
class CanFetchHelpMenuQuestionList extends AbstractRule
{
/**
* @return bool
*/
protected function authorized(): bool
{
// TODO Set Authorization rules
return true;
}
/**
* @param $object
* @return bool
*/
protected function validators($object): bool
{
return true;
}
/**
* @param $object
* @return bool
*/
protected function criteria($object): bool
{
return true;
}
}
@@ -4,20 +4,28 @@ namespace App\Classes\Modules\Orders\ControllersLogic;
use App\Classes\Exceptions\RequestValidationException;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Addresses\Services\FetchesAddress;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\PerfexCRM\Processors\NewLeadTaskToPerfexCRMProcessor;
use App\Classes\Modules\Orders\Processors\CreateOrderProcessor;
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\WarehouseReferences;
use App\Http\Resources\OrderResource;
use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress;
use App\Models\Address;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
class CreateOrderLogic extends AbstractControllerLogic
{
protected function notification():array {
protected function notification(): array
{
return [
'title' => 'Created Order',
'message' => 'You have successfully created a new Order'
@@ -39,6 +47,14 @@ class CreateOrderLogic extends AbstractControllerLogic
/** @var GeneratesOrderNumber */
private $generatesOrderNumber;
/** @var CreatesAddress */
private $createsAddress;
/** @var CanCreateAddress */
private $canCreateAddress;
/** @var NewLeadTaskToPerfexCRMProcessor */
private $newLeadTaskToPerfexCRMProcessor;
/**
* CreateOrderLogic constructor.
* @param FetchesCompany $fetchesCompany
@@ -46,36 +62,58 @@ class CreateOrderLogic extends AbstractControllerLogic
* @param CreateOrderProcessor $createOrderProcessor
* @param FetchesCompanyModule $fetchesCompanyModule
* @param GeneratesOrderNumber $generatesOrderNumber
* @param NewLeadTaskToPerfexCRMProcessor $newLeadTaskToPerfexCRMProcessor
* @param CreatesAddress $createsAddress
* @param CanCreateAddress $canCreateAddress
*/
public function __construct(FetchesCompany $fetchesCompany, FetchesAddress $fetchesAddress, CreateOrderProcessor $createOrderProcessor, FetchesCompanyModule $fetchesCompanyModule, GeneratesOrderNumber $generatesOrderNumber)
public function __construct(FetchesCompany $fetchesCompany, FetchesAddress $fetchesAddress, CreateOrderProcessor $createOrderProcessor, FetchesCompanyModule $fetchesCompanyModule, GeneratesOrderNumber $generatesOrderNumber, CreatesAddress $createsAddress, CanCreateAddress $canCreateAddress, NewLeadTaskToPerfexCRMProcessor $newLeadTaskToPerfexCRMProcessor)
{
$this->fetchesCompany = $fetchesCompany;
$this->fetchesAddress = $fetchesAddress;
$this->createOrderProcessor = $createOrderProcessor;
$this->fetchesCompanyModule = $fetchesCompanyModule;
$this->generatesOrderNumber = $generatesOrderNumber;
$this->createsAddress = $createsAddress;
$this->canCreateAddress = $canCreateAddress;
$this->newLeadTaskToPerfexCRMProcessor = $newLeadTaskToPerfexCRMProcessor;
}
public function logic(Request $request) : JsonResponse {
public function logic(Request $request): JsonResponse
{
$company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]);
$address = $this->fetchesAddress->execute(['id' => $request->input('address_id')]);
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->input('warehouse_id')]);
// todo-new: fix this
// if select warehouse foshan
if ($request->input('warehouse_id') === 'foshan') {
// 13 - sabah, 14 - sarawak
if (in_array($address->state->id, [13, 14])) {
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::YD_FS_WEST_MALAYSIA]);
} else {
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::YD_FS_WEST_MALAYSIA]);
}
} else {
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->input('warehouse_id')]);
if(!in_array($company->companyModules()->importers()->first()->id, WarehouseReferences::YD_EXEMPT_LIST)){
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU ? WarehouseReferences::YD_GUANG_ZHOU : WarehouseReferences::YD_YIWU]);
if (!in_array($company->companyModules()->importers()->first()->id, WarehouseReferences::YD_EXEMPT_LIST)) {
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU ? WarehouseReferences::YD_GUANG_ZHOU : WarehouseReferences::YD_YIWU]);
}
}
if($originWarehouse->reference === WarehouseReferences::YD_YIWU && in_array($address->state_id, [5, 13, 14])) {
throw new RequestValidationException('Our Yiwu warehouse is unable to ship goods to Sabah & Sarawak at the moment. you can select our Guangzhou warehouse as an alternative.');
}
$order = $this->createOrderProcessor->execute($company, $originWarehouse, $address, $this->generatesOrderNumber->execute());
if(config('perfexcrm.is_enabled') == 'true'){
$this->newLeadTaskToPerfexCRMProcessor->execute($company);
}
return $this->resourceResponse(new OrderResource($order));
}
}
@@ -0,0 +1,60 @@
<?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\OrderV2Resource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchOrderV2Logic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Order',
'message' => 'You have successfully retrieved an order'
];
}
/** @var CanFetchOrder */
private $canFetchOrder;
/** @var FetchesOrder */
private $fetchesOrder;
/**
* FetchOrderLogic 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]);
return $this->resourceResponse(new OrderV2Resource($query));
}
}
@@ -0,0 +1,56 @@
<?php
namespace App\Classes\Modules\Orders\ControllersLogic;
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\OrderV2Resource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListOrdersV2Logic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Orders',
'message' => 'You have successfully retrieved a list of Orders'
];
}
/** @var CanListOrders */
private $canListOrders;
/** @var ListsOrders */
private $listsOrders;
/**
* ListOrdersLogic constructor.
* @param CanListOrders $canListOrders
* @param ListsOrders $listsOrders
*/
public function __construct(CanListOrders $canListOrders, ListsOrders $listsOrders)
{
$this->canListOrders = $canListOrders;
$this->listsOrders = $listsOrders;
}
public function logic(Request $request) : JsonResponse
{
$this->canListOrders->passes();
$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));
}
}
@@ -14,12 +14,11 @@ class FetchesDataFromYDPortal
* @return \Psr\Http\Message\ResponseInterface
*/
public function clientRequest(string $url, string $method, $body){
$client = new \GuzzleHttp\Client();
$client = new \GuzzleHttp\Client();
$body['apicode'] = env('YD_API_CODE');
$request = $client->requestAsync($method, $url, ['query' => $body]);
$request = $client->requestAsync($method, $url, ['query' => $body, 'timeout' => 15]);
return $request->wait();
}
@@ -32,6 +31,7 @@ class FetchesDataFromYDPortal
$content = $request->getBody()->getContents();
$content = str_replace("\r",'', $content);
$content = str_replace("\n",'', $content);
$content = str_replace("\t",'', $content);
return json_decode($content);
}
}
}
@@ -0,0 +1,81 @@
<?php
namespace App\Classes\Modules\PackingLists\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\PackingLists\Services\DeletesPackingList;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\PackingLists\Services\Packages\FetchesPackage;
use App\Classes\Modules\PackingLists\Standards\Rules\CanDeletePackingList;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Models\PackingList;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class DeletePackingListByPackageIdLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Deleted PackingList',
'message' => 'You have successfully deleted a PackingList'
];
}
/** @var CanDeletePackingList */
private $canDeletePackingList;
/** @var DeletesPackingList */
private $deletesPackingList;
/** @var FetchesPackingList */
private $fetchesPackingList;
/** @var FetchesPackage */
private $fetchesPackage;
/**
* DeletePackingListByPackageIdLogic constructor.
* @param CanDeletePackingList $canDeletePackingList
* @param DeletesPackingList $deletesPackingList
* @param FetchesPackingList $fetchesPackingList
* @param FetchesPackage $fetchesPackage
*/
public function __construct(CanDeletePackingList $canDeletePackingList, DeletesPackingList $deletesPackingList, FetchesPackingList $fetchesPackingList, FetchesPackage $fetchesPackage)
{
$this->canDeletePackingList = $canDeletePackingList;
$this->deletesPackingList = $deletesPackingList;
$this->fetchesPackingList = $fetchesPackingList;
$this->fetchesPackage = $fetchesPackage;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$this->canDeletePackingList->passes();
$package = $this->fetchesPackage->execute(['id' => $request->route('id')]);
$packingList = $package->packingList;
$packingList = PackingList::where('reference', $packingList->reference)->get();
$childPackingList = PackingList::where('owner_type', PackingList::class)->whereIn('owner_id', $packingList->pluck('id'))->get();
$packingList->each->delete();
$childPackingList->each->delete();
return $this->response([]);
}
}
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\PackingLists\Processors;
use App\Classes\General\Interfaces\Packable;
use App\Classes\Modules\PerfexCRM\Processors\PackingListToPerfexCRMProcessor;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Services\CreatesPackingList;
use App\Classes\Modules\PackingLists\Standards\Rules\CanCreatePackingList;
@@ -25,16 +26,20 @@ class CreatePackingListProcessor
/** @var CreatesPackingList */
private $createsPackingList;
/** @var PackingListToPerfexCRMProcessor */
private $packingListToPerfexCRMProcessor;
/**
* CreatePackingListProcessor constructor.
* @param CanCreatePackingList $canCreatePackingList
* @param CreatesPackingList $createsPackingList
* @param PackingListToPerfexCRMProcessor $packingListToPerfexCRMProcessor
*/
public function __construct(CanCreatePackingList $canCreatePackingList, CreatesPackingList $createsPackingList)
public function __construct(CanCreatePackingList $canCreatePackingList, CreatesPackingList $createsPackingList, PackingListToPerfexCRMProcessor $packingListToPerfexCRMProcessor)
{
$this->canCreatePackingList = $canCreatePackingList;
$this->createsPackingList = $createsPackingList;
$this->packingListToPerfexCRMProcessor = $packingListToPerfexCRMProcessor;
}
/**
@@ -51,15 +56,19 @@ class CreatePackingListProcessor
/** @var PackingList $packingList */
$packingList = $this->createsPackingList->execute($object, $packable);
$appointee_id = $packingList->owner_id == 1 ? 2037 : $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
$appointee_id = $packingList->owner_id == 1 ? 2307 : $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
$type = $object->getType() === PackingListType::SHIPPING_PACKING_LIST ? PackingListType::SHIPPING_PACKING_LIST_REPLICA : PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA;
/** create packing list replica */
$object = new PackingListObject($object->getReference().'_01', $appointee_id, $type, ApprovalStatus::PENDING_SUBMISSION);
$this->createsPackingList->execute($object, $packingList);
if(config('perfexcrm.is_enabled') == 'true'){
$this->packingListToPerfexCRMProcessor->execute($packingList);
}
return $packingList;
}
}
}
@@ -0,0 +1,160 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors;
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\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\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\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 FetchContainersFromYdPortalProcessor
{
/** @var FetchesDataFromYDPortal */
private $fetchesDataFRomYDPortal;
/** @var CreatesTransport */
private $createsTransport;
/** @var CreatesSchedule */
private $createsSchedule;
/** @var FetchesContainer */
private $fetchesContainer;
/** @var CreateContainerProcessor */
private $createContainerProcessor;
/**
* @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
* @param FetchesContainer $fetchesContainer
* @param CreateContainerProcessor $createContainerProcessor
*/
public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule, FetchesContainer $fetchesContainer, CreateContainerProcessor $createContainerProcessor)
{
$this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal;
$this->createsTransport = $createsTransport;
$this->createsSchedule = $createsSchedule;
$this->fetchesContainer = $fetchesContainer;
$this->createContainerProcessor = $createContainerProcessor;
}
/**
* @return void
* @throws MalformedRequestException
* @throws AccessForbiddenException
* @throws RequestValidationException
*/
public function execute()
{
$packingLists = PackingList::where('type', PackingListType::SHIPPING_PACKING_LIST)->doesntHave('containers')->get();
foreach ($packingLists as $packingList) {
$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){
continue;
}
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])->addDays(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)) continue;
$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);
$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>';
}
}
}
@@ -0,0 +1,162 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors;
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\Notifications\ShipmentRescheduleEmail;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Models\Container;
use App\Models\Order;
use App\Models\PackingList;
use Carbon\Carbon;
class FetchContainersUpdatesFromYdPortalProcessor
{
/** @var FetchesDataFromYDPortal */
private $fetchesDataFRomYDPortal;
/** @var UpdatesContractObligation */
private $updatesContractObligations;
/** @var CreatesSchedule */
private $createsSchedule;
/**
* @param FetchesDataFromYDPortal $fetchesDataFRomYDPortal
* @param UpdatesContractObligation $updatesContractObligations
* @param CreatesSchedule $createsSchedule
*/
public function __construct(FetchesDataFromYDPortal $fetchesDataFRomYDPortal, UpdatesContractObligation $updatesContractObligations, CreatesSchedule $createsSchedule)
{
$this->fetchesDataFRomYDPortal = $fetchesDataFRomYDPortal;
$this->updatesContractObligations = $updatesContractObligations;
$this->createsSchedule = $createsSchedule;
}
/**
* @return void
* @throws MalformedRequestException
*/
public function execute()
{
$containers = Container::where('status', ApprovalStatus::PENDING_VERIFICATION)->get();
foreach ($containers as $container) {
$time_start = microtime(true);
$packingList = $container->packingLists()->random();
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
'trakingno' => $packingList->reference
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
if(!$rows->data){
continue;
}
$unstuffingDate = null;
$delayDate = 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);
}
if ($trackingRow->tracking === '已开船') {
$delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
}
if ($trackingRow->tracking === '货物已进目的港仓库') {
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
}
if($delayDate){
$delayDate = $delayDate->addDays(2);
$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]);
}
}
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start)/60;
echo 'successful => <b>Total Execution Time:</b> '.$execution_time.' Mins<br>';
}
}
}
@@ -0,0 +1,115 @@
<?php
namespace App\Classes\Modules\PackingLists\Processors;
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\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 FetchDeliveryUpdatesFromYdPortalProcessor
{
/** @var UpdatesContractObligation */
private $updatesContractObligations;
/** @var CreatesTransport */
private $createsTransport;
/** @var CreatesSchedule */
private $createsSchedule;
/**
* @param UpdatesContractObligation $updatesContractObligations
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
*/
public function __construct(UpdatesContractObligation $updatesContractObligations, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule)
{
$this->updatesContractObligations = $updatesContractObligations;
$this->createsTransport = $createsTransport;
$this->createsSchedule = $createsSchedule;
}
/**
* @return void
* @throws MalformedRequestException
* @throws GuzzleException
*/
public function execute()
{
$packingLists = PackingList::where('type', PackingListType::SHIPPING_PACKING_LIST)->whereRaw('LENGTH(reference) > 12')->whereHas('containers', function ($container){
return $container->where('status', 3);
})->doesntHave('transports')->get()->reverse();
foreach ($packingLists->chunk(50) as $chunk) {
foreach ($chunk as $packingList){
if(!$packingList->reference) continue;
$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)) continue;
$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 'successful => <b>Total Execution Time:</b> '.$execution_time.' Mins<br>';
}
}
}
}
@@ -264,7 +264,7 @@ class FetchLoadedContainersFromVTPortalProcessor
//
// $this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations);
} else {
$appointee_id = 2037;
$appointee_id = 2307;
}
$packingListObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::SUSPENDED, null);
@@ -139,336 +139,360 @@ class FetchOrderListsFromYdPortalProcessor
*/
public function execute(?Carbon $start = null, ?Carbon $end = null)
{
try {
$start = $start ? $start : Carbon::today()->subDays(30);
ini_set('max_execution_time', '900');
// $missingOrders = ['M202302161513122', 'YW202302161027442', 'YW202302151637022', 'M202302151605025', 'M202302151527103', 'M202302151527356', 'M202302151556019', 'YW202302151520241', 'YW202302151445068', 'M202302151359169', 'YW202302151349223', 'YW202302151336520', 'M202302151334316', 'YW202302151148129', 'M202302151145379', 'M202302151142411', 'M202302151037036', 'M202302151036398', 'M202302150919406', 'M202302141535009', 'YW202302141532318', 'M202302141319463', 'M202302141319045', 'YW202302141405471', 'M202302141334494', 'YW202302141321569', 'YW202302141323005', 'M202302141309053', 'M202302140905116', 'M202302141039558', 'M202302141022333', 'YW202302140943182', 'YW202302140923485', 'YW202302131728233', 'YW202302131702040', 'M202302131649417', 'M202302131638056', 'YW202302131601110', 'YW202302131530436', 'YW202302131411338', 'YW202302131355161', 'YW202302131312526', 'M202302130859076', 'M202302111708070', 'M202302111455134', 'M202302111457501', 'M202302111444041', 'M202302111506514', 'M202302111440286', 'M202302111354585', 'M202302111055551', 'M202302110900216', 'YW202302101743112', 'M202302091559443', 'M202302101716374', 'M202302101700402', 'M202302101633570', 'M202302101612095', 'M202302101611408', 'M202302101542340', 'M202302101408370', 'M202302101323341', 'M202302101129532', 'M202302101025109', 'M202302101006595', 'M202302091706357', 'YW202302091255022', 'YW202302091448196', 'YW202302091446431', 'M202302091138154', 'M202302091129396', 'YW202302091028175', 'M202302091006545', 'YW202302090942033', 'YW202302081743094', 'M202302081530599', 'M202302081531210', 'M202302081508571', 'YW202302081530492', 'M202302081500361', 'M202302081253105', 'M202302081303370', 'M202302071636303', 'M202302071741187', 'YW202302071735407', 'M202302071706323', 'M202302071537501', 'M202302071538092', 'YW202302071516453', 'M202302071311314', 'M202302071148154', 'YW202302071136018', 'M202302071036027', 'M202302071008010', 'M202302061742178', 'M202302061615198', 'M202302061502093', 'M202302061458532', 'M202302061552141', 'M202302061548431', 'M202302061555033', 'YW202302061404567', 'M202302061322463', 'M202302061042556', 'M202302061021277', 'M202302060917276', 'M202302041551570', 'M202302041552382', 'YW202302041515257', 'M202302041405502', 'M202302041030185', 'YW202302041215576', 'YW202302041058469', 'YW202302041024459', 'YW202302040939568', 'M202302031701053', 'M202302031700316', 'M202302031430562', 'M202302031431535', 'M202302031147213', 'YW202302031406529', 'YW202302031322256', 'M202302021718554', 'M202302021417415', 'YW202302021404542', 'M202302021055324', 'YW202302021037462', 'M202302011613381', 'M202302011347586', 'M202302011348245', 'M202301151635132', 'M202301141803516', 'YW202301141653536', 'M202301131504477', 'M202301131538220', 'M202301121327453', 'YW202301111153183', 'M202301091649543', 'M202212311641071', 'YW202212211532191', 'YW202212191605226'];
$startLimit = Carbon::parse('01-12-2021');
$from = $end ? Carbon::today()->diff($end)->days : 0;
$to = $start ? Carbon::today()->diff($start)->days : 10;
if($start->isBefore($startLimit)){
$start = $startLimit;
}
for ($x = $from; $x <= $to; $x++) {
try {
$startDate = Carbon::today()->subDays($x);
$end = $end ? $end : Carbon::today()->addDay();
$startLimit = Carbon::parse('01-12-2021');
$orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [
'begintime' => $start->timestamp,
'endtime' => $end->timestamp,
]);
if($startDate->isBefore($startLimit)){
$startDate = $startLimit;
}
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
$endDate = Carbon::today()->subDays($x - 1);
foreach($rows->data as $row){
$containerReference = null;
$loadingDate = null;
$unstuffingDate = null;
$deliveryDate = null;
$etd = null;
$eta = null;
$delayDate = null;
$trackingRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/ApiTracking.ashx', 'GET', [
'trakingno' => $row->expressno
$orderRequest = $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/GetOrderList.ashx', 'GET', [
'begintime' => $startDate->timestamp,
'endtime' => $endDate->timestamp,
]);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
if(!$rows){
continue;
}
if(!$rows->data) continue;
foreach (array_reverse($rows->data) as $trackingRow) {
if ($trackingRow->tracking === '货物已送达仓库准备入库中') {
$receiveDate = Carbon::parse($trackingRow->trackingtime);
}
foreach($rows->data as $row){
$time_start = microtime(true);
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])->addDays(2);
}
$containerReference = null;
$loadingDate = null;
$unstuffingDate = null;
$deliveryDate = null;
$etd = null;
$eta = null;
$delayDate = null;
$status = $row->status;
$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);
}
}
$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 = 2037;
} 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($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])->addDays(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;
if($containerReference) {
try {
$container = $this->fetchesContainer->execute(['reference' => $containerReference]);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
} catch (ResourceNotFoundException $exception){
$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 = 2037;
}
else {
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id;
$appointee_id = 2307;
} else {
$appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
}
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $appointee_id]);
$warehouseReceiveObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::WAREHOUSE_RECEIVE_LIST, $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
$containerObject = new ContainerObject($containerReference, '', '', ContainerTypes::FORTY_FEET_DRY_CONTAINER, $loadingDate, ApprovalStatus::PENDING_VERIFICATION);
/** @var Container $container */
$container = $this->createContainerProcessor->execute($containerObject, $originWarehouse);
/** @var PackingList $warehouseReceiveList */
$warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order);
$container->packingLists()->detach($packingList);
$container->packingLists()->attach($packingList);
$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);
$transport = $container->transports()->first();
if ($allow_contract) {
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));
}
}
$contract = $this->unityCreateContract->execute();
if($delayDate){
$delayDate = $delayDate->addDays(2);
$transport = $container->transports()->first();
$contractReference = $contract->hash_id;
$contractObligations = $contract->contract_obligation_list;
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));
}
}
$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);
}
}
if($unstuffingDate && $container->status !== ApprovalStatus::COMPLETED){
$container->update(['status' => ApprovalStatus::COMPLETED]);
$container->transports()->first()->update(['drop_date' => $unstuffingDate, 'status' => ApprovalStatus::COMPLETED]);
$packingListObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::SUSPENDED, !$allow_contract ? null : $contractReference);
/** @var PackingList $packingList */
foreach($container->packingLists as $packingList){
$packingList = $this->createPackingListProcessor->execute($packingListObject, $order);
if($packingList->status === ApprovalStatus::PENDING_VERIFICATION){
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
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;
}
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]);
$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->addDays(2);
$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();
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));
$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]);
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';
}
echo 'successful';
} catch (\Exception $exception) {
Log::debug($exception);
}
} catch (\Exception $exception) {
Log::debug($exception);
}
}
}
@@ -66,7 +66,6 @@ class FetchPackingListFromVTPortalProcessor
}
} catch (GuzzleException $exception) {
dd($exception);
Log::error($exception);
continue;
}
@@ -0,0 +1,267 @@
<?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 FetchPackingListsFromYdPortalProcessor
{
/** @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|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){
$time_start = microtime(true);
$receiveDate = Carbon::parse(substr(preg_replace("/[^0-9]/", "", $row->expressno), 0, 8));
$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
]);
}
}
$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);
}
}
}
}
@@ -152,7 +152,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
} catch (ResourceNotFoundException $exception) {
$allow_contract = false;
$order = $this->fetchesCompanyModule->execute(['id' => 1]);
$appointee_id = 2037;
$appointee_id = 2307;
}
$packingListReference = $parcel[0];
@@ -0,0 +1,74 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use Illuminate\Http\Request;
use App\Classes\General\Interfaces\DataTransferObject;
class CreateLeadPerfexCRMObject implements DataTransferObject
{
/** @var string */
private $name;
/** @var string */
private $email;
/** @var string */
private $phone;
/** @var string */
private $companyName;
/** @var string */
private $companyReference;
public function __construct(string $name, string $email, string $phone, string $companyName, string $companyReference)
{
$this->name = $name;
$this->email = $email;
$this->phone = $phone;
$this->companyName = $companyName;
$this->companyReference = $companyReference;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @return string
*/
public function getEmail(): string
{
return $this->email;
}
/**
* @return string
*/
public function getPhone(): string
{
return $this->phone;
}
/**
* @return string
*/
public function getCompanyName(): string
{
return $this->companyName;
}
/**
* @return string
*/
public function getCompanyReference(): string
{
return $this->companyReference;
}
}
@@ -0,0 +1,161 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use App\Classes\General\Interfaces\DataTransferObject;
class CreateTaskPerfexCRMObject implements DataTransferObject
{
/** @var string */
private $email;
/** @var string */
private $name;
/** @var string */
private $description;
/** @var string */
private $leadId;
/** @var string */
private $milestoneId;
/** @var string */
private $projectId;
/** @var string */
private $reference;
/** @var string */
private $onTaskCompletion;
/** @var string */
private $status;
/** @var string */
private $department;
/** @var string */
private $priority;
/** @var string */
private $duedate;
public function __construct(string $email, string $name, string $description, string $leadId, string $projectId, string $milestoneId, string $reference, string $onTaskCompletion, string $status, string $department, string $priority, string $duedate)
{
$this->email = $email;
$this->name = $name;
$this->description = $description;
$this->leadId = $leadId;
$this->projectId = $projectId;
$this->milestoneId = $milestoneId;
$this->reference = $reference;
$this->onTaskCompletion = $onTaskCompletion;
$this->status = $status;
$this->department = $department;
$this->priority = $priority;
$this->duedate = $duedate;
}
/**
* @return string
*/
public function getEmail(): string
{
return $this->email;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* @return string
*/
public function getLeadId(): string
{
return $this->leadId;
}
public function setLeadId(string $leadId)
{
$this->leadId = $leadId;
}
/**
* @return string
*/
public function getProjectId(): string
{
return $this->projectId;
}
/**
* @return string
*/
public function getMilestoneId(): string
{
return $this->milestoneId;
}
/**
* @return string
*/
public function getReference(): string
{
return $this->reference;
}
/**
* @return string
*/
public function getOnTaskCompletion(): string
{
return $this->onTaskCompletion;
}
/**
* @return string
*/
public function getStatus(): string
{
return $this->status;
}
/**
* @return string
*/
public function getDepartment(): string
{
return $this->department;
}
/**
* @return string
*/
public function getPriority(): string
{
return $this->priority;
}
/**
* @return string
*/
public function getDuedate(): string
{
return $this->duedate;
}
}
@@ -0,0 +1,99 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use Illuminate\Http\Request;
use App\Classes\General\Interfaces\DataTransferObject;
class CustomerContactObject implements DataTransferObject
{
/** @var int */
private $customerId;
/** @var string */
private $firstname;
/** @var string */
private $lastname;
/** @var string */
private $email;
/** @var string */
private $password;
/** @var string */
private $isPrimary;
/** @var string */
private $sendSetPasswordEmail;
public function __construct(string $customerId, string $firstname, string $lastname, string $email, string $password, string $isPrimary, string $sendSetPasswordEmail)
{
$this->customerId = $customerId;
$this->firstname = $firstname;
$this->lastname = $lastname;
$this->email = $email;
$this->password = $password;
$this->isPrimary = $isPrimary;
$this->sendSetPasswordEmail = $sendSetPasswordEmail;
}
/**
* @return int
*/
public function getCustomerId(): int
{
return $this->customerId;
}
/**
* @return string
*/
public function getFirstName(): string
{
return $this->firstname;
}
/**
* @return string
*/
public function getLastName(): string
{
return $this->lastname;
}
/**
* @return string
*/
public function getEmail(): string
{
return $this->email;
}
/**
* @return string
*/
public function getPassword(): string
{
return $this->password;
}
/**
* @return string
*/
public function getIsPrimary(): string
{
return $this->isPrimary;
}
/**
* @return string
*/
public function getSendSetPasswordEmail(): string
{
return $this->sendSetPasswordEmail;
}
}
@@ -0,0 +1,124 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use Illuminate\Http\Request;
use App\Classes\General\Interfaces\DataTransferObject;
class InitialPerfexCRMObject implements DataTransferObject
{
/** @var string */
private $companyName;
/** @var string */
private $companyReference;
/** @var string */
private $contactName;
/** @var string */
private $contactEmail;
/** @var string */
private $bookingMarking;
/** @var string */
private $projectName;
/** @var int */
private $projectStatus;
/** @var array */
private $milestoneNames;
/** @var array */
private $taskNames;
public function __construct(string $companyName, string $companyReference, string $contactName, string $contactEmail, string $bookingMarking, string $projectName, int $projectStatus, array $milestoneNames, array $taskNames)
{
$this->companyName = $companyName;
$this->companyReference = $companyReference;
$this->contactName = $contactName;
$this->contactEmail = $contactEmail;
$this->bookingMarking = $bookingMarking;
$this->projectName = $projectName;
$this->projectStatus = $projectStatus;
$this->milestoneNames = $milestoneNames;
$this->taskNames = $taskNames;
}
/**
* @return string
*/
public function getCompanyName(): string
{
return $this->companyName;
}
/**
* @return string
*/
public function getCompanyReference(): string
{
return $this->companyReference;
}
/**
* @return string
*/
public function getContactName(): string
{
return $this->contactName;
}
/**
* @return string
*/
public function getContactEmail(): string
{
return $this->contactEmail;
}
/**
* @return string
*/
public function getBookingMarking(): string
{
return $this->bookingMarking;
}
/**
* @return string
*/
public function getProjectName(): string
{
return $this->projectName;
}
/**
* @return string
*/
public function getProjectStatus(): int
{
return $this->projectStatus;
}
/**
* @return array
*/
public function getMilestoneNames(): array
{
return $this->milestoneNames;
}
/**
* @return array
*/
public function getTaskNames(): array
{
return $this->taskNames;
}
}
@@ -0,0 +1,86 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use Illuminate\Http\Request;
use App\Classes\General\Interfaces\DataTransferObject;
class InvoicePaymentPerfexCRMObject implements DataTransferObject
{
/** @var int */
private $invoiceId;
/** @var float */
private $amount;
/** @var string */
private $date;
/** @var int */
private $paymentMode;
/** @var string */
private $transactionId;
/** @var string */
private $note;
public function __construct(int $invoiceId, float $amount, string $date, int $paymentMode, string $transactionId, string $note)
{
$this->invoiceId = $invoiceId;
$this->amount = $amount;
$this->date = $date;
$this->paymentMode = $paymentMode;
$this->transactionId = $transactionId;
$this->note = $note;
}
/**
* @return int
*/
public function getInvoiceId(): int
{
return $this->invoiceId;
}
/**
* @return float
*/
public function getAmount(): float
{
return $this->amount;
}
/**
* @return string
*/
public function getDate(): string
{
return $this->date;
}
/**
* @return int
*/
public function getPaymentMode(): int
{
return $this->paymentMode;
}
/**
* @return string
*/
public function getTransactionId(): string
{
return $this->transactionId;
}
/**
* @return string
*/
public function getNote(): string
{
return $this->note;
}
}
@@ -0,0 +1,145 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use Illuminate\Http\Request;
use App\Classes\General\Interfaces\DataTransferObject;
class InvoicePerfexCRMObject implements DataTransferObject
{
/** @var string */
private $clientId;
/** @var string */
private $number;
/** @var string */
private $date;
/** @var string */
private $dueDate;
/** @var string */
private $currency;
/** @var float */
private $subTotal;
/** @var float */
private $total;
/** @var string */
private $billingStreet;
/** @var string */
private $projectId;
/** @var array */
private $allowedPaymentModes;
/** @var array */
private $invoiceItems;
public function __construct(string $clientId, string $number, string $date, string $dueDate, string $currency, float $subTotal, float $total, string $billingStreet, string $projectId, array $allowedPaymentModes, array $invoiceItems)
{
$this->clientId = $clientId;
$this->number = $number;
$this->date = $date;
$this->dueDate = $dueDate;
$this->currency = $currency;
$this->subTotal = $subTotal;
$this->total = $total;
$this->billingStreet = $billingStreet;
$this->projectId = $projectId;
$this->allowedPaymentModes = $allowedPaymentModes;
$this->invoiceItems = $invoiceItems;
}
/**
* @return string
*/
public function getClientId(): string
{
return $this->clientId;
}
/**
* @return string
*/
public function getNumber(): string
{
return $this->number;
}
/**
* @return string
*/
public function getDate(): string
{
return $this->date;
}
/**
* @return string
*/
public function getDueDate(): string
{
return $this->dueDate;
}
/**
* @return string
*/
public function getCurrency(): string
{
return $this->currency;
}
/**
* @return float
*/
public function getSubTotal(): float
{
return $this->subTotal;
}
/**
* @return float
*/
public function getTotal(): float
{
return $this->total;
}
/**
* @return string
*/
public function getBillingStreet(): string
{
return $this->billingStreet;
}
/**
* @return string
*/
public function getProjectId(): string
{
return $this->projectId;
}
/**
* @return array
*/
public function getAllowedPaymentModes(): array
{
return $this->allowedPaymentModes;
}
/**
* @return array
*/
public function getInvoiceItems(): array
{
return $this->invoiceItems;
}
}
@@ -0,0 +1,86 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use Illuminate\Http\Request;
use App\Classes\General\Interfaces\DataTransferObject;
class InvoiceSingleItemPerfexCRMObject implements DataTransferObject
{
/** @var string */
public $description;
/** @var string */
public $longDescription;
/** @var float */
public $qty;
/** @var float */
public $rate;
/** @var int */
public $order;
/** @var string */
public $unit;
public function __construct(string $description, string $longDescription, float $qty, float $rate, int $order, string $unit)
{
$this->description = $description;
$this->longDescription = $longDescription;
$this->qty = $qty;
$this->rate = $rate;
$this->order = $order;
$this->unit = $unit;
}
/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* @return string
*/
public function getLongDescription(): string
{
return $this->longDescription;
}
/**
* @return float
*/
public function getQty(): float
{
return $this->qty;
}
/**
* @return float
*/
public function getRate(): float
{
return $this->rate;
}
/**
* @return int
*/
public function getOrder(): int
{
return $this->order;
}
/**
* @return string
*/
public function getUnit(): string
{
return $this->unit;
}
}
@@ -0,0 +1,62 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use Illuminate\Http\Request;
use App\Classes\General\Interfaces\DataTransferObject;
use App\Models\Transaction;
class UpdatePerfexCRMInvoiceObject implements DataTransferObject
{
/** @var string */
private $email;
/** @var Transaction */
private $transaction;
/** @var bool */
private $isPaid;
/** @var string */
private $projectId;
public function __construct(string $email, string $projectId, Transaction $transaction, bool $isPaid)
{
$this->email = $email;
$this->transaction = $transaction;
$this->isPaid = $isPaid;
$this->projectId = $projectId;
}
/**
* @return string
*/
public function getEmail(): string
{
return $this->email;
}
/**
* @return string
*/
public function getProjectId(): string
{
return $this->projectId;
}
/**
* @return Transaction
*/
public function getTransaction(): Transaction
{
return $this->transaction;
}
/**
* @return bool
*/
public function getIsPaid(): bool
{
return $this->isPaid;
}
}
@@ -0,0 +1,128 @@
<?php
namespace App\Classes\Modules\PerfexCRM\DataTransferObjects;
use Illuminate\Http\Request;
use App\Classes\General\Interfaces\DataTransferObject;
class UpdatePerfexCRMObject implements DataTransferObject
{
/** @var string */
private $companyName;
/** @var string */
private $companyReference;
/** @var string */
private $contactName;
/** @var string */
private $contactEmail;
/** @var string */
private $bookingMarking;
/** @var string */
private $projectName;
/** @var int */
private $projectStatus;
/** @var array */
private $milestoneNames;
/** @var array */
private $tasks;
public function __construct(string $companyName, string $companyReference, string $contactName, string $contactEmail, string $bookingMarking, string $projectName, int $projectStatus, array $milestoneNames, array $tasks)
{
$this->companyName = $companyName;
$this->companyReference = $companyReference;
$this->contactName = $contactName;
$this->contactEmail = $contactEmail;
$this->bookingMarking = $bookingMarking;
$this->projectName = $projectName;
$this->projectStatus = $projectStatus;
$this->milestoneNames = $milestoneNames;
$this->tasks = $tasks;
}
/**
* @return string
*/
public function getCompanyName(): string
{
return $this->companyName;
}
/**
* @return string
*/
public function getCompanyReference(): string
{
return $this->companyReference;
}
/**
* @return string
*/
public function getContactName(): string
{
return $this->contactName;
}
/**
* @return string
*/
public function getContactEmail(): string
{
return $this->contactEmail;
}
/**
* @return string
*/
public function getBookingMarking(): string
{
return $this->bookingMarking;
}
/**
* @return string
*/
public function getProjectName(): string
{
return $this->projectName;
}
/**
* @return int
*/
public function getProjectStatus(): int
{
return $this->projectStatus;
}
/**
* @return array
*/
public function getMilestoneNames(): array
{
return $this->milestoneNames;
}
/**
* @return array
*/
public function getTasks(): array
{
return $this->tasks;
}
public function setTasks($tasks)
{
$this->tasks = $tasks;
}
}
@@ -0,0 +1,178 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Processors;
use App\Models\Transaction;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMInvoice;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMInvoicePayment;
use App\Classes\Modules\PerfexCRM\Services\ConvertsPerfexCRMLeadToCustomer;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMProject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePerfexCRMObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePaymentPerfexCRMObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoiceSingleItemPerfexCRMObject;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerProject;
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
use App\Models\PackingList;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
class CreatePerfexCRMInvoiceProcessor
{
/** @var CreatesPerfexCRMInvoice */
private $createsPerfexCRMInvoice;
/** @var CreatesPerfexCRMInvoicePayment */
private $createsPerfexCRMInvoicePayment;
/** @var ConvertsPerfexCRMLeadToCustomer */
private $convertsPerfexCRMLeadToCustomer;
/** @var FetchesPerfexCRMProject */
private $fetchesPerfexCRMProject;
/** @var CreatesPerfexCRMCustomerProject */
private $createsPerfexCRMCustomerProject;
/**
* CreatePerfexCRMInvoiceProcessor constructor.
* @param CreatesPerfexCRMInvoice $createsPerfexCRMInvoice
*/
public function __construct(CreatesPerfexCRMInvoice $createsPerfexCRMInvoice,
CreatesPerfexCRMInvoicePayment $createsPerfexCRMInvoicePayment,
ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer,
FetchesPerfexCRMProject $fetchesPerfexCRMProject,
CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject)
{
$this->createsPerfexCRMInvoice = $createsPerfexCRMInvoice;
$this->createsPerfexCRMInvoicePayment = $createsPerfexCRMInvoicePayment;
$this->convertsPerfexCRMLeadToCustomer = $convertsPerfexCRMLeadToCustomer;
$this->fetchesPerfexCRMProject = $fetchesPerfexCRMProject;
$this->createsPerfexCRMCustomerProject = $createsPerfexCRMCustomerProject;
}
/**
* @param Transaction $transaction
* @param bool $isPaid, default: false
* @return null|object
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Transaction $transaction, bool $isPaid = false) {
$clientId = "";
$number = $transaction->bill_no;
$prefix = "INV-";
//This will remove the prefix if prefix already exist in the string
if (substr($number, 0, strlen($prefix)) == $prefix) {
$number = substr($number, strlen($prefix));
}
$date = Carbon::parse($transaction->created_at)->format('Y-m-d');
$dueDate = Carbon::parse($transaction->created_at)->addDays(6)->startOfDay()->format('Y-m-d');
$currency = 1;
$subTotal = 0.00;
$total = 0.00;
$companyModule = $transaction->owner->owner->companyModule;
$billingStreet = "";
$addresses = $companyModule
->addresses()
->where('status', '=', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)
->where('type', '=', \App\Classes\ValueObjects\Constants\AddressType::BILLING)->first();
if ($addresses !== null) {
$billingStreet = $billingStreet.$addresses->street_one;
$billingStreet = $billingStreet.$addresses->street_two.',';
$billingStreet = $billingStreet.$addresses->district()->first()->name.',';
$billingStreet = $billingStreet.$addresses->postcode;
$billingStreet = $billingStreet.$addresses->state()->first()->name.',';
$billingStreet = $billingStreet.$addresses->country()->first()->name;
}
else{
$billingStreet = "[Pending Billing Details by user]";
}
$allowedPaymentModes = [];
$invoiceItems = [];
$employee = $companyModule->employees()->first();
$email = $employee->email;
$result = $this->convertsPerfexCRMLeadToCustomer->execute($email);
if(isset($result->payload)){
$clientId = $result->payload['client_id'];
}
//get project
$projectId = ""; //Project only exist in CRM if the customer already made payment
$projectName = "";
if($isPaid){
if($transaction->owner instanceof PackingList){
$orderReference = $transaction->owner->owner->reference;
$packingListReference = $transaction->owner->reference;
$projectName = 'IZYIM | X1 Shipping | '.$orderReference.' | '.$packingListReference;
$result = $this->fetchesPerfexCRMProject->execute($projectName, $clientId);
if(isset($result->payload)){
$project = $result->payload[0];
$projectId = $project['id'];
}
else{
$result = $this->createsPerfexCRMCustomerProject->execute($projectName, PerfexCRMProjectStatus::NOT_STARTED, $clientId);
if(isset($result->payload)){ //Here means project creation successful
$projectId = $result->payload['project_id'];
}
}
}
if($projectId == ""){
Log::error(json_encode('CreatePerfexCRMInvoiceProcessor debug: '.$projectName));
Log::error(json_encode($transaction->owner));
}
}
//newitems
foreach ($transaction->transactionDetails as $key => $transaction_detail){
$order = $key + 1;
$description = $transaction_detail->name;
$quantity = $transaction_detail->quantity;
$unitPrice = $transaction_detail->price;
$subTotal = $subTotal + $transaction_detail->amount;
//string $description, string $longDescription, int $qty, int $rate, int $order, string $unit
$invoiceSingleItem = new InvoiceSingleItemPerfexCRMObject(
$description,
"",
$quantity,
$unitPrice,
$order,
""
);
array_push($invoiceItems, $invoiceSingleItem);
}
$total = $transaction->amount;
//This setting is similar to Setup > Leads > Sources, Setup > Leads > Statuses
//Can be found at Finance > Payment Modes
array_push($allowedPaymentModes, 1, 2);
$invoicePerfexCRMObject = new InvoicePerfexCRMObject(
$clientId,
$number,
$date,
$dueDate,
$currency,
$subTotal,
$total,
$billingStreet,
$projectId,
$allowedPaymentModes,
$invoiceItems
);
$result = $this->createsPerfexCRMInvoice->execute($invoicePerfexCRMObject);
return $result;
}
}
@@ -0,0 +1,36 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Processors;
// use App\Classes\Modules\PerfexCRM\DataTransferObjects\ContactObject;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMLead;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateLeadPerfexCRMObject;
class CreatePerfexCRMLeadProcessor
{
/** @var CreatesPerfexCRMLead */
private $createsPerfexCRMLead;
/**
* CreatePerfexCRMLeadProcessor constructor.
* @param CreatesPerfexCRMLead $createsPerfexCRMLead
*/
public function __construct(CreatesPerfexCRMLead $createsPerfexCRMLead)
{
$this->createsPerfexCRMLead = $createsPerfexCRMLead;
}
/**
* @param CreateLeadPerfexCRMObject $createLeadPerfexCRMObject
* @return null|object
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(CreateLeadPerfexCRMObject $createLeadPerfexCRMObject) {
return $this->createsPerfexCRMLead->execute($createLeadPerfexCRMObject);
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Processors;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMTask;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateTaskPerfexCRMObject;
class CreatePerfexCRMTaskProcessor
{
/** @var CreatesPerfexCRMTask */
private $createsPerfexCRMTask;
/**
* @param CreatesPerfexCRMTask $createsPerfexCRMTask
*/
public function __construct(CreatesPerfexCRMTask $createsPerfexCRMTask)
{
$this->createsPerfexCRMTask = $createsPerfexCRMTask;
}
/**
* @param CreateTaskPerfexCRMObject $createTaskPerfexCRMObject
* @return true
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(CreateTaskPerfexCRMObject $createTaskPerfexCRMObject) {
$this->createsPerfexCRMTask->execute(
$createTaskPerfexCRMObject->getName(),
$createTaskPerfexCRMObject->getDescription(),
$createTaskPerfexCRMObject->getLeadId(),
$createTaskPerfexCRMObject->getMilestoneId(),
$createTaskPerfexCRMObject->getProjectId(),
$createTaskPerfexCRMObject->getReference(),
$createTaskPerfexCRMObject->getOnTaskCompletion(),
$createTaskPerfexCRMObject->getDepartment(),
$createTaskPerfexCRMObject->getStatus(),
$createTaskPerfexCRMObject->getPriority(),
$createTaskPerfexCRMObject->getDuedate()
);
return true;
}
}
@@ -0,0 +1,43 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Processors;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateTaskPerfexCRMObject;
use App\Classes\Jobs\CreatePerfexCRMSingleTask;
use App\Classes\ValueObjects\Constants\PerfexCRMTaskPriority;
use App\Classes\ValueObjects\Constants\PerfexCRMTasks;
use App\Models\Company;
class NewLeadTaskToPerfexCRMProcessor
{
/**
* @param Company $company
* @return true
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Company $company)
{
$companyModule = $company->companyModules()->first();
$employee = $companyModule->employees()->first();
$contactEmail = $employee->email;
$createTaskPerfexCRMObject = new CreateTaskPerfexCRMObject(
$contactEmail,
PerfexCRMTasks::TASK_IDENTIFICATION_1['name'],
PerfexCRMTasks::TASK_IDENTIFICATION_1['description'],
"",
"",
"",
"",
"",
PerfexCRMTasks::TASK_IDENTIFICATION_1['status'],
PerfexCRMTasks::TASK_IDENTIFICATION_1['department'],
PerfexCRMTaskPriority::DEFAULT,
"0"
);
CreatePerfexCRMSingleTask::dispatch($createTaskPerfexCRMObject);
return true;
}
}
@@ -0,0 +1,60 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Processors;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
use App\Classes\ValueObjects\Constants\PerfexCRMTasks;
use App\Classes\Jobs\UpdatePerfexCRM;
use App\Classes\Jobs\UpdatePerfexCRMPrelude;
use App\Models\PackingList;
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
use Illuminate\Support\Facades\Log;
class PackingListToPerfexCRMProcessor
{
/**
* @param PackingList $packingList
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(PackingList $packingList)
{
try {
if($packingList->owner instanceof \App\Models\Order) {
$order = $packingList->owner;
$companyModule = $order->companyModule()->first();
$connection = $companyModule->inviters()->withPivot('invitee_reference')->first();
$companyName = $companyModule->name;
$companyReference = $connection ? $connection->pivot->invitee_reference:'';
$employee = $companyModule->employees()->first();
$contactEmail = $employee->email;
$contactName = $employee->name;
$orderReference = $packingList->owner->reference;
$packingListReference = $packingList->reference;
$projectName = 'IZYIM | X1 Shipping | '.$orderReference.' | '.$packingListReference;
$updatePerfexCRMObject = new UpdatePerfexCRMObject(
$companyName,
$companyReference,
$contactName,
$contactEmail,
"",
$projectName,
PerfexCRMProjectStatus::NOT_STARTED,
[],
[
PerfexCRMTasks::TASK_LOADED_CONTAINER_1,
PerfexCRMTasks::TASK_LOADED_CONTAINER_2,
]
);
UpdatePerfexCRMPrelude::dispatch($packingList, null, $updatePerfexCRMObject, UpdatePerfexCRM::class, null);
}
} catch (\Exception $exception){
Log::error(json_encode('PackingListToPerfexCRMProcessor debug:'));
Log::error(json_encode($packingList));
Log::error($exception);
}
return true;
}
}
@@ -0,0 +1,75 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Processors;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
use App\Classes\ValueObjects\Constants\PerfexCRMTasks;
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\Jobs\UpdatePerfexCRMInvoice;
use App\Classes\Jobs\UpdatePerfexCRM;
use App\Classes\Jobs\UpdatePerfexCRMPrelude;
use App\Classes\Jobs\CreatePerfexCRMInvoice;
use App\Models\Transaction;
use Illuminate\Support\Facades\Log;
class TransactionToPerfexCRMProcessor
{
/**
* @param Transaction $model
* @param int $status
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Transaction $model, int $status)
{
try
{
if($model->owner instanceof \App\Models\Transaction && $status == ApprovalStatus::APPROVED)
{
$packingList = $model->owner->owner;
$order = $packingList->owner()->first();
$companyModule = $order->companyModule()->first();
$companyName = $companyModule->name;
$companyReference = $companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
$employee = $companyModule->employees()->first();
$contactEmail = $employee->email;
$contactName = $employee->name;
$orderReference = $order->reference;
$packingListReference = $packingList->reference;
$projectName = 'IZYIM | X1 Shipping | '.$orderReference.' | '.$packingListReference;
$bookingMarking = $packingList->id."-".$packingList->owner->id;
$updatePerfexCRMObject = new UpdatePerfexCRMObject(
$companyName,
$companyReference,
$contactName,
$contactEmail,
$bookingMarking,
$projectName,
PerfexCRMProjectStatus::IN_PROGRESS,
[],
[
PerfexCRMTasks::TASK_1,
PerfexCRMTasks::TASK_POST_PAYMENT_1,
PerfexCRMTasks::TASK_POST_PAYMENT_2,
PerfexCRMTasks::TASK_POST_PAYMENT_3,
PerfexCRMTasks::TASK_POST_PAYMENT_4,
]
);
UpdatePerfexCRMPrelude::dispatch(null, $model, $updatePerfexCRMObject, UpdatePerfexCRM::class, UpdatePerfexCRMInvoice::class);
}
else if($model->owner instanceof \App\Models\PackingList && $model->status == ApprovalStatus::PENDING_SUBMISSION && $status == ApprovalStatus::APPROVED)
{
CreatePerfexCRMInvoice::dispatch($model);
}
}
catch (\Exception $exception) {
Log::error('TransactionToPerfexCRMProcessor debug:');
Log::error($exception);
}
return true;
}
}
@@ -0,0 +1,231 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Processors;
use App\Classes\Modules\PerfexCRM\Services\ConvertsPerfexCRMLeadToCustomer;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerProject;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMMilestone;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMTask;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMProject;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMMilestone;
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMTask;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomer;
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerContact;
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMTask;
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMCustomer;
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMProject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CustomerContactObject;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
use App\Classes\ValueObjects\Constants\PerfexCRMTaskStatus;
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;
class UpdatePerfexCRMProcessor
{
/** @var ConvertsPerfexCRMLeadToCustomer */
private $convertsPerfexCRMLeadToCustomer;
/** @var CreatesPerfexCRMCustomerProject */
private $createsPerfexCRMCustomerProject;
/** @var CreatesPerfexCRMMilestone */
private $createsPerfexCRMMilestone;
/** @var CreatesPerfexCRMTask */
private $createsPerfexCRMTask;
/** @var FetchesPerfexCRMProject */
private $fetchesPerfexCRMProject;
/** @var FetchesPerfexCRMMilestone */
private $fetchesPerfexCRMMilestone;
/** @var FetchesPerfexCRMTask */
private $fetchesPerfexCRMTask;
/** @var CreatesPerfexCRMCustomer */
private $createsPerfexCRMCustomer;
/** @var CreatesPerfexCRMCustomerContact */
private $createsPerfexCRMCustomerContact;
/** @var UpdatesPerfexCRMTask */
private $updatesPerfexCRMTask;
/** @var UpdatesPerfexCRMCustomer */
private $updatesPerfexCRMCustomer;
/** @var UpdatesPerfexCRMProject */
private $updatesPerfexCRMProject;
/**
* @param ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer
* @param CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject
* @param CreatesPerfexCRMMilestone $createsPerfexCRMMilestone
* @param CreatesPerfexCRMTask $createsPerfexCRMTask
* @param FetchesPerfexCRMProject $fetchesPerfexCRMProject
* @param FetchesPerfexCRMMilestone $fetchesPerfexCRMMilestone
* @param FetchesPerfexCRMTask $fetchesPerfexCRMTask
* @param CreatesPerfexCRMCustomer $createsPerfexCRMCustomer
* @param CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact
* @param UpdatesPerfexCRMTask $updatesPerfexCRMTask
* @param UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer
* @param UpdatesPerfexCRMProject $updatesPerfexCRMProject
*/
public function __construct(ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer,
CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject,
CreatesPerfexCRMMilestone $createsPerfexCRMMilestone,
CreatesPerfexCRMTask $createsPerfexCRMTask,
FetchesPerfexCRMProject $fetchesPerfexCRMProject,
FetchesPerfexCRMMilestone $fetchesPerfexCRMMilestone,
FetchesPerfexCRMTask $fetchesPerfexCRMTask,
CreatesPerfexCRMCustomer $createsPerfexCRMCustomer,
CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact,
UpdatesPerfexCRMTask $updatesPerfexCRMTask,
UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer,
UpdatesPerfexCRMProject $updatesPerfexCRMProject)
{
$this->convertsPerfexCRMLeadToCustomer = $convertsPerfexCRMLeadToCustomer;
$this->createsPerfexCRMCustomerProject = $createsPerfexCRMCustomerProject;
$this->createsPerfexCRMMilestone = $createsPerfexCRMMilestone;
$this->createsPerfexCRMTask = $createsPerfexCRMTask;
$this->fetchesPerfexCRMProject = $fetchesPerfexCRMProject;
$this->fetchesPerfexCRMMilestone = $fetchesPerfexCRMMilestone;
$this->fetchesPerfexCRMTask = $fetchesPerfexCRMTask;
$this->createsPerfexCRMCustomer = $createsPerfexCRMCustomer;
$this->createsPerfexCRMCustomerContact = $createsPerfexCRMCustomerContact;
$this->updatesPerfexCRMTask = $updatesPerfexCRMTask;
$this->updatesPerfexCRMCustomer = $updatesPerfexCRMCustomer;
$this->updatesPerfexCRMProject = $updatesPerfexCRMProject;
}
/**
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
* @return null|object
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(UpdatePerfexCRMObject $updatePerfexCRMObject) {
$projectId = "";
// Customer has to exist first before Project can appear under it
// Check with Perfex CRM, if this user (email) was previously a lead, should automatically now become a customer
$crmCompany = $updatePerfexCRMObject->getCompanyName();
$result = $this->convertsPerfexCRMLeadToCustomer->execute($updatePerfexCRMObject->getContactEmail());
if(isset($result->payload)){
$crmClientId = $result->payload['client_id'];
if (isset($result->payload['company'])) {
$crmCompany = $result->payload['company'];
}
}
else{
//if reach this point, this means this user is not a official customer nor is a lead in crm
//Create Customer has 2 parts: Create Company (client), Create Contact
$result = $this->createsPerfexCRMCustomer->execute($crmCompany);
if(is_null($result)){
$crmCompany = $crmCompany." 2";
$result = $this->createsPerfexCRMCustomer->execute($crmCompany);
}
$crmClientId = $result->payload['clientId'];
$customerContactObject = new CustomerContactObject(
$crmClientId,
$updatePerfexCRMObject->getContactName(),
$updatePerfexCRMObject->getContactName(),
$updatePerfexCRMObject->getContactEmail(),
"pU^T@sC#9Q",
"on",
"on"
);
$result = $this->createsPerfexCRMCustomerContact->execute($customerContactObject);
}
//Update custom fields to identify company reference from exchange or shipping portal
$value_exists = false;
if (isset($result->payload['customfields'])) {
foreach ($result->payload['customfields'] as $element) {
if ($element['value'] === $updatePerfexCRMObject->getCompanyReference()) {
$value_exists = true;
break;
}
}
}
if(!$value_exists);
{
$result = $this->updatesPerfexCRMCustomer->execute($crmClientId, $crmCompany, $updatePerfexCRMObject->getCompanyReference());
}
// Get existing or create project, project has to exist first before milestone can appear under it
$result = $this->fetchesPerfexCRMProject->execute($updatePerfexCRMObject->getProjectName(), $crmClientId);
if(isset($result->payload)){
$project = $result->payload[0];
$projectId = $project['id'];
//if the project status is anything but PerfexCRMProjectStatus::NOT_STARTED, update the project
if($updatePerfexCRMObject->getProjectStatus() != PerfexCRMProjectStatus::NOT_STARTED && $project['status'] == PerfexCRMProjectStatus::NOT_STARTED)
{
$this->updatesPerfexCRMProject->execute($project, $updatePerfexCRMObject->getProjectStatus());
}
}
else{
$result = $this->createsPerfexCRMCustomerProject->execute($updatePerfexCRMObject->getProjectName(), $updatePerfexCRMObject->getProjectStatus(), $crmClientId);
if(isset($result->payload)){ //Here means project creation successful
$projectId = $result->payload['project_id'];
}
}
$tasks = $updatePerfexCRMObject->getTasks();
if(count($tasks) > 0){
//Create tasks with milestone
for($count=0; $count < count($tasks); $count++) {
$milestoneId = 0; //By default milestoneId is 0, having this set at individual task is optional
if($tasks[$count]['milestone'] != "") //Create milestone only if it is defined
{
// Get existing or create milestone, milestone has to exist first before task can appear under it
$result = $this->fetchesPerfexCRMMilestone->execute($tasks[$count]['milestone'], $projectId);
if(isset($result->payload)){
$array = json_decode(json_encode($result->payload[0]), true);
$milestoneId = $array['id'];
}
else{
$result = $this->createsPerfexCRMMilestone->execute($tasks[$count]['milestone'], $projectId, $count);
if(isset($result->payload)){
$milestoneId = $result->payload['milestone_id'];
}
}
}
$taskStatus = PerfexCRMTaskStatus::NOT_STARTED;
if($tasks[$count]['status'] != ''){
$taskStatus = $tasks[$count]['status'];
}
// Get existing or create task
$result = $this->fetchesPerfexCRMTask->execute($tasks[$count]['name'], $milestoneId, 'project', $projectId);
if(isset($result->payload)){
break; //Breaking the rest of the tasks in array assuming that they are all created as a batch previously
//The following are code not needed at Shipping Portal, Exchange need certain task's status to be updated dynamically
// if($taskStatus != PerfexCRMTaskStatus::NOT_STARTED && $result->payload[0]['status'] == PerfexCRMTaskStatus::NOT_STARTED)
// {
// $task = $result->payload[0];
// $result = $this->updatesPerfexCRMTask->execute($task['id'], $task['name'], $task['milestone'], $task['rel_id'], $taskStatus, $task['startdate'], is_null($task['duedate']) ? '': $task['duedate']);
// }
}
else{
$result = $this->createsPerfexCRMTask->execute($tasks[$count]['name'], $tasks[$count]['description'], '', $milestoneId, $projectId, $tasks[$count]['reference'], $tasks[$count]['on_task_completion'], $tasks[$count]['department'], $taskStatus, $tasks[$count]['priority'], $tasks[$count]['duedate']);
}
}
}
$payload = [];
$payload['projectId'] = $projectId;
return (object) $payload;
}
}
@@ -0,0 +1,34 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
class ConvertsPerfexCRMLeadToCustomer
{
/**
* @param string $email
* @return null|object
* @throws MalformedRequestException
*/
public function execute(string $email) {
try{
$response = Http::withHeaders([
'authtoken' => config('perfexcrm.api_key'),])
->get(config('perfexcrm.base_url').'/api/leads/convertocustomer/'.$email);
if($response->successful()){
$data = $response->json();
return (object) $data;
}else{
Log::error($response);
return null;
}
}catch(\Exception $exception){
throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage());
}
}
}
@@ -0,0 +1,37 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
class CreatesPerfexCRMCustomer
{
/**
* @param string $companyName
* @return null|object
* @throws MalformedRequestException
*/
public function execute(string $companyName) {
try{
$data = [
'company' => $companyName
];
$response = Http::asForm()->withHeaders([
'authtoken' => config('perfexcrm.api_key')])
->post(config('perfexcrm.base_url').'/api/customers',$data);
if($response->successful()){
$data = $response->json();
return (object) $data;
}else{
Log::error($response);
return null;
}
}catch(\Exception $exception){
throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage());
}
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Services;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CustomerContactObject;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
class CreatesPerfexCRMCustomerContact
{
/**
* @param CustomerContactObject $customerContactObject
* @return null|object
* @throws MalformedRequestException
*/
public function execute(CustomerContactObject $customerContactObject) {
try{
$data = [
'customer_id' => $customerContactObject->getCustomerId(),
'firstname' => $customerContactObject->getFirstName(),
'lastname' => $customerContactObject->getLastName(),
'email' => $customerContactObject->getEmail(), //$email
'password' => $customerContactObject->getPassword(),
'is_primary' => $customerContactObject->getIsPrimary(),
//'send_set_password_email' => $customerContactObject->getSendSetPasswordEmail(),
];
$response = Http::asForm()->withHeaders([
'authtoken' => config('perfexcrm.api_key')])
->post(config('perfexcrm.base_url').'/api/contacts',$data);
if($response->successful()){
$data = $response->json();
return (object) $data;
}else{
Log::error($response);
return null;
}
}catch(\Exception $exception){
throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage());
}
}
}
@@ -0,0 +1,43 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
class CreatesPerfexCRMCustomerProject
{
/**
* @param string $projectName
* @param string $clientId
* @return null|object
* @throws MalformedRequestException
*/
public function execute(string $projectName, int $status, string $clientId) {
try{
$data = [
'name' => $projectName,
'rel_type' => 'customer',
'billing_type' => 1,
'clientid' => $clientId,
'start_date' => date('Y-m-d'),
'status' => $status
];
$response = Http::asForm()->withHeaders([
'authtoken' => config('perfexcrm.api_key')])
->post(config('perfexcrm.base_url').'/api/projects',$data);
if($response->successful()){
$data = $response->json();
return (object) $data;
}else{
Log::error($response);
return null;
}
}catch(\Exception $exception){
throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage());
}
}
}
@@ -0,0 +1,63 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePerfexCRMObject;
class CreatesPerfexCRMInvoice
{
/**
* @param InvoicePerfexCRMObject $invoicePerfexCRMObject
* @return null|object
* @throws MalformedRequestException
*/
public function execute(InvoicePerfexCRMObject $invoicePerfexCRMObject) {
try{
$subtotal = floor($invoicePerfexCRMObject->getSubTotal() * 100) / 100;
$total = floor($invoicePerfexCRMObject->getTotal() * 100) / 100;
$data = [
'clientid' => $invoicePerfexCRMObject->getClientId(),
'number' => $invoicePerfexCRMObject->getNumber(),
'date' => $invoicePerfexCRMObject->getDate(),
'duedate' => $invoicePerfexCRMObject->getDueDate(),
'currency' => $invoicePerfexCRMObject->getCurrency(),
'subtotal' => number_format($subtotal, 2, '.', ''),
'total' => number_format($total, 2, '.', ''),
'billing_street' => $invoicePerfexCRMObject->getBillingStreet(),
'project_id' => $invoicePerfexCRMObject->getProjectId(),
'allowed_payment_modes[0]' => 1,
'allowed_payment_modes[1]' => 2,
];
for($count=0; $count < count($invoicePerfexCRMObject->getInvoiceItems()); $count++) {
$oneItem = [
"newitems[".$count."][description]" => $invoicePerfexCRMObject->getInvoiceItems()[$count]->description,
"newitems[".$count."][long_description]" => $invoicePerfexCRMObject->getInvoiceItems()[$count]->longDescription,
"newitems[".$count."][qty]" => $invoicePerfexCRMObject->getInvoiceItems()[$count]->qty,
"newitems[".$count."][rate]" => $invoicePerfexCRMObject->getInvoiceItems()[$count]->rate,
"newitems[".$count."][order]" => $invoicePerfexCRMObject->getInvoiceItems()[$count]->order,
"newitems[".$count."][unit]" => $invoicePerfexCRMObject->getInvoiceItems()[$count]->unit,
];
$data = array_merge($data, $oneItem);
}
$response = Http::asForm()->withHeaders([
'authtoken' => config('perfexcrm.api_key')])
->post(config('perfexcrm.base_url').'/api/invoices',$data);
if($response->successful()){
$data = $response->json();
return (object) $data;
}else{
Log::error($response);
return null;
}
}catch(\Exception $exception){
throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage());
}
}
}
@@ -0,0 +1,43 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InvoicePaymentPerfexCRMObject;
class CreatesPerfexCRMInvoicePayment
{
/**
* @param InvoicePaymentPerfexCRMObject $invoicePaymentPerfexCRMObject
* @return null|object
* @throws MalformedRequestException
*/
public function execute(InvoicePaymentPerfexCRMObject $invoicePaymentPerfexCRMObject) {
try{
$data = [
'invoiceid' => $invoicePaymentPerfexCRMObject->getInvoiceId(),
'amount' => number_format($invoicePaymentPerfexCRMObject->getAmount(), 2, '.', ''),
'date' => $invoicePaymentPerfexCRMObject->getDate(),
'paymentmode' => $invoicePaymentPerfexCRMObject->getPaymentMode(),
'transactionid' => $invoicePaymentPerfexCRMObject->getTransactionId(),
'note' => $invoicePaymentPerfexCRMObject->getNote(),
];
$response = Http::asForm()->withHeaders([
'authtoken' => config('perfexcrm.api_key')])
->post(config('perfexcrm.base_url').'/api/invoices/recordpayment',$data);
if($response->successful()){
$data = $response->json();
return (object) $data;
}else{
Log::error($response);
return null;
}
}catch(\Exception $exception){
throw new MalformedRequestException('Unable to get correct response from Perfex CRM server' . $exception->getMessage());
}
}
}
@@ -0,0 +1,50 @@
<?php
namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateLeadPerfexCRMObject;
class CreatesPerfexCRMLead
{
/**
* @param CreateLeadPerfexCRMObject $createLeadPerfexCRMObject
* @return null|object
* @throws MalformedRequestException
*/
public function execute(CreateLeadPerfexCRMObject $createLeadPerfexCRMObject) {
try{
$custom_fields = [
"leads" => [
4 => $createLeadPerfexCRMObject->getCompanyReference()
]
];
$data = [
'name' => $createLeadPerfexCRMObject->getName(),
'email' => $createLeadPerfexCRMObject->getEmail(),
'phonenumber' => $createLeadPerfexCRMObject->getPhone(),
'company' => $createLeadPerfexCRMObject->getCompanyName(),
'source' => 2, //1: Exchange, 2: Shipping Portal
'status' => 2, //2: Lead, 1: Customer
'custom_fields' => $custom_fields
];
$response = Http::asForm()->withHeaders([
'authtoken' => config('perfexcrm.api_key')])
->post(config('perfexcrm.base_url').'/api/leads/byemail',$data);
if($response->successful()){
$data = $response->json();
return (object) $data;
}else{
Log::error($response);
return null;
}
}catch(\Exception $exception){
throw new MalformedRequestException('Unable to get correct response from Perfex CRM server ' . $exception->getMessage());
}
}
}

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