Skip to content

Commit

Permalink
DT-620 UC9 added
Browse files Browse the repository at this point in the history
  • Loading branch information
preetamnpr committed Nov 29, 2023
1 parent 2a3808f commit a64eb48
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ public static BookingScenarioListBuilder buildTree(
AMENDMENT_RECEIVED)
.then (uc9_shipper_cancelBookingAmendment()
.then(shipper_GetBooking(
CANCELLED,
PENDING_AMENDMENT)))))),
PENDING_AMENDMENT,
CANCELLED)))))),
uc7_shipper_submitBookingAmendment()
.then(
shipper_GetBooking(
CONFIRMED,
AMENDMENT_RECEIVED)
.then (uc9_shipper_cancelBookingAmendment()
.then(shipper_GetBooking(
CANCELLED,
CONFIRMED)))),
CONFIRMED,
CANCELLED)))),
uc10_carrier_declineBooking()
.then(shipper_GetBooking(DECLINED)),
uc12_shipper_cancelBooking()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@Getter
@Slf4j
public class UC9_Shipper_CancelBookingAmendment extends BookingAction {
public class UC9_Shipper_CancelBookingAmendment extends StateChangingBookingAction {
private final JsonSchemaValidator requestSchemaValidator;
private final JsonSchemaValidator responseSchemaValidator;

Expand Down Expand Up @@ -52,10 +52,6 @@ protected Stream<? extends ConformanceCheck> createSubChecks() {
new UrlPathCheck(BookingRole::isShipper, getMatchedExchangeUuid(), "/v2/bookings/%s".formatted(cbrr)),
new ResponseStatusCheck(
BookingRole::isCarrier, getMatchedExchangeUuid(), expectedStatus),
new CarrierBookingRefStatusPayloadResponseConformanceCheck(
getMatchedExchangeUuid(),
BookingState.CANCELLED
),
new ApiHeaderCheck(
BookingRole::isShipper,
getMatchedExchangeUuid(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ public void cancelBookingAmendment(String bookingReference, String reason) {
if (reason == null || reason.isBlank()) {
reason = "Amendment cancelled by shipper (no reason given)";
}
final var cancelReason = reason;
getBooking().put("reason", cancelReason);
var amendedBooking = getAmendedBooking().orElseThrow(AssertionError::new);
amendedBooking.put("reason", reason);
amendedBooking.put("reason", cancelReason);
}

private void changeState(String attributeName, BookingState newState) {
Expand Down

0 comments on commit a64eb48

Please sign in to comment.