Skip to content

Commit

Permalink
Merge pull request #17 from hopper/add-cfar-itinerary-pricing
Browse files Browse the repository at this point in the history
Add cfar itinerary pricing collection
  • Loading branch information
jpinetHCAP authored May 2, 2024
2 parents 0a2abe4 + 7cfc036 commit 9ee6718
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
package com.hopper.cloud.airlines.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.hopper.cloud.airlines.JSON;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class CfarItineraryPricing {
public static final String SERIALIZED_NAME_PASSENGER_PRICING = "passenger_pricing";
@SerializedName(SERIALIZED_NAME_PASSENGER_PRICING)
private List<PassengerPricing> passengerPricing = new ArrayList<>();

public static final String SERIALIZED_NAME_ANCILLARIES = "ancillaries";
@SerializedName(SERIALIZED_NAME_ANCILLARIES)
private List<Ancillary> ancillaries = null;

public static final String SERIALIZED_NAME_PASSENGERS = "passengers";
@SerializedName(SERIALIZED_NAME_PASSENGERS)
private List<CfarPassenger> passengers = null;

public CfarItineraryPricing() {
}

/**
* List of pricing per passenger for a fare
*
* @return passengerPricing
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "List of pricing per passenger for a fare")

public List<PassengerPricing> getPassengerPricing() {
return passengerPricing;
}


public void setPassengerPricing(List<PassengerPricing> passengerPricing) {
this.passengerPricing = passengerPricing;
}

public CfarItineraryPricing passengerPricing(List<PassengerPricing> passengerPricing) {

this.passengerPricing = passengerPricing;
return this;
}

public CfarItineraryPricing addPassengerPricingItem(PassengerPricing passengerPricingItem) {
this.passengerPricing.add(passengerPricingItem);
return this;
}


/**
* Ancillaries attached to a fare and their prices
*
* @return ancillaries
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Ancillaries attached to a fare and their prices")
public List<Ancillary> getAncillaries() {
return ancillaries;
}

public void setAncillaries(List<Ancillary> ancillaries) {
this.ancillaries = ancillaries;
}

public CfarItineraryPricing ancillaries(List<Ancillary> ancillaries) {

this.ancillaries = ancillaries;
return this;
}

public CfarItineraryPricing addAncillariesItem(Ancillary ancillariesItem) {
if (this.ancillaries == null) {
this.ancillaries = new ArrayList<>();
}
this.ancillaries.add(ancillariesItem);
return this;
}

public CfarItineraryPricing passengers(List<CfarPassenger> passengers) {
this.passengers = passengers;
return this;
}

public CfarItineraryPricing addPassengersItem(CfarPassenger passengerItem) {
if (this.passengers == null) {
this.passengers = new ArrayList<>();
}
this.passengers.add(passengerItem);
return this;
}

/**
* Retrieve Passengers
* @return passengers
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Passengers associated with the itinerary")

public List<CfarPassenger> getPassengers() {
return passengers;
}

public void setPassengers(List<CfarPassenger> passengers) {
this.passengers = passengers;
}


@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CfarItineraryPricing cfarItineraryPricing = (CfarItineraryPricing) o;
return Objects.equals(this.passengerPricing, cfarItineraryPricing.passengerPricing) &&
Objects.equals(this.passengers, cfarItineraryPricing.passengers) &&
Objects.equals(this.ancillaries, cfarItineraryPricing.ancillaries);
}

@Override
public int hashCode() {
return Objects.hash(passengerPricing, passengers, ancillaries);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CfarItineraryPricing {\n");
sb.append(" passengerPricing: ").append(toIndentedString(passengerPricing)).append("\n");
sb.append(" passengers: ").append(toIndentedString(passengers)).append("\n");
sb.append(" ancillaries: ").append(toIndentedString(ancillaries)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!CfarItineraryPricing.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'CfarItineraryPricing' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<CfarItineraryPricing> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(CfarItineraryPricing.class));

return (TypeAdapter<T>) new TypeAdapter<CfarItineraryPricing>() {
@Override
public void write(JsonWriter out, CfarItineraryPricing value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}

@Override
public CfarItineraryPricing read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
return thisAdapter.fromJsonTree(jsonObj);
}

}.nullSafe();
}
}

/**
* Create an instance of CfarItineraryPricing given an JSON string
*
* @param jsonString JSON string
* @return An instance of CfarItineraryPricing
* @throws IOException if the JSON string is invalid with respect to CfarItineraryPricing
*/
public static CfarItineraryPricing fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, CfarItineraryPricing.class);
}

