Giter Club home page Giter Club logo

amadeus-java's People

Contributors

akshitsingla avatar alnacle avatar anthonyroux avatar cbetta avatar frankkoornstra avatar gabbor avatar gimperial avatar gustavo-bertoldi avatar jabrena avatar jpcanaverde avatar minjikarin avatar nirmalvp avatar siddydutta avatar spirosbatzio avatar sprokof avatar steve-donovan avatar torresc24 avatar tsolakoua avatar xianqiliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amadeus-java's Issues

Java string limit 64kb, longer than Trip Parser's input

Description

Tried to implemented support for Trip Parser #28. The string created for the POST can't be handled because it exceeds the 64kb limit and returns the error "constant string too long".

Steps to Reproduce

Switch to #59 and run the following code by replacing the base64string with the actual base64 from the swagger.
String body = "{\"data\":{\"type\":\"trip-parser-job\",\"content\":\"base64string\"}}"; TripParser tripParser = amadeus.travel.tripParserJobs.post(body);

Expected Behavior: Starts parsing job

Actual Behavior: constant string too long

Issue

Description

[Describe the issue]
I have integrated the hotel search API successfully to my website but I keep getting 1 image per hotel, how can I get more images per hotel?

Steps to Reproduce

  1. [First step]
  2. [Second step]
  3. [and so on...]

Expected Behavior: [What you expect to happen]

Actual Behavior: [What actually happens]

Stable Behavior? [What percentage of the time does it reproduce?]

Versions

[What version of Java/JVM are you running? What Operating System are you on?]

Checklist

Please make sure you checked the following:

  • Did you download the latest version of this library?

Example in README for Flight Create Orders is wrong

// Flight Create Orders to book a flight
// Using a JSonObject or String
FlightOrder createdOrder = amadeus.booking.flightOrders.pricing.post(body);

This is not the way to call create orders, I think it should be FlightOrder order = amadeus.booking.flightOrders.post(body)

Null Object Reference

Attempt to invoke virtual method 'java.lang.String com.google.gson.JsonElement.getAsString()' on a null object reference

The above error occurs when I call the Locations endpoint via this library. Below is the complete stacktrace:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.gson.JsonElement.getAsString()' on a null object reference
at com.amadeus.Response.detectError(Response.java:69)
at com.amadeus.HTTPClient.execute(HTTPClient.java:223)
at com.amadeus.HTTPClient.unauthenticatedRequest(HTTPClient.java:117)
at com.amadeus.HTTPClient.request(HTTPClient.java:202)
at com.amadeus.HTTPClient.get(HTTPClient.java:66)
at com.amadeus.referenceData.Locations.get(Locations.java:67)

Below, is how I am implementing the call:

**//Initialize using parameters
new Thread(new Runnable() {
@OverRide
public void run() {
Amadeus amadeus = Amadeus
.builder(Constants.AMADEUS_CLIENT_ID, Constants.AMADEUS_SECRET_KEY)
.build();

            try{
                Location[] locations = amadeus.referenceData.locations.get(Params
                        .with("keyword", "LON")
                        .and("subType", Locations.ANY));

                // The raw response, as a string
                locations[0].getResponse().getBody();
                Log.e("amadeus::", locations[0].getResponse().getBody());
            }catch (ResponseException ex){
                Log.e("amadeus::", ex.getResponse().toString());
            }
        }
    }).start();**

safetyRatedLocations does not return any safetyRatings

safetyRatings is always null in the results (these lat,lng returns results in the sandbox):

Amadeus amadeus = Amadeus.builder("[hidden]", "[hidden]").build(); try { SafePlace[] safetyScore = amadeus.safety.safetyRatedLocations .get(Params.with("latitude", 51.50735).and("longitude", -0.12775)); System.out.println(); } catch (ResponseException e) { e.printStackTrace(); }

using

com.amadeus
amadeus-java
5.3.0

Flight Offers Price expecting String in Price fields not double !

