Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Replace LocalDateTime With ZonedDateTime #92

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/com/duffel/model/AirlineInitiatedChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import lombok.Getter;
import lombok.ToString;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.List;

/**
Expand All @@ -31,7 +31,7 @@ public class AirlineInitiatedChange extends Data<AirlineInitiatedChange> {
* The ISO 8601 datetime at which an action was taken
*/
@JsonProperty("action_taken_at")
private LocalDateTime actionTakenAt;
private ZonedDateTime actionTakenAt;

/**
* List of updated slices and segments following the change. These slices and segments may each have a new ID
Expand All @@ -55,7 +55,7 @@ public class AirlineInitiatedChange extends Data<AirlineInitiatedChange> {
* The ISO 8601 datetime at which we detected the airline-initiated change
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* Duffel's unique identifier for the airline-initiated change
Expand Down Expand Up @@ -86,7 +86,7 @@ public class AirlineInitiatedChange extends Data<AirlineInitiatedChange> {
* The ISO 8601 datetime at which the airline-initiated change was last updated
*/
@JsonProperty("updated_at")
private LocalDateTime updatedAt;
private ZonedDateTime updatedAt;

/**
* Actions that can be taken for this change.
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/duffel/model/Webhook.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import lombok.Setter;
import lombok.ToString;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.List;

/**
Expand All @@ -29,7 +29,7 @@ public class Webhook extends Data<Webhook> {
* Example: "2020-04-11T15:48:11.642Z"
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* The events that this webhook will be subscribed to
Expand Down Expand Up @@ -59,7 +59,7 @@ public class Webhook extends Data<Webhook> {
* Example: "2020-04-11T15:48:11.642Z"
*/
@JsonProperty("updated_at")
private LocalDateTime updatedAt;
private ZonedDateTime updatedAt;

/**
* The URL where your webhook will be received
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/duffel/model/response/Offer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import lombok.ToString;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.List;

/**
Expand Down Expand Up @@ -73,15 +73,15 @@ public class Offer extends Data<Offer> {
* Example: "2020-01-17T10:12:14.545Z"
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* The ISO 8601 datetime expiry of the offer before which the traveller should use this offer to create an order.
* After this time the offer can no longer be used to create an order.
* Example: "2020-01-17T10:42:14.545Z"
*/
@JsonProperty("expires_at")
private LocalDateTime expiresAt;
private ZonedDateTime expiresAt;

/**
* Duffel's unique identifier for the offer
Expand Down Expand Up @@ -189,6 +189,6 @@ public class Offer extends Data<Offer> {
* Example: "2020-01-17T10:12:14.545Z"
*/
@JsonProperty("updated_at")
private LocalDateTime updatedAt;
private ZonedDateTime updatedAt;

}
4 changes: 2 additions & 2 deletions src/main/java/com/duffel/model/response/OfferResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import lombok.Getter;
import lombok.ToString;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.List;

/**
Expand Down Expand Up @@ -44,7 +44,7 @@ public class OfferResponse extends Data<OfferResponse> {
* Example: "2020-02-12T15:21:01.927Z"
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* Whether the offer request was created in live mode. This field will be set to true if the offer request was
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/duffel/model/response/Order.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import lombok.ToString;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -60,7 +60,7 @@ public class Order extends Data<Order> {
* e.g. "2020-04-11T15:48:11.642Z"
*/
@JsonProperty("cancelled_at")
private LocalDateTime cancelledAt;
private ZonedDateTime cancelledAt;

/**
* The conditions associated with this order, describing the kinds of modifications you can make to it and any
Expand All @@ -78,7 +78,7 @@ public class Order extends Data<Order> {
* e.g. "2020-04-11T15:48:11.642Z"
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* The documents issued for this order
Expand Down Expand Up @@ -146,7 +146,7 @@ public class Order extends Data<Order> {
* datetime is in the last minute you can consider the order up to date.
*/
@JsonProperty("synced_at")
private LocalDateTime syncedAt;
private ZonedDateTime syncedAt;

/**
* The amount of tax payable on the order for all the flights booked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import lombok.ToString;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;

/**
* Order cancellation.
Expand All @@ -21,19 +21,19 @@ public class OrderCancellation {
* The ISO 8601 datetime that indicates when the order cancellation was confirmed
*/
@JsonProperty("confirmed_at")
private LocalDateTime confirmedAt;
private ZonedDateTime confirmedAt;

