Skip to main content

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 Search during Quote or a Quote during Book, 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 ConnectorsHttpClient is 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 PlatformOptions must 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 PlatformOptions allows for scalability and adaptability to new supplier requirements.