Skip to content

Commit 5a02bc5

Browse files
committed
1: add transfer orders IT, 2: fix transfer orders model, 3: update wording
1 parent b0084ca commit 5a02bc5

31 files changed

+123
-32
lines changed

src/main/java/com/amadeus/Ordering.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class Ordering {
2828
* <code>/v1/ordering/transfer-orders</code> endpoints.
2929
* </p>
3030
*/
31-
public TransferOrders tranferOrders;
31+
public TransferOrders transferOrders;
3232

3333
/**
3434
* <p>
@@ -45,7 +45,7 @@ public TransferOrder transferOrder(String orderId) {
4545
* @hide
4646
*/
4747
public Ordering(Amadeus client) {
48-
this.tranferOrders = new TransferOrders(client);
48+
this.transferOrders = new TransferOrders(client);
4949
this.client = client;
5050
}
5151
}

src/main/java/com/amadeus/referenceData/locations/pointsOfInterest/BySquare.java

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.amadeus.exceptions.ResponseException;
77
import com.amadeus.resources.PointOfInterest;
88
import com.amadeus.resources.Resource;
9-
import com.google.gson.Gson;
109

1110
/**
1211
* <p>

src/main/java/com/amadeus/resources/TransferOffersPost.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected Quotation() {}
133133

134134
@ToString
135135
public class PartnerInfo {
136-
private @Getter String serviceProvider;
136+
private @Getter ServiceProvider serviceProvider;
137137

138138
protected PartnerInfo() {}
139139

src/main/java/com/amadeus/resources/TransferOrder.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class TransferReservation {
3636
private @Getter TransferOffersPost.Vehicle vehicle;
3737
private @Getter TransferOffersPost.ServiceProvider serviceProvider;
3838
private @Getter TransferOffersPost.PartnerInfo partnerInfo;
39+
3940
private @Getter TransferOffersPost.Quotation quotation;
4041
private @Getter TransferOffersPost.Quotation converted;
4142
private @Getter TransferOffersPost.ExtraService[] extraServices;
@@ -77,7 +78,7 @@ protected Contact() {}
7778

7879
@ToString
7980
public class Agency {
80-
private @Getter Email contacts;
81+
private @Getter Email[] contacts;
8182

8283
protected Agency() {}
8384

src/test/java/com/amadeus/HTTPClientThreadSafeIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void setup() {
3939
wireMockServer = new WireMockServer(8080);
4040
wireMockServer.start();
4141

42-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
42+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
4343
String address = "/v1/security/oauth2/token"
4444
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
4545
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/NamespaceTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public class NamespaceTest {
114114
assertNotNull(client.referenceData.locations.hotels.byGeocode);
115115
assertNotNull(client.referenceData.locations.cities);
116116
assertNotNull(client.airline.destinations);
117-
assertNotNull(client.ordering.tranferOrders);
117+
assertNotNull(client.ordering.transferOrders);
118118
assertNotNull(client.ordering.transferOrder("XXX"));
119119
}
120120

src/test/java/com/amadeus/airline/DestinationsIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setup() {
3333
wireMockServer = new WireMockServer(8080);
3434
wireMockServer.start();
3535

36-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
36+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3737
String address = "/v1/security/oauth2/token"
3838
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3939
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/booking/FlightOrdersIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void setup() {
4141
wireMockServer = new WireMockServer(8080);
4242
wireMockServer.start();
4343

44-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
44+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
4545
String address = "/v1/security/oauth2/token"
4646
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
4747
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/dutyOfCare/diseases/Covid19ReportIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void setup() {
3232
wireMockServer = new WireMockServer(8080);
3333
wireMockServer.start();
3434

35-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
35+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3636
String address = "/v1/security/oauth2/token"
3737
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3838
wireMockServer.stubFor(post(urlEqualTo(address))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package com.amadeus.ordering;
2+
3+
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
4+
import static com.github.tomakehurst.wiremock.client.WireMock.post;
5+
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
6+
import static org.junit.jupiter.api.Assertions.assertNotNull;
7+
8+
import com.amadeus.Amadeus;
9+
import com.amadeus.Params;
10+
import com.amadeus.exceptions.ResponseException;
11+
import com.amadeus.resources.TransferOrder;
12+
import com.github.tomakehurst.wiremock.WireMockServer;
13+
import com.google.gson.JsonObject;
14+
import com.google.gson.JsonParser;
15+
import java.io.File;
16+
import java.io.IOException;
17+
import java.nio.file.Files;
18+
import org.junit.jupiter.api.AfterEach;
19+
import org.junit.jupiter.api.BeforeEach;
20+
import org.junit.jupiter.api.Test;
21+
22+
// https://developers.amadeus.com/self-service/category/cars-and-transfers/api-doc/transfer-booking
23+
public class TransferOrdersIT {
24+
25+
WireMockServer wireMockServer;
26+
27+
private Amadeus amadeus;
28+
29+
/**
30+
* Authentication is conducted for each test.
31+
*/
32+
@BeforeEach
33+
public void setup() {
34+
wireMockServer = new WireMockServer(8080);
35+
wireMockServer.start();
36+
37+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
38+
String address = "/v1/security/oauth2/token"
39+
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
40+
wireMockServer.stubFor(post(urlEqualTo(address))
41+
.willReturn(aResponse().withHeader("Content-Type", "application/json")
42+
.withStatus(200)
43+
.withBodyFile("auth_ok.json")));
44+
45+
amadeus = Amadeus
46+
.builder("DEMO", "DEMO")
47+
.setHost("localhost")
48+
.setPort(8080)
49+
.setSsl(false)
50+
.setLogLevel("debug")
51+
.build();
52+
}
53+
54+
@AfterEach
55+
public void teardown() {
56+
wireMockServer.stop();
57+
}
58+
59+
@Test
60+
public void givenClientWhenCallTransferOrdersWithParamsThenOK()
61+
throws ResponseException, IOException {
62+
63+
//Given
64+
String address = "/v1/ordering/transfer-orders" + "?offerId=123456";
65+
wireMockServer.stubFor(post(urlEqualTo(address))
66+
.willReturn(aResponse().withHeader("Content-Type", "application/json")
67+
.withStatus(200)
68+
.withBodyFile("transfer_orders_response_ok.json")));
69+
70+
JsonObject request = getRequestFromResources("transfer_orders_request_ok.json");
71+
Params params = Params.with("offerId", "123456");
72+
73+
//When
74+
TransferOrder result = amadeus.ordering.transferOrders.post(request, params);
75+
76+
//Then
77+
assertNotNull(result);
78+
}
79+
80+
private JsonObject getRequestFromResources(String jsonFile) throws IOException {
81+
82+
final String folder = "__files/";
83+
84+
ClassLoader classLoader = getClass().getClassLoader();
85+
File file = new File(classLoader.getResource(folder + jsonFile).getFile());
86+
String jsonString = new String(Files.readAllBytes(file.toPath()));
87+
88+
return new JsonParser().parse(jsonString).getAsJsonObject();
89+
}
90+
91+
}

