Skip to content

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

  1. Create company for partner on add/agency (Customers -> New Company) !!! Partner should be admin for own company, email is required field
  2. After creating the company, a block with an offer to enable synchronization will appear at the bottom of the page.
  3. Log in to the partner’s account, create a company.
  4. As a Partner, go to the settings page on the Synchronizations tab and allow synchronization
  5. As an Owner, go to the Dashboard and confirm synchronization
  6. Partner’s vehicles should appear on the /vehicles page in the partner tab
  7. 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.
  • 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”
  • 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: true flag – this makes it easier to find and delete them, as well as to distinguish them from the owner’s own tariffs
  • 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.)
  • deleteVehicleForPartners - marking vehicle copies as deleted

    • Called when changing status from isOwn: true to isOwn: false or when deleting
    • Marks copies for partners as deleted (deleted: true)
    • Updates search indexes

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