Description

Based on the API Reference of Flight Offers Price :

image

The Price values (including base, total and grandTotal) expecting String in JSON request while the SearchPrice class in the SDK defined these variables as double :

image

So calling the method by passing the FlightOfferSearch as parameter like this :

FlightPrice flightPrice = amadeus.shopping.flightOffersSearch.pricing.post(flightOfferSearch)

would cause generating the below request :

Request(verb=POST, scheme=https, host=test.api.amadeus.com, path=/v1/shopping/flight-offers/pricing, params=null, body={"data":{"type":"flight-offers-pricing","flightOffers":[{"type":"flight-offer","id":"3","source":"GDS","instantTicketingRequired":false,"nonHomogeneous":false,"oneWay":false,"lastTicketingDate":"2021-11-29","numberOfBookableSeats":4,"itineraries":[{"duration":"PT2H15M","segments":[{"departure":{"iataCode":"IKA","at":"2021-11-30T15:10:00"},"arrival":{"iataCode":"DXB","terminal":"3","at":"2021-11-30T17:55:00"},"carrierCode":"FZ","number":"1928","aircraft":{"code":"7M9"},"duration":"PT2H15M","id":"29","numberOfStops":0,"blacklistedInEU":false}]},{"duration":"PT2H20M","segments":[{"departure":{"iataCode":"DXB","terminal":"3","at":"2021-12-07T12:20:00"},"arrival":{"iataCode":"IKA","at":"2021-12-07T14:10:00"},"carrierCode":"FZ","number":"1927","aircraft":{"code":"7M9"},"duration":"PT2H20M","id":"100","numberOfStops":0,"blacklistedInEU":false}]}],"price":{"currency":"IRR","total":9.4406E7,"base":7.924E7,"fees":[{"amount":0.0,"type":"SUPPLIER"},{"amount":0.0,"type":"TICKETING"}],"grandTotal":9.4406E7},"pricingOptions":{"includedCheckedBagsOnly":true,"fareType":["PUBLISHED"],"refundableFare":false,"noRestrictionFare":false,"noPenaltyFare":false},"validatingAirlineCodes":["FZ"],"travelerPricings":[{"travelerId":"1","fareOption":"STANDARD","travelerType":"ADULT","price":{"currency":"IRR","total":9.4406E7,"base":7.924E7,"grandTotal":0.0},"fareDetailsBySegment":[{"segmentId":"29","cabin":"ECONOMY","fareBasis":"TRL7IR1","class":"T","includedCheckedBags":{"weight":30,"weightUnit":"KG"}},{"segmentId":"100","cabin":"ECONOMY","fareBasis":"TRL7IR1","class":"T","includedCheckedBags":{"weight":30,"weightUnit":"KG"}}]}]}]}}, bearerToken=Bearer xxxxxxxxxxxxxxxxxxxxxxxx, clientVersion=5.8.0, languageVersion=1.8.0_162, appId=null, appVersion=null, ssl=true, port=443, headers={Authorization=Bearer xxxxxxxxxxxxxxxxxxxxxxxxx, Accept=application/json, application/vnd.amadeus+json, User-Agent=amadeus-java/5.8.0 java/1.8.0_162, Content-Type=application/vnd.amadeus+json}, uri=https://test.api.amadeus.com:443/v1/shopping/flight-offers/pricing?, connection=null)

and the result would be like this :

{ "errors": [ { "code": 477, "title": "INVALID FORMAT", "detail": "This attribute should be a number", "source": { "pointer": "/data/flightOffers[0]/price/grandTotal" }, "status": 400 }, { "code": 477, "title": "INVALID FORMAT", "detail": "This attribute should be a number", "source": { "pointer": "/data/flightOffers[0]/price/total" }, "status": 400 }, { "code": 477, "title": "INVALID FORMAT", "detail": "This attribute should be a number", "source": { "pointer": "/data/flightOffers[0]/price/base" }, "status": 400 }, { "code": 477, "title": "INVALID FORMAT", "detail": "This attribute should be a number", "source": { "pointer": "/data/flightOffers[0]/travelerPricings[0]/price/total" }, "status": 400 }, { "code": 477, "title": "INVALID FORMAT", "detail": "This attribute should be a number", "source": { "pointer": "/data/flightOffers[0]/travelerPricings[0]/price/base" }, "status": 400 } ] }

It seems that GSON is serializing the double values without double quotes and this is causing INVALID FORMAT error from the server side.
Any suggestion ?

_Hamid

Nullpointer in HTTPClient class

Description

If you call the Amadeus next-function without a response object which contains a meta-element (which is usually the case after you retrieved the last bunch of data) a Nullpointer is raised.

java.lang.NullPointerException: null
at com.amadeus.resources.Resource.fromArray(Resource.java:31) ~[amadeus-java-5.0.0.jar!/:5.0.0]
at com.amadeus.HTTPClient.page(HTTPClient.java:445) ~[amadeus-java-5.0.0.jar!/:5.0.0]
at com.amadeus.HTTPClient.next(HTTPClient.java:293) ~[amadeus-java-5.0.0.jar!/:5.0.0]

Seems to be that this line in HTTPClient is the problem. Because then in here HTTPClient the Nullpointer is raised.

Steps to Reproduce

  1. Call amadeus.shopping.hotelOffers.get() with limit
  2. Call amadeus.next function in a loop
  3. after you got the last result you will not get any meta-json-element in the response-result object which produces in the following amadeus-next call a nullpointer.

Expected Behavior: No NullPointer. :-)
Would expect that the result of amadeus.next is null in this case. Or maybe better return a List instead of an array and use Collections.emptyList();

