Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dt 740 #27

Merged
merged 12 commits into from
Dec 18, 2023
Merged

Dt 740 #27

merged 12 commits into from
Dec 18, 2023

Conversation

preetamnpr
Copy link
Contributor

No description provided.

@preetamnpr preetamnpr requested review from nt-gt and gj0dcsa December 6, 2023 12:16
Comment on lines 52 to 54
BookingState.COMPLETED
BookingState.COMPLETED,
dsp.amendedBookingStatus() != null ? BookingState.AMENDMENT_CONFIRMED : null
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look correct. It should be possible to end with a AMENDEDMENT that was declined/cancelled when reaching the UC12_Carrier_ConfirmBookingCompletedAction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we are not calling UC12 for amendment Declined or cancelled. https://miro.com/app/board/uXjVND1csI8=/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a confirmed booking never has a grey state, then having line 53 is incorrect.
If a confirmed booking can have a grey state, then it could have any of the grey states AMENDMENT CONFIRMED, AMENDMENT DECLINED or AMENDMENT CANCELLED.

Either way, the code is inconsistent by saying that if there is an amended status, it must be AMENDMENT CONFIRMED.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, this one is still "unanswered". I suspect it is because the scenarios do not cover the case of (as an example): ... -> UC5 -> UC7 -> UC9 -> UC12

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

We call the UC8A and then go to UC12.. Hence I put that AmendedBookingStatus check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get ur point. The amendedBookingStatus shouldnt be checked in the UC12. 👍 because the flow of confirmed amendment itself complete after UC8A . am I right ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I would expect the amendedBookingStatus in UC12 should match the value of dsp.amendedBookingStatus().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the miro board, UC12 shouldnt be having any AMENDMENT status.

Copy link
Collaborator

@nt-gt nt-gt Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify that assertion with Flavia. Sometimes the states can inherit the amendment/updated state even though it is not visible in the Miro board. (In eBL, after UC4a, the RECEIVED state is actually RECEIVED + UPDATE CONFIRMED even though the UPDATE CONFIRMED is not visible).

When discussing the scenario with Flavia, be sure to show an exceptional case where you could end up in UC12 with an amended state.

Example: ... -> UC5 -> UC7 -> UC8a -> UC12

I hope she agrees with you, because then we can just "reset" the amendment state + content when doing UC12 and simplify the check here. But as said, please confirm with the PO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with internally, at UC12 we dont need to check the final AmendmentStatus for Booking.

Comment on lines 47 to 52
private static final Set<BookingState> MAY_UPDATE_REQUEST_STATES = Set.of(
RECEIVED,
PENDING_UPDATE,
PENDING_UPDATE_CONFIRMATION
UPDATE_RECEIVED
);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mixing original and amended states but it is used only with original states in putBooking, which makes me suspect the logic is not correctly updated.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is NOT_APPLICABLE_FOR_SIMPLE_STATE_CHANGE and MAY_UPDATE_REQUEST_STATES still used? If not, please remove them.

If they are, then that code is probably still broken because of how we do state checks now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed NOT_APPLICABLE_FOR_SIMPLE_STATE_CHANGE.
MAY_UPDATE_REQUEST_STATES is still being used in PutBooking.. Hence I didnt touch it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but the use of MAY_UPDATE_REQUEST_STATES in putBooking is from the time where getBookingState() could return the amended or the original booking. Given getBookingState() (now getOriginalBookingState()) always returns the original booking state, the state in putBooking must be updated to align with the new semantics.

billede

@@ -123,7 +130,9 @@ public void confirmBooking(String reference, Supplier<String> cbrGenerator, Stri
setReason(reason);
}


public void resetAmendedBookingState() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be private as it is not intended for external usage.

@preetamnpr
Copy link
Contributor Author

image Conformance Checks pass

Comment on lines 252 to 253
String cbrr = actionPrompt.get("cbrr").asText();
String cbr = actionPrompt.get("cbr").asText();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for a future change): The actionPrompt.get should be actiopnPrompt.required (generally anywhere you see them).

I have begun replacing them in the eBL code. But as said, do it in a later commit

case AMENDMENT_CONFIRMED -> then(
shipper_GetBooking(CONFIRMED,bookingState)
.thenEither(
uc12_carrier_confirmBookingCompleted().thenHappyPathFrom(COMPLETED),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replace this line with:

Suggested change
uc12_carrier_confirmBookingCompleted().thenHappyPathFrom(COMPLETED),
noAction().thenHappyPathFrom(CONFIRMED),

The noAction() is a stepping stone for enabling the .thenHappyPathFrom call.

Comment on lines 110 to 116
case AMENDMENT_CANCELLED, AMENDMENT_DECLINED -> then(
shipper_GetBooking(originalBookingState,bookingState)
.then(
uc6_carrier_requestUpdateToConfirmedBooking().thenHappyPathFrom(PENDING_AMENDMENT)
)
);
};
Copy link
Collaborator

@nt-gt nt-gt Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From AMENDMENT_CANCELLED and AMENDMENT_DECLINED the possible actions depend on the original booking state.

I think this case can be simplified into:

Suggested change
case AMENDMENT_CANCELLED, AMENDMENT_DECLINED -> then(
shipper_GetBooking(originalBookingState,bookingState)
.then(
uc6_carrier_requestUpdateToConfirmedBooking().thenHappyPathFrom(PENDING_AMENDMENT)
)
);
};
case AMENDMENT_CANCELLED, AMENDMENT_DECLINED -> then(
shipper_GetBooking(originalBookingState,bookingState)
.thenHappyPathFrom(originalBookingState));

Comment on lines 106 to 107
uc12_carrier_confirmBookingCompleted().thenHappyPathFrom(COMPLETED),
uc6_carrier_requestUpdateToConfirmedBooking().thenHappyPathFrom(PENDING_AMENDMENT)
noAction().thenHappyPathFrom(CONFIRMED),
noAction().thenHappyPathFrom(PENDING_AMENDMENT)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logically, this looks weird. Code wise, this looks like we are in two different states at the same time.

Line 104 asserts we are in CONFIRMED so there for the thenHappyPathFrom(PENDING_AMENDMENT) does not fit the bill. Either line 104 is not correct or line 107 is misleading.

Copy link
Contributor Author

@preetamnpr preetamnpr Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the State of the booking is in two states CONFIRMED and PENDING_AMENDMENT

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference: As far as this state flow generation works, it is in state PENDING_AMENDMENT (for when computing future states)

As an example, it does not make sense for the booking to be completed while it is in PENDING_AMENDMENT. The PENDING_AMENDMENT state means the carrier cannot complete the booking in its current form. This means that the complete booking action is too forgiving. It should not allow a booking in PENDING_AMENDMENT to complete.

@preetamnpr preetamnpr merged commit d409e2c into dev Dec 18, 2023
1 check passed
@nt-gt nt-gt deleted the DT-740 branch December 18, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants