Sabre API货币换算

时间:2018-12-27 10:21:53

标签: php currency sabre

我需要有关如何在Sabre REST API中将美元转换为菲律宾货币的帮助。使用讨价还价工具

因为我们位于菲律宾,所以需要更改货币。 提供下面的代码,如果凭据有问题,只需发布​​,我将创建一个新的访问令牌。

<?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);
?>

我刚刚添加了以下代码:

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

1 个答案:

答案 0 :(得分:1)

您可以在 TravelerInfoSummary-> PriceRequestInformation 下更改货币代码。对于REST API,我认为DTO很相似

<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>