Documentation
¶
Overview ¶
Package ledger writes the wallet movement records of the billing module: every gift-credit and balance change an order makes is recorded here, with the same shape, timestamp and remark vocabulary. Callers pass the transaction-scoped log repository so a record commits with the movement it describes.
Index ¶
- Constants
- func PayWithBalance(ctx context.Context, logs LogWriter, entry Balance) error
- func Recharge(ctx context.Context, logs LogWriter, entry Balance) error
- func RefundGift(ctx context.Context, logs LogWriter, entry Gift) error
- func SpendGift(ctx context.Context, logs LogWriter, entry Gift) error
- type Balance
- type Gift
- type LogWriter
Constants ¶
View Source
const ( RemarkPurchaseDeduction = "Purchase order deduction" RemarkRenewalDeduction = "Renewal order deduction" RemarkResetTrafficDeduction = "Reset traffic order deduction" RemarkBalancePayment = "Purchase payment" RemarkCancellationRefund = "Order cancellation refund" )
Remarks of gift-credit movements, shown to administrators in the gift log.
Variables ¶
This section is empty.
Functions ¶
func PayWithBalance ¶
PayWithBalance records balance spent to pay an order.
func RefundGift ¶
RefundGift records gift credit returned to the wallet by an order.
Types ¶
type Balance ¶
type Balance struct {
UserID int64
OrderNo string
// Amount is the balance moved; Balance is the balance afterwards.
Amount int64
Balance int64
}
Balance describes a balance movement of one wallet for an order.
Click to show internal directories.
Click to hide internal directories.