Skip to content

Commit 9ee6718

Browse files
authored
Merge pull request #17 from hopper/add-cfar-itinerary-pricing
Add cfar itinerary pricing collection
2 parents 0a2abe4 + 7cfc036 commit 9ee6718

File tree

2 files changed

+246
-3
lines changed

2 files changed

+246
-3
lines changed
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
package com.hopper.cloud.airlines.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.google.gson.*;
5+
import com.google.gson.annotations.SerializedName;
6+
import com.google.gson.reflect.TypeToken;
7+
import com.google.gson.stream.JsonReader;
8+
import com.google.gson.stream.JsonWriter;
9+
import com.hopper.cloud.airlines.JSON;
10+
import io.swagger.annotations.ApiModel;
11+
import io.swagger.annotations.ApiModelProperty;
12+
13+
import java.io.IOException;
14+
import java.util.ArrayList;
15+
import java.util.List;
16+
import java.util.Objects;
17+
18+
@JsonInclude(JsonInclude.Include.NON_NULL)
19+
public class CfarItineraryPricing {
20+
public static final String SERIALIZED_NAME_PASSENGER_PRICING = "passenger_pricing";
21+
@SerializedName(SERIALIZED_NAME_PASSENGER_PRICING)
22+
private List<PassengerPricing> passengerPricing = new ArrayList<>();
23+
24+
public static final String SERIALIZED_NAME_ANCILLARIES = "ancillaries";
25+
@SerializedName(SERIALIZED_NAME_ANCILLARIES)
26+
private List<Ancillary> ancillaries = null;
27+
28+
public static final String SERIALIZED_NAME_PASSENGERS = "passengers";
29+
@SerializedName(SERIALIZED_NAME_PASSENGERS)
30+
private List<CfarPassenger> passengers = null;
31+
32+
public CfarItineraryPricing() {
33+
}
34+
35+
/**
36+
* List of pricing per passenger for a fare
37+
*
38+
* @return passengerPricing
39+
**/
40+
@javax.annotation.Nonnull
41+
@ApiModelProperty(required = true, value = "List of pricing per passenger for a fare")
42+
43+
public List<PassengerPricing> getPassengerPricing() {
44+
return passengerPricing;
45+
}
46+
47+
48+
public void setPassengerPricing(List<PassengerPricing> passengerPricing) {
49+
this.passengerPricing = passengerPricing;
50+
}
51+
52+
public CfarItineraryPricing passengerPricing(List<PassengerPricing> passengerPricing) {
53+
54+
this.passengerPricing = passengerPricing;
55+
return this;
56+
}
57+
58+
public CfarItineraryPricing addPassengerPricingItem(PassengerPricing passengerPricingItem) {
59+
this.passengerPricing.add(passengerPricingItem);
60+
return this;
61+
}
62+
63+
64+
/**
65+
* Ancillaries attached to a fare and their prices
66+
*
67+
* @return ancillaries
68+
**/
69+
@javax.annotation.Nullable
70+
@ApiModelProperty(value = "Ancillaries attached to a fare and their prices")
71+
public List<Ancillary> getAncillaries() {
72+
return ancillaries;
73+
}
74+
75+
public void setAncillaries(List<Ancillary> ancillaries) {
76+
this.ancillaries = ancillaries;
77+
}
78+
79+
public CfarItineraryPricing ancillaries(List<Ancillary> ancillaries) {
80+
81+
this.ancillaries = ancillaries;
82+
return this;
83+
}
84+
85+
public CfarItineraryPricing addAncillariesItem(Ancillary ancillariesItem) {
86+
if (this.ancillaries == null) {
87+
this.ancillaries = new ArrayList<>();
88+
}
89+
this.ancillaries.add(ancillariesItem);
90+
return this;
91+
}
92+
93+
public CfarItineraryPricing passengers(List<CfarPassenger> passengers) {
94+
this.passengers = passengers;
95+
return this;
96+
}
97+
98+
public CfarItineraryPricing addPassengersItem(CfarPassenger passengerItem) {
99+
if (this.passengers == null) {
100+
this.passengers = new ArrayList<>();
101+
}
102+
this.passengers.add(passengerItem);
103+
return this;
104+
}
105+
106+
/**
107+
* Retrieve Passengers
108+
* @return passengers
109+
**/
110+
@javax.annotation.Nullable
111+
@ApiModelProperty(value = "Passengers associated with the itinerary")
112+
113+
public List<CfarPassenger> getPassengers() {
114+
return passengers;
115+
}
116+
117+
public void setPassengers(List<CfarPassenger> passengers) {
118+
this.passengers = passengers;
119+
}
120+
121+
122+
@Override
123+
public boolean equals(Object o) {
124+
if (this == o) {
125+
return true;
126+
}
127+
if (o == null || getClass() != o.getClass()) {
128+
return false;
129+
}
130+
CfarItineraryPricing cfarItineraryPricing = (CfarItineraryPricing) o;
131+
return Objects.equals(this.passengerPricing, cfarItineraryPricing.passengerPricing) &&
132+
Objects.equals(this.passengers, cfarItineraryPricing.passengers) &&
133+
Objects.equals(this.ancillaries, cfarItineraryPricing.ancillaries);
134+
}
135+
136+
@Override
137+
public int hashCode() {
138+
return Objects.hash(passengerPricing, passengers, ancillaries);
139+
}
140+
141+
@Override
142+
public String toString() {
143+
StringBuilder sb = new StringBuilder();
144+
sb.append("class CfarItineraryPricing {\n");
145+
sb.append(" passengerPricing: ").append(toIndentedString(passengerPricing)).append("\n");
146+
sb.append(" passengers: ").append(toIndentedString(passengers)).append("\n");
147+
sb.append(" ancillaries: ").append(toIndentedString(ancillaries)).append("\n");
148+
sb.append("}");
149+
return sb.toString();
150+
}
151+
152+
/**
153+
* Convert the given object to string with each line indented by 4 spaces
154+
* (except the first line).
155+
*/
156+
private String toIndentedString(Object o) {
157+
if (o == null) {
158+
return "null";
159+
}
160+
return o.toString().replace("\n", "\n ");
161+
}
162+
163+
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
164+
@SuppressWarnings("unchecked")
165+
@Override
166+
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
167+
if (!CfarItineraryPricing.class.isAssignableFrom(type.getRawType())) {
168+
return null; // this class only serializes 'CfarItineraryPricing' and its subtypes
169+
}
170+
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
171+
final TypeAdapter<CfarItineraryPricing> thisAdapter
172+
= gson.getDelegateAdapter(this, TypeToken.get(CfarItineraryPricing.class));
173+
174+
return (TypeAdapter<T>) new TypeAdapter<CfarItineraryPricing>() {
175+
@Override
176+
public void write(JsonWriter out, CfarItineraryPricing value) throws IOException {
177+
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
178+
elementAdapter.write(out, obj);
179+
}
180+
181+
@Override
182+
public CfarItineraryPricing read(JsonReader in) throws IOException {
183+
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
184+
return thisAdapter.fromJsonTree(jsonObj);
185+
}
186+
187+
}.nullSafe();
188+
}
189+
}
190+
191+
/**
192+
* Create an instance of CfarItineraryPricing given an JSON string
193+
*
194+
* @param jsonString JSON string
195+
* @return An instance of CfarItineraryPricing
196+
* @throws IOException if the JSON string is invalid with respect to CfarItineraryPricing
197+
*/
198+
public static CfarItineraryPricing fromJson(String jsonString) throws IOException {
199+
return JSON.getGson().fromJson(jsonString, CfarItineraryPricing.class);
200+
}
201+
202+
/**
203+
* Convert an instance of CfarItineraryPricing to an JSON string
204+
*
205+
* @return JSON string
206+
*/
207+
public String toJson() {
208+
return JSON.getGson().toJson(this);
209+
}
210+
}
211+

