Merged
Conversation
…l purchase check) and 7.2 (product-service reviews) meet their contracts, as part of the ongoing marketplace role-capabilities epic (F1–F6.1 already merged/verified)
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.
Resultados dos testes no browser
Testei os dois contratos diretamente no browser (navegação +
fetchviajavascript_tool, sem Postman/curl), usando dados reais: registei um cliente novo (f7.tester@example.com, userId 21), completei uma compra real (produto 251, "4K Monitor 1", $399.99) e acompanhei a saga até CONFIRMED (Inventory Reserved → Order Confirmed), para ter uma compra verificável genuína — não havia nenhuma order CONFIRMED/SHIPPED/DELIVERED em BD antes deste teste.Task 7.1 —
order-serviceinternal purchase checkX-Internal-Token, direto a :8083GET /internal/purchases/existsorder.internal.token.invalid✅{"purchased":true}✅{"purchased":false}✅gateway.auth.missing.token✅ (Layer 1 bloqueia anónimos)order.internal.token.invalid— pedido chegou ao order-serviceAchado a registar: o gateway tem
Path=/api/v1/orders/**como predicate (linha 161 degateway-service.yml), que também casa com/internal/**. Um utilizador autenticado (não só o product-service) consegue fazer o pedido chegar ao order-service através do gateway — só não obtém dados porque a Layer 2 (X-Internal-Token) o rejeita. Isto não é um bug: os comentários no próprio código (OrderSecurityConfig.java,InternalTokenFilter.java) já dizem explicitamente "an anonymous external caller is stopped at the gateway" — só anónimos, não autenticados. Mas a frase mais informal da tarefa ("gateway não expõe /internal") é mais forte do que o comportamento real; deixo isto explícito para não gerar falsa confiança.Task 7.2 —
product-servicereviews (via gateway :8222, rota pública)customerId, productId, rating, commentcorretos ✅review.already.exists✅review.not.purchased— prova a chamada Feign real product-service→order-service ✅product.not.found✅product.not.found(indistinguível de not-found, D4) ✅review.not.found✅review.delete.forbidden✅Não testado: o caminho 503 (
review.verification.unavailable) — exigiria derrubar o order-service, o que não fiz por ser ação destrutiva fora do pedido.Estado final: reviews voltaram a 0 para o produto 251 (limpeza feita); ficaram 2 contas de cliente novas e 1 order CONFIRMED reais em BD, criadas propositadamente para servir de prova de compra verificada.