Skip to content

Implement UiTDatabank event synchronization and upgrade UiTPAS to v2 API#45

Draft
Copilot wants to merge 10 commits into
masterfrom
copilot/implement-synchronization-with-uitdb
Draft

Implement UiTDatabank event synchronization and upgrade UiTPAS to v2 API#45
Copilot wants to merge 10 commits into
masterfrom
copilot/implement-synchronization-with-uitdb

Conversation

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown

Events should sync to UiTDatabank automatically, and the UiTPAS integration needs to move from the legacy OAuth1/XML API to the newer OAuth2/JSON API (v2).

Changes

  • OAuth2 client credentials authUitDatabankService gains getOAuth2Token() with expiration-aware caching, plus entryApiRequest() and uitpasApiRequest() helpers for the new APIs. New env URLs for api.uitpas.be and account.uitid.be.

  • Event synchronization (UitDBEvents) — Replaces the stub upload() with a real implementation that creates/updates events via Entry API v3. Builds JSON payload with calendar (single/multiple subEvents), location, description, and priceInfo from ticket categories. Persists uitdb_event_id on successful creation.

  • Image/photo upload — After creating or updating an event, the upload() method automatically syncs the event's poster and logo images to UiTDatabank. Images are uploaded via POST /images (media object by URL) and then linked to the event via POST /events/{id}/images.

  • UiTPAS v2 (UiTPASVerifier) — New JSON-based methods for tariff lookup (GET /events/{id}/tariffs), ticket sale registration (POST /ticket-sales), cancellation (DELETE /ticket-sales/{id}), and check-in (POST /events/{id}/checkins). Legacy XML/OAuth1 methods retained as fallback when client credentials aren't configured.

  • Config — Added UITDB_CLIENT_ID and UITDB_CLIENT_SECRET to .env.example and config/services.php. System auto-selects v2 when these are present.

  • GitHub Actions CI — Added .github/workflows/tests.yml that uses docker compose (v2 plugin) to build and start the application and MySQL containers, runs database migrations, then executes PHPUnit tests inside the webserver container.

// Usage: sync an event to UiTDatabank
$service = UitDatabankService::fromConfig();
$eventService = $service->getEventService();
if ($eventService) {
    $uitdbId = $eventService->upload($event);
}

Copilot AI linked an issue Jun 2, 2026 that may be closed by this pull request
Copilot AI added 2 commits June 2, 2026 09:32
- Add OAuth2 client credentials authentication support to UitDatabankService
- Implement event synchronization in UitDBEvents using Entry API v3 (JSON)
- Upgrade UiTPASVerifier to support new UiTPAS JSON API v2 with fallback to legacy XML API
- Add new environment URLs for UiTPAS API and OAuth2 auth endpoints
- Update config and .env.example with new UITDB_CLIENT_ID and UITDB_CLIENT_SECRET settings
- Update UitDBService contract with getEventService method
- Update readme documentation to reflect new capabilities
- Add unit tests for new functionality
Copilot AI changed the title [WIP] Add synchronization with uitdatabank and upgrade uitpas balie Implement UiTDatabank event synchronization and upgrade UiTPAS to v2 API Jun 2, 2026
Copilot AI requested a review from daedeloth June 2, 2026 09:35
@daedeloth

Copy link
Copy Markdown
Member

@copilot add support for uploading images / photos to uitdatabank

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Author

@copilot add support for uploading images / photos to uitdatabank

Implemented in commit Fix unused loop variable and add warning log for failed image uploads. The upload() method now automatically uploads the event's poster and logo images to UiTDatabank after creating/updating the event. It uses the Entry API /images endpoint to create a media object from the image URL, then links it to the event via /events/{id}/images.

@daedeloth

Copy link
Copy Markdown
Member

@copilot add github CI integration to run the tests

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Author

@copilot add github CI integration to run the tests

Added in .github/workflows/tests.yml. The workflow runs PHPUnit tests on push/PR to master/main with a PHP 8.0/8.1/8.2 matrix, using Composer caching for faster runs.

@daedeloth

Copy link
Copy Markdown
Member

@copilot fix github ci testrunner (by making sure you are using docker-compose and the migrations run)

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Author

@copilot fix github ci testrunner (by making sure you are using docker-compose and the migrations run)

Fixed. The CI workflow now uses docker-compose up -d --build to start the app and MySQL containers, waits for MySQL to be ready, runs php artisan migrate --force, then executes PHPUnit tests inside the webserver container.

@daedeloth

Copy link
Copy Markdown
Member

@copilot fix

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Author

@copilot fix

The CI runner doesn't have the standalone docker-compose binary — it only has the Docker Compose v2 plugin (docker compose). Updated all commands to use docker compose instead.

@daedeloth

Copy link
Copy Markdown
Member

@copilot fix

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Author

@copilot fix

The webserver container was crashing because the docker-compose.yml volume mount (./:/var/www/html) was overwriting the container's built files (including vendor/) with the host directory that has no dependencies installed. Added a docker-compose.ci.yml override that removes the volume mount for CI, so the container uses its built-in files. Also removed the obsolete version attribute to eliminate the warning, and added a container status check step for debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement synchronization with uitdb

2 participants