Search code examples
phpcurrencysabre

Sabre API Currency Conversion


I need help on how to change the US DOLLAR currency into Philippine currency in Sabre REST API. Using the Bargain Finder Max.

It is need to change the currency because we are located in Philippines. Provided the code below and if there is a problem in credentials just post and i will create a new access token.

<?php
$key = "T1RLAQK5VRIz4u9UxsrtRpVkv3TPUpGDpxD3eZ1ylkey88VRPyWu7FXRAADAK01jW46inTdqwxIBMPzzfM30QkYRuzvEnf3wEslyMSLmfZMPfV0rTTjdyuv4EYAzi+276mRO3f1VRsDI+Y/VW+CRm82SYlgkp6cW+MhqltdgpnuP+uzDCL8aXE3yD3hcRXQPlEDbFtcjWQ1lLE1fmfr5+xrcHwtggEGcwRG4BDyVwDgKFucjSfE9jZ51ORnYpTPgfK6rDsyHU/rJr8QKb83PVqKBKD+L/FeKaqrQolkcn5Pdemg2bWFtaTzNoQCi";
$header[] = "Authorization: Bearer " . $key;
$header[] = "Accept: application/json"; 
$header[] = "Content-Type: application/json";
$data = '{
 "OTA_AirLowFareSearchRQ": {
     "Target": "Production",
       "POS": {
            "Source": [{
                "PseudoCityCode":"F9CE",
                "RequestorID": {
                    "Type": "1",
                  "ID": "1",
                    "CompanyName": {
                  }
             }
         }]
        },
        "OriginDestinationInformation": [{
          "RPH": "1",
           "DepartureDateTime": "2019-01-05T11:00:00",
           "OriginLocation": {
             "LocationCode": "CGK"
         },
            "DestinationLocation": {
                "LocationCode": "SUB"
         },
            "TPA_Extensions": {
             "SegmentType": {
                    "Code": "O"
               }
         }
     },
        {
         "RPH": "2",
           "DepartureDateTime": "2019-01-06T11:00:00",
           "OriginLocation": {
             "LocationCode": "CGK"
         },
            "DestinationLocation": {
                "LocationCode": "SUB"
         },
            "TPA_Extensions": {
             "SegmentType": {
                    "Code": "O"
               }
         }
     }],
       "TravelPreferences": {
          "ValidInterlineTicket": true,
           "CabinPref": [{
             "Cabin": "Y",
             "PreferLevel": "Preferred"
            }],
           "TPA_Extensions": {
             "TripType": {
                   "Value": "Return"
             },
                "LongConnectTime": {
                    "Min": 780,
                 "Max": 1200,
                    "Enable": true
              },
                "ExcludeCallDirectCarriers": {
                  "Enabled": true
             }
         }
     },
        "TravelerInfoSummary": {
            "SeatsRequested": [1],
          "AirTravelerAvail": [{
              "PassengerTypeQuantity": [{
                 "Code": "ADT",
                    "Quantity": 1
               }]
            }],
            "PriceRequestInformation" : {
                "CurrencyCode" : "PHP"
            }
        },
        "TPA_Extensions": {
         "IntelliSellTransaction": {
             "RequestType": {
                    "Name": "50ITINS"
             }
         }
     }
 }
}';
$jsonstr = json_decode($data, true);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api-crt.cert.havail.sabre.com/v4.3.0/shop/flights?mode=live&limit=50&offset=1" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);

$result = curl_exec ($ch);
?>

I just added the code below:

"PriceRequestInformation" : {
                "CurrencyCode" : "PHP"
            }

Solution

  • You can change the currency code under TravelerInfoSummary -> PriceRequestInformation. For REST api, I think the DTO are similar

    <TravelerInfoSummary>
        <SeatsRequested>1</SeatsRequested>
        <AirTravelerAvail>
            <PassengerTypeQuantity Code="ADT" Quantity="1" />
        </AirTravelerAvail>
        <PriceRequestInformation CurrencyCode="CAD">
            <TPA_Extensions>
                <Priority>
                    <Price Priority="1" />
                    <DirectFlights Priority="2" />
                    <Time Priority="3" />
                    <Vendor Priority="4" />
                </Priority>
            </TPA_Extensions>
        </PriceRequestInformation>
    </TravelerInfoSummary>