get-impala/impala-php

此包已被弃用且不再维护。未建议替代包。

Impala酒店PMS API的PHP包装器

2.0.2 2018-08-01 11:46 UTC

This package is not auto-updated.

Last update: 2021-08-19 15:46:40 UTC


README

CircleCI Maintainability Test Coverage

安装

很简单

$ composer require get-impala/impala-php

测试

要运行测试,您可以运行以下命令

$ ./vendor/bin/phpunit

获取API密钥

要使用此库,您需要一个Impala API密钥。更多信息可以在Impala开发者文档的“入门”部分找到:'Getting Started'

入门

安装后,您可以使用其工厂类实例化库

require_once __DIR__ . '/vendor/autoload.php';

use Impala\ImpalaFactory;

$impala = ImpalaFactory::create(<api-key>);

处理单个酒店

如果您的应用程序将一次只处理一个酒店,您可以像这样实例化Impala API

$hapiHotel = ImpalaFactory::create('secret', 'hapi');

处理多个酒店

如果您的应用程序将处理多个酒店,您可以省略hotelId参数,如下所示

$impala = ImpalaFactory::create('secret');

// You can then pass the hotelId directly to the method
$impala->getBookings(['hotelId' => 'hapi']);

// Or with extra parameters
$impala->getBookings([
    'hotelId' => 'hapi',
    'startDate' => '2018-02-03',
    'endDate' => '2018-02-05',
]);

// Or, you can call getHotel to return a single-hotel API instance
$hapiHotel = $impala->getHotel('hapi')

// You can then call the API methods like normal
$hapiHotel->getBookings();

进行API调用

API方法接受一个关联数组作为其第一个参数,其中包含API调用的参数。如果没有要设置的参数,则可以省略。

接受ID的API方法将ID作为第一个参数。

更新资源的API方法接受一个JSON merge patch的数组表示作为其第二个参数。

例如

use Impala\ImpalaFactory;

$hapiHotel = ImpalaFactory::create('secret', 'hapi')

$hapiHotel->getBookings([
    'startDate' => '2018-02-03',
    'endDate' => '2018-02-05',
]);

$hapiHotel->getBookingById('c4be6570-15fc-4926-b339-446db4800f81');

API方法

名称 HTTP API端点
getAllocationById GET /v2/hotel/:hotelId/allocation/:allocationId
getAllocations GET /v2/hotel/:hotelId/allocation
getAreaById GET /v2/hotel/:hotelId/area/:areaId
getAreas GET /v2/hotel/:hotelId/area
getAreaTypeById GET /v2/hotel/:hotelId/area-type/:areaTypeId
getAreaTypes [GET /v2/hotel/:hotelId/area-type][type-area-type]
getBillById GET /v2/hotel/:hotelId/bill/:billId
getChargeByIdForBill GET /v2/hotel/:hotelId/bill/:billId/charge/:chargeId
getChargesForBill GET /v2/hotel/:hotelId/bill/:billId/charge
createChargeForBill POST /v2/hotel/:hotelId/bill/:billId/charge
refundChargeByIdForBill POST /v2/hotel/:hotelId/bill/:billId/charge/:chargeId/refund
getPaymentByIdForBill GET /v2/hotel/:hotelId/bill/:billId/payment/:paymentId
getPaymentsForBill GET /v2/hotel/:hotelId/bill/:billId/payment
createPaymentForBill POST /v2/hotel/:hotelId/bill/:billId/payment
refundPaymentByIdForBill POST /v2/hotel/:hotelId/bill/:billId/payment/:paymentId/refund
getBookingById GET /v2/hotel/:hotelId/booking/:bookingId
getBookings GET /v2/hotel/:hotelId/booking
createBooking POST /v2/hotel/:hotelId/booking
updateBookingById PATCH /v2/hotel/:hotelId/booking/:bookingId
checkInBookingById POST /v2/hotel/:hotelId/booking/:bookingId/check-in
checkOutBookingById POST /v2/hotel/:hotelId/booking/:bookingId/check-out
cancelBookingById POST /v2/hotel/:hotelId/booking/:bookingId/cancel
getGuestsForBooking GET /v2/hotel/:hotelId/booking/:bookingId/guest
getBillsForBooking GET /v2/hotel/:hotelId/booking/:bookingId/bill
getBookingSets [[GET /v2/hotel/:hotelId/booking-set][type-bookingset]]
根据ID获取预订集 [[GET /v2/hotel/:hotelId/booking-set/:bookingSetId][type-bookingset]]
创建预订集 [[POST /v2/hotel/:hotelId/booking-set][type-bookingset]]
更新预订集 [[PATCH /v2/hotel/:hotelId/booking-set/:bookingSetId][type-bookingset]]
根据ID获取额外信息 GET /v2/hotel/:hotelId/extra/:extraId
获取额外信息列表 GET /v2/hotel/:hotelId/extra
根据ID获取客人信息 GET /v2/hotel/:hotelId/guest/:guestId
获取客人信息列表 GET /v2/hotel/:hotelId/guest
创建客人 POST /v2/hotel/:hotelId/guest
更新客人 PATCH /v2/hotel/:hotelId/guest/:guestId
获取客人的账单 GET /v2/hotel/:hotelId/guest/:guestId/bill
根据ID获取价格计划 GET /v2/hotel/:hotelId/rate-plan/:ratePlanId
获取价格计划列表 GET /v2/hotel/:hotelId/rate-plan
获取价格计划的价格 GET /v2/hotel/:hotelId/rate-plan/:ratePlanId/price
更新价格计划的价格 PUT /v2/hotel/:hotelId/rate-plan/:ratePlanId/price
获取价格集 GET /v2/hotel/:hotelId/rate-set