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

Add idempotency protection to B #145

Closed
wants to merge 4 commits into from

Conversation

matdavies
Copy link
Contributor

When finished, should fix #100

Currently draft format. Per the comment here, I have attempted to change the return type of ProcessFlowResult. Could not just return a string, as ProcessCheckpoint uses the orderQuote to determine the HttpStatusCode to return, so added a ProcessFlowResult object to contain both the string to return and this value.

I'm not sure about this though, design-wise, as it is adding an Http dependency to the CustomBookingEngine which may violate some design principles here, so throwing this up as a draft for review.

Comment on lines -290 to +292
if (!result) throw new OpenBookingException(new OrderAlreadyExistsError());
if (!result) return CreateOrderResult.OrderAlreadyExists;

return CreateOrderResult.OrderSuccessfullyCreated;
Copy link
Contributor

@nickevansuk nickevansuk Aug 4, 2023

Choose a reason for hiding this comment

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

Noting that this abstraction - the idea of moving the throwing of the OrderAlreadyExistsError into the StoreBookingEngine - is excellent.

It is however, a breaking change for users of the library.

Will break this out into a separate issue to capture it for future.

@nickevansuk
Copy link
Contributor

Closing as this has now been mostly implemented in #207, with a separate issue to capture the remaining functionality created in #208.

Thanks so much for your work on this all those years ago @matdavies !

@nickevansuk nickevansuk closed this Aug 4, 2023
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.

B is not idempotent for identical requests
2 participants