mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Commerce never initiates a refund. POST /v1/billing/refunds, POST /v1/billing/refund, POST /v1/order/:orderid/refund and POST /v1/payment/:paymentid/refund are gone with their handlers (engine.CreateRefund, checkout Refund, square.Refund) and the helpers only they used; GET /v1/billing/refunds stays read-only. A claim is settled by a replacement order, never a refund. A refund or dispute of a plan's payment reaches its invoice only from the processor's webhook, under the processor's own refund id, through one locked writer that reads the invoice afresh (engine.RecordRefund, engine.RecordDispute). Every state a dispute reports reaches the invoice; INQUIRY_CLOSED holds the payment no longer, WON stays final and LOST stays disputed. No backfill of the payment-to-invoice index is run: the only plan payments made before v1.50.139 are the team's own card purchases (z24, zk) and one Square record. Co-authored-by: Hanzo Dev <[email protected]>
41 lines
1.8 KiB
Go
41 lines
1.8 KiB
Go
package events
|
|
|
|
// Standard commerce event subjects for NATS/JetStream.
|
|
const (
|
|
SubjectOrderCreated = "commerce.order.created"
|
|
SubjectOrderCompleted = "commerce.order.completed"
|
|
SubjectOrderCanceled = "commerce.order.canceled"
|
|
SubjectCheckoutStarted = "commerce.checkout.started"
|
|
SubjectCheckoutFailed = "commerce.checkout.failed"
|
|
SubjectPaymentReceived = "commerce.payment.received"
|
|
SubjectCartUpdated = "commerce.cart.updated"
|
|
SubjectProductViewed = "commerce.product.viewed"
|
|
|
|
// Catalog lifecycle. A created/updated product is what closes the
|
|
// commerce→content loop: the content lane consumes product.created to
|
|
// auto-render the product's ecom asset (design == slug). Prefixed
|
|
// `commerce.` like every other subject so the COMMERCE stream
|
|
// (StreamSubjects `commerce.>`) captures them.
|
|
SubjectProductCreated = "commerce.product.created"
|
|
SubjectProductUpdated = "commerce.product.updated"
|
|
|
|
// Referral events
|
|
SubjectReferralLinkCreated = "commerce.referral.link_created"
|
|
SubjectReferralClaimed = "commerce.referral.claimed"
|
|
SubjectReferralCreditGranted = "commerce.referral.credit_granted"
|
|
SubjectReferralCommissionEarned = "commerce.referral.commission_earned"
|
|
SubjectReferralPayoutSent = "commerce.referral.payout_sent"
|
|
SubjectReferralTierUpgraded = "commerce.referral.tier_upgraded"
|
|
|
|
// Contributor events
|
|
SubjectContributorRegistered = "commerce.contributor.registered"
|
|
SubjectContributorPayoutCalc = "commerce.contributor.payout_calculated"
|
|
SubjectContributorPayoutSent = "commerce.contributor.payout_sent"
|
|
)
|
|
|
|
// StreamName is the JetStream stream for commerce events.
|
|
const StreamName = "COMMERCE"
|
|
|
|
// StreamSubjects defines what subjects the COMMERCE stream captures.
|
|
var StreamSubjects = []string{"commerce.>"}
|