PlatformOptions
The PlatformOptions class defines configuration settings for the Connector. It allows for fine-tuning behavior for each operation, such as Search, Quote, Book, CheckBookings, and Cancel. These configurations are essential for adapting the Connector to specific supplier requirements and ensuring compliance with Travelgate standards.
Purposeβ
The PlatformOptions class is used to:
- Configure behavior like IP filtering for suppliers using a
ConnectorsHttpClient. - Specify when secondary operations, like a
SearchduringQuoteor aQuoteduringBook, are required. - Ensure supplier-specific restrictions and requirements are adhered to during Connector operations.
Key Configurationsβ
ConnectorsHttpClientβ
- Used for suppliers that require IP-based filtering.
- A
ConnectorsHttpClientis specified for each operation to ensure requests originate from the correct IP. - Available options:
Default: Standard HTTP client without IP filtering.DefaultProxy: Filters requests through a proxy IP. Usefull when the supplier filter's by IP.ProxyPCI: (Deprecated) Not in use.
Repeat Flow Operation Requiredβ
Defines the conditions under which repeating an operation is required during another operation. Possible values include:
Never: A repeat operation is not required.Always: A repeat operation is always required.OnExpiration: A repeat operation is required when the previous Search results have expired.OnErrorExpiration: A repeat operation is required only when an expiration-specific error occurs.
Note: For example, a 'Search' operation might be required during Quote or Book operations. Possible values include:
Refer to the following documentation for more details: Repeat_Flow_Operations.
Example Configurationβ
Here is an example of a fully configured PlatformOptions:
return new PlatformOptions
{
Search = new SearchOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default,
},
Quote = new QuoteOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default,
SearchRequired = new SearchRequired
{
When = SearchRequiredWhen.Always
}
},
Book = new BookOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default,
QuoteRequired = new QuoteRequired
{
When = QuoteRequiredWhen.Never
}
},
CheckBookings = new CheckBookingsOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default,
},
Cancel = new CancelOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default
}
};
Connectorβ
To apply the PlatformOptions, inject the configuration into the Connector startup using the provided extension method:
public static void ConfigurePlatformOptions(this WebApplication webApplication)
{
webApplication.ConfigurePlatformOptions(TgxPlatform.PlatformName, BuildDefaultPlatformOptions());
}
The BuildDefaultPlatformOptions method defines the default configuration for the Connector:
public static PlatformOptions BuildDefaultPlatformOptions()
{
return new PlatformOptions
{
Search = new SearchOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default,
},
Quote = new QuoteOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default,
SearchRequired = new SearchRequired
{
When = SearchRequiredWhen.Always
}
},
Book = new BookOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default,
QuoteRequired = new QuoteRequired
{
When = QuoteRequiredWhen.Never
}
},
CheckBookings = new CheckBookingsOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default,
},
Cancel = new CancelOptions
{
ConnectorsHttpClient = ConnectorsHttpClient.Default
}
};
}
Usage Notesβ
- The
PlatformOptionsmust be defined for each Connector and tailored to the supplierβs specific requirements. - Validating these configurations during development ensures seamless operation and prevents runtime errors.
- The flexibility provided by
PlatformOptionsallows for scalability and adaptability to new supplier requirements.