src/test/java/com/amadeus/referenceData/locations/CitiesIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void setup() {
3232
wireMockServer = new WireMockServer(8080);
3333
wireMockServer.start();
3434

35-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
35+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3636
String address = "/v1/security/oauth2/token"
3737
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3838
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/referenceData/locations/HotelIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void setup() {
3939
wireMockServer = new WireMockServer(8080);
4040
wireMockServer.start();
4141

42-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
42+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
4343
String address = "/v1/security/oauth2/token"
4444
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
4545
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/referenceData/locations/PointOfInterestIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void setup() {
2929
wireMockServer = new WireMockServer(8080);
3030
wireMockServer.start();
3131

32-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
32+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3333
String address = "/v1/security/oauth2/token"
3434
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3535
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/referenceData/locations/hotels/ByCityIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void setup() {
3232
wireMockServer = new WireMockServer(8080);
3333
wireMockServer.start();
3434

35-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
35+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3636
String address = "/v1/security/oauth2/token"
3737
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3838
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/referenceData/locations/hotels/ByGeocodeIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void setup() {
3232
wireMockServer = new WireMockServer(8080);
3333
wireMockServer.start();
3434

35-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
35+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3636
String address = "/v1/security/oauth2/token"
3737
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3838
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/referenceData/locations/hotels/ByHotelsIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void setup() {
3232
wireMockServer = new WireMockServer(8080);
3333
wireMockServer.start();
3434

35-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
35+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3636
String address = "/v1/security/oauth2/token"
3737
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3838
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/referenceData/locations/pointsOfInterest/BySquareIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setup() {
3333
wireMockServer = new WireMockServer(8080);
3434
wireMockServer.start();
3535

36-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
36+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3737
String address = "/v1/security/oauth2/token"
3838
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3939
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/safety/SafetyIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void setup() {
3232
wireMockServer = new WireMockServer(8080);
3333
wireMockServer.start();
3434

35-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
35+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3636
String address = "/v1/security/oauth2/token"
3737
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3838
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/ActivityIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void setup() {
3030
wireMockServer = new WireMockServer(8080);
3131
wireMockServer.start();
3232

33-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
33+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3434
String address = "/v1/security/oauth2/token"
3535
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3636
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/FlightOfferSearchIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void setup() {
3737
wireMockServer = new WireMockServer(8080);
3838
wireMockServer.start();
3939

40-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
40+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
4141
String address = "/v1/security/oauth2/token"
4242
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
4343
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/HotelOfferSearchIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void setup() {
3232
wireMockServer = new WireMockServer(8080);
3333
wireMockServer.start();
3434

35-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
35+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3636
String address = "/v1/security/oauth2/token"
3737
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3838
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/HotelOffersSearchIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void setup() {
3232
wireMockServer = new WireMockServer(8080);
3333
wireMockServer.start();
3434

35-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
35+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3636
String address = "/v1/security/oauth2/token"
3737
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3838
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/SeatMapsIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void setup() {
3737
wireMockServer = new WireMockServer(8080);
3838
wireMockServer.start();
3939

40-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
40+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
4141
String address = "/v1/security/oauth2/token"
4242
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
4343
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/TransferOffersIT.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.amadeus.shopping.availability;
1+
package com.amadeus.shopping;
22

33
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
44
import static com.github.tomakehurst.wiremock.client.WireMock.post;
@@ -33,7 +33,7 @@ public void setup() {
3333
wireMockServer = new WireMockServer(8080);
3434
wireMockServer.start();
3535

36-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
36+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3737
String address = "/v1/security/oauth2/token"
3838
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3939
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/activities/BySquareIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setup() {
3333
wireMockServer = new WireMockServer(8080);
3434
wireMockServer.start();
3535

36-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
36+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3737
String address = "/v1/security/oauth2/token"
3838
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3939
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/availability/FlightAvailabilitiesIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setup() {
3333
wireMockServer = new WireMockServer(8080);
3434
wireMockServer.start();
3535

36-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
36+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3737
String address = "/v1/security/oauth2/token"
3838
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3939
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/flightOffers/PredictionIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void setup() {
3434
wireMockServer = new WireMockServer(8080);
3535
wireMockServer.start();
3636

37-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
37+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3838
String address = "/v1/security/oauth2/token"
3939
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
4040
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/flightOffers/PricingIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void setup() {
3838
wireMockServer = new WireMockServer(8080);
3939
wireMockServer.start();
4040

41-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
41+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
4242
String address = "/v1/security/oauth2/token"
4343
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
4444
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/shopping/flightOffers/UpsellingIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setup() {
3333
wireMockServer = new WireMockServer(8080);
3434
wireMockServer.start();
3535

36-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
36+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3737
String address = "/v1/security/oauth2/token"
3838
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3939
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/travel/TripParserIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void setup() {
3333
wireMockServer = new WireMockServer(8080);
3434
wireMockServer.start();
3535

36-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
36+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3737
String address = "/v1/security/oauth2/token"
3838
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3939
wireMockServer.stubFor(post(urlEqualTo(address))

src/test/java/com/amadeus/travel/TripPurposeIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void setup() {
3030
wireMockServer = new WireMockServer(8080);
3131
wireMockServer.start();
3232

33-
//https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
33+
// https://developers.amadeus.com/self-service/apis-docs/guides/authorization-262
3434
String address = "/v1/security/oauth2/token"
3535
+ "?grant_type=client_credentials&client_secret=DEMO&client_id=DEMO";
3636
wireMockServer.stubFor(post(urlEqualTo(address))

0 commit comments

Comments
 (0)