This article shares some possible use cases your code could support, as well as
a sample flow that could support each use case. This can be a helpful jumping
off point as you plan your code's implementation.
Your code could allow the business owner to assign a booking policy to one of
their services.
To assign a booking policy to a service:
- Call queryServices()
to retrieve all relevant services and display them to the business owner.
Make sure to save
id
and revision
of the service for which the owner
wants to change the booking policy.
- Use queryBookingPolicies()
to retrieve all relevant booking policies and display them to the owner. Let
them pick one and save the
bookingPolicy.id
.
- Optional: Allow the owner to create a new policy if they can't find a policy
that meets all their needs by calling
createBookingPolicy()).
Let the owner input all relevant parameters for the policy and save the ID
of the new policy.
- Call updateService()
and provide
service.id
, service.revision
, and service.booking.policy.id
.
Your code could allow the user to set a new default booking policy for their site.
To change the default policy:
- Call queryBookingPolicies()
to retrieve all relevant booking policies and display them to the business
owner. Let them choose a policy and save its ID.
- Optional: Allow the owner to create a new policy if they can't find a policy
that meets all their needs by calling
createBookingPolicy()).
Let the owner input all relevant parameters for the policy and save the ID
of the new policy.
- Call setDefaultBookingPolicy()
and pass the relevant
bookingPolicy.id
.