more auth

This commit is contained in:
mats committed 2026-09-01 14:26:57 +02:00
1 parent fd9446632d
commit 7995fedbd3
2 files changed
+43

No files matched your search

+5
View File
@@ -87,6 +87,11 @@ const (
// 261x D per rate), idempotent per refund id. Invoice orders reverse via // 261x D per rate), idempotent per refund id. Invoice orders reverse via
// credit notes (invoice.credited), so RefundIssued never fires for them. // credit notes (invoice.credited), so RefundIssued never fires for them.
RefundIssued Type = "refund.issued" RefundIssued Type = "refund.issued"
// OfferAccepted is emitted when a B2B offer (offert) is accepted — it
// becomes the agreement (avtal). The ledger consumes it (durable queue
// ledger-offer-contracts) and creates/activates a Contract carrying the
// offer's line items. Payload is an order.OfferAccepted (platform/order).
OfferAccepted Type = "offer.accepted"
// Scheduling (go-cart-actor cmd/scheduling). Emitted when timeslots are // Scheduling (go-cart-actor cmd/scheduling). Emitted when timeslots are
// confirmed from an order capture or cancelled. // confirmed from an order capture or cancelled.
+38
View File
@@ -145,6 +145,44 @@ func DecodeInvoiceCredited(raw []byte) (InvoiceCredited, error) {
return c, err return c, err
} }
// OfferLine is one line of an accepted offer — the quotation row the ledger
// contract carries. UnitPriceIncVat is öre; TaxRateBp is basis points
// (2500 = 25 %).
type OfferLine struct {
Sku string `json:"sku,omitempty"`
Name string `json:"name"`
Quantity int `json:"quantity"`
UnitPriceIncVat int64 `json:"unit_price_inc_vat,omitempty"`
TaxRateBp int `json:"tax_rate_bp,omitempty"`
}
// OfferAccepted is the payload of an event.OfferAccepted envelope: a B2B
// offer (offert) was accepted and becomes the agreement (avtal). The payload
// carries the offer identity, the buyer company, and the offer's line items
// so the consumer — the ledger's offer reactor — can create/activate the
// contract exactly as offered. Lines may be empty defensively; reactors must
// still record the acceptance as an agreement covering the referenced offer.
type OfferAccepted struct {
OrderID string `json:"order_id"`
OfferNumber string `json:"offer_number"`
CompanyID string `json:"company_id,omitempty"`
CompanyName string `json:"company_name,omitempty"`
OrgNumber string `json:"org_number,omitempty"`
CustomerEmail string `json:"customer_email,omitempty"`
ValidUntil string `json:"valid_until,omitempty"`
AcceptedAtMs int64 `json:"accepted_at_ms"`
Notes string `json:"notes,omitempty"`
Lines []OfferLine `json:"lines,omitempty"`
}
func (o OfferAccepted) Encode() ([]byte, error) { return json.Marshal(o) }
func DecodeOfferAccepted(raw []byte) (OfferAccepted, error) {
var o OfferAccepted
err := json.Unmarshal(raw, &o)
return o, err
}
// SalePaid is the payload of an event.SalePaid envelope: a consumer (PSP) // SalePaid is the payload of an event.SalePaid envelope: a consumer (PSP)
// order was captured. It is the accounting fact for shop sales — the ledger // order was captured. It is the accounting fact for shop sales — the ledger
// aggregates captured sales into the daily SHOP- voucher (clearing D / // aggregates captured sales into the daily SHOP- voucher (clearing D /