Skip to content

Visbook PHP Client generated by swagger

jaidevel/visbook-php-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwaggerClient-php

About localization/internationalization We currently support 6 languages: Norwegian, English, Swedish, Danish, German, Russian, The fallback language is always english. Translations are used for products and properties returned by the api, but the quality will depend on the hotel to have provided translations in the requested language. Specify the language you want to use by using the Accept-Language header. ## About reservations Once you make a reservation, you take up capacity at the hotel. Reservations must be kept alive every 40 seconds, else they expire to free up the capacity. When doing checkout (i.e when the user is sent to the payment processor), the expiration of the reservation is extended by 20 minutes. This means you do not need to ping the api while the user is "away" doing payment. There is a hard limit of 30 minutes before reservations are expired no questions asked.** This is to avoid someone holding capacity indefinitely. ## About authorization Before a guest is able to do payment/checkout, the guest must have a valid cookie. This is obtained by doing the login/validation flow. The /login request sends the user a one-time-passord on the selected medium (email, sms). This code must be returned to us via the /validation endpoint within reasonable time. /validation will return a httpOnly cookie, which must be present when doing /checkout. This cookie must also be present if you want to use endpoints that relate to customer data, like /orders and /user. /validation also returns customer data, if the customer exists, which can be used to "pre-fill" customer data for checkout. ## About checkout #### Amount The client is responsible for calculating an amount, which is the amount the guest should pay. This serves as a security mechanism, to see that the client and server agrees on the amount, to make sure there hasn't been any "mismatch" between client and server. #### PaymentType The client should make a call to /checkout/paymentTypes to see which payment types are available. #### Terms The client should make a call to /setup/terms to present the terms to the user. Checkout is only possible if acceptedTerms is true. #### Error/Success Upon success, the user will be forwarded to successUrl, with orderGroup as a query parameter. Example: https://reservations.visbook.com/5252/order?orderGroupId=1111111 You can then use orderGroupId to call /ordergroups/{id} to present an online order confirmation. Sms/Email order confirmation is handled by the api automatically. Upon error, the user will be forwarded to errorUrl with the query parameter errorCode. Example: https://reservations.visbook.com/1047/checkout?errorCode=1 Where errorCode conforms to the following table: | ErrorCode | Description | | --------- | ----------- | | 1 | Unable to reserve the amount on the card. Contact card issuer. | | 2 | Unable to capture the amount on the card. Contact card issuer. | | 3 | Unable to query the payment provider about the transaction. Contact the hotel. | | 4 | Unable to annul (refund) the transaction. Contact the hotel. | | 6 | Unable to set order to status paid. Contact the hotel. | | 7 | Unknown response from the payment processor. Contact the hotel. | | 8 | Unable to find the order. Contact the hotel. | | 9 | The order has been modified by someone else. Contact the hotel. | | 10 | Unable to save the order. Accounting error due to amount being lower than required fixed amount on this account. Contact the hotel. | | 11 | Unable to save the order, there's an error with the price. Contact the hotel. | | 12 | Unable to save the order, the invoice customer was not found. Contact the hotel. | | 13 | Some reservations have expired. Try again. | | 14 | Unable to process sale. Contact card issuer. | ## General flow 1. Create product reservations via /reservations endpoint 2. Keep reservations alive every 30-40 seconds via /reservations/ping (If you don't your reservations will expire) 3. Authorize guest via /login and /validation to receive a cookie you can use to checkout 4. Complete the order via /checkout. The guest must be authorized before this step is possible.

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 8.38.0
  • Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Swagger\Client\Api\AvailabilityCalendarApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$web_products_ids = array(56); // int[] | Web products ids array.
$month = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Month. Format yyyy-MM.
$webentity = 56; // int | 

try {
    $result = $apiInstance->apiWebentityAvailabilityWebProductsIdsMonthGet($web_products_ids, $month, $webentity);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AvailabilityCalendarApi->apiWebentityAvailabilityWebProductsIdsMonthGet: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to https://ws.visbook.com

Class Method HTTP request Description
AvailabilityCalendarApi apiWebentityAvailabilityWebProductsIdsMonthGet GET /api/{webentity}/availability/{webProductsIds}/{month} Get calendar with available web products for each day in month.
CheckoutApi apiWebentityCheckoutPaymenttypesGet GET /api/{webentity}/checkout/paymenttypes Get payment types and their settings.
CheckoutApi apiWebentityCheckoutPayorderPost POST /api/{webentity}/checkout/payorder Pay specific order.
CheckoutApi apiWebentityCheckoutPost POST /api/{webentity}/checkout Post checkout Create user if not exists, update if exists, register payment, extend reservation for X minutes.
CheckoutApi apiWebentityCheckoutUserinfoPost POST /api/{webentity}/checkout/userinfo Get fields for guest.
CompanyInformationApi apiWebentityCompanyinformationGet GET /api/{webentity}/companyinformation Return information about the current company.
CompanyInformationApi apiWebentityCompanyinformationIdGet GET /api/{webentity}/companyinformation/{id} Return company information by encrypted company Id.
GdprApi apiWebentityGdprGet GET /api/{webentity}/gdpr Generate GDPR report. Create request to GDPR web service.
GiftcardApi apiWebentityGiftcardBalanceIdGet GET /api/{webentity}/giftcard/balance/{id} Get giftcard info by Id.
LoginApi apiWebentityLoginRequestEmailPost POST /api/{webentity}/login/request/email Requests an email token.
LoginApi apiWebentityLoginRequestSmsPost POST /api/{webentity}/login/request/sms Requests an sms token.
LoginApi apiWebentityLogoutPost POST /api/{webentity}/logout Logout customer.
OrderGroupsApi apiWebentityOrdergroupsGet GET /api/{webentity}/ordergroups Gets all order groups belonging to the authorized customer.
OrderGroupsApi apiWebentityOrdergroupsIdGet GET /api/{webentity}/ordergroups/{id} Gets the specified order group by id.
OrderGroupsApi apiWebentityOrdergroupsPut PUT /api/{webentity}/ordergroups Refund specific order group by id.
OrderGroupsApi apiWebentityOrdergroupsTokenOrderGroupIdOrderIdGet GET /api/{webentity}/ordergroups/{token}/{orderGroupId}/{orderId} Gets the specified order group by id and valid access token.
OrdersApi apiWebentityOrdersGet GET /api/{webentity}/orders List the logged in guest's orders for current company.
OrdersApi apiWebentityOrdersIdGet GET /api/{webentity}/orders/{id} Returns specific order data by identified id. If encryptedCompanyId empty, current companyId will be used.
PdfApi apiWebentityPdfEncryptedCompanyIdOrderIdGet GET /api/{webentity}/pdf/{encryptedCompanyId}/{orderId} Generate pdf file for encryptedCompanyId order.
PdfApi apiWebentityPdfEncryptedCompanyIdOrderIdVisdocIdGet GET /api/{webentity}/pdf/{encryptedCompanyId}/{orderId}/{visdocId} Stream pdf file.
PricingCalendarApi apiWebentityPricingcalendarGet GET /api/{webentity}/pricingcalendar Get lowest price available for every day for an entire month.
ReleaseChangeLogApi apiWebentityReleasechangelogGet GET /api/{webentity}/releasechangelog Get information about changes for all api version.
ReservationsApi apiWebentityReservationsDelete DELETE /api/{webentity}/reservations Cancel reservations.
ReservationsApi apiWebentityReservationsEncryptedCompanyIdReservationIdPut PUT /api/{webentity}/reservations/{encryptedCompanyId}/{reservationId} Update reservation.
ReservationsApi apiWebentityReservationsPingPost POST /api/{webentity}/reservations/ping Ping reservations. Update life time.
ReservationsApi apiWebentityReservationsPost POST /api/{webentity}/reservations Create new reservation.
SetupApi apiWebentitySetupGet GET /api/{webentity}/setup Get Setup by web entity Id.
SetupApi apiWebentitySetupTermsPost POST /api/{webentity}/setup/terms Returns terms for web entity.
UserApi apiWebentityUserDelete DELETE /api/{webentity}/user Anonymize user for current company and all related companies.
UserApi apiWebentityUserGet GET /api/{webentity}/user Get user data with the most recent order.
UserApi apiWebentityUserPut PUT /api/{webentity}/user Update user data for current company and all related companies. Can be partially updated.
ValidationApi apiWebentityValidationEmailTokenGet GET /api/{webentity}/validation/email/{token} Validates the a previously created token and returns customer data if any.
ValidationApi apiWebentityValidationMobileTokenGet GET /api/{webentity}/validation/mobile/{token} Validates the a previously created token and returns customer data if any.
WebProductsApi apiWebentityWebproductsFromToGet GET /api/{webentity}/webproducts/{from}/{to} Get list of web products for the period for company and related companies. Optional filter by product group(s) or/and property(ies).
WebProductsApi apiWebentityWebproductsFromToWebProductIdGet GET /api/{webentity}/webproducts/{from}/{to}/{webProductId} Get web product by Id.
WebProductsApi apiWebentityWebproductsGet GET /api/{webentity}/webproducts Get all web products for company and related companies. Optional filter by product group(s) or/and property(ies).

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

About

Visbook PHP Client generated by swagger

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published