Actual Behavior: Nullpointer

Stable Behavior? No. 100% chance to hit it if you load the full data which is a common case.

Versions

OpenJDK / Docker Linux

Checklist

Please make sure you checked the following:

  • Did you download the latest version of this library? yes

Bug in Android

Description

When I try to use the library in Android App. I have noticed that it always send POST request instead of GET request.
The reason is under com.amadeus/Request.java you have
protected void establishConnection() throws IOException {
this.connection = (HttpURLConnection) new URL(uri).openConnection();
connection.setRequestMethod(verb);
connection.setDoInput(true);
connection.setDoOutput(true);

So no matter setRequestMethod is, when setDoOutput=true, it always POST

According to https://developer.android.com/reference/java/net/HttpURLConnection
HTTP Methods
HttpURLConnection uses the GET method by default. It will use POST if setDoOutput(true) has been called. Other HTTP methods (OPTIONS, HEAD, PUT, DELETE and TRACE) can be used with setRequestMethod(String).

Suggestion fix:
connection.setDoOuput(true) only when the verb is POST

String handling

Strings can be handled more properly, Example
if (verb == "GET" && params != null) ## Request.java line 147

"GET" can be put in Constants file and re-used everywhere.

Steps to Reproduce

  1. Make Constants.java
  2. Replace all Strings

That will improve performance

NullPointerException when getting error description

Description

java.lang.NullPointerException: null
	at com.amadeus.exceptions.ResponseException.getErrorsDescription(ResponseException.java:93)
	at com.amadeus.exceptions.ResponseException.determineLongDescription(ResponseException.java:66)
	at com.amadeus.exceptions.ResponseException.determineDescription(ResponseException.java:45)
	at com.amadeus.exceptions.ResponseException.<init>(ResponseException.java:22)
	at com.amadeus.exceptions.ClientException.<init>(ClientException.java:14)
	at com.amadeus.Response.detectError(Response.java:77)
	at com.amadeus.HTTPClient.execute(HTTPClient.java:361)
	at com.amadeus.HTTPClient.unauthenticatedRequest(HTTPClient.java:253)
	at com.amadeus.HTTPClient.request(HTTPClient.java:339)
	at com.amadeus.HTTPClient.get(HTTPClient.java:67)
	at com.amadeus.shopping.HotelOffers.get(HotelOffers.java:50)

ResponseException.java:93

message.append(String.format("%s", json.get("detail").getAsString()));

I assume the problem is that there's no detail in the body?

Steps to Reproduce

Make a hotel offers request for the 12th of April 2021 in London, with a 150KM radius.

Or anything that results in an error without a detail key?

Expected Behavior: An exception with some information on what the error is.

Actual Behavior: A NullPointerException.

Stable Behavior? I'm not sure what actual error response is causing this - it seems a bit random from my perspective. I don't always get an error, even with the same request. I suppose I could try and make requests manually to dig a bit further, but that defeats the point of using the SDK.

Versions

kotlin("jvm") version "1.3.72"

Checklist

Please make sure you checked the following:

  • Did you download the latest version of this library?
    Yes.

integrating soap Enterprise API

Description

I am trying to integrate Amadeus SOAP enterprise web services using Java. How to call and make headers 4.0 and requests in Java?
Any prerequisite jar provided to create header and to call services?

How to add an OSI remark for Emirate Airline

Hello we need to update our pnrs with

"OSI EK DFNT"

so we can confirm the booking with emirate,
can you please tell us how to add the OSI please ?

Thanks for your help
Kind regards
Nicolas

SOAP Amadeus APISin Java

Description

[Describe the issue]

Steps to Reproduce

  1. [First step]
  2. [Second step]
  3. [and so on...]

Expected Behavior: [What you expect to happen]

Actual Behavior: [What actually happens]

Stable Behavior? [What percentage of the time does it reproduce?]

Versions

[What version of Java/JVM are you running? What Operating System are you on?]

Checklist

Please make sure you checked the following:

  • Did you download the latest version of this library?

Network Exception Android API 19

Not sure what's causing this but when I make an API call it gives me a network exception error. This only happens on my API 19 android device. Otherwise it works fine on my API 27 emulator + API 28 real device.

com.amadeus.exceptions.NetworkException: [---]

Fix unwanted exception on Delete Flight Order Management API

The Flight Orders Management API returns en empty body with status code 204 when an order is deleted successfully. The SDK doesn't handle this use case properly; it throws a ParserException as the API does not return a FlightOrder object, instead returns the empty response with code 204.

How to reproduce

import com.amadeus.Amadeus;
import com.amadeus.booking.FlightOrder;
import com.amadeus.exceptions.ResponseException;

public class FlightOrderManagement {
    public static void main(String[] args)  throws ResponseException {
      Amadeus amadeus = Amadeus
              .builder("client_key","client_secret")
              .build();
      com.amadeus.resources.FlightOrder order = amadeus.booking.flightOrder("eJzTd9cP8A8y8nIDAAtUAlk").delete();

      if (order.getResponse().getStatusCode() != 204) {
        System.out.println("Wrong status code: " + order.getResponse().getStatusCode());
        System.exit(-1);
      }

      System.out.println("deleted");
     }
}
Exception in thread "main" com.amadeus.exceptions.ParserException: [204]
        at com.amadeus.Response.detectError(Response.java:79)
        at com.amadeus.HTTPClient.execute(HTTPClient.java:361)
        at com.amadeus.HTTPClient.unauthenticatedRequest(HTTPClient.java:253)
        at com.amadeus.HTTPClient.request(HTTPClient.java:339)
        at com.amadeus.HTTPClient.delete(HTTPClient.java:94)
        at com.amadeus.booking.FlightOrder.delete(FlightOrder.java:85)
        at com.amadeus.booking.FlightOrder.delete(FlightOrder.java:95)
        at flightsearch.FlightSearch.main(FlightSearch.java:17)

Remove the duplicate version

Description

We are managing the version at 2 different places:
1 in the Amadeus constant file
1 in the gradle file

It's painful when releasing a new version to update both (+ the unit test)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.