定制 hele/partner-sync-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hele/partner-sync-api

Composer 安装命令:

composer require hele/partner-sync-api

包简介

Hele partner sync API PHP library

README 文档

README

Build Status Scrutinizer Code Quality

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:

composer require hele/partner-sync-api

Or download archive from Github and extract to your project.

Simple usage

<?php

// require __DIR__ . '/hele-partner-sync-api/autoload.php'; // non-composer usage
require __DIR__ . '/vendor/autoload.php';

$app = new \HelePartnerSyncApi\Application('secret-key');
$app->onGetSlots(function (\DateTime $date, array $parameters) {
    // return $this->reservationFacade->getFreeSlots($date);
});
$app->onCreateReservation(function (\DateTime $startDateTime, \DateTime $endDateTime, $quantity, array $parameters) {
    // $this->reservationFacade->createReservation(...);
});
$app->onCancelReservation(function (\DateTime $startDateTime, \DateTime $endDateTime, $quantity, array $parameters) {
    // $this->reservationFacade->cancelReservation(...);
});
$app->run();
  • All $parameters arguments may contain custom data needed by your application (e.g. some serviceId 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:

[
    [
        'startDateTime' => DateTimeInterface,
        'endDateTime' => DateTimeInterface,
        'capacity' => int,
    ],
    [
        'startDateTime' => DateTimeInterface,
        'endDateTime' => DateTimeInterface,
        'capacity' => int,
    ],
]

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.

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固