2017 © Pedro Peláez
 

project t-hub-service

Level-2 service integration with Atandra T-HUB

image

acobster/t-hub-service

Level-2 service integration with Atandra T-HUB

  • Tuesday, March 13, 2018
  • by acobster
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 4 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

T-HUB Service

Atandra, (*1)

Build Status, (*2)

Overview

An HTTP-service-style application for integrating a database-driven online store with the T-HUB desktop application. The included index.php file can serve as an independent web-facing script., (*3)

Currently the implementation is tied to a specific database structure. Maybe in the future it will become more configurable. Maybe., (*4)

NOTE: This service implements only the first two levels of integration: getOrders and updateOrdersShippingStatus as decribed in the T-HUB Service Spec, (*5)

Setup

Clone the repo:, (*6)

$ git clone git@github.com:acobster/t-hub-service.git path/to/public/service/dir

Configure the service by adding a file called thub_config.php in the public service dir (it should be in the same directory as index.php):, (*7)

<?php

define( 'DB_NAME', 'your_db' );
define( 'DB_USER', 'user' );
define( 'DB_PASSWORD', 'password' );
define( 'DB_HOST', 'localhost' );
define( 'DB_SOCKET', '/tmp/mysql.sock' ); // optional

// Using default values is discouraged in most cases.
// See docblock for THubService::config()
THub\THubService::config(array(
    'viewDir'       => '/some/dir/',
    'user'          => 'thub-user',
    'passwordFile'  => '/path/to/thub.passwd',
    'securityKey'   => 'some-long-string',
    'requireKey'    => false // defaults to true
));

?>

To generate the password file, run:, (*8)

php -r "echo password_hash('<your desired password>', PASSWORD_DEFAULT);" > /path/to/thub.passwd

Note that the /path/to/thub.passwd file must match the passwordFile path declared in the config., (*9)

Test it out!

The code comes with a Postman collection for various operations against the service endpoint. Import test/integration/THUB.postman_collection.json into Postman to get started, and take one of the requests for a spin. Careful! UpdateOrderShippingStatus has side-effects!, (*10)

Development

To start development, you must have Lando installed. After cloning, just run:, (*11)

lando start

inside the repo root., (*12)

Running Tests

There are unit and integration tests, all of which run inside the Lando environment:, (*13)

lando unit # runs unit tests
lando e2e  # runs integration tests
lando test # runs entire test suite

The Lando Postman environment

The code comes with a Postman environment for testing with the collection mentioned above. Import it from test/integration/lando.postman_environment.json., (*14)

The Versions

13/03 2018

dev-master

9999999-dev https://github.com/acobster/t-hub-service

Level-2 service integration with Atandra T-HUB

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Coby Tamayo

api xml shipping

31/01 2018

dev-refactor

dev-refactor https://github.com/acobster/t-hub-service

Level-2 service integration with Atandra T-HUB

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Coby Tamayo

api xml shipping

12/01 2018

dev-lando

dev-lando https://github.com/acobster/t-hub-service

Level-2 service integration with Atandra T-HUB

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Coby Tamayo

api xml shipping