feat: cap rooms sharing a contingent per booking
This commit is contained in:
1 parent
5942ecf340
commit
3d94505e8d
18 files changed
+671
-19
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\BpnConnect;
|
||||
|
||||
class RoomsClient extends AbstractApiClient
|
||||
{
|
||||
private const string CONTINGENT_POOLS_PATH = '/api/v1/rooms/contingent-pools';
|
||||
|
||||
/**
|
||||
* Which room type's contingent each room type of a hotel draws on.
|
||||
*
|
||||
* The office sells one room at several occupancies by pointing the extra room types at the
|
||||
* first one's contingent (`PartnerZimmer.IDPartnerZimmer_FS_KontiAus`). A room type with its
|
||||
* own contingent maps to itself.
|
||||
*
|
||||
* @param int $hotelId the hotel's BusPro address id (the export's `<hotel idbuspro>`)
|
||||
*
|
||||
* @return array<int, int> room type id => room type id owning its contingent
|
||||
*/
|
||||
public function getContingentPools(int $hotelId): array
|
||||
{
|
||||
$payload = $this->request(self::CONTINGENT_POOLS_PATH, ['hotelId' => $hotelId]);
|
||||
|
||||
$pools = [];
|
||||
foreach ($payload['data'] ?? [] as $item) {
|
||||
$pools[(int) $item['room_type_id']] = (int) $item['pool_room_type_id'];
|
||||
}
|
||||
|
||||
return $pools;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user