Partner synchronization
Allows using partner vehicles for rental through your own company
Owner - the company owner who requests vehicles from a partner company
Partner - the company providing its vehicles for rental
The main reason for synchronization
Without synchronization: the partnerâs car must be created manually.
Use case: There is a need for a rental car. The user logs into the partnerâs system, opens the offer generator, and searches for an available car. After selecting and saving the desired car, they go to their system and manually create a reservation for that car.
Possible improvement: It would be convenient to see which partnerâs vehicles are available directly in your system, without having to switch to the partnerâs system.
How to activate sync
- Create company for partner on add/agency (Customers -> New Company) !!! Partner should be admin for own company, email is required field
- After creating the company, a block with an offer to enable synchronization will appear at the bottom of the page.
- Log in to the partnerâs account, create a company.
- As a Partner, go to the settings page on the Synchronizations tab and allow synchronization
- As an Owner, go to the Dashboard and confirm synchronization
- Partnerâs vehicles should appear on the /vehicles page in the partner tab
- When updating and creating a vehicle, all changes are synchronized with the partner
A vehicle stops synchronizing if:
- It is deleted in the partnerâs system
- When joining a company in the Partner system
Synchronization Statuses
- Pending - Synchronization request sent, awaiting ownerâs decision
- Accepted - Synchronization is active, data is automatically synchronized
- Declined - Synchronization request declined by the owner
- StoppedByOwner - Synchronization paused by the owner
- StoppedByPartner - Synchronization paused by the partner
How to test sync
Creating a vehicle
- When a vehicle is created, it should appear in all companies with synchronization enabled (test createVehicleForPartners).
- Check creation with global and local brands â the vehicle page has no errors.
- Check creation with an additional service (extra) that is not in the Ownerâs system but exists in Partner system â the array of extra services is empty in the Owner system.
- Check creation with a season tariffs matrix created in the ownerâs system â the matrix is copied to the Owner system.
- Open already created cars in the partnerâs system - no errors should occur.
Vehicle update
- When updating a car, it must be updated in all companies with synchronization enabled (test synchronizeVehicle).
- Prices are not updated.
- Additional services and the tariff matrix are not updated.
- Pay attention to updating damages, photos, vehicle info - must always be in its actual state
Delete a vehicle
- After a vehicle is deleted from the Partnerâs system, it must also be deleted from the Ownerâs system.
Search
- Vehicles must be found using the vehicle search in the vehicle list and when searching for cars when creating a reservation.
- It should be possible to create a booking for a partnerâs vehicle.
Architecture
Key Features
- sync-vehicles - API endpoint for bulk synchronization of vehicles between partner companies
- synchronizeVehicle - Resolver for synchronizing changes in a vehicle with all partners
- createVehicleForPartners - Resolver for creating copies of a new vehicle for all partners
- deleteVehicleForPartners - Resolver for marking copies of a vehicle as deleted for all partners
Important Concepts
- seasons tariffs matrix and prices - supplierâs conditions by default. We have the right to change data in our contract as we wish
- parentRef - vehicle ID in the Partner company. This ID is used to find the vehicle in the owner company for updates
- isPartner - flag for identifying partner seasonal tariffs
Synchronization Management Resolvers
-
acceptSynchronization - accepting a synchronization request (the âAcceptâ button in settings on the Synchronizations tab)
- Finds all ownerâs vehicles with
isOwn: true - Creates copies for the partner
- Sets synchronization status to âAcceptedâ
- Finds all ownerâs vehicles with
-
createSynchronization - creating a synchronization request (the âSyncâ button in the âUpdate partnerâ form)
- Creates a synchronization record with âPendingâ status
- Requires the partner to be an administrator of their company
-
declineSynchronization - declining a synchronization request (the âDeclineâ button in settings on the Synchronizations tab)
- Sets synchronization status to âDeclinedâ
-
deleteSynchronization - deleting a synchronization request (the âDeactivateâ button in the âUpdate partnerâ form)
- Deletes the synchronization record if its status is âPendingâ
- Throws an error if the status is not âPendingâ
-
ownerStopSynchronization - pausing synchronization by the owner
- Sets synchronization status to âStoppedByOwnerâ
-
partnerReactivateSynchronization - resuming synchronization by the partner
- Changes status from âStoppedByPartnerâ to âPendingâ
Vehicle Synchronization Resolvers
-
createVehicleForPartners - creating copies of a new vehicle for all partners
- Automatically called when creating a vehicle with
isOwn: true - Copies basic vehicle data
- Copies seasonal tariffs with the â[Partner]â label and the
isPartner: trueflag â this makes it easier to find and delete them, as well as to distinguish them from the ownerâs own tariffs
- Automatically called when creating a vehicle with
-
synchronizeVehicle - updating copies of a vehicle for partners
- Automatically called when updating a vehicle with
isOwn: true - Updates only specific fields (vehicle information, images, damages)
- Does not affect partner-specific fields (prices, availability, etc.)
- Automatically called when updating a vehicle with
-
deleteVehicleForPartners - marking vehicle copies as deleted
- Called when changing status from
isOwn: truetoisOwn: falseor when deleting - Marks copies for partners as deleted (
deleted: true) - Updates search indexes
- Called when changing status from
API Endpoints (disabled, should be fixed)
- sync-vehicles - bulk vehicle synchronization
- Used for recovery after synchronization failures
- Applied during mass changes in data structure or business logic