feat: connect Catalog to Basket with direct C# basket previews - #8
Open
ivanmilevtues wants to merge 2 commits into
Open
ivanmilevtues wants to merge 2 commits into
ivanmilevtues wants to merge 2 commits into
Conversation
Introduce a direct Basket-to-Catalog HTTP connection with Aspire service discovery. Validate complete batches before saving and preserve baskets on catalog failures. Cover missing products, outages, cancellation, authentication and input limits. Amp-Thread-ID: https://ampcode.com/threads/T-01a0d851-f6a1-75de-9f3b-578690b1f00f Co-authored-by: Amp <amp@ampcode.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
CodeBoarding reviewStatus: 5 changed components See the full change in CodeBoarding. graph LR
n_Client_App["Client App"]
n_Ordering_Service["Ordering Service"]
n_Identity_API["Identity API"]
n_Web_Frontends["Web Frontends"]
n_Catalog_Service["Catalog Service"]
n_Webhooks_and_Shared_Infrastructure["Webhooks and Shared Infrastructure"]
n_Event_Bus["Event Bus"]
n_Basket_API["Basket API"]
n_Application_Host_and_Defaults["Application Host and Defaults"]
n_Payment_Processor["Payment Processor"]
n_Payment_Processor -- "publishes events to" --> n_Event_Bus
n_Ordering_Service -- "stores outbox events in" --> n_Catalog_Service
n_Ordering_Service -- "uses migration helpers in" --> n_Webhooks_and_Shared_Infrastructure
n_Ordering_Service -- "publishes and subscribes events via" --> n_Event_Bus
n_Ordering_Service -- "configures defaults from" --> n_Application_Host_and_Defaults
n_Web_Frontends -- "subscribes to events on" --> n_Event_Bus
n_Web_Frontends -- "configures HTTP and config defaults from" --> n_Application_Host_and_Defaults
n_Catalog_Service -- "uses migration helpers in" --> n_Webhooks_and_Shared_Infrastructure
n_Catalog_Service -- "publishes and subscribes events via" --> n_Event_Bus
n_Catalog_Service -- "calls" --> n_Basket_API
n_Webhooks_and_Shared_Infrastructure -- "subscribes to events on" --> n_Event_Bus
n_Webhooks_and_Shared_Infrastructure -- "configures authentication defaults from" --> n_Application_Host_and_Defaults
n_Event_Bus -- "dispatches events to" --> n_Payment_Processor
n_Event_Bus -- "dispatches events to" --> n_Ordering_Service
n_Event_Bus -- "dispatches events to" --> n_Web_Frontends
n_Event_Bus -- "dispatches events to" --> n_Catalog_Service
n_Event_Bus -- "dispatches events to" --> n_Webhooks_and_Shared_Infrastructure
n_Event_Bus -- "dispatches events to" --> n_Basket_API
n_Basket_API -- "subscribes to events on" --> n_Event_Bus
n_Basket_API -- "configures defaults from" --> n_Application_Host_and_Defaults
classDef added fill:#1f883d,stroke:#0b5d23,color:#ffffff;
classDef modified fill:#bf8700,stroke:#7d4e00,color:#ffffff;
classDef deleted fill:#cf222e,stroke:#82071e,color:#ffffff,stroke-dasharray:5 3;
class n_Catalog_Service,n_Basket_API modified;
linkStyle 9 stroke:#0b5d23,stroke-width:2px;
|
Catalog calls BasketPreview.Create in the Basket assembly without HTTP or the integration event bus. Keep previews read-only and reuse Basket validation. Preserve Catalog host settings when publishing the cross-service reference. Amp-Thread-ID: https://ampcode.com/threads/T-01a0d851-f6a1-75de-9f3b-578690b1f00f Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validate basket products against the catalog before saving and add a read-only endpoint for previewing basket line totals. This prevents updates containing missing products and lets callers estimate a line using the current catalog price and Basket validation rules.
Changes
Validate basket updates against Catalog
FailedPreconditionfor missing products andUnavailablefor catalog failures.Add basket line previews
Expose the following endpoint in Catalog API versions 1.0 and 2.0:
BasketPreview.Createand Basket item validation through a direct in-process reference to the Basket assembly.400for invalid product IDs or quantities and404for missing products.Testing
Previously completed local validation:
dotnet test --solution eShop.Web.slnf— 158 passed, 0 failed, including container-backed functional tests.src/Catalog.API/Catalog.API.csproj— succeeded.git diff --check— passed.