Download the PHP package hele/partner-sync-api without Composer
On this page you can find all versions of the php package hele/partner-sync-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hele/partner-sync-api
More information about hele/partner-sync-api
Files in hele/partner-sync-api
Package partner-sync-api
Short Description Hele partner sync API PHP library
License MIT
Informations about the package partner-sync-api
Hele partner sync API
This repository provides PHP client library for synchronization of reservations with Hele.cz website.
Minimal supported version of PHP is 5.3.
Installation
The best way to install this library is using Composer:
Or download archive from Github and extract to your project.
Simple usage
- All
$parameters
arguments may contain custom data needed by your application (e.g. someserviceId
identifying service in your application) - if you need so, contact us. - All callbacks should finish within 9 seconds!
- Secret key will be assigned to you and should not leak anywhere (if that happens somehow, contact us for generating new one).
onCreateReservation
This endpoint is called when user creates some order on Hele.cz.
You should save new reservation to your database with the data given.
If reservation cannot be created for some reason, you can throw any Exception and the reservation on Hele website will not be performed.
We call this endpoint only if we know there is a free slot on that time (according to output in onGetSlots
), so throwing exceptions should not be needed.
Array provided in $parameters
contains (beside your custom data) also following keys: customerName
, customerEmail
, customerPhone
(in format +420777111222
), customerNote
.
Values of all these keys may be null.
onCancelReservation
This endpoint is called when previously created reservation is cancelled. You should delete old reservation from your database to free the time slot. If you do not want to implement this feature, let us know and we will send you an email on such cases (but you will need to perform this action manually).
onGetSlots
This endpoint is called periodically to synchronize reservations on Hele.cz with your database. You should always return all slots from your database (matching given date and parameters) even if only few of them will be available for Hele. The callback must return array of arrays in following format:
Testing implementation
After receiving secret
from us (by email), you can test if your implementation works as expected on prepared tool.
First check if your API is responding correctly using checkHealth
method.
Then try to fetch some slots and create reservation.
After that, you should see capacity drop on that time where you created the reservation.