@@ -4,133 +4,133 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Endpoint |
| 6 | 6 | { |
| 7 | - const API_VERSION = "5"; |
|
| 7 | + const API_VERSION = "5"; |
|
| 8 | 8 | |
| 9 | - const MAIN_HOST = "https://wh.route4me.com/modules/api/v5.0"; |
|
| 9 | + const MAIN_HOST = "https://wh.route4me.com/modules/api/v5.0"; |
|
| 10 | 10 | |
| 11 | - const MAIN_HOST_WEB = "https://wh.route4me.com/modules/webapi/v5.0"; |
|
| 11 | + const MAIN_HOST_WEB = "https://wh.route4me.com/modules/webapi/v5.0"; |
|
| 12 | 12 | |
| 13 | - // <editor-fold defaultstate="collapsed" desc="region Routes"> |
|
| 13 | + // <editor-fold defaultstate="collapsed" desc="region Routes"> |
|
| 14 | 14 | |
| 15 | - const Routes = self::MAIN_HOST . "/routes"; |
|
| 16 | - const RoutesDuplicate = self::MAIN_HOST . "/routes/duplicate"; |
|
| 17 | - const RoutesMerge = self::MAIN_HOST . "/routes/merge"; |
|
| 18 | - const RoutesPaginate = self::MAIN_HOST . "/routes/paginate"; |
|
| 19 | - const RoutesFallbackPaginate = self::MAIN_HOST . "/routes/fallback/paginate"; |
|
| 20 | - const RoutesFallbackDatatable = self::MAIN_HOST . "/routes/fallback/datatable"; |
|
| 21 | - const RoutesFallback = self::MAIN_HOST . "/routes/fallback"; |
|
| 22 | - const RoutesReindexCallback = self::MAIN_HOST . "/routes/reindex-callback"; |
|
| 23 | - const RoutesDatatable = self::MAIN_HOST . "/routes/datatable"; |
|
| 24 | - const RoutesDatatableConfig = self::MAIN_HOST . "/routes/datatable/config"; |
|
| 25 | - const RoutesDatatableConfigFallback = self::MAIN_HOST . "/routes/fallback/datatable/config"; |
|
| 15 | + const Routes = self::MAIN_HOST . "/routes"; |
|
| 16 | + const RoutesDuplicate = self::MAIN_HOST . "/routes/duplicate"; |
|
| 17 | + const RoutesMerge = self::MAIN_HOST . "/routes/merge"; |
|
| 18 | + const RoutesPaginate = self::MAIN_HOST . "/routes/paginate"; |
|
| 19 | + const RoutesFallbackPaginate = self::MAIN_HOST . "/routes/fallback/paginate"; |
|
| 20 | + const RoutesFallbackDatatable = self::MAIN_HOST . "/routes/fallback/datatable"; |
|
| 21 | + const RoutesFallback = self::MAIN_HOST . "/routes/fallback"; |
|
| 22 | + const RoutesReindexCallback = self::MAIN_HOST . "/routes/reindex-callback"; |
|
| 23 | + const RoutesDatatable = self::MAIN_HOST . "/routes/datatable"; |
|
| 24 | + const RoutesDatatableConfig = self::MAIN_HOST . "/routes/datatable/config"; |
|
| 25 | + const RoutesDatatableConfigFallback = self::MAIN_HOST . "/routes/fallback/datatable/config"; |
|
| 26 | 26 | |
| 27 | - // </editor-fold> |
|
| 27 | + // </editor-fold> |
|
| 28 | 28 | |
| 29 | - // <editor-fold defaultstate="collapsed" desc="Team Users"> |
|
| 29 | + // <editor-fold defaultstate="collapsed" desc="Team Users"> |
|
| 30 | 30 | |
| 31 | - const TEAM_USERS = self::MAIN_HOST . "/team/users"; |
|
| 32 | - const TEAM_USERS_BULK_INSERT = self::MAIN_HOST . "/team/bulk-insert"; |
|
| 33 | - const DriverReview = self::MAIN_HOST . "/driver-reviews"; |
|
| 31 | + const TEAM_USERS = self::MAIN_HOST . "/team/users"; |
|
| 32 | + const TEAM_USERS_BULK_INSERT = self::MAIN_HOST . "/team/bulk-insert"; |
|
| 33 | + const DriverReview = self::MAIN_HOST . "/driver-reviews"; |
|
| 34 | 34 | |
| 35 | - // </editor-fold> |
|
| 35 | + // </editor-fold> |
|
| 36 | 36 | |
| 37 | - const ACCOUNT_PROFILE = self::MAIN_HOST . "/profile-api"; |
|
| 38 | - |
|
| 39 | - // <editor-fold defaultstate="collapsed" desc="Vehicles"> |
|
| 40 | - |
|
| 41 | - const Vehicles = self::MAIN_HOST . "/vehicles"; |
|
| 42 | - const VehicleTemporary = self::MAIN_HOST . "/vehicles/assign"; |
|
| 43 | - const VehicleExecuteOrder = self::MAIN_HOST . "/vehicles/execute"; |
|
| 44 | - const VehicleLocation = self::MAIN_HOST . "/vehicles/location"; |
|
| 45 | - const VehicleProfiles = self::MAIN_HOST . "/vehicle-profiles"; |
|
| 46 | - const VehicleLicense = self::MAIN_HOST . "/vehicles/license"; |
|
| 47 | - const VehicleSearch = self::MAIN_HOST . "/vehicles/search"; |
|
| 48 | - |
|
| 49 | - const RECURRING_ROUTES = self::MAIN_HOST . "/recurring-routes"; |
|
| 50 | - const RECURRING_ROUTES_SCHEDULES = self::MAIN_HOST . "/recurring-routes/schedules"; |
|
| 51 | - const RECURRING_ROUTES_SCHEDULES_PAGINATION = self::MAIN_HOST . "/recurring-routes/schedules/pagination"; |
|
| 52 | - const RECURRING_ROUTES_ROUTE_SCHEDULES = self::MAIN_HOST . "/recurring-routes/route-schedules"; |
|
| 53 | - const RECURRING_ROUTES_ROUTE_SCHEDULES_PAGINATION = |
|
| 54 | - self::MAIN_HOST . "/recurring-routes/route-schedules/pagination"; |
|
| 55 | - const RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE = self::MAIN_HOST . "/recurring-routes/route-schedules/replace"; |
|
| 56 | - const RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY = self::MAIN_HOST . "/recurring-routes/scheduled-routes/is-copy"; |
|
| 57 | - const RECURRING_ROUTES_SCHEDULED_ROUTES_GET_COPIES = |
|
| 58 | - self::MAIN_HOST . "/recurring-routes/scheduled-routes/get-copies"; |
|
| 59 | - const RECURRING_ROUTES_MASTER_ROUTES = self::MAIN_HOST . "/recurring-routes/master-routes"; |
|
| 60 | - |
|
| 61 | - // </editor-fold> |
|
| 37 | + const ACCOUNT_PROFILE = self::MAIN_HOST . "/profile-api"; |
|
| 38 | + |
|
| 39 | + // <editor-fold defaultstate="collapsed" desc="Vehicles"> |
|
| 40 | + |
|
| 41 | + const Vehicles = self::MAIN_HOST . "/vehicles"; |
|
| 42 | + const VehicleTemporary = self::MAIN_HOST . "/vehicles/assign"; |
|
| 43 | + const VehicleExecuteOrder = self::MAIN_HOST . "/vehicles/execute"; |
|
| 44 | + const VehicleLocation = self::MAIN_HOST . "/vehicles/location"; |
|
| 45 | + const VehicleProfiles = self::MAIN_HOST . "/vehicle-profiles"; |
|
| 46 | + const VehicleLicense = self::MAIN_HOST . "/vehicles/license"; |
|
| 47 | + const VehicleSearch = self::MAIN_HOST . "/vehicles/search"; |
|
| 48 | + |
|
| 49 | + const RECURRING_ROUTES = self::MAIN_HOST . "/recurring-routes"; |
|
| 50 | + const RECURRING_ROUTES_SCHEDULES = self::MAIN_HOST . "/recurring-routes/schedules"; |
|
| 51 | + const RECURRING_ROUTES_SCHEDULES_PAGINATION = self::MAIN_HOST . "/recurring-routes/schedules/pagination"; |
|
| 52 | + const RECURRING_ROUTES_ROUTE_SCHEDULES = self::MAIN_HOST . "/recurring-routes/route-schedules"; |
|
| 53 | + const RECURRING_ROUTES_ROUTE_SCHEDULES_PAGINATION = |
|
| 54 | + self::MAIN_HOST . "/recurring-routes/route-schedules/pagination"; |
|
| 55 | + const RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE = self::MAIN_HOST . "/recurring-routes/route-schedules/replace"; |
|
| 56 | + const RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY = self::MAIN_HOST . "/recurring-routes/scheduled-routes/is-copy"; |
|
| 57 | + const RECURRING_ROUTES_SCHEDULED_ROUTES_GET_COPIES = |
|
| 58 | + self::MAIN_HOST . "/recurring-routes/scheduled-routes/get-copies"; |
|
| 59 | + const RECURRING_ROUTES_MASTER_ROUTES = self::MAIN_HOST . "/recurring-routes/master-routes"; |
|
| 60 | + |
|
| 61 | + // </editor-fold> |
|
| 62 | 62 | |
| 63 | - // <editor-fold defaultstate="collapsed" desc="Telematicx Platform"> |
|
| 63 | + // <editor-fold defaultstate="collapsed" desc="Telematicx Platform"> |
|
| 64 | 64 | |
| 65 | - const STAGING_HOST = "https://virtserver.swaggerhub.com/Route4Me/telematics-gateway/1.0.0"; |
|
| 65 | + const STAGING_HOST = "https://virtserver.swaggerhub.com/Route4Me/telematics-gateway/1.0.0"; |
|
| 66 | 66 | |
| 67 | - const TELEMATICS_CONNECTION = self::STAGING_HOST."/connections"; |
|
| 68 | - const TELEMATICS_CONNECTION_VEHICLES = self::STAGING_HOST . "/connections/{connection_token}/vehicles"; |
|
| 67 | + const TELEMATICS_CONNECTION = self::STAGING_HOST."/connections"; |
|
| 68 | + const TELEMATICS_CONNECTION_VEHICLES = self::STAGING_HOST . "/connections/{connection_token}/vehicles"; |
|
| 69 | 69 | |
| 70 | - const TELEMATICS_ACCESS_TOKEN = self::STAGING_HOST . "/access-tokens"; |
|
| 71 | - const TELEMATICS_ACCESS_TOKEN_SCHEDULES = self::STAGING_HOST . "/access-token-schedules"; |
|
| 72 | - const TELEMATICS_ACCESS_TOKEN_SCHEDULE_ITEMS = self::STAGING_HOST . "/access-token-schedules/{schedule_id}/items"; |
|
| 70 | + const TELEMATICS_ACCESS_TOKEN = self::STAGING_HOST . "/access-tokens"; |
|
| 71 | + const TELEMATICS_ACCESS_TOKEN_SCHEDULES = self::STAGING_HOST . "/access-token-schedules"; |
|
| 72 | + const TELEMATICS_ACCESS_TOKEN_SCHEDULE_ITEMS = self::STAGING_HOST . "/access-token-schedules/{schedule_id}/items"; |
|
| 73 | 73 | |
| 74 | - const TELEMATICS_VEHICLE_GROUPS = self::STAGING_HOST . "/vehicle-groups"; |
|
| 75 | - const TELEMATICS_VEHICLE_GROUPS_RELATION = self::STAGING_HOST . "/vehicle-groups/{vehicle_group_id}/{relation}"; |
|
| 76 | - const TELEMATICS_VEHICLES_RESLATION = self::STAGING_HOST . "/vehicles/{vehicle_id}/{relation}"; |
|
| 74 | + const TELEMATICS_VEHICLE_GROUPS = self::STAGING_HOST . "/vehicle-groups"; |
|
| 75 | + const TELEMATICS_VEHICLE_GROUPS_RELATION = self::STAGING_HOST . "/vehicle-groups/{vehicle_group_id}/{relation}"; |
|
| 76 | + const TELEMATICS_VEHICLES_RESLATION = self::STAGING_HOST . "/vehicles/{vehicle_id}/{relation}"; |
|
| 77 | 77 | |
| 78 | - const TELEMATICS_INFO_MEMBERS = self::STAGING_HOST . "/info/members"; |
|
| 79 | - const TELEMATICS_INFO_VEHICLES = self::STAGING_HOST . "/info/vehicles"; |
|
| 80 | - const TELEMATICS_INFO_VEHICLE = self::STAGING_HOST . "/info/vehicle/{vehicle_id}/track"; |
|
| 81 | - const TELEMATICS_INFO_MODULES = self::STAGING_HOST . "/info/members"; |
|
| 78 | + const TELEMATICS_INFO_MEMBERS = self::STAGING_HOST . "/info/members"; |
|
| 79 | + const TELEMATICS_INFO_VEHICLES = self::STAGING_HOST . "/info/vehicles"; |
|
| 80 | + const TELEMATICS_INFO_VEHICLE = self::STAGING_HOST . "/info/vehicle/{vehicle_id}/track"; |
|
| 81 | + const TELEMATICS_INFO_MODULES = self::STAGING_HOST . "/info/members"; |
|
| 82 | 82 | |
| 83 | - const TELEMATICS_ADDRESSES = self::STAGING_HOST . "/addresses"; |
|
| 83 | + const TELEMATICS_ADDRESSES = self::STAGING_HOST . "/addresses"; |
|
| 84 | 84 | |
| 85 | - const TELEMATICS_Errors = self::STAGING_HOST . "/errors"; |
|
| 85 | + const TELEMATICS_Errors = self::STAGING_HOST . "/errors"; |
|
| 86 | 86 | |
| 87 | - const TELEMATICS_CUSTOMER_NOTIFICATIONS = self::STAGING_HOST . "/customers/{customer_id}/notifications"; |
|
| 88 | - const TELEMATICS_CUSTOMERS = self::STAGING_HOST . "/customers"; |
|
| 89 | - const TELEMATICS_CUSTOMER_ID = self::STAGING_HOST . "/customers/{customer_id}"; |
|
| 87 | + const TELEMATICS_CUSTOMER_NOTIFICATIONS = self::STAGING_HOST . "/customers/{customer_id}/notifications"; |
|
| 88 | + const TELEMATICS_CUSTOMERS = self::STAGING_HOST . "/customers"; |
|
| 89 | + const TELEMATICS_CUSTOMER_ID = self::STAGING_HOST . "/customers/{customer_id}"; |
|
| 90 | 90 | |
| 91 | - const TELEMATICS_NOTIFICATION_SCHEDULE_ITEMS = self::STAGING_HOST . "/notification-schedules/{notification_schedule_id}/items"; |
|
| 92 | - const TELEMATICS_NOTIFICATION_SCHEDULES = self::STAGING_HOST . "/notification-schedules"; |
|
| 93 | - const TELEMATICS_NOTIFICATION_SCHEDULE_IS = self::STAGING_HOST . "/notification-schedules/{schedule_id}"; |
|
| 94 | - const TELEMATICS_ONETIME_NOTIFICATIONS = self::STAGING_HOST . "/one-time-notifications"; |
|
| 91 | + const TELEMATICS_NOTIFICATION_SCHEDULE_ITEMS = self::STAGING_HOST . "/notification-schedules/{notification_schedule_id}/items"; |
|
| 92 | + const TELEMATICS_NOTIFICATION_SCHEDULES = self::STAGING_HOST . "/notification-schedules"; |
|
| 93 | + const TELEMATICS_NOTIFICATION_SCHEDULE_IS = self::STAGING_HOST . "/notification-schedules/{schedule_id}"; |
|
| 94 | + const TELEMATICS_ONETIME_NOTIFICATIONS = self::STAGING_HOST . "/one-time-notifications"; |
|
| 95 | 95 | |
| 96 | - const TELEMATICS_MEMBER = self::STAGING_HOST; |
|
| 96 | + const TELEMATICS_MEMBER = self::STAGING_HOST; |
|
| 97 | 97 | |
| 98 | - const TELEMATICS_MEMBER_MODULES = self::STAGING_HOST . "/user-activated-modules"; |
|
| 98 | + const TELEMATICS_MEMBER_MODULES = self::STAGING_HOST . "/user-activated-modules"; |
|
| 99 | 99 | |
| 100 | - const TELEMATICS_MEMBER_MODULE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}"; |
|
| 101 | - const TELEMATICS_MEMBER_MODULE_VEHICLES = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles"; |
|
| 102 | - const TELEMATICS_MEMBER_MODULE_VEHICLE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles/{vehicle_id}"; |
|
| 100 | + const TELEMATICS_MEMBER_MODULE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}"; |
|
| 101 | + const TELEMATICS_MEMBER_MODULE_VEHICLES = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles"; |
|
| 102 | + const TELEMATICS_MEMBER_MODULE_VEHICLE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles/{vehicle_id}"; |
|
| 103 | 103 | |
| 104 | - const TELEMATICS_VENDORS = self::STAGING_HOST . "/vendors"; |
|
| 105 | - const TELEMATICS_VENDOR_ID = self::STAGING_HOST . "/vendors/{vendor_id}"; |
|
| 104 | + const TELEMATICS_VENDORS = self::STAGING_HOST . "/vendors"; |
|
| 105 | + const TELEMATICS_VENDOR_ID = self::STAGING_HOST . "/vendors/{vendor_id}"; |
|
| 106 | 106 | |
| 107 | - // </editor-fold> |
|
| 108 | - |
|
| 109 | - const ADDRESSES = self::MAIN_HOST . "/address-book/addresses"; |
|
| 110 | - const ADDRESSES_BATCH_CREATE = self::MAIN_HOST . "/address-book/addresses/batch-create"; |
|
| 111 | - const ADDRESSES_INDEX_ALL = self::MAIN_HOST . "/address-book/addresses/index/all"; |
|
| 112 | - const ADDRESSES_INDEX_PAGINATION = self::MAIN_HOST . "/address-book/addresses/index/pagination"; |
|
| 113 | - const ADDRESSES_INDEX_CLUSTERING = self::MAIN_HOST . "/address-book/addresses/index/clustering"; |
|
| 114 | - const ADDRESSES_SHOW = self::MAIN_HOST . "/address-book/addresses/show"; |
|
| 115 | - const ADDRESSES_BATCH_UPDATE = self::MAIN_HOST . "/address-book/addresses/batch-update"; |
|
| 116 | - const ADDRESSES_UPDATE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/update-by-areas"; |
|
| 117 | - const ADDRESSES_DELETE = self::MAIN_HOST . "/address-book/addresses/delete"; |
|
| 118 | - const ADDRESSES_DELETE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/delete-by-areas"; |
|
| 119 | - const ADDRESSES_CUSTOM_FIELDS = self::MAIN_HOST . "/address-book/addresses/custom-fields"; |
|
| 120 | - const ADDRESSES_DEPOTS = self::MAIN_HOST . "/address-book/addresses/depots"; |
|
| 121 | - const ADDRESSES_EXPORT = self::MAIN_HOST . "/address-book/addresses/export"; |
|
| 122 | - const ADDRESSES_EXPORT_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/export-by-areas"; |
|
| 123 | - const ADDRESSES_EXPORT_BY_AREA_IDS = self::MAIN_HOST . "/address-book/addresses/export-by-area-ids"; |
|
| 124 | - const ADDRESSES_JOB_TRACKER_STATUS = self::MAIN_HOST . "/address-book/addresses/job-tracker/status"; |
|
| 125 | - const ADDRESSES_JOB_TRACKER_RESULT = self::MAIN_HOST . "/address-book/addresses/job-tracker/result"; |
|
| 126 | - |
|
| 127 | - const POD_WORKFLOW = self::MAIN_HOST . "/workflows"; |
|
| 128 | - |
|
| 129 | - const ORDER = self::MAIN_HOST . "/orders-platform"; |
|
| 130 | - const ORDER_CREATE = self::ORDER . "/create"; |
|
| 131 | - const ORDER_BATCH_CREATE = self::ORDER . "/batch-create"; |
|
| 132 | - const ORDER_BATCH_DELETE = self::ORDER . "/batch-delete"; |
|
| 133 | - const ORDER_BATCH_UPDATE = self::ORDER . "/batch-update"; |
|
| 134 | - const ORDER_BATCH_UPDATE_FILTER = self::ORDER_BATCH_UPDATE . "/filter"; |
|
| 135 | - const ORDER_CUSTOM_FIELDS = self::ORDER . "/order-custom-user-fields"; |
|
| 107 | + // </editor-fold> |
|
| 108 | + |
|
| 109 | + const ADDRESSES = self::MAIN_HOST . "/address-book/addresses"; |
|
| 110 | + const ADDRESSES_BATCH_CREATE = self::MAIN_HOST . "/address-book/addresses/batch-create"; |
|
| 111 | + const ADDRESSES_INDEX_ALL = self::MAIN_HOST . "/address-book/addresses/index/all"; |
|
| 112 | + const ADDRESSES_INDEX_PAGINATION = self::MAIN_HOST . "/address-book/addresses/index/pagination"; |
|
| 113 | + const ADDRESSES_INDEX_CLUSTERING = self::MAIN_HOST . "/address-book/addresses/index/clustering"; |
|
| 114 | + const ADDRESSES_SHOW = self::MAIN_HOST . "/address-book/addresses/show"; |
|
| 115 | + const ADDRESSES_BATCH_UPDATE = self::MAIN_HOST . "/address-book/addresses/batch-update"; |
|
| 116 | + const ADDRESSES_UPDATE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/update-by-areas"; |
|
| 117 | + const ADDRESSES_DELETE = self::MAIN_HOST . "/address-book/addresses/delete"; |
|
| 118 | + const ADDRESSES_DELETE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/delete-by-areas"; |
|
| 119 | + const ADDRESSES_CUSTOM_FIELDS = self::MAIN_HOST . "/address-book/addresses/custom-fields"; |
|
| 120 | + const ADDRESSES_DEPOTS = self::MAIN_HOST . "/address-book/addresses/depots"; |
|
| 121 | + const ADDRESSES_EXPORT = self::MAIN_HOST . "/address-book/addresses/export"; |
|
| 122 | + const ADDRESSES_EXPORT_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/export-by-areas"; |
|
| 123 | + const ADDRESSES_EXPORT_BY_AREA_IDS = self::MAIN_HOST . "/address-book/addresses/export-by-area-ids"; |
|
| 124 | + const ADDRESSES_JOB_TRACKER_STATUS = self::MAIN_HOST . "/address-book/addresses/job-tracker/status"; |
|
| 125 | + const ADDRESSES_JOB_TRACKER_RESULT = self::MAIN_HOST . "/address-book/addresses/job-tracker/result"; |
|
| 126 | + |
|
| 127 | + const POD_WORKFLOW = self::MAIN_HOST . "/workflows"; |
|
| 128 | + |
|
| 129 | + const ORDER = self::MAIN_HOST . "/orders-platform"; |
|
| 130 | + const ORDER_CREATE = self::ORDER . "/create"; |
|
| 131 | + const ORDER_BATCH_CREATE = self::ORDER . "/batch-create"; |
|
| 132 | + const ORDER_BATCH_DELETE = self::ORDER . "/batch-delete"; |
|
| 133 | + const ORDER_BATCH_UPDATE = self::ORDER . "/batch-update"; |
|
| 134 | + const ORDER_BATCH_UPDATE_FILTER = self::ORDER_BATCH_UPDATE . "/filter"; |
|
| 135 | + const ORDER_CUSTOM_FIELDS = self::ORDER . "/order-custom-user-fields"; |
|
| 136 | 136 | } |
@@ -12,51 +12,51 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // <editor-fold defaultstate="collapsed" desc="region Routes"> |
| 14 | 14 | |
| 15 | - const Routes = self::MAIN_HOST . "/routes"; |
|
| 16 | - const RoutesDuplicate = self::MAIN_HOST . "/routes/duplicate"; |
|
| 17 | - const RoutesMerge = self::MAIN_HOST . "/routes/merge"; |
|
| 18 | - const RoutesPaginate = self::MAIN_HOST . "/routes/paginate"; |
|
| 19 | - const RoutesFallbackPaginate = self::MAIN_HOST . "/routes/fallback/paginate"; |
|
| 20 | - const RoutesFallbackDatatable = self::MAIN_HOST . "/routes/fallback/datatable"; |
|
| 21 | - const RoutesFallback = self::MAIN_HOST . "/routes/fallback"; |
|
| 22 | - const RoutesReindexCallback = self::MAIN_HOST . "/routes/reindex-callback"; |
|
| 23 | - const RoutesDatatable = self::MAIN_HOST . "/routes/datatable"; |
|
| 24 | - const RoutesDatatableConfig = self::MAIN_HOST . "/routes/datatable/config"; |
|
| 25 | - const RoutesDatatableConfigFallback = self::MAIN_HOST . "/routes/fallback/datatable/config"; |
|
| 15 | + const Routes = self::MAIN_HOST."/routes"; |
|
| 16 | + const RoutesDuplicate = self::MAIN_HOST."/routes/duplicate"; |
|
| 17 | + const RoutesMerge = self::MAIN_HOST."/routes/merge"; |
|
| 18 | + const RoutesPaginate = self::MAIN_HOST."/routes/paginate"; |
|
| 19 | + const RoutesFallbackPaginate = self::MAIN_HOST."/routes/fallback/paginate"; |
|
| 20 | + const RoutesFallbackDatatable = self::MAIN_HOST."/routes/fallback/datatable"; |
|
| 21 | + const RoutesFallback = self::MAIN_HOST."/routes/fallback"; |
|
| 22 | + const RoutesReindexCallback = self::MAIN_HOST."/routes/reindex-callback"; |
|
| 23 | + const RoutesDatatable = self::MAIN_HOST."/routes/datatable"; |
|
| 24 | + const RoutesDatatableConfig = self::MAIN_HOST."/routes/datatable/config"; |
|
| 25 | + const RoutesDatatableConfigFallback = self::MAIN_HOST."/routes/fallback/datatable/config"; |
|
| 26 | 26 | |
| 27 | 27 | // </editor-fold> |
| 28 | 28 | |
| 29 | 29 | // <editor-fold defaultstate="collapsed" desc="Team Users"> |
| 30 | 30 | |
| 31 | - const TEAM_USERS = self::MAIN_HOST . "/team/users"; |
|
| 32 | - const TEAM_USERS_BULK_INSERT = self::MAIN_HOST . "/team/bulk-insert"; |
|
| 33 | - const DriverReview = self::MAIN_HOST . "/driver-reviews"; |
|
| 31 | + const TEAM_USERS = self::MAIN_HOST."/team/users"; |
|
| 32 | + const TEAM_USERS_BULK_INSERT = self::MAIN_HOST."/team/bulk-insert"; |
|
| 33 | + const DriverReview = self::MAIN_HOST."/driver-reviews"; |
|
| 34 | 34 | |
| 35 | 35 | // </editor-fold> |
| 36 | 36 | |
| 37 | - const ACCOUNT_PROFILE = self::MAIN_HOST . "/profile-api"; |
|
| 37 | + const ACCOUNT_PROFILE = self::MAIN_HOST."/profile-api"; |
|
| 38 | 38 | |
| 39 | 39 | // <editor-fold defaultstate="collapsed" desc="Vehicles"> |
| 40 | 40 | |
| 41 | - const Vehicles = self::MAIN_HOST . "/vehicles"; |
|
| 42 | - const VehicleTemporary = self::MAIN_HOST . "/vehicles/assign"; |
|
| 43 | - const VehicleExecuteOrder = self::MAIN_HOST . "/vehicles/execute"; |
|
| 44 | - const VehicleLocation = self::MAIN_HOST . "/vehicles/location"; |
|
| 45 | - const VehicleProfiles = self::MAIN_HOST . "/vehicle-profiles"; |
|
| 46 | - const VehicleLicense = self::MAIN_HOST . "/vehicles/license"; |
|
| 47 | - const VehicleSearch = self::MAIN_HOST . "/vehicles/search"; |
|
| 48 | - |
|
| 49 | - const RECURRING_ROUTES = self::MAIN_HOST . "/recurring-routes"; |
|
| 50 | - const RECURRING_ROUTES_SCHEDULES = self::MAIN_HOST . "/recurring-routes/schedules"; |
|
| 51 | - const RECURRING_ROUTES_SCHEDULES_PAGINATION = self::MAIN_HOST . "/recurring-routes/schedules/pagination"; |
|
| 52 | - const RECURRING_ROUTES_ROUTE_SCHEDULES = self::MAIN_HOST . "/recurring-routes/route-schedules"; |
|
| 41 | + const Vehicles = self::MAIN_HOST."/vehicles"; |
|
| 42 | + const VehicleTemporary = self::MAIN_HOST."/vehicles/assign"; |
|
| 43 | + const VehicleExecuteOrder = self::MAIN_HOST."/vehicles/execute"; |
|
| 44 | + const VehicleLocation = self::MAIN_HOST."/vehicles/location"; |
|
| 45 | + const VehicleProfiles = self::MAIN_HOST."/vehicle-profiles"; |
|
| 46 | + const VehicleLicense = self::MAIN_HOST."/vehicles/license"; |
|
| 47 | + const VehicleSearch = self::MAIN_HOST."/vehicles/search"; |
|
| 48 | + |
|
| 49 | + const RECURRING_ROUTES = self::MAIN_HOST."/recurring-routes"; |
|
| 50 | + const RECURRING_ROUTES_SCHEDULES = self::MAIN_HOST."/recurring-routes/schedules"; |
|
| 51 | + const RECURRING_ROUTES_SCHEDULES_PAGINATION = self::MAIN_HOST."/recurring-routes/schedules/pagination"; |
|
| 52 | + const RECURRING_ROUTES_ROUTE_SCHEDULES = self::MAIN_HOST."/recurring-routes/route-schedules"; |
|
| 53 | 53 | const RECURRING_ROUTES_ROUTE_SCHEDULES_PAGINATION = |
| 54 | - self::MAIN_HOST . "/recurring-routes/route-schedules/pagination"; |
|
| 55 | - const RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE = self::MAIN_HOST . "/recurring-routes/route-schedules/replace"; |
|
| 56 | - const RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY = self::MAIN_HOST . "/recurring-routes/scheduled-routes/is-copy"; |
|
| 54 | + self::MAIN_HOST."/recurring-routes/route-schedules/pagination"; |
|
| 55 | + const RECURRING_ROUTES_ROUTE_SCHEDULES_REPLACE = self::MAIN_HOST."/recurring-routes/route-schedules/replace"; |
|
| 56 | + const RECURRING_ROUTES_SCHEDULED_ROUTES_IS_COPY = self::MAIN_HOST."/recurring-routes/scheduled-routes/is-copy"; |
|
| 57 | 57 | const RECURRING_ROUTES_SCHEDULED_ROUTES_GET_COPIES = |
| 58 | - self::MAIN_HOST . "/recurring-routes/scheduled-routes/get-copies"; |
|
| 59 | - const RECURRING_ROUTES_MASTER_ROUTES = self::MAIN_HOST . "/recurring-routes/master-routes"; |
|
| 58 | + self::MAIN_HOST."/recurring-routes/scheduled-routes/get-copies"; |
|
| 59 | + const RECURRING_ROUTES_MASTER_ROUTES = self::MAIN_HOST."/recurring-routes/master-routes"; |
|
| 60 | 60 | |
| 61 | 61 | // </editor-fold> |
| 62 | 62 | |
@@ -65,72 +65,72 @@ discard block |
||
| 65 | 65 | const STAGING_HOST = "https://virtserver.swaggerhub.com/Route4Me/telematics-gateway/1.0.0"; |
| 66 | 66 | |
| 67 | 67 | const TELEMATICS_CONNECTION = self::STAGING_HOST."/connections"; |
| 68 | - const TELEMATICS_CONNECTION_VEHICLES = self::STAGING_HOST . "/connections/{connection_token}/vehicles"; |
|
| 68 | + const TELEMATICS_CONNECTION_VEHICLES = self::STAGING_HOST."/connections/{connection_token}/vehicles"; |
|
| 69 | 69 | |
| 70 | - const TELEMATICS_ACCESS_TOKEN = self::STAGING_HOST . "/access-tokens"; |
|
| 71 | - const TELEMATICS_ACCESS_TOKEN_SCHEDULES = self::STAGING_HOST . "/access-token-schedules"; |
|
| 72 | - const TELEMATICS_ACCESS_TOKEN_SCHEDULE_ITEMS = self::STAGING_HOST . "/access-token-schedules/{schedule_id}/items"; |
|
| 70 | + const TELEMATICS_ACCESS_TOKEN = self::STAGING_HOST."/access-tokens"; |
|
| 71 | + const TELEMATICS_ACCESS_TOKEN_SCHEDULES = self::STAGING_HOST."/access-token-schedules"; |
|
| 72 | + const TELEMATICS_ACCESS_TOKEN_SCHEDULE_ITEMS = self::STAGING_HOST."/access-token-schedules/{schedule_id}/items"; |
|
| 73 | 73 | |
| 74 | - const TELEMATICS_VEHICLE_GROUPS = self::STAGING_HOST . "/vehicle-groups"; |
|
| 75 | - const TELEMATICS_VEHICLE_GROUPS_RELATION = self::STAGING_HOST . "/vehicle-groups/{vehicle_group_id}/{relation}"; |
|
| 76 | - const TELEMATICS_VEHICLES_RESLATION = self::STAGING_HOST . "/vehicles/{vehicle_id}/{relation}"; |
|
| 74 | + const TELEMATICS_VEHICLE_GROUPS = self::STAGING_HOST."/vehicle-groups"; |
|
| 75 | + const TELEMATICS_VEHICLE_GROUPS_RELATION = self::STAGING_HOST."/vehicle-groups/{vehicle_group_id}/{relation}"; |
|
| 76 | + const TELEMATICS_VEHICLES_RESLATION = self::STAGING_HOST."/vehicles/{vehicle_id}/{relation}"; |
|
| 77 | 77 | |
| 78 | - const TELEMATICS_INFO_MEMBERS = self::STAGING_HOST . "/info/members"; |
|
| 79 | - const TELEMATICS_INFO_VEHICLES = self::STAGING_HOST . "/info/vehicles"; |
|
| 80 | - const TELEMATICS_INFO_VEHICLE = self::STAGING_HOST . "/info/vehicle/{vehicle_id}/track"; |
|
| 81 | - const TELEMATICS_INFO_MODULES = self::STAGING_HOST . "/info/members"; |
|
| 78 | + const TELEMATICS_INFO_MEMBERS = self::STAGING_HOST."/info/members"; |
|
| 79 | + const TELEMATICS_INFO_VEHICLES = self::STAGING_HOST."/info/vehicles"; |
|
| 80 | + const TELEMATICS_INFO_VEHICLE = self::STAGING_HOST."/info/vehicle/{vehicle_id}/track"; |
|
| 81 | + const TELEMATICS_INFO_MODULES = self::STAGING_HOST."/info/members"; |
|
| 82 | 82 | |
| 83 | - const TELEMATICS_ADDRESSES = self::STAGING_HOST . "/addresses"; |
|
| 83 | + const TELEMATICS_ADDRESSES = self::STAGING_HOST."/addresses"; |
|
| 84 | 84 | |
| 85 | - const TELEMATICS_Errors = self::STAGING_HOST . "/errors"; |
|
| 85 | + const TELEMATICS_Errors = self::STAGING_HOST."/errors"; |
|
| 86 | 86 | |
| 87 | - const TELEMATICS_CUSTOMER_NOTIFICATIONS = self::STAGING_HOST . "/customers/{customer_id}/notifications"; |
|
| 88 | - const TELEMATICS_CUSTOMERS = self::STAGING_HOST . "/customers"; |
|
| 89 | - const TELEMATICS_CUSTOMER_ID = self::STAGING_HOST . "/customers/{customer_id}"; |
|
| 87 | + const TELEMATICS_CUSTOMER_NOTIFICATIONS = self::STAGING_HOST."/customers/{customer_id}/notifications"; |
|
| 88 | + const TELEMATICS_CUSTOMERS = self::STAGING_HOST."/customers"; |
|
| 89 | + const TELEMATICS_CUSTOMER_ID = self::STAGING_HOST."/customers/{customer_id}"; |
|
| 90 | 90 | |
| 91 | - const TELEMATICS_NOTIFICATION_SCHEDULE_ITEMS = self::STAGING_HOST . "/notification-schedules/{notification_schedule_id}/items"; |
|
| 92 | - const TELEMATICS_NOTIFICATION_SCHEDULES = self::STAGING_HOST . "/notification-schedules"; |
|
| 93 | - const TELEMATICS_NOTIFICATION_SCHEDULE_IS = self::STAGING_HOST . "/notification-schedules/{schedule_id}"; |
|
| 94 | - const TELEMATICS_ONETIME_NOTIFICATIONS = self::STAGING_HOST . "/one-time-notifications"; |
|
| 91 | + const TELEMATICS_NOTIFICATION_SCHEDULE_ITEMS = self::STAGING_HOST."/notification-schedules/{notification_schedule_id}/items"; |
|
| 92 | + const TELEMATICS_NOTIFICATION_SCHEDULES = self::STAGING_HOST."/notification-schedules"; |
|
| 93 | + const TELEMATICS_NOTIFICATION_SCHEDULE_IS = self::STAGING_HOST."/notification-schedules/{schedule_id}"; |
|
| 94 | + const TELEMATICS_ONETIME_NOTIFICATIONS = self::STAGING_HOST."/one-time-notifications"; |
|
| 95 | 95 | |
| 96 | 96 | const TELEMATICS_MEMBER = self::STAGING_HOST; |
| 97 | 97 | |
| 98 | - const TELEMATICS_MEMBER_MODULES = self::STAGING_HOST . "/user-activated-modules"; |
|
| 98 | + const TELEMATICS_MEMBER_MODULES = self::STAGING_HOST."/user-activated-modules"; |
|
| 99 | 99 | |
| 100 | - const TELEMATICS_MEMBER_MODULE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}"; |
|
| 101 | - const TELEMATICS_MEMBER_MODULE_VEHICLES = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles"; |
|
| 102 | - const TELEMATICS_MEMBER_MODULE_VEHICLE_ID = self::STAGING_HOST . "/user-activated-modules/{module_id}/vehicles/{vehicle_id}"; |
|
| 100 | + const TELEMATICS_MEMBER_MODULE_ID = self::STAGING_HOST."/user-activated-modules/{module_id}"; |
|
| 101 | + const TELEMATICS_MEMBER_MODULE_VEHICLES = self::STAGING_HOST."/user-activated-modules/{module_id}/vehicles"; |
|
| 102 | + const TELEMATICS_MEMBER_MODULE_VEHICLE_ID = self::STAGING_HOST."/user-activated-modules/{module_id}/vehicles/{vehicle_id}"; |
|
| 103 | 103 | |
| 104 | - const TELEMATICS_VENDORS = self::STAGING_HOST . "/vendors"; |
|
| 105 | - const TELEMATICS_VENDOR_ID = self::STAGING_HOST . "/vendors/{vendor_id}"; |
|
| 104 | + const TELEMATICS_VENDORS = self::STAGING_HOST."/vendors"; |
|
| 105 | + const TELEMATICS_VENDOR_ID = self::STAGING_HOST."/vendors/{vendor_id}"; |
|
| 106 | 106 | |
| 107 | 107 | // </editor-fold> |
| 108 | 108 | |
| 109 | - const ADDRESSES = self::MAIN_HOST . "/address-book/addresses"; |
|
| 110 | - const ADDRESSES_BATCH_CREATE = self::MAIN_HOST . "/address-book/addresses/batch-create"; |
|
| 111 | - const ADDRESSES_INDEX_ALL = self::MAIN_HOST . "/address-book/addresses/index/all"; |
|
| 112 | - const ADDRESSES_INDEX_PAGINATION = self::MAIN_HOST . "/address-book/addresses/index/pagination"; |
|
| 113 | - const ADDRESSES_INDEX_CLUSTERING = self::MAIN_HOST . "/address-book/addresses/index/clustering"; |
|
| 114 | - const ADDRESSES_SHOW = self::MAIN_HOST . "/address-book/addresses/show"; |
|
| 115 | - const ADDRESSES_BATCH_UPDATE = self::MAIN_HOST . "/address-book/addresses/batch-update"; |
|
| 116 | - const ADDRESSES_UPDATE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/update-by-areas"; |
|
| 117 | - const ADDRESSES_DELETE = self::MAIN_HOST . "/address-book/addresses/delete"; |
|
| 118 | - const ADDRESSES_DELETE_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/delete-by-areas"; |
|
| 119 | - const ADDRESSES_CUSTOM_FIELDS = self::MAIN_HOST . "/address-book/addresses/custom-fields"; |
|
| 120 | - const ADDRESSES_DEPOTS = self::MAIN_HOST . "/address-book/addresses/depots"; |
|
| 121 | - const ADDRESSES_EXPORT = self::MAIN_HOST . "/address-book/addresses/export"; |
|
| 122 | - const ADDRESSES_EXPORT_BY_AREAS = self::MAIN_HOST . "/address-book/addresses/export-by-areas"; |
|
| 123 | - const ADDRESSES_EXPORT_BY_AREA_IDS = self::MAIN_HOST . "/address-book/addresses/export-by-area-ids"; |
|
| 124 | - const ADDRESSES_JOB_TRACKER_STATUS = self::MAIN_HOST . "/address-book/addresses/job-tracker/status"; |
|
| 125 | - const ADDRESSES_JOB_TRACKER_RESULT = self::MAIN_HOST . "/address-book/addresses/job-tracker/result"; |
|
| 126 | - |
|
| 127 | - const POD_WORKFLOW = self::MAIN_HOST . "/workflows"; |
|
| 128 | - |
|
| 129 | - const ORDER = self::MAIN_HOST . "/orders-platform"; |
|
| 130 | - const ORDER_CREATE = self::ORDER . "/create"; |
|
| 131 | - const ORDER_BATCH_CREATE = self::ORDER . "/batch-create"; |
|
| 132 | - const ORDER_BATCH_DELETE = self::ORDER . "/batch-delete"; |
|
| 133 | - const ORDER_BATCH_UPDATE = self::ORDER . "/batch-update"; |
|
| 134 | - const ORDER_BATCH_UPDATE_FILTER = self::ORDER_BATCH_UPDATE . "/filter"; |
|
| 135 | - const ORDER_CUSTOM_FIELDS = self::ORDER . "/order-custom-user-fields"; |
|
| 109 | + const ADDRESSES = self::MAIN_HOST."/address-book/addresses"; |
|
| 110 | + const ADDRESSES_BATCH_CREATE = self::MAIN_HOST."/address-book/addresses/batch-create"; |
|
| 111 | + const ADDRESSES_INDEX_ALL = self::MAIN_HOST."/address-book/addresses/index/all"; |
|
| 112 | + const ADDRESSES_INDEX_PAGINATION = self::MAIN_HOST."/address-book/addresses/index/pagination"; |
|
| 113 | + const ADDRESSES_INDEX_CLUSTERING = self::MAIN_HOST."/address-book/addresses/index/clustering"; |
|
| 114 | + const ADDRESSES_SHOW = self::MAIN_HOST."/address-book/addresses/show"; |
|
| 115 | + const ADDRESSES_BATCH_UPDATE = self::MAIN_HOST."/address-book/addresses/batch-update"; |
|
| 116 | + const ADDRESSES_UPDATE_BY_AREAS = self::MAIN_HOST."/address-book/addresses/update-by-areas"; |
|
| 117 | + const ADDRESSES_DELETE = self::MAIN_HOST."/address-book/addresses/delete"; |
|
| 118 | + const ADDRESSES_DELETE_BY_AREAS = self::MAIN_HOST."/address-book/addresses/delete-by-areas"; |
|
| 119 | + const ADDRESSES_CUSTOM_FIELDS = self::MAIN_HOST."/address-book/addresses/custom-fields"; |
|
| 120 | + const ADDRESSES_DEPOTS = self::MAIN_HOST."/address-book/addresses/depots"; |
|
| 121 | + const ADDRESSES_EXPORT = self::MAIN_HOST."/address-book/addresses/export"; |
|
| 122 | + const ADDRESSES_EXPORT_BY_AREAS = self::MAIN_HOST."/address-book/addresses/export-by-areas"; |
|
| 123 | + const ADDRESSES_EXPORT_BY_AREA_IDS = self::MAIN_HOST."/address-book/addresses/export-by-area-ids"; |
|
| 124 | + const ADDRESSES_JOB_TRACKER_STATUS = self::MAIN_HOST."/address-book/addresses/job-tracker/status"; |
|
| 125 | + const ADDRESSES_JOB_TRACKER_RESULT = self::MAIN_HOST."/address-book/addresses/job-tracker/result"; |
|
| 126 | + |
|
| 127 | + const POD_WORKFLOW = self::MAIN_HOST."/workflows"; |
|
| 128 | + |
|
| 129 | + const ORDER = self::MAIN_HOST."/orders-platform"; |
|
| 130 | + const ORDER_CREATE = self::ORDER."/create"; |
|
| 131 | + const ORDER_BATCH_CREATE = self::ORDER."/batch-create"; |
|
| 132 | + const ORDER_BATCH_DELETE = self::ORDER."/batch-delete"; |
|
| 133 | + const ORDER_BATCH_UPDATE = self::ORDER."/batch-update"; |
|
| 134 | + const ORDER_BATCH_UPDATE_FILTER = self::ORDER_BATCH_UPDATE."/filter"; |
|
| 135 | + const ORDER_CUSTOM_FIELDS = self::ORDER."/order-custom-user-fields"; |
|
| 136 | 136 | } |
@@ -6,319 +6,319 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Order extends Common |
| 8 | 8 | { |
| 9 | - public $address_1; |
|
| 10 | - public $address_2; |
|
| 11 | - public $cached_lat; |
|
| 12 | - public $cached_lng; |
|
| 13 | - public $curbside_lat; |
|
| 14 | - public $curbside_lng; |
|
| 15 | - public $address_alias; |
|
| 16 | - public $address_city; |
|
| 17 | - public $EXT_FIELD_first_name; |
|
| 18 | - public $EXT_FIELD_last_name; |
|
| 19 | - public $EXT_FIELD_email; |
|
| 20 | - public $EXT_FIELD_phone; |
|
| 21 | - public $EXT_FIELD_custom_data; |
|
| 22 | - |
|
| 23 | - public $color; |
|
| 24 | - public $order_icon; |
|
| 25 | - public $local_time_window_start; |
|
| 26 | - public $local_time_window_end; |
|
| 27 | - public $local_time_window_start_2; |
|
| 28 | - public $local_time_window_end_2; |
|
| 29 | - public $service_time; |
|
| 30 | - |
|
| 31 | - public $day_scheduled_for_YYMMDD; |
|
| 32 | - |
|
| 33 | - public $route_id; |
|
| 34 | - public $redirect; |
|
| 35 | - public $optimization_problem_id; |
|
| 36 | - public $order_id; |
|
| 37 | - public $order_uuid; |
|
| 38 | - public $order_ids; |
|
| 39 | - |
|
| 40 | - public $day_added_YYMMDD; |
|
| 41 | - public $scheduled_for_YYMMDD; |
|
| 42 | - public $fields; |
|
| 43 | - public $offset; |
|
| 44 | - public $limit; |
|
| 45 | - public $query; |
|
| 46 | - |
|
| 47 | - public $created_timestamp; |
|
| 48 | - public $order_status_id; |
|
| 49 | - public $member_id; |
|
| 50 | - public $address_state_id; |
|
| 51 | - public $address_country_id; |
|
| 52 | - public $address_zip; |
|
| 53 | - public $in_route_count; |
|
| 54 | - public $last_visited_timestamp; |
|
| 55 | - public $last_routed_timestamp; |
|
| 56 | - public $local_timezone_string; |
|
| 57 | - public $is_validated; |
|
| 58 | - public $is_pending; |
|
| 59 | - public $is_accepted; |
|
| 60 | - public $is_started; |
|
| 61 | - public $is_completed; |
|
| 62 | - public $custom_user_fields; |
|
| 63 | - |
|
| 64 | - public $addresses = []; |
|
| 65 | - |
|
| 66 | - public function __construct() |
|
| 67 | - { |
|
| 68 | - Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * @param Order $params |
|
| 73 | - */ |
|
| 74 | - public static function addOrder($params) |
|
| 75 | - { |
|
| 76 | - $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_id', |
|
| 77 | - 'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp', 'order_uuid']; |
|
| 78 | - |
|
| 79 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 80 | - |
|
| 81 | - $response = Route4Me::makeRequst([ |
|
| 82 | - 'url' => Endpoint::ORDER_V4, |
|
| 83 | - 'method' => 'POST', |
|
| 84 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 85 | - ]); |
|
| 86 | - |
|
| 87 | - return $response; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - public static function addOrder2Route($params) |
|
| 91 | - { |
|
| 92 | - $allQueryFields = ['route_id', 'redirect']; |
|
| 93 | - $allBodyFields = ['addresses']; |
|
| 94 | - |
|
| 95 | - $response = Route4Me::makeRequst([ |
|
| 96 | - 'url' => Endpoint::ROUTE_V4, |
|
| 97 | - 'method' => 'PUT', |
|
| 98 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 99 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 100 | - ]); |
|
| 101 | - |
|
| 102 | - return $response; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - public static function addOrder2Optimization($params) |
|
| 106 | - { |
|
| 107 | - $allQueryFields = ['optimization_problem_id', 'redirect', 'device_type']; |
|
| 108 | - $allBodyFields = ['addresses']; |
|
| 109 | - |
|
| 110 | - $response = Route4Me::makeRequst([ |
|
| 111 | - 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 112 | - 'method' => 'PUT', |
|
| 113 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 114 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 115 | - ]); |
|
| 116 | - |
|
| 117 | - return $response; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - public static function getOrder($params) |
|
| 121 | - { |
|
| 122 | - $allQueryFields = ['order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', |
|
| 123 | - 'offset', 'limit']; |
|
| 124 | - |
|
| 125 | - $response = Route4Me::makeRequst([ |
|
| 126 | - 'url' => Endpoint::ORDER_V4, |
|
| 127 | - 'method' => 'GET', |
|
| 128 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 129 | - ]); |
|
| 130 | - |
|
| 131 | - return $response; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - public static function getOrders($params) |
|
| 135 | - { |
|
| 136 | - $allQueryFields = ['offset', 'limit']; |
|
| 137 | - |
|
| 138 | - $response = Route4Me::makeRequst([ |
|
| 139 | - 'url' => Endpoint::ORDER_V4, |
|
| 140 | - 'method' => 'GET', |
|
| 141 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 142 | - ]); |
|
| 143 | - |
|
| 144 | - return $response; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - public function getRandomOrderId($offset, $limit) |
|
| 148 | - { |
|
| 149 | - $randomOrder = $this->getRandomOrder($offset, $limit); |
|
| 150 | - |
|
| 151 | - if (is_null($randomOrder) || !isset($randomOrder)) { |
|
| 152 | - return null; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - return $randomOrder['order_id']; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - public function getRandomOrder($offset, $limit) |
|
| 159 | - { |
|
| 160 | - $params = ['offset' => $offset, 'limit' => $limit]; |
|
| 161 | - |
|
| 162 | - $orders = self::getOrders($params); |
|
| 163 | - |
|
| 164 | - if (is_null($orders) || !isset($orders['results'])) { |
|
| 165 | - return null; |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - $randomIndex = rand(0, sizeof($orders['results']) - 1); |
|
| 169 | - |
|
| 170 | - $order = $orders['results'][$randomIndex]; |
|
| 171 | - |
|
| 172 | - return $order; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - public static function removeOrder($params) |
|
| 176 | - { |
|
| 177 | - $allBodyFields = ['order_ids']; |
|
| 178 | - |
|
| 179 | - $response = Route4Me::makeRequst([ |
|
| 180 | - 'url' => Endpoint::ORDER_V4, |
|
| 181 | - 'method' => 'DELETE', |
|
| 182 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 183 | - ]); |
|
| 184 | - |
|
| 185 | - return $response; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - public static function updateOrder($params) |
|
| 189 | - { |
|
| 190 | - $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_ids', |
|
| 191 | - 'fields', 'offset', 'limit', 'query', 'created_timestamp', 'route_uuid']; |
|
| 192 | - |
|
| 193 | - $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 194 | - |
|
| 195 | - $response = Route4Me::makeRequst([ |
|
| 196 | - 'url' => Endpoint::ORDER_V4, |
|
| 197 | - 'method' => 'PUT', |
|
| 198 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 199 | - ]); |
|
| 200 | - |
|
| 201 | - return $response; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - public static function searchOrder($params) |
|
| 205 | - { |
|
| 206 | - $allQueryFields = ['fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit']; |
|
| 207 | - |
|
| 208 | - $response = Route4Me::makeRequst([ |
|
| 209 | - 'url' => Endpoint::ORDER_V4, |
|
| 210 | - 'method' => 'GET', |
|
| 211 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 212 | - ]); |
|
| 213 | - |
|
| 214 | - return $response; |
|
| 215 | - } |
|
| 9 | + public $address_1; |
|
| 10 | + public $address_2; |
|
| 11 | + public $cached_lat; |
|
| 12 | + public $cached_lng; |
|
| 13 | + public $curbside_lat; |
|
| 14 | + public $curbside_lng; |
|
| 15 | + public $address_alias; |
|
| 16 | + public $address_city; |
|
| 17 | + public $EXT_FIELD_first_name; |
|
| 18 | + public $EXT_FIELD_last_name; |
|
| 19 | + public $EXT_FIELD_email; |
|
| 20 | + public $EXT_FIELD_phone; |
|
| 21 | + public $EXT_FIELD_custom_data; |
|
| 22 | + |
|
| 23 | + public $color; |
|
| 24 | + public $order_icon; |
|
| 25 | + public $local_time_window_start; |
|
| 26 | + public $local_time_window_end; |
|
| 27 | + public $local_time_window_start_2; |
|
| 28 | + public $local_time_window_end_2; |
|
| 29 | + public $service_time; |
|
| 30 | + |
|
| 31 | + public $day_scheduled_for_YYMMDD; |
|
| 32 | + |
|
| 33 | + public $route_id; |
|
| 34 | + public $redirect; |
|
| 35 | + public $optimization_problem_id; |
|
| 36 | + public $order_id; |
|
| 37 | + public $order_uuid; |
|
| 38 | + public $order_ids; |
|
| 39 | + |
|
| 40 | + public $day_added_YYMMDD; |
|
| 41 | + public $scheduled_for_YYMMDD; |
|
| 42 | + public $fields; |
|
| 43 | + public $offset; |
|
| 44 | + public $limit; |
|
| 45 | + public $query; |
|
| 46 | + |
|
| 47 | + public $created_timestamp; |
|
| 48 | + public $order_status_id; |
|
| 49 | + public $member_id; |
|
| 50 | + public $address_state_id; |
|
| 51 | + public $address_country_id; |
|
| 52 | + public $address_zip; |
|
| 53 | + public $in_route_count; |
|
| 54 | + public $last_visited_timestamp; |
|
| 55 | + public $last_routed_timestamp; |
|
| 56 | + public $local_timezone_string; |
|
| 57 | + public $is_validated; |
|
| 58 | + public $is_pending; |
|
| 59 | + public $is_accepted; |
|
| 60 | + public $is_started; |
|
| 61 | + public $is_completed; |
|
| 62 | + public $custom_user_fields; |
|
| 63 | + |
|
| 64 | + public $addresses = []; |
|
| 65 | + |
|
| 66 | + public function __construct() |
|
| 67 | + { |
|
| 68 | + Route4Me::setBaseUrl(Endpoint::BASE_URL); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * @param Order $params |
|
| 73 | + */ |
|
| 74 | + public static function addOrder($params) |
|
| 75 | + { |
|
| 76 | + $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_id', |
|
| 77 | + 'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp', 'order_uuid']; |
|
| 78 | + |
|
| 79 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 80 | + |
|
| 81 | + $response = Route4Me::makeRequst([ |
|
| 82 | + 'url' => Endpoint::ORDER_V4, |
|
| 83 | + 'method' => 'POST', |
|
| 84 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 85 | + ]); |
|
| 86 | + |
|
| 87 | + return $response; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + public static function addOrder2Route($params) |
|
| 91 | + { |
|
| 92 | + $allQueryFields = ['route_id', 'redirect']; |
|
| 93 | + $allBodyFields = ['addresses']; |
|
| 94 | + |
|
| 95 | + $response = Route4Me::makeRequst([ |
|
| 96 | + 'url' => Endpoint::ROUTE_V4, |
|
| 97 | + 'method' => 'PUT', |
|
| 98 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 99 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 100 | + ]); |
|
| 101 | + |
|
| 102 | + return $response; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + public static function addOrder2Optimization($params) |
|
| 106 | + { |
|
| 107 | + $allQueryFields = ['optimization_problem_id', 'redirect', 'device_type']; |
|
| 108 | + $allBodyFields = ['addresses']; |
|
| 109 | + |
|
| 110 | + $response = Route4Me::makeRequst([ |
|
| 111 | + 'url' => Endpoint::OPTIMIZATION_PROBLEM, |
|
| 112 | + 'method' => 'PUT', |
|
| 113 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 114 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 115 | + ]); |
|
| 116 | + |
|
| 117 | + return $response; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + public static function getOrder($params) |
|
| 121 | + { |
|
| 122 | + $allQueryFields = ['order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', |
|
| 123 | + 'offset', 'limit']; |
|
| 124 | + |
|
| 125 | + $response = Route4Me::makeRequst([ |
|
| 126 | + 'url' => Endpoint::ORDER_V4, |
|
| 127 | + 'method' => 'GET', |
|
| 128 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 129 | + ]); |
|
| 130 | + |
|
| 131 | + return $response; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + public static function getOrders($params) |
|
| 135 | + { |
|
| 136 | + $allQueryFields = ['offset', 'limit']; |
|
| 137 | + |
|
| 138 | + $response = Route4Me::makeRequst([ |
|
| 139 | + 'url' => Endpoint::ORDER_V4, |
|
| 140 | + 'method' => 'GET', |
|
| 141 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 142 | + ]); |
|
| 143 | + |
|
| 144 | + return $response; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + public function getRandomOrderId($offset, $limit) |
|
| 148 | + { |
|
| 149 | + $randomOrder = $this->getRandomOrder($offset, $limit); |
|
| 150 | + |
|
| 151 | + if (is_null($randomOrder) || !isset($randomOrder)) { |
|
| 152 | + return null; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + return $randomOrder['order_id']; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + public function getRandomOrder($offset, $limit) |
|
| 159 | + { |
|
| 160 | + $params = ['offset' => $offset, 'limit' => $limit]; |
|
| 161 | + |
|
| 162 | + $orders = self::getOrders($params); |
|
| 163 | + |
|
| 164 | + if (is_null($orders) || !isset($orders['results'])) { |
|
| 165 | + return null; |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + $randomIndex = rand(0, sizeof($orders['results']) - 1); |
|
| 169 | + |
|
| 170 | + $order = $orders['results'][$randomIndex]; |
|
| 171 | + |
|
| 172 | + return $order; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + public static function removeOrder($params) |
|
| 176 | + { |
|
| 177 | + $allBodyFields = ['order_ids']; |
|
| 178 | + |
|
| 179 | + $response = Route4Me::makeRequst([ |
|
| 180 | + 'url' => Endpoint::ORDER_V4, |
|
| 181 | + 'method' => 'DELETE', |
|
| 182 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 183 | + ]); |
|
| 184 | + |
|
| 185 | + return $response; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + public static function updateOrder($params) |
|
| 189 | + { |
|
| 190 | + $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_ids', |
|
| 191 | + 'fields', 'offset', 'limit', 'query', 'created_timestamp', 'route_uuid']; |
|
| 192 | + |
|
| 193 | + $allBodyFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 194 | + |
|
| 195 | + $response = Route4Me::makeRequst([ |
|
| 196 | + 'url' => Endpoint::ORDER_V4, |
|
| 197 | + 'method' => 'PUT', |
|
| 198 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
| 199 | + ]); |
|
| 200 | + |
|
| 201 | + return $response; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + public static function searchOrder($params) |
|
| 205 | + { |
|
| 206 | + $allQueryFields = ['fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit']; |
|
| 207 | + |
|
| 208 | + $response = Route4Me::makeRequst([ |
|
| 209 | + 'url' => Endpoint::ORDER_V4, |
|
| 210 | + 'method' => 'GET', |
|
| 211 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params), |
|
| 212 | + ]); |
|
| 213 | + |
|
| 214 | + return $response; |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - public static function validateCoordinate($coord) |
|
| 218 | - { |
|
| 219 | - $key = key($coord); |
|
| 220 | - |
|
| 221 | - if (!is_numeric($coord[$key])) { |
|
| 222 | - return false; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - switch ($key) { |
|
| 226 | - case 'cached_lat': |
|
| 227 | - case 'curbside_lat': |
|
| 228 | - if ($coord[$key] > 90 || $coord[$key] < -90) { |
|
| 229 | - return false; |
|
| 230 | - } |
|
| 231 | - break; |
|
| 232 | - case 'cached_lng': |
|
| 233 | - case 'curbside_lng': |
|
| 234 | - if ($coord[$key] > 180 || $coord[$key] < -180) { |
|
| 235 | - return false; |
|
| 236 | - } |
|
| 237 | - break; |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - return true; |
|
| 241 | - } |
|
| 217 | + public static function validateCoordinate($coord) |
|
| 218 | + { |
|
| 219 | + $key = key($coord); |
|
| 220 | + |
|
| 221 | + if (!is_numeric($coord[$key])) { |
|
| 222 | + return false; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + switch ($key) { |
|
| 226 | + case 'cached_lat': |
|
| 227 | + case 'curbside_lat': |
|
| 228 | + if ($coord[$key] > 90 || $coord[$key] < -90) { |
|
| 229 | + return false; |
|
| 230 | + } |
|
| 231 | + break; |
|
| 232 | + case 'cached_lng': |
|
| 233 | + case 'curbside_lng': |
|
| 234 | + if ($coord[$key] > 180 || $coord[$key] < -180) { |
|
| 235 | + return false; |
|
| 236 | + } |
|
| 237 | + break; |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + return true; |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | - public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping) |
|
| 244 | - { |
|
| 245 | - $max_line_length = 512; |
|
| 246 | - $delemietr = ','; |
|
| 247 | - |
|
| 248 | - $results = []; |
|
| 249 | - $results['fail'] = []; |
|
| 250 | - $results['success'] = []; |
|
| 251 | - |
|
| 252 | - $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
|
| 243 | + public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping) |
|
| 244 | + { |
|
| 245 | + $max_line_length = 512; |
|
| 246 | + $delemietr = ','; |
|
| 247 | + |
|
| 248 | + $results = []; |
|
| 249 | + $results['fail'] = []; |
|
| 250 | + $results['success'] = []; |
|
| 251 | + |
|
| 252 | + $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr); |
|
| 253 | 253 | |
| 254 | - $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_id', 'order_ids', |
|
| 255 | - 'fields', 'offset', 'limit', 'query', 'created_timestamp', 'order_uuid']; |
|
| 256 | - |
|
| 257 | - $allOrderFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 258 | - |
|
| 259 | - if (!empty($columns)) { |
|
| 260 | - array_push($results['fail'], 'Empty CSV table'); |
|
| 254 | + $excludeFields = ['route_id', 'redirect', 'optimization_problem_id', 'order_id', 'order_ids', |
|
| 255 | + 'fields', 'offset', 'limit', 'query', 'created_timestamp', 'order_uuid']; |
|
| 256 | + |
|
| 257 | + $allOrderFields = Route4Me::getObjectProperties(new self(), $excludeFields); |
|
| 258 | + |
|
| 259 | + if (!empty($columns)) { |
|
| 260 | + array_push($results['fail'], 'Empty CSV table'); |
|
| 261 | 261 | |
| 262 | - return $results; |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - $iRow = 1; |
|
| 266 | - |
|
| 267 | - while (false !== ($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
| 268 | - if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && [null] !== $rows) { |
|
| 269 | - $cached_lat = 0.000; |
|
| 270 | - $cached_lng = 0.000; |
|
| 271 | - |
|
| 272 | - foreach (['cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng'] as $coord) { |
|
| 273 | - if (!$this->validateCoordinate([$coord => $rows[$ordersFieldsMapping[$coord]]])) { |
|
| 274 | - array_push($results['fail'], "$iRow --> Wrong " + $coord); |
|
| 275 | - ++$iRow; |
|
| 276 | - continue; |
|
| 277 | - } else { |
|
| 278 | - switch ($coord) { |
|
| 279 | - case 'cached_lat': |
|
| 280 | - $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 281 | - break; |
|
| 282 | - case 'cached_lng': |
|
| 283 | - $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 284 | - break; |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - $address = $rows[$ordersFieldsMapping['address_1']]; |
|
| 290 | - |
|
| 291 | - foreach (['order_city', 'order_state_id', 'order_zip_code', 'order_country_id'] as $addressPart) { |
|
| 292 | - if (isset($ordersFieldsMapping[$addressPart])) { |
|
| 293 | - $address .= ', '.$rows[$ordersFieldsMapping[$addressPart]]; |
|
| 294 | - } |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].', '.$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']].'<br>'; |
|
| 298 | - |
|
| 299 | - $parametersArray = []; |
|
| 300 | - |
|
| 301 | - $parametersArray['cached_lat'] = $cached_lat; |
|
| 302 | - $parametersArray['cached_lng'] = $cached_lng; |
|
| 303 | - |
|
| 304 | - foreach ($allOrderFields as $orderField) { |
|
| 305 | - if (isset($ordersFieldsMapping[$orderField])) { |
|
| 306 | - $parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]]; |
|
| 307 | - } |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - $orderParameters = self::fromArray($parametersArray); |
|
| 311 | - |
|
| 312 | - $order = new self(); |
|
| 313 | - |
|
| 314 | - $orderResults = $order->addOrder($orderParameters); |
|
| 315 | - |
|
| 316 | - array_push($results['success'], 'The order with order_id = '.strval($orderResults['order_id']).' added successfuly.'); |
|
| 317 | - } else { |
|
| 318 | - array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
|
| 319 | - } |
|
| 320 | - |
|
| 321 | - ++$iRow; |
|
| 322 | - } |
|
| 323 | - } |
|
| 262 | + return $results; |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + $iRow = 1; |
|
| 266 | + |
|
| 267 | + while (false !== ($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))) { |
|
| 268 | + if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && [null] !== $rows) { |
|
| 269 | + $cached_lat = 0.000; |
|
| 270 | + $cached_lng = 0.000; |
|
| 271 | + |
|
| 272 | + foreach (['cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng'] as $coord) { |
|
| 273 | + if (!$this->validateCoordinate([$coord => $rows[$ordersFieldsMapping[$coord]]])) { |
|
| 274 | + array_push($results['fail'], "$iRow --> Wrong " + $coord); |
|
| 275 | + ++$iRow; |
|
| 276 | + continue; |
|
| 277 | + } else { |
|
| 278 | + switch ($coord) { |
|
| 279 | + case 'cached_lat': |
|
| 280 | + $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 281 | + break; |
|
| 282 | + case 'cached_lng': |
|
| 283 | + $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]); |
|
| 284 | + break; |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + $address = $rows[$ordersFieldsMapping['address_1']]; |
|
| 290 | + |
|
| 291 | + foreach (['order_city', 'order_state_id', 'order_zip_code', 'order_country_id'] as $addressPart) { |
|
| 292 | + if (isset($ordersFieldsMapping[$addressPart])) { |
|
| 293 | + $address .= ', '.$rows[$ordersFieldsMapping[$addressPart]]; |
|
| 294 | + } |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].', '.$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']].'<br>'; |
|
| 298 | + |
|
| 299 | + $parametersArray = []; |
|
| 300 | + |
|
| 301 | + $parametersArray['cached_lat'] = $cached_lat; |
|
| 302 | + $parametersArray['cached_lng'] = $cached_lng; |
|
| 303 | + |
|
| 304 | + foreach ($allOrderFields as $orderField) { |
|
| 305 | + if (isset($ordersFieldsMapping[$orderField])) { |
|
| 306 | + $parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]]; |
|
| 307 | + } |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + $orderParameters = self::fromArray($parametersArray); |
|
| 311 | + |
|
| 312 | + $order = new self(); |
|
| 313 | + |
|
| 314 | + $orderResults = $order->addOrder($orderParameters); |
|
| 315 | + |
|
| 316 | + array_push($results['success'], 'The order with order_id = '.strval($orderResults['order_id']).' added successfuly.'); |
|
| 317 | + } else { |
|
| 318 | + array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); |
|
| 319 | + } |
|
| 320 | + |
|
| 321 | + ++$iRow; |
|
| 322 | + } |
|
| 323 | + } |
|
| 324 | 324 | } |
@@ -16,55 +16,55 @@ |
||
| 16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
| 17 | 17 | |
| 18 | 18 | $order = new Order([ |
| 19 | - 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 20 | - 'address_alias' => 'Auto test address', |
|
| 21 | - 'address_city' => 'Philadelphia', |
|
| 22 | - 'address_geo' => [ |
|
| 23 | - 'lat' => 48.335991, |
|
| 24 | - 'lng' => 31.18287 |
|
| 25 | - ], |
|
| 26 | - 'first_name' => 'John', |
|
| 27 | - 'last_name' => 'Doe', |
|
| 28 | - 'email' => '[email protected]' |
|
| 19 | + 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 20 | + 'address_alias' => 'Auto test address', |
|
| 21 | + 'address_city' => 'Philadelphia', |
|
| 22 | + 'address_geo' => [ |
|
| 23 | + 'lat' => 48.335991, |
|
| 24 | + 'lng' => 31.18287 |
|
| 25 | + ], |
|
| 26 | + 'first_name' => 'John', |
|
| 27 | + 'last_name' => 'Doe', |
|
| 28 | + 'email' => '[email protected]' |
|
| 29 | 29 | ]); |
| 30 | 30 | |
| 31 | 31 | $orders = null; |
| 32 | 32 | $orderId = null; |
| 33 | 33 | |
| 34 | 34 | try { |
| 35 | - $orders = new Orders(); |
|
| 35 | + $orders = new Orders(); |
|
| 36 | 36 | |
| 37 | - // create order |
|
| 38 | - $newOrder = $orders->create($order); |
|
| 39 | - $orderId = $newOrder->order_uuid; |
|
| 40 | - echo "Create Order with uuid='" . $orderId . "'" . PHP_EOL; |
|
| 37 | + // create order |
|
| 38 | + $newOrder = $orders->create($order); |
|
| 39 | + $orderId = $newOrder->order_uuid; |
|
| 40 | + echo "Create Order with uuid='" . $orderId . "'" . PHP_EOL; |
|
| 41 | 41 | |
| 42 | - // read order |
|
| 43 | - $readOrder = $orders->get($orderId); |
|
| 44 | - echo "Read Order first_name is '" . $readOrder->first_name . "'" . PHP_EOL; |
|
| 42 | + // read order |
|
| 43 | + $readOrder = $orders->get($orderId); |
|
| 44 | + echo "Read Order first_name is '" . $readOrder->first_name . "'" . PHP_EOL; |
|
| 45 | 45 | |
| 46 | - // update order |
|
| 47 | - $params = [ |
|
| 48 | - 'first_name' => 'Jane' |
|
| 49 | - ]; |
|
| 50 | - $updateOrder = $orders->update($orderId, $params); |
|
| 51 | - echo "Update Order first_name is '" . $updateOrder->first_name . "'" . PHP_EOL; |
|
| 46 | + // update order |
|
| 47 | + $params = [ |
|
| 48 | + 'first_name' => 'Jane' |
|
| 49 | + ]; |
|
| 50 | + $updateOrder = $orders->update($orderId, $params); |
|
| 51 | + echo "Update Order first_name is '" . $updateOrder->first_name . "'" . PHP_EOL; |
|
| 52 | 52 | |
| 53 | - // delete order |
|
| 54 | - if ($orders->delete($orderId)) { |
|
| 55 | - echo "Order with uuid='" . $orderId . "' was deleted successful." . PHP_EOL; |
|
| 56 | - } else { |
|
| 57 | - echo "Order with uuid='" . $orderId . "' was not deleted." . PHP_EOL; |
|
| 58 | - } |
|
| 53 | + // delete order |
|
| 54 | + if ($orders->delete($orderId)) { |
|
| 55 | + echo "Order with uuid='" . $orderId . "' was deleted successful." . PHP_EOL; |
|
| 56 | + } else { |
|
| 57 | + echo "Order with uuid='" . $orderId . "' was not deleted." . PHP_EOL; |
|
| 58 | + } |
|
| 59 | 59 | } catch (Exception $e) { |
| 60 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 60 | + echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 61 | 61 | |
| 62 | - if ($orders && $orderId) { |
|
| 63 | - try { |
|
| 64 | - $orders->delete($orderId); |
|
| 65 | - echo "Order with uuid='" . $orderId . "' was cleaned up successful." . PHP_EOL; |
|
| 66 | - } catch (Exception $e) { |
|
| 67 | - echo "Order with uuid='" . $orderId . "' was not cleaned up." . PHP_EOL; |
|
| 68 | - } |
|
| 69 | - } |
|
| 62 | + if ($orders && $orderId) { |
|
| 63 | + try { |
|
| 64 | + $orders->delete($orderId); |
|
| 65 | + echo "Order with uuid='" . $orderId . "' was cleaned up successful." . PHP_EOL; |
|
| 66 | + } catch (Exception $e) { |
|
| 67 | + echo "Order with uuid='" . $orderId . "' was not cleaned up." . PHP_EOL; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -37,34 +37,34 @@ |
||
| 37 | 37 | // create order |
| 38 | 38 | $newOrder = $orders->create($order); |
| 39 | 39 | $orderId = $newOrder->order_uuid; |
| 40 | - echo "Create Order with uuid='" . $orderId . "'" . PHP_EOL; |
|
| 40 | + echo "Create Order with uuid='".$orderId."'".PHP_EOL; |
|
| 41 | 41 | |
| 42 | 42 | // read order |
| 43 | 43 | $readOrder = $orders->get($orderId); |
| 44 | - echo "Read Order first_name is '" . $readOrder->first_name . "'" . PHP_EOL; |
|
| 44 | + echo "Read Order first_name is '".$readOrder->first_name."'".PHP_EOL; |
|
| 45 | 45 | |
| 46 | 46 | // update order |
| 47 | 47 | $params = [ |
| 48 | 48 | 'first_name' => 'Jane' |
| 49 | 49 | ]; |
| 50 | 50 | $updateOrder = $orders->update($orderId, $params); |
| 51 | - echo "Update Order first_name is '" . $updateOrder->first_name . "'" . PHP_EOL; |
|
| 51 | + echo "Update Order first_name is '".$updateOrder->first_name."'".PHP_EOL; |
|
| 52 | 52 | |
| 53 | 53 | // delete order |
| 54 | 54 | if ($orders->delete($orderId)) { |
| 55 | - echo "Order with uuid='" . $orderId . "' was deleted successful." . PHP_EOL; |
|
| 55 | + echo "Order with uuid='".$orderId."' was deleted successful.".PHP_EOL; |
|
| 56 | 56 | } else { |
| 57 | - echo "Order with uuid='" . $orderId . "' was not deleted." . PHP_EOL; |
|
| 57 | + echo "Order with uuid='".$orderId."' was not deleted.".PHP_EOL; |
|
| 58 | 58 | } |
| 59 | 59 | } catch (Exception $e) { |
| 60 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 60 | + echo "ERROR: ".$e->getMessage().PHP_EOL; |
|
| 61 | 61 | |
| 62 | 62 | if ($orders && $orderId) { |
| 63 | 63 | try { |
| 64 | 64 | $orders->delete($orderId); |
| 65 | - echo "Order with uuid='" . $orderId . "' was cleaned up successful." . PHP_EOL; |
|
| 65 | + echo "Order with uuid='".$orderId."' was cleaned up successful.".PHP_EOL; |
|
| 66 | 66 | } catch (Exception $e) { |
| 67 | - echo "Order with uuid='" . $orderId . "' was not cleaned up." . PHP_EOL; |
|
| 67 | + echo "Order with uuid='".$orderId."' was not cleaned up.".PHP_EOL; |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -15,41 +15,41 @@ |
||
| 15 | 15 | Route4Me::setApiKey(Constants::API_KEY); |
| 16 | 16 | |
| 17 | 17 | $ordersParams = [ |
| 18 | - [ |
|
| 19 | - 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 20 | - 'address_alias' => 'Address for batch workflow 0', |
|
| 21 | - 'address_city' => 'Philadelphia', |
|
| 22 | - 'address_geo' => [ |
|
| 23 | - 'lat' => 48.335991, |
|
| 24 | - 'lng' => 31.18287 |
|
| 25 | - ], |
|
| 26 | - 'first_name' => 'John', |
|
| 27 | - 'last_name' => 'Doe', |
|
| 28 | - 'email' => '[email protected]' |
|
| 29 | - ], [ |
|
| 30 | - 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 31 | - 'address_alias' => 'Address for batch workflow 1', |
|
| 32 | - 'address_city' => 'Philadelphia', |
|
| 33 | - 'address_geo' => [ |
|
| 34 | - 'lat' => 48.335991, |
|
| 35 | - 'lng' => 31.18287 |
|
| 36 | - ], |
|
| 37 | - 'first_name' => 'John', |
|
| 38 | - 'last_name' => 'Doe', |
|
| 39 | - 'email' => '[email protected]' |
|
| 40 | - ] |
|
| 18 | + [ |
|
| 19 | + 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 20 | + 'address_alias' => 'Address for batch workflow 0', |
|
| 21 | + 'address_city' => 'Philadelphia', |
|
| 22 | + 'address_geo' => [ |
|
| 23 | + 'lat' => 48.335991, |
|
| 24 | + 'lng' => 31.18287 |
|
| 25 | + ], |
|
| 26 | + 'first_name' => 'John', |
|
| 27 | + 'last_name' => 'Doe', |
|
| 28 | + 'email' => '[email protected]' |
|
| 29 | + ], [ |
|
| 30 | + 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 31 | + 'address_alias' => 'Address for batch workflow 1', |
|
| 32 | + 'address_city' => 'Philadelphia', |
|
| 33 | + 'address_geo' => [ |
|
| 34 | + 'lat' => 48.335991, |
|
| 35 | + 'lng' => 31.18287 |
|
| 36 | + ], |
|
| 37 | + 'first_name' => 'John', |
|
| 38 | + 'last_name' => 'Doe', |
|
| 39 | + 'email' => '[email protected]' |
|
| 40 | + ] |
|
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | 43 | try { |
| 44 | - $orders = new Orders(); |
|
| 45 | - |
|
| 46 | - // create a batch of orders |
|
| 47 | - $res = $orders->batchCreate($ordersParams); |
|
| 48 | - if ($res) { |
|
| 49 | - echo "Create a batch of orders." . PHP_EOL; |
|
| 50 | - } else { |
|
| 51 | - echo "Error to create a batch of orders." . PHP_EOL; |
|
| 52 | - } |
|
| 44 | + $orders = new Orders(); |
|
| 45 | + |
|
| 46 | + // create a batch of orders |
|
| 47 | + $res = $orders->batchCreate($ordersParams); |
|
| 48 | + if ($res) { |
|
| 49 | + echo "Create a batch of orders." . PHP_EOL; |
|
| 50 | + } else { |
|
| 51 | + echo "Error to create a batch of orders." . PHP_EOL; |
|
| 52 | + } |
|
| 53 | 53 | } catch (Exception $e) { |
| 54 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 54 | + echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 55 | 55 | } |
@@ -46,10 +46,10 @@ |
||
| 46 | 46 | // create a batch of orders |
| 47 | 47 | $res = $orders->batchCreate($ordersParams); |
| 48 | 48 | if ($res) { |
| 49 | - echo "Create a batch of orders." . PHP_EOL; |
|
| 49 | + echo "Create a batch of orders.".PHP_EOL; |
|
| 50 | 50 | } else { |
| 51 | - echo "Error to create a batch of orders." . PHP_EOL; |
|
| 51 | + echo "Error to create a batch of orders.".PHP_EOL; |
|
| 52 | 52 | } |
| 53 | 53 | } catch (Exception $e) { |
| 54 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 54 | + echo "ERROR: ".$e->getMessage().PHP_EOL; |
|
| 55 | 55 | } |
@@ -16,30 +16,30 @@ |
||
| 16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
| 17 | 17 | |
| 18 | 18 | try { |
| 19 | - $orders = new Orders(); |
|
| 20 | - |
|
| 21 | - // Get all the orders created under the specific Route4Me account |
|
| 22 | - $ordersAll = $orders->search(); |
|
| 23 | - |
|
| 24 | - // Search orders by known IDs |
|
| 25 | - $params = [ |
|
| 26 | - "filters" => [ |
|
| 27 | - "order_ids" => ["B3CBB9C07D37406997EE73D9CEC18264", "D91F4962CC4C468A9563896A93DBE4D7"] |
|
| 28 | - ] |
|
| 29 | - ]; |
|
| 30 | - $ordersByIds = $orders->search($params); |
|
| 31 | - |
|
| 32 | - // Search all the orders with specific address_alias, return only specific fields in response. |
|
| 33 | - $params = [ |
|
| 34 | - "return_provided_fields_as_map" => true, |
|
| 35 | - "fields" => ["order_uuid", "address_alias", "email", "first_name", "phone"], |
|
| 36 | - "search" => [ |
|
| 37 | - "matches" => ["address_alias" => "Auto test address"] |
|
| 38 | - ] |
|
| 39 | - ]; |
|
| 40 | - $ordersWithAddress = $orders->search($params); |
|
| 41 | - |
|
| 42 | - print_r($ordersWithAddress); |
|
| 19 | + $orders = new Orders(); |
|
| 20 | + |
|
| 21 | + // Get all the orders created under the specific Route4Me account |
|
| 22 | + $ordersAll = $orders->search(); |
|
| 23 | + |
|
| 24 | + // Search orders by known IDs |
|
| 25 | + $params = [ |
|
| 26 | + "filters" => [ |
|
| 27 | + "order_ids" => ["B3CBB9C07D37406997EE73D9CEC18264", "D91F4962CC4C468A9563896A93DBE4D7"] |
|
| 28 | + ] |
|
| 29 | + ]; |
|
| 30 | + $ordersByIds = $orders->search($params); |
|
| 31 | + |
|
| 32 | + // Search all the orders with specific address_alias, return only specific fields in response. |
|
| 33 | + $params = [ |
|
| 34 | + "return_provided_fields_as_map" => true, |
|
| 35 | + "fields" => ["order_uuid", "address_alias", "email", "first_name", "phone"], |
|
| 36 | + "search" => [ |
|
| 37 | + "matches" => ["address_alias" => "Auto test address"] |
|
| 38 | + ] |
|
| 39 | + ]; |
|
| 40 | + $ordersWithAddress = $orders->search($params); |
|
| 41 | + |
|
| 42 | + print_r($ordersWithAddress); |
|
| 43 | 43 | } catch (Exception $e) { |
| 44 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 44 | + echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 45 | 45 | } |
@@ -41,5 +41,5 @@ |
||
| 41 | 41 | |
| 42 | 42 | print_r($ordersWithAddress); |
| 43 | 43 | } catch (Exception $e) { |
| 44 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 44 | + echo "ERROR: ".$e->getMessage().PHP_EOL; |
|
| 45 | 45 | } |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | Route4Me::setApiKey(Constants::API_KEY); |
| 17 | 17 | |
| 18 | 18 | $customField = new CustomField([ |
| 19 | - 'order_custom_field_name' => 'CustomField1', |
|
| 20 | - 'order_custom_field_label' => 'Custom Field 1', |
|
| 21 | - 'order_custom_field_type' => 'checkbox', |
|
| 22 | - 'order_custom_field_type_info' => [ |
|
| 23 | - 'short_label' => 'cFl1' |
|
| 24 | - ] |
|
| 19 | + 'order_custom_field_name' => 'CustomField1', |
|
| 20 | + 'order_custom_field_label' => 'Custom Field 1', |
|
| 21 | + 'order_custom_field_type' => 'checkbox', |
|
| 22 | + 'order_custom_field_type_info' => [ |
|
| 23 | + 'short_label' => 'cFl1' |
|
| 24 | + ] |
|
| 25 | 25 | ]); |
| 26 | 26 | |
| 27 | 27 | print_r($customField); |
@@ -30,41 +30,41 @@ discard block |
||
| 30 | 30 | $uuid = null; |
| 31 | 31 | |
| 32 | 32 | try { |
| 33 | - $orders = new Orders(); |
|
| 33 | + $orders = new Orders(); |
|
| 34 | 34 | |
| 35 | - // create custom field |
|
| 36 | - $newField = $orders->createOrderCustomField($customField); |
|
| 37 | - $uuid = $newField->order_custom_field_uuid; |
|
| 38 | - echo "Create Custom field, label is '" . $newField->order_custom_field_label . "'" . PHP_EOL; |
|
| 35 | + // create custom field |
|
| 36 | + $newField = $orders->createOrderCustomField($customField); |
|
| 37 | + $uuid = $newField->order_custom_field_uuid; |
|
| 38 | + echo "Create Custom field, label is '" . $newField->order_custom_field_label . "'" . PHP_EOL; |
|
| 39 | 39 | |
| 40 | - // update custom field |
|
| 41 | - $customField->order_custom_field_label = 'Custom Field New'; |
|
| 42 | - $updateField = $orders->updateOrderCustomField($uuid, $customField); |
|
| 43 | - echo "Update Custom field, label is '" . $updateField->order_custom_field_label . "'" . PHP_EOL; |
|
| 40 | + // update custom field |
|
| 41 | + $customField->order_custom_field_label = 'Custom Field New'; |
|
| 42 | + $updateField = $orders->updateOrderCustomField($uuid, $customField); |
|
| 43 | + echo "Update Custom field, label is '" . $updateField->order_custom_field_label . "'" . PHP_EOL; |
|
| 44 | 44 | |
| 45 | - // read custom fields |
|
| 46 | - $readFields = $orders->getOrderCustomFields(); |
|
| 47 | - foreach ($readFields as $key => $field) { |
|
| 48 | - if ($field->order_custom_field_uuid === $uuid) { |
|
| 49 | - echo "Found Custom field with label '" . $field->order_custom_field_label . "'" . PHP_EOL; |
|
| 50 | - break; |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - // delete custom field |
|
| 54 | - if ($orders->deleteOrderCustomField($uuid)) { |
|
| 55 | - echo "Custom field with uuid='" . $uuid . "' was deleted successful." . PHP_EOL; |
|
| 56 | - } else { |
|
| 57 | - echo "Custom field with uuid='" . $uuid . "' was not deleted." . PHP_EOL; |
|
| 58 | - } |
|
| 45 | + // read custom fields |
|
| 46 | + $readFields = $orders->getOrderCustomFields(); |
|
| 47 | + foreach ($readFields as $key => $field) { |
|
| 48 | + if ($field->order_custom_field_uuid === $uuid) { |
|
| 49 | + echo "Found Custom field with label '" . $field->order_custom_field_label . "'" . PHP_EOL; |
|
| 50 | + break; |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + // delete custom field |
|
| 54 | + if ($orders->deleteOrderCustomField($uuid)) { |
|
| 55 | + echo "Custom field with uuid='" . $uuid . "' was deleted successful." . PHP_EOL; |
|
| 56 | + } else { |
|
| 57 | + echo "Custom field with uuid='" . $uuid . "' was not deleted." . PHP_EOL; |
|
| 58 | + } |
|
| 59 | 59 | } catch (Exception $e) { |
| 60 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 60 | + echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 61 | 61 | |
| 62 | - if ($orders && $uuid) { |
|
| 63 | - try { |
|
| 64 | - $orders->deleteOrderCustomField($uuid); |
|
| 65 | - echo "Custom field with uuid='" . $uuid . "' was cleaned up successful." . PHP_EOL; |
|
| 66 | - } catch (Exception $e) { |
|
| 67 | - echo "Custom field with uuid='" . $uuid . "' was not cleaned up." . PHP_EOL; |
|
| 68 | - } |
|
| 69 | - } |
|
| 62 | + if ($orders && $uuid) { |
|
| 63 | + try { |
|
| 64 | + $orders->deleteOrderCustomField($uuid); |
|
| 65 | + echo "Custom field with uuid='" . $uuid . "' was cleaned up successful." . PHP_EOL; |
|
| 66 | + } catch (Exception $e) { |
|
| 67 | + echo "Custom field with uuid='" . $uuid . "' was not cleaned up." . PHP_EOL; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -35,36 +35,36 @@ |
||
| 35 | 35 | // create custom field |
| 36 | 36 | $newField = $orders->createOrderCustomField($customField); |
| 37 | 37 | $uuid = $newField->order_custom_field_uuid; |
| 38 | - echo "Create Custom field, label is '" . $newField->order_custom_field_label . "'" . PHP_EOL; |
|
| 38 | + echo "Create Custom field, label is '".$newField->order_custom_field_label."'".PHP_EOL; |
|
| 39 | 39 | |
| 40 | 40 | // update custom field |
| 41 | 41 | $customField->order_custom_field_label = 'Custom Field New'; |
| 42 | 42 | $updateField = $orders->updateOrderCustomField($uuid, $customField); |
| 43 | - echo "Update Custom field, label is '" . $updateField->order_custom_field_label . "'" . PHP_EOL; |
|
| 43 | + echo "Update Custom field, label is '".$updateField->order_custom_field_label."'".PHP_EOL; |
|
| 44 | 44 | |
| 45 | 45 | // read custom fields |
| 46 | 46 | $readFields = $orders->getOrderCustomFields(); |
| 47 | 47 | foreach ($readFields as $key => $field) { |
| 48 | - if ($field->order_custom_field_uuid === $uuid) { |
|
| 49 | - echo "Found Custom field with label '" . $field->order_custom_field_label . "'" . PHP_EOL; |
|
| 48 | + if ($field->order_custom_field_uuid===$uuid) { |
|
| 49 | + echo "Found Custom field with label '".$field->order_custom_field_label."'".PHP_EOL; |
|
| 50 | 50 | break; |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | // delete custom field |
| 54 | 54 | if ($orders->deleteOrderCustomField($uuid)) { |
| 55 | - echo "Custom field with uuid='" . $uuid . "' was deleted successful." . PHP_EOL; |
|
| 55 | + echo "Custom field with uuid='".$uuid."' was deleted successful.".PHP_EOL; |
|
| 56 | 56 | } else { |
| 57 | - echo "Custom field with uuid='" . $uuid . "' was not deleted." . PHP_EOL; |
|
| 57 | + echo "Custom field with uuid='".$uuid."' was not deleted.".PHP_EOL; |
|
| 58 | 58 | } |
| 59 | 59 | } catch (Exception $e) { |
| 60 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 60 | + echo "ERROR: ".$e->getMessage().PHP_EOL; |
|
| 61 | 61 | |
| 62 | 62 | if ($orders && $uuid) { |
| 63 | 63 | try { |
| 64 | 64 | $orders->deleteOrderCustomField($uuid); |
| 65 | - echo "Custom field with uuid='" . $uuid . "' was cleaned up successful." . PHP_EOL; |
|
| 65 | + echo "Custom field with uuid='".$uuid."' was cleaned up successful.".PHP_EOL; |
|
| 66 | 66 | } catch (Exception $e) { |
| 67 | - echo "Custom field with uuid='" . $uuid . "' was not cleaned up." . PHP_EOL; |
|
| 67 | + echo "Custom field with uuid='".$uuid."' was not cleaned up.".PHP_EOL; |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -17,60 +17,60 @@ |
||
| 17 | 17 | Route4Me::setApiKey(Constants::API_KEY); |
| 18 | 18 | |
| 19 | 19 | $order = new Order([ |
| 20 | - 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 21 | - 'address_alias' => 'Auto test address', |
|
| 22 | - 'address_city' => 'Philadelphia', |
|
| 23 | - 'address_geo' => [ |
|
| 24 | - 'lat' => 48.335991, |
|
| 25 | - 'lng' => 31.18287 |
|
| 26 | - ], |
|
| 27 | - 'first_name' => 'John', |
|
| 28 | - 'last_name' => 'Doe', |
|
| 29 | - 'email' => '[email protected]' |
|
| 20 | + 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 21 | + 'address_alias' => 'Auto test address', |
|
| 22 | + 'address_city' => 'Philadelphia', |
|
| 23 | + 'address_geo' => [ |
|
| 24 | + 'lat' => 48.335991, |
|
| 25 | + 'lng' => 31.18287 |
|
| 26 | + ], |
|
| 27 | + 'first_name' => 'John', |
|
| 28 | + 'last_name' => 'Doe', |
|
| 29 | + 'email' => '[email protected]' |
|
| 30 | 30 | ]); |
| 31 | 31 | |
| 32 | 32 | $orders = null; |
| 33 | 33 | $orderId = null; |
| 34 | 34 | |
| 35 | 35 | try { |
| 36 | - $orders = new Orders(); |
|
| 36 | + $orders = new Orders(); |
|
| 37 | 37 | |
| 38 | - // create order |
|
| 39 | - $newOrder = $orders->create($order); |
|
| 40 | - $orderId = $newOrder->order_id; |
|
| 41 | - $orderUuid = $newOrder->order_uuid; |
|
| 42 | - echo "Create Order with id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 38 | + // create order |
|
| 39 | + $newOrder = $orders->create($order); |
|
| 40 | + $orderId = $newOrder->order_id; |
|
| 41 | + $orderUuid = $newOrder->order_uuid; |
|
| 42 | + echo "Create Order with id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 43 | 43 | |
| 44 | - // get order by ID |
|
| 45 | - $orderById = $orders->get($orderId); |
|
| 46 | - echo "Read Order by id, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 44 | + // get order by ID |
|
| 45 | + $orderById = $orders->get($orderId); |
|
| 46 | + echo "Read Order by id, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 47 | 47 | |
| 48 | - // get order by UUID |
|
| 49 | - $orderByUuid = $orders->get($orderUuid); |
|
| 50 | - echo "Read Order by uuid, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 48 | + // get order by UUID |
|
| 49 | + $orderByUuid = $orders->get($orderUuid); |
|
| 50 | + echo "Read Order by uuid, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 51 | 51 | |
| 52 | - // compare orders |
|
| 53 | - if ($orderById == $orderByUuid) { |
|
| 54 | - echo "The Orders are equal." . PHP_EOL; |
|
| 55 | - } else { |
|
| 56 | - echo "The Orders are not equal." . PHP_EOL; |
|
| 57 | - } |
|
| 52 | + // compare orders |
|
| 53 | + if ($orderById == $orderByUuid) { |
|
| 54 | + echo "The Orders are equal." . PHP_EOL; |
|
| 55 | + } else { |
|
| 56 | + echo "The Orders are not equal." . PHP_EOL; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - // delete order |
|
| 60 | - if ($orders->delete($orderUuid)) { |
|
| 61 | - echo "Order with uuid='" . $orderUuid . "' was deleted successful." . PHP_EOL; |
|
| 62 | - } else { |
|
| 63 | - echo "Order with uuid='" . $orderUuid . "' was not deleted." . PHP_EOL; |
|
| 64 | - } |
|
| 59 | + // delete order |
|
| 60 | + if ($orders->delete($orderUuid)) { |
|
| 61 | + echo "Order with uuid='" . $orderUuid . "' was deleted successful." . PHP_EOL; |
|
| 62 | + } else { |
|
| 63 | + echo "Order with uuid='" . $orderUuid . "' was not deleted." . PHP_EOL; |
|
| 64 | + } |
|
| 65 | 65 | } catch (Exception $e) { |
| 66 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 66 | + echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 67 | 67 | |
| 68 | - if ($orders && $orderId) { |
|
| 69 | - try { |
|
| 70 | - $orders->delete($orderUuid); |
|
| 71 | - echo "Order with uuid='" . $orderUuid . "' was cleaned up successful." . PHP_EOL; |
|
| 72 | - } catch (Exception $e) { |
|
| 73 | - echo "Order with uuid='" . $orderUuid . "' was not cleaned up." . PHP_EOL; |
|
| 74 | - } |
|
| 75 | - } |
|
| 68 | + if ($orders && $orderId) { |
|
| 69 | + try { |
|
| 70 | + $orders->delete($orderUuid); |
|
| 71 | + echo "Order with uuid='" . $orderUuid . "' was cleaned up successful." . PHP_EOL; |
|
| 72 | + } catch (Exception $e) { |
|
| 73 | + echo "Order with uuid='" . $orderUuid . "' was not cleaned up." . PHP_EOL; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | } |
@@ -39,38 +39,38 @@ |
||
| 39 | 39 | $newOrder = $orders->create($order); |
| 40 | 40 | $orderId = $newOrder->order_id; |
| 41 | 41 | $orderUuid = $newOrder->order_uuid; |
| 42 | - echo "Create Order with id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 42 | + echo "Create Order with id='".$orderId."' and uuid='".$orderUuid."'".PHP_EOL; |
|
| 43 | 43 | |
| 44 | 44 | // get order by ID |
| 45 | 45 | $orderById = $orders->get($orderId); |
| 46 | - echo "Read Order by id, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 46 | + echo "Read Order by id, id='".$orderId."' and uuid='".$orderUuid."'".PHP_EOL; |
|
| 47 | 47 | |
| 48 | 48 | // get order by UUID |
| 49 | 49 | $orderByUuid = $orders->get($orderUuid); |
| 50 | - echo "Read Order by uuid, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 50 | + echo "Read Order by uuid, id='".$orderId."' and uuid='".$orderUuid."'".PHP_EOL; |
|
| 51 | 51 | |
| 52 | 52 | // compare orders |
| 53 | - if ($orderById == $orderByUuid) { |
|
| 54 | - echo "The Orders are equal." . PHP_EOL; |
|
| 53 | + if ($orderById==$orderByUuid) { |
|
| 54 | + echo "The Orders are equal.".PHP_EOL; |
|
| 55 | 55 | } else { |
| 56 | - echo "The Orders are not equal." . PHP_EOL; |
|
| 56 | + echo "The Orders are not equal.".PHP_EOL; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // delete order |
| 60 | 60 | if ($orders->delete($orderUuid)) { |
| 61 | - echo "Order with uuid='" . $orderUuid . "' was deleted successful." . PHP_EOL; |
|
| 61 | + echo "Order with uuid='".$orderUuid."' was deleted successful.".PHP_EOL; |
|
| 62 | 62 | } else { |
| 63 | - echo "Order with uuid='" . $orderUuid . "' was not deleted." . PHP_EOL; |
|
| 63 | + echo "Order with uuid='".$orderUuid."' was not deleted.".PHP_EOL; |
|
| 64 | 64 | } |
| 65 | 65 | } catch (Exception $e) { |
| 66 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 66 | + echo "ERROR: ".$e->getMessage().PHP_EOL; |
|
| 67 | 67 | |
| 68 | 68 | if ($orders && $orderId) { |
| 69 | 69 | try { |
| 70 | 70 | $orders->delete($orderUuid); |
| 71 | - echo "Order with uuid='" . $orderUuid . "' was cleaned up successful." . PHP_EOL; |
|
| 71 | + echo "Order with uuid='".$orderUuid."' was cleaned up successful.".PHP_EOL; |
|
| 72 | 72 | } catch (Exception $e) { |
| 73 | - echo "Order with uuid='" . $orderUuid . "' was not cleaned up." . PHP_EOL; |
|
| 73 | + echo "Order with uuid='".$orderUuid."' was not cleaned up.".PHP_EOL; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -14,59 +14,59 @@ |
||
| 14 | 14 | Route4Me::setApiKey(Constants::API_KEY); |
| 15 | 15 | |
| 16 | 16 | $orderParams = Order::fromArray([ |
| 17 | - 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 18 | - 'cached_lat' => 48.335991, |
|
| 19 | - 'cached_lng' => 31.18287, |
|
| 20 | - 'address_alias' => 'Auto test address', |
|
| 21 | - 'address_city' => 'Philadelphia', |
|
| 22 | - 'EXT_FIELD_first_name' => 'John', |
|
| 23 | - 'EXT_FIELD_last_name' => 'Doe', |
|
| 24 | - 'EXT_FIELD_email' => '[email protected]' |
|
| 17 | + 'address_1' => '1358 E Luzerne St, Philadelphia, PA 19124, US', |
|
| 18 | + 'cached_lat' => 48.335991, |
|
| 19 | + 'cached_lng' => 31.18287, |
|
| 20 | + 'address_alias' => 'Auto test address', |
|
| 21 | + 'address_city' => 'Philadelphia', |
|
| 22 | + 'EXT_FIELD_first_name' => 'John', |
|
| 23 | + 'EXT_FIELD_last_name' => 'Doe', |
|
| 24 | + 'EXT_FIELD_email' => '[email protected]' |
|
| 25 | 25 | ]); |
| 26 | 26 | |
| 27 | 27 | $order = null; |
| 28 | 28 | $orderId = null; |
| 29 | 29 | |
| 30 | 30 | try { |
| 31 | - $order = new Order(); |
|
| 31 | + $order = new Order(); |
|
| 32 | 32 | |
| 33 | - // create order |
|
| 34 | - $newOrder = $order->addOrder($orderParams); |
|
| 35 | - $orderId = $newOrder['order_id']; |
|
| 36 | - $orderUuid = $newOrder['order_uuid']; |
|
| 37 | - echo "Create Order with id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 33 | + // create order |
|
| 34 | + $newOrder = $order->addOrder($orderParams); |
|
| 35 | + $orderId = $newOrder['order_id']; |
|
| 36 | + $orderUuid = $newOrder['order_uuid']; |
|
| 37 | + echo "Create Order with id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 38 | 38 | |
| 39 | - // get order by ID |
|
| 40 | - $orderById = $order->getOrder(['order_id' => $orderId]); |
|
| 41 | - echo "Read Order by id, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 39 | + // get order by ID |
|
| 40 | + $orderById = $order->getOrder(['order_id' => $orderId]); |
|
| 41 | + echo "Read Order by id, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 42 | 42 | |
| 43 | - // get order by UUID |
|
| 44 | - $orderByUuid = $order->getOrder(['order_id' => $orderUuid]); |
|
| 45 | - echo "Read Order by uuid, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 43 | + // get order by UUID |
|
| 44 | + $orderByUuid = $order->getOrder(['order_id' => $orderUuid]); |
|
| 45 | + echo "Read Order by uuid, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 46 | 46 | |
| 47 | - // compare orders |
|
| 48 | - if ($orderById == $orderByUuid) { |
|
| 49 | - echo "The Orders are equal." . PHP_EOL; |
|
| 50 | - } else { |
|
| 51 | - echo "The Orders are not equal." . PHP_EOL; |
|
| 52 | - } |
|
| 47 | + // compare orders |
|
| 48 | + if ($orderById == $orderByUuid) { |
|
| 49 | + echo "The Orders are equal." . PHP_EOL; |
|
| 50 | + } else { |
|
| 51 | + echo "The Orders are not equal." . PHP_EOL; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - // delete order |
|
| 55 | - $res = $order->removeOrder(['order_ids' => [$orderUuid]]); |
|
| 56 | - if ($res) { |
|
| 57 | - echo "Order with uuid='" . $orderUuid . "' was deleted successful." . PHP_EOL; |
|
| 58 | - } else { |
|
| 59 | - echo "Order with uuid='" . $orderUuid . "' was not deleted." . PHP_EOL; |
|
| 60 | - } |
|
| 54 | + // delete order |
|
| 55 | + $res = $order->removeOrder(['order_ids' => [$orderUuid]]); |
|
| 56 | + if ($res) { |
|
| 57 | + echo "Order with uuid='" . $orderUuid . "' was deleted successful." . PHP_EOL; |
|
| 58 | + } else { |
|
| 59 | + echo "Order with uuid='" . $orderUuid . "' was not deleted." . PHP_EOL; |
|
| 60 | + } |
|
| 61 | 61 | } catch (Exception $e) { |
| 62 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 62 | + echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 63 | 63 | |
| 64 | - if ($order && $orderId) { |
|
| 65 | - try { |
|
| 66 | - $order->removeOrder(['order_ids' => [$orderUuid]]); |
|
| 67 | - echo "Order with uuid='" . $orderUuid . "' was cleaned up successful." . PHP_EOL; |
|
| 68 | - } catch (Exception $e) { |
|
| 69 | - echo "Order with uuid='" . $orderUuid . "' was not cleaned up." . PHP_EOL; |
|
| 70 | - } |
|
| 71 | - } |
|
| 64 | + if ($order && $orderId) { |
|
| 65 | + try { |
|
| 66 | + $order->removeOrder(['order_ids' => [$orderUuid]]); |
|
| 67 | + echo "Order with uuid='" . $orderUuid . "' was cleaned up successful." . PHP_EOL; |
|
| 68 | + } catch (Exception $e) { |
|
| 69 | + echo "Order with uuid='" . $orderUuid . "' was not cleaned up." . PHP_EOL; |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -34,39 +34,39 @@ |
||
| 34 | 34 | $newOrder = $order->addOrder($orderParams); |
| 35 | 35 | $orderId = $newOrder['order_id']; |
| 36 | 36 | $orderUuid = $newOrder['order_uuid']; |
| 37 | - echo "Create Order with id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 37 | + echo "Create Order with id='".$orderId."' and uuid='".$orderUuid."'".PHP_EOL; |
|
| 38 | 38 | |
| 39 | 39 | // get order by ID |
| 40 | 40 | $orderById = $order->getOrder(['order_id' => $orderId]); |
| 41 | - echo "Read Order by id, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 41 | + echo "Read Order by id, id='".$orderId."' and uuid='".$orderUuid."'".PHP_EOL; |
|
| 42 | 42 | |
| 43 | 43 | // get order by UUID |
| 44 | 44 | $orderByUuid = $order->getOrder(['order_id' => $orderUuid]); |
| 45 | - echo "Read Order by uuid, id='" . $orderId . "' and uuid='" . $orderUuid . "'" . PHP_EOL; |
|
| 45 | + echo "Read Order by uuid, id='".$orderId."' and uuid='".$orderUuid."'".PHP_EOL; |
|
| 46 | 46 | |
| 47 | 47 | // compare orders |
| 48 | - if ($orderById == $orderByUuid) { |
|
| 49 | - echo "The Orders are equal." . PHP_EOL; |
|
| 48 | + if ($orderById==$orderByUuid) { |
|
| 49 | + echo "The Orders are equal.".PHP_EOL; |
|
| 50 | 50 | } else { |
| 51 | - echo "The Orders are not equal." . PHP_EOL; |
|
| 51 | + echo "The Orders are not equal.".PHP_EOL; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // delete order |
| 55 | 55 | $res = $order->removeOrder(['order_ids' => [$orderUuid]]); |
| 56 | 56 | if ($res) { |
| 57 | - echo "Order with uuid='" . $orderUuid . "' was deleted successful." . PHP_EOL; |
|
| 57 | + echo "Order with uuid='".$orderUuid."' was deleted successful.".PHP_EOL; |
|
| 58 | 58 | } else { |
| 59 | - echo "Order with uuid='" . $orderUuid . "' was not deleted." . PHP_EOL; |
|
| 59 | + echo "Order with uuid='".$orderUuid."' was not deleted.".PHP_EOL; |
|
| 60 | 60 | } |
| 61 | 61 | } catch (Exception $e) { |
| 62 | - echo "ERROR: " . $e->getMessage() . PHP_EOL; |
|
| 62 | + echo "ERROR: ".$e->getMessage().PHP_EOL; |
|
| 63 | 63 | |
| 64 | 64 | if ($order && $orderId) { |
| 65 | 65 | try { |
| 66 | 66 | $order->removeOrder(['order_ids' => [$orderUuid]]); |
| 67 | - echo "Order with uuid='" . $orderUuid . "' was cleaned up successful." . PHP_EOL; |
|
| 67 | + echo "Order with uuid='".$orderUuid."' was cleaned up successful.".PHP_EOL; |
|
| 68 | 68 | } catch (Exception $e) { |
| 69 | - echo "Order with uuid='" . $orderUuid . "' was not cleaned up." . PHP_EOL; |
|
| 69 | + echo "Order with uuid='".$orderUuid."' was not cleaned up.".PHP_EOL; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |