Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xvilo/ovpay-api
Unofficial API Wrapper for OVPay
https://github.com/xvilo/ovpay-api
api client ovpay php
Last synced: about 2 months ago
JSON representation
Unofficial API Wrapper for OVPay
- Host: GitHub
- URL: https://github.com/xvilo/ovpay-api
- Owner: xvilo
- License: apache-2.0
- Created: 2023-01-01T15:21:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-28T10:45:44.000Z (9 months ago)
- Last Synced: 2024-11-12T10:48:37.225Z (about 2 months ago)
- Topics: api, client, ovpay, php
- Language: PHP
- Homepage:
- Size: 232 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## OV Pay PHP API Wrapper
[![codecov](https://codecov.io/gh/xvilo/ovpay-api/branch/main/graph/badge.svg?token=TTNSB24MKE)](https://codecov.io/gh/xvilo/ovpay-api)Unofficial API Wrapper for OVPay. This is a work in progress and based off an undocumented api. **stability is not
guaranteed**.For now only the unauthenticated API routes are available, but more will follow.
### TODO:
- [x] Add models
- [x] Add support for authentication, then:
- [x] Add support for `Trips`
- [x] Add support for `PaymentCards`
- [x] Add support for `Payments`
- [ ] Add working token refreshing logic
- [ ] Add better error response handling
### Example:Request trips, then request trip details:
```php
Authenticate(new TokenMethod($parser->parse('eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs...')));// Get payment cards
$card = $client->tokens()->getPaymentCards()[0];
// Get trips for specified Card xtat UUID
$trips = $client->trips()->getTrips($card->getExternalTransitAccountToken());
// Get last trip
$items = $trips->getItems();
/** @var Trip $trip */
$trip = end($items)->getTrip();
// Get trip details by ID
var_dump($client->trips()->getTrip($trip->getExternalBackOfficeToken(), $trip->getId()));
// class Xvilo\OVpayApi\Models\Receipt\ReceiptTrip#94 (4) {
// private readonly ?array $correctionOptions =>
// NULL
// private readonly Xvilo\OVpayApi\Models\Trip $trip =>
// class Xvilo\OVpayApi\Models\Trip#131 (13) {
// private readonly string $xbot =>
// string(36) "8126d60f-bded-46d3-9a70-30915a61008b"
// private readonly int $id =>
// int(12345678)
// private readonly int $version =>
// int(1)
// private readonly string $transport =>
// string(4) "RAIL"
// private readonly string $status =>
// string(8) "COMPLETE"
// private readonly string $checkInLocation =>
// string(16) "Utrecht Centraal"
// private readonly DateTimeImmutable $checkInTimestamp =>
// class DateTimeImmutable#79 (3) {
// public $date =>
// string(26) "2022-12-30 08:55:30.000000"
// public $timezone_type =>
// int(1)
// public $timezone =>
// string(6) "+01:00"
// }
// private readonly ?string $checkOutLocation =>
// string(5) "Baarn"
// private readonly ?DateTimeImmutable $checkOutTimestamp =>
// class DateTimeImmutable#101 (3) {
// public $date =>
// string(26) "2022-12-30 09:45:30.000000"
// public $timezone_type =>
// int(1)
// public $timezone =>
// string(6) "+01:00"
// }
// private readonly string $currency =>
// string(3) "EUR"
// private readonly int $fare =>
// int(540)
// private readonly string $organisationName =>
// string(2) "NS"
// private readonly bool $loyaltyOrDiscount =>
// bool(false)
// }
// private readonly mixed $correctedFrom =>
// NULL
// private readonly mixed $correctedFromType =>
// NULL
// }
```