src/main/java/com/hopper/cloud/airlines/model/UpdateCfarContractRequest.java

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.google.gson.stream.JsonWriter;
2323
import io.swagger.annotations.ApiModel;
2424
import io.swagger.annotations.ApiModelProperty;
25+
2526
import java.io.IOException;
2627

2728
import com.google.gson.reflect.TypeToken;
@@ -33,7 +34,7 @@
3334
*/
3435
@ApiModel(description = "Update CFAR contract request")
3536
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-06-28T12:18:49.517876+02:00[Europe/Paris]")
36-
@JsonInclude(JsonInclude.Include. NON_NULL)
37+
@JsonInclude(JsonInclude.Include.NON_NULL)
3738
public class UpdateCfarContractRequest {
3839
public static final String SERIALIZED_NAME_PNR_REFERENCE = "pnr_reference";
3940
@SerializedName(SERIALIZED_NAME_PNR_REFERENCE)
@@ -91,6 +92,10 @@ public class UpdateCfarContractRequest {
9192
@SerializedName(SERIALIZED_NAME_TAXES)
9293
private List<CfarTax> taxes = new ArrayList<>();
9394

95+
public static final String SERIALIZED_NAME_ITINERARY_PRICING = "itinerary_pricing";
96+
@SerializedName(SERIALIZED_NAME_ITINERARY_PRICING)
97+
private CfarItineraryPricing itineraryPricing;
98+
9499
public UpdateCfarContractRequest() {
95100
}
96101

@@ -102,6 +107,7 @@ public UpdateCfarContractRequest pnrReference(String pnrReference) {
102107

103108
/**
104109
* Get pnrReference
110+
*
105111
* @return pnrReference
106112
**/
107113
@javax.annotation.Nonnull
@@ -125,6 +131,7 @@ public UpdateCfarContractRequest emailAddress(String emailAddress) {
125131

126132
/**
127133
* Get emailAddress
134+
*
128135
* @return emailAddress
129136
**/
130137
@javax.annotation.Nonnull
@@ -148,6 +155,7 @@ public UpdateCfarContractRequest status(CfarContractStatus status) {
148155

149156
/**
150157
* Get status
158+
*
151159
* @return status
152160
**/
153161
@javax.annotation.Nonnull
@@ -164,6 +172,7 @@ public void setStatus(CfarContractStatus status) {
164172

165173
/**
166174
* Phone number of the customer
175+
*
167176
* @return phoneNumber
168177
**/
169178
@ApiModelProperty(example = "12345678900", value = "Phone number of the customer")
@@ -182,6 +191,7 @@ public UpdateCfarContractRequest firstName(String firstName) {
182191

183192
/**
184193
* First name of the cardholder
194+
*
185195
* @return firstName
186196
**/
187197
@ApiModelProperty(example = "John", value = "First name of the cardholder")
@@ -200,6 +210,7 @@ public UpdateCfarContractRequest lastName(String lastName) {
200210

201211
/**
202212
* Last name of the cardholder
213+
*
203214
* @return lastName
204215
**/
205216
@ApiModelProperty(example = "Smith", value = "Last name of the cardholder")
@@ -218,6 +229,7 @@ public UpdateCfarContractRequest addressLine1(String addressLine1) {
218229

219230
/**
220231
* Address of the cardholder (first line)
232+
*
221233
* @return addressLine1
222234
**/
223235
@ApiModelProperty(example = "123 12th St", value = "Address of the cardholder (first line)")
@@ -236,6 +248,7 @@ public UpdateCfarContractRequest addressLine2(String addressLine2) {
236248

237249
/**
238250
* Address of the cardholder (second line)
251+
*
239252
* @return addressLine2
240253
**/
241254
@ApiModelProperty(example = "Building B", value = "Address of the cardholder (second line)")
@@ -254,6 +267,7 @@ public UpdateCfarContractRequest city(String city) {
254267

255268
/**
256269
* City of the cardholder
270+
*
257271
* @return city
258272
**/
259273
@ApiModelProperty(example = "Quebec City", value = "City of the cardholder")
@@ -272,6 +286,7 @@ public UpdateCfarContractRequest stateOrProvince(String stateOrProvince) {
272286

273287
/**
274288
* State or province of the cardholder
289+
*
275290
* @return stateOrProvince
276291
**/
277292
@ApiModelProperty(example = "QC", value = "State or province of the cardholder")
@@ -290,6 +305,7 @@ public UpdateCfarContractRequest postalCode(String postalCode) {
290305

291306
/**
292307
* Postal code of the cardholder
308+
*
293309
* @return postalCode
294310
**/
295311
@ApiModelProperty(example = "G1R 4S9", value = "Postal code of the cardholder")
@@ -308,6 +324,7 @@ public UpdateCfarContractRequest country(String country) {
308324

309325
/**
310326
* Country of the cardholder
327+
*
311328
* @return country
312329
**/
313330
@ApiModelProperty(example = "CA", value = "Country of the cardholder")
@@ -348,6 +365,19 @@ public void setTaxes(List<CfarTax> taxes) {
348365
this.taxes = taxes;
349366
}
350367

368+
public UpdateCfarContractRequest itineraryPricing(CfarItineraryPricing itineraryPricing) {
369+
this.itineraryPricing = itineraryPricing;
370+
return this;
371+
}
372+
373+
public CfarItineraryPricing getItineraryPricing() {
374+
return itineraryPricing;
375+
}
376+
377+
public void setItineraryPricing(CfarItineraryPricing itineraryPricing) {
378+
this.itineraryPricing = itineraryPricing;
379+
}
380+
351381
@Override
352382
public boolean equals(Object o) {
353383
if (this == o) {
@@ -370,12 +400,13 @@ public boolean equals(Object o) {
370400
Objects.equals(this.postalCode, updateCfarContractRequest.postalCode) &&
371401
Objects.equals(this.country, updateCfarContractRequest.country) &&
372402
Objects.equals(this.taxesTotal, updateCfarContractRequest.taxesTotal) &&
373-
Objects.equals(this.taxes, updateCfarContractRequest.taxes);
403+
Objects.equals(this.taxes, updateCfarContractRequest.taxes) &&
404+
Objects.equals(this.itineraryPricing, updateCfarContractRequest.itineraryPricing);
374405
}
375406

376407
@Override
377408
public int hashCode() {
378-
return Objects.hash(status, pnrReference, emailAddress, phoneNumber, firstName, lastName, addressLine1, addressLine2, city, stateOrProvince, postalCode, country, taxesTotal, taxes);
409+
return Objects.hash(status, pnrReference, emailAddress, phoneNumber, firstName, lastName, addressLine1, addressLine2, city, stateOrProvince, postalCode, country, taxesTotal, taxes, itineraryPricing);
379410
}
380411

381412
@Override
@@ -397,6 +428,7 @@ public String toString() {
397428
sb.append(" country: ").append(toIndentedString(country)).append("\n");
398429
sb.append(" taxesTotal: ").append(toIndentedString(taxesTotal)).append("\n");
399430
sb.append(" taxes: ").append(toIndentedString(taxes)).append("\n");
431+
sb.append(" itineraryPricing: ").append(toIndentedString(itineraryPricing)).append("\n");
400432
sb.append("}");
401433
return sb.toString();
402434
}

0 commit comments

Comments
 (0)