dev-master
9999999-devamsbus booking client
MIT
The Requires
- php >=5.4
- ext-curl *
- guzzlehttp/guzzle ~4.0
The Development Requires
Wallogit.com
2017 © Pedro Peláez
amsbus booking client
This package is a php client implementation for the AmsBus (RO) Webservice (SOAP). It is based on the webservice description found here: INSERT DOC HERE, (*1)
Below you will find example calls for the different endpoints., (*2)
Install via composer., (*3)
Add "thomaswiener/client-amsbus": "dev-master" to your composer.json and update vendors., (*4)
| Provider | Url |
|---|---|
| Packagist | https://packagist.org/packages/thomaswiener/client-amsbus |
| Github | https://github.com/thomaswiener/client-amsbus |
$loader = require_once __DIR__ . "/./vendor/autoload.php";
$config = array(
'url' => 'https://eshopcv.amsbus.cz:8443/',
'id' => 'xxxxxxxxxxxxx',
'version' => 'v1',
'sslVerifcationEnabled' => false
);
$client = new \AmsBusClient\Client($config);
$stationService = new \AmsBusClient\Endpoint\Station($client);
$connectionService = new \AmsBusClient\Endpoint\Connection($client);
$seatService = new \AmsBusClient\Endpoint\Seat($client);
$ticketService = new \AmsBusClient\Endpoint\Ticket($client);
originCode = 'Praha [*CZ]';
$destinationCode = 'Brno [*CZ]';
$pax = ['John Doe', 'Jane Doe'];
$tripDate = (new \DateTime())->setDate(2014, 12, 2);
$searchString = "Ber"; $response = $stationService->search($searchString);
$connectionData = new \AmsBusClient\Data\Connection();
$connectionData
->setFrom($originCode)
->setTo($destinationCode)
->setTripDate($tripDate);
$response = $connectionService->search($connectionData);
$handle = $response->getData()->handle;
foreach ($response->getData()->connections as $index => $connection) {
break;
}
$urlParams = [$handleId, $indexId];
$response = $connectionService->getInfo($urlParams);
$response = $seatService->block(array(), $urlParams);
$response = $seatService->unblock(array(), $urlParams);
$urlParams = [$ticketHandle]; #from response
$additionalInfo = new \AmsBusClient\Data\AdditionalInfo();
foreach ($tickets as $index => $ticket) {
$passenger = new \AmsBusClient\Data\Passenger();
$passenger->setName('John Doe');
$passenger->setTicketIdx($index); //the ticket index in the array (probably)
$additionalInfo->addPassenger($passenger);
}
$response = $ticketService->create($additionalInfo, $urlParams);
$ticket = $response->getData();
$response = $ticketService->get($ticketHandle);
$response = $ticketService->cancel($ticketHandle);
foreach ($tickets as $ticket) {
$transCode = $ticket->transCode;
$operation = \AmsBusClient\Endpoint\Interfaces\TicketInterface::OPERATION_THERE;
$response = $ticketService->refund($transCode, $operation);
$refundHandles[] = $response->getData()->refundHandle;
}
foreach ($refundHandles as $refundHandle) {
$response = $ticketService->refundCancel($refundHandle);
}
foreach ($refundHandles as $refundHandle) {
$response = $ticketService->refundConfirm($refundHandle);
}
amsbus booking client
MIT