/**
* Convert an instance of CfarItineraryPricing to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.IOException;

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

public static final String SERIALIZED_NAME_ITINERARY_PRICING = "itinerary_pricing";
@SerializedName(SERIALIZED_NAME_ITINERARY_PRICING)
private CfarItineraryPricing itineraryPricing;

public UpdateCfarContractRequest() {
}

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

/**
* Get pnrReference
*
* @return pnrReference
**/
@javax.annotation.Nonnull
Expand All @@ -125,6 +131,7 @@ public UpdateCfarContractRequest emailAddress(String emailAddress) {

/**
* Get emailAddress
*
* @return emailAddress
**/
@javax.annotation.Nonnull
Expand All @@ -148,6 +155,7 @@ public UpdateCfarContractRequest status(CfarContractStatus status) {

/**
* Get status
*
* @return status
**/
@javax.annotation.Nonnull
Expand All @@ -164,6 +172,7 @@ public void setStatus(CfarContractStatus status) {

/**
* Phone number of the customer
*
* @return phoneNumber
**/
@ApiModelProperty(example = "12345678900", value = "Phone number of the customer")
Expand All @@ -182,6 +191,7 @@ public UpdateCfarContractRequest firstName(String firstName) {

/**
* First name of the cardholder
*
* @return firstName
**/
@ApiModelProperty(example = "John", value = "First name of the cardholder")
Expand All @@ -200,6 +210,7 @@ public UpdateCfarContractRequest lastName(String lastName) {

/**
* Last name of the cardholder
*
* @return lastName
**/
@ApiModelProperty(example = "Smith", value = "Last name of the cardholder")
Expand All @@ -218,6 +229,7 @@ public UpdateCfarContractRequest addressLine1(String addressLine1) {

/**
* Address of the cardholder (first line)
*
* @return addressLine1
**/
@ApiModelProperty(example = "123 12th St", value = "Address of the cardholder (first line)")
Expand All @@ -236,6 +248,7 @@ public UpdateCfarContractRequest addressLine2(String addressLine2) {

/**
* Address of the cardholder (second line)
*
* @return addressLine2
**/
@ApiModelProperty(example = "Building B", value = "Address of the cardholder (second line)")
Expand All @@ -254,6 +267,7 @@ public UpdateCfarContractRequest city(String city) {

/**
* City of the cardholder
*
* @return city
**/
@ApiModelProperty(example = "Quebec City", value = "City of the cardholder")
Expand All @@ -272,6 +286,7 @@ public UpdateCfarContractRequest stateOrProvince(String stateOrProvince) {

/**
* State or province of the cardholder
*
* @return stateOrProvince
**/
@ApiModelProperty(example = "QC", value = "State or province of the cardholder")
Expand All @@ -290,6 +305,7 @@ public UpdateCfarContractRequest postalCode(String postalCode) {

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

/**
* Country of the cardholder
*
* @return country
**/
@ApiModelProperty(example = "CA", value = "Country of the cardholder")
Expand Down Expand Up @@ -348,6 +365,19 @@ public void setTaxes(List<CfarTax> taxes) {
this.taxes = taxes;
}

public UpdateCfarContractRequest itineraryPricing(CfarItineraryPricing itineraryPricing) {
this.itineraryPricing = itineraryPricing;
return this;
}

public CfarItineraryPricing getItineraryPricing() {
return itineraryPricing;
}

public void setItineraryPricing(CfarItineraryPricing itineraryPricing) {
this.itineraryPricing = itineraryPricing;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -370,12 +400,13 @@ public boolean equals(Object o) {
Objects.equals(this.postalCode, updateCfarContractRequest.postalCode) &&
Objects.equals(this.country, updateCfarContractRequest.country) &&
Objects.equals(this.taxesTotal, updateCfarContractRequest.taxesTotal) &&
Objects.equals(this.taxes, updateCfarContractRequest.taxes);
Objects.equals(this.taxes, updateCfarContractRequest.taxes) &&
Objects.equals(this.itineraryPricing, updateCfarContractRequest.itineraryPricing);
}

@Override
public int hashCode() {
return Objects.hash(status, pnrReference, emailAddress, phoneNumber, firstName, lastName, addressLine1, addressLine2, city, stateOrProvince, postalCode, country, taxesTotal, taxes);
return Objects.hash(status, pnrReference, emailAddress, phoneNumber, firstName, lastName, addressLine1, addressLine2, city, stateOrProvince, postalCode, country, taxesTotal, taxes, itineraryPricing);
}

@Override
Expand All @@ -397,6 +428,7 @@ public String toString() {
sb.append(" country: ").append(toIndentedString(country)).append("\n");
sb.append(" taxesTotal: ").append(toIndentedString(taxesTotal)).append("\n");
sb.append(" taxes: ").append(toIndentedString(taxes)).append("\n");
sb.append(" itineraryPricing: ").append(toIndentedString(itineraryPricing)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down

0 comments on commit 9ee6718

Please sign in to comment.