feat: Implement payment service with Stripe integration - #6
Merged
Conversation
…tion Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…che layers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… and handler layers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nd env files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…a/zookeeper/kafka-ui Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…struct The order-service publishes the Order struct directly which uses json:"id" for the order ID field. The consumer struct had json:"order_id" which would leave OrderID as uuid.Nil after unmarshaling, breaking Stripe intent creation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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
order.created→ creates Stripe PaymentIntent → stores Payment recordpayment_intent.succeeded/payment_failed/processingevents and publishespayment.created/completed/failedKafka eventsnetworks: auron-network, making them unreachable from all microservicesChanges
New service —
services/payment-service/Paymententity,PaymentStatus,OrderCreatedEvent, repository/service/cache/events/stripe client interfaces, 5 sentinel errorspaymentstable with status CHECK constraint, amount > 0 CHECK, unique index onorder_idUpdatePaymentStatusandUpdateStripeIDsas separate operationspayment:<uuid>key, 1h TTLpayment.created,payment.completed,payment.failedorder.created(grouppayment-service); idempotent viaGetPaymentByOrderIDcheckstripe-go/v76; converts amount to cents; passespayment_id/order_id/user_idas Stripe metadataclient_secretonly travels viapayment.createdKafka event, never HTTP; webhook verification bypassed whenSTRIPE_WEBHOOK_SECRETis empty (dev)context.WithCancelfor clean consumer shutdown on SIGTERMdocker-compose.ymlREDIS_URL,KAFKA_BROKERS,STRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRETtopayment-servicekafka: condition: service_healthytopayment-service.depends_onnetworks: - auron-networktozookeeper,kafka,kafka-ui(bug fix)Test plan
docker-compose up payment-service payments-db redis kafkastarts without errorsGET /healthreturns{"status":"healthy","service":"payment-service"}POST /api/payments/webhook/stripewith a valid Stripe test event returns 200GET /api/payments/:idwith a valid auth token returns the payment or 404order.created→ payment-service creates a PaymentIntent and publishespayment.createdpayment_intent.succeededwebhook updates payment status tocompletedand publishespayment.completed🤖 Generated with Claude Code