/**
* The ISO 8601 datetime at which the order cancellation was created
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* The ISO 8601 datetime by which this cancellation must be confirmed
*/
@JsonProperty("expires_at")
private LocalDateTime expiresAt;
private ZonedDateTime expiresAt;

/**
* Duffel's unique identifier for the order cancellation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import lombok.Getter;
import lombok.ToString;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;

/**
* Payment requirements for an order.
Expand All @@ -22,15 +22,15 @@ public class PaymentRequirements {
* Example: "2020-01-17T10:42:14Z"
*/
@JsonProperty("payment_required_by")
private LocalDateTime paymentRequiredBy;
private ZonedDateTime paymentRequiredBy;

/**
* The ISO 8601 datetime at which the price associated with the order will no longer be guaranteed by the airline
* and may change before payment. This will be null when requires_instant_payment is true.
* Example: "2020-01-17T10:42:14"
*/
@JsonProperty("price_guarantee_expires_at")
private LocalDateTime priceGuaranteeExpiresAt;
private ZonedDateTime priceGuaranteeExpiresAt;

/**
* When payment is required at the time of booking this will be true and payment_required_by and
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/duffel/model/response/PaymentResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import lombok.ToString;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;

/**
* Payment response.
Expand All @@ -30,7 +30,7 @@ public class PaymentResponse extends Data<PaymentResponse> {
* Example: "2020-04-11T15:48:11.642Z"
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* The currency of the amount, as an ISO 4217 currency code. It will match your organisation's billing currency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import lombok.Getter;
import lombok.ToString;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;

/**
* Status of an order payment.
Expand All @@ -28,13 +28,13 @@ public class PaymentStatus {
* where awaiting_payment is false.
*/
@JsonProperty("payment_required_by")
private LocalDateTime paymentRequiredBy;
private ZonedDateTime paymentRequiredBy;

/**
* The ISO 8601 datetime at which the price associated with the order will no longer be guaranteed by the airline
* and the order will need to be repriced before payment. This will be null when there is no price guarantee.
*/
@JsonProperty("price_guarantee_expires_at")
private LocalDateTime priceGuaranteeExpiresAt;
private ZonedDateTime priceGuaranteeExpiresAt;

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import lombok.ToString;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;

/**
* Change order possible offer.
Expand Down Expand Up @@ -38,13 +38,13 @@ public class OrderChangeOffer extends Data<OrderChangeOffer> {
* The ISO 8601 datetime at which the offer was created
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* The ISO 8601 datetime at which the offer will expire and no longer be usable to create an order
*/
@JsonProperty("expires_at")
private LocalDateTime expiresAt;
private ZonedDateTime expiresAt;

/**
* Duffel's unique identifier for the order change offer
Expand Down Expand Up @@ -107,7 +107,7 @@ public class OrderChangeOffer extends Data<OrderChangeOffer> {
* The ISO 8601 datetime at which the offer was last updated
*/
@JsonProperty("updated_at")
private LocalDateTime updatedAt;
private ZonedDateTime updatedAt;

/**
* The slices within an order change that are being added to and/or removed from the order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import lombok.Getter;
import lombok.ToString;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.util.List;

/**
Expand All @@ -22,7 +22,7 @@ public class OrderChangeResponse extends Data<OrderChangeResponse> {
* The ISO 8601 datetime at which the order change request was created
*/
@JsonProperty("created_at")
private LocalDateTime createdAt;
private ZonedDateTime createdAt;

/**
* The ID of your order change request
Expand Down Expand Up @@ -59,6 +59,6 @@ public class OrderChangeResponse extends Data<OrderChangeResponse> {
* The ISO 8601 datetime at which the order change request was last updated
*/
@JsonProperty("updated_at")
private LocalDateTime updatedAt;
private ZonedDateTime updatedAt;

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.mockserver.model.Parameter;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -67,7 +67,7 @@ void update(MockServerClient mockClient) {

assertEquals("aic_0000AMPr4lUGju0EEBrHCC", airlineInitiatedChange.getId());
assertEquals(AirlineInitiatedChangeActionTaken.cancelled, airlineInitiatedChange.getActionTaken());
assertEquals(LocalDateTime.parse("2022-08-11T10:51:30.702393"), airlineInitiatedChange.getUpdatedAt());
assertEquals(ZonedDateTime.parse("2022-08-11T10:51:30.702393Z"), airlineInitiatedChange.getUpdatedAt());
}

}
Loading