sightseeingtech/passhub-api

v1.0.0 2018-06-21 17:22 UTC

This package is not auto-updated.

Last update: 2024-04-14 03:16:25 UTC


README

PassHub API documentation

Access PassHub with Php. This module offers high level and low level calls to the API.

Requirements

PHP 5.5 and later

Installation & Usage

Composer

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

{
  "require": {
      "sightseeingtech/passhub-api": "1.0"
   }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to///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');

try {
    $config = passhub\client\Configuration::getDefaultConfiguration();

    $config->setApiKey('X-Api-Key', 'YOUR_API_KEY');
    $config->setHost('YOUR_HOST');

    $orderRecordResource = new passhub\client\api\OrderRecordResourceApi(
        new GuzzleHttp\Client(['verify' => false]),
        $config
    );

    $item = new passhub\client\model\OrderItem([
        'customer_name' => 'My Name',
        'customer_type' => 'ADULT',
        'sku' => '1GL5_Child',
        'quantity' => 1,
        'price_paid' => 55.2,
        'tour_date' => new DateTime('2018-06-10')
    ]);

    $group = new passhub\client\model\GroupEntryDTO([
        'group_name' => 'TESTSDK_GROUP_NAME',
        'voucher_per_person' => true,
        'items' => [$item],
    ]);

    $order = new passhub\client\model\OrderRecordDTO([
        'amount' => 110.4,
        'customer_email' => 'test@test.com',
        'vendor_order_id' => 'TESTSDK_ORDER_1',
        'originiator' => 'TESTSDK_ORIGINATOR',
        'groups' => [$group],
    ]);

    $createdOrder = $orderRecordResource->createOrderRecord($order);

    echo $createdOrder->getId();
} catch (Exception $e) {
    print_r($e->getMessage());
}

?>

Documentation for API Endpoints

Class Method HTTP request Description
OrderRecordResourceApi createOrderRecord POST /api/v1/orderRecords createOrderRecord
OrderRecordResourceApi getAllOrderRecords GET /api/v2/orderRecords getAllOrderRecords
OrderRecordResourceApi getOrderRecord GET /api/v1/orderRecords/{id} getOrderRecord
OrderRecordResourceApi mergeVouchers POST /api/v1/orderRecords/mergeVouchers mergeVouchers
OrderRecordResourceApi updateOrderRecord PUT /api/v1/orderRecords updateOrderRecord
ProductResourceApi findProductsByVendor GET /api/v1/products/vendor/{vendorId} findProductsByVendor
ProductResourceApi getAllProducts GET /api/v2/products getAllProducts
VendorResourceApi getAllVendors GET /api/v2/vendors getAllVendors
VoucherResourceApi cancelValidation POST /api/v2/voucher/validate/cancel [V2] Cancel validation for the voucher
VoucherResourceApi cancelVoucher POST /api/v1/voucher/cancel cancelVoucher
VoucherResourceApi convertVoucher POST /api/v1/voucher/convert convertVoucher
VoucherResourceApi validateVoucher POST /api/v2/voucher/validate [V2] Validates voucher which represents single order item or group of them.

Documentation For Models

Documentation For Authorization

X-Api-Key

  • Type: API key
  • API key parameter name: X-Api-Key
  • Location: HTTP header