Skip to main content

Currency Converter

The Currency Converter plugin enables the application of currency conversion to all the prices within a single option. This plugin takes an option and a currency as input and provides the same option with currency conversion applied to all the prices. It obtains rate information from a file located on our SFTP server. It's important to note that the existence of this file on the SFTP server and its compliance with specific requirements are mandatory. Otherwise, an error will be returned.

To get started with the Currency Converter plugin, follow these simple steps:

1.Create and Upload your Currency Converter File

To get started, create your currency converter file in the correct format and then upload it to your SFTP account. We've provided a template file below ⬇️ to help you with this process. Just click on the file name, add your own rules, save it in CSV format, and then upload it to the corresponding folder in your SFTP.

sftp.xmltravelgate.com

📁HotelX
     📁HotelX_0000
         📁BusinessRules
             📄currency_map.csv

File Format Specification

  • File Name: currency_map.csv
  • Directory: HotelX/HotelX0000/BusinessRules
  • Delimiter: Comma (,)
  • Header Row:
    • Code
    • Rate
      • Decimal separator for rate must be point .
info

The rate with value 1.00 is the base currency. Other rates are calculated from it.

📹Learn how to change the format of the csv file in order to edit and save it

2. Execute Currency Converter Plugin in your Query

Once you've uploaded your currency converter file, to use the plugin add the following field to the settings node of your request. Note that currency converter plugin can just be executed in search query. In order to successfully execute the preference plugin, you will need to create the request with the following variables.

  • step: "RESPONSE_OPTION"
  • type: "CURRENCY_CONVERSION"
  • name: "currency_exchange"
  • parameters:
    • currency: The currency to which you want to convert, ISO 4217.
    • exclude: True or false. Determinates if the options on which the currency change cannot be applied (no currency found in SFTP) are excluded.
"settings": {
"plugins": [
{
"step": "RESPONSE_OPTION",
"pluginsType": {
"type": "CURRENCY_CONVERSION",
"name": "currency_exchange",
"parameters": [
{
"key": "currency",
"value": "EUR"
},
{
"key": "exclude",
"value": "true"
}
]
}
}
]
}