fix(admin): shorten the receipt letter, show the account id
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 23s
CI / ui (pull_request) Successful in 1m16s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m49s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 23s
CI / ui (pull_request) Successful in 1m16s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m49s
The receipt letter repeated what the receipt itself states. It now carries the amount, the moment of payment with its offset, and the link — the receipt is the document, and it opens without authentication, so there is nothing for the two to disagree about. Subject reworded to name what it is. The ledger and tax-export tables labelled the account link "card", meaning the user card. On pages about payments that reads as a bank card, which is exactly how it was misread. Both now show the first eight characters of the account id, so the column carries data — two rows from the same buyer are visible at a glance — while the link still holds the whole id.
This commit is contained in:
@@ -1375,6 +1375,17 @@ func normalizeComplaintStatus(s string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// shortID abbreviates an account id for a table cell: enough to recognise the same buyer across
|
||||
// rows at a glance, while the link still carries the whole id. Money tables have no room for a full
|
||||
// uuid, and a generic label there ("card") read as a payment card on the very pages about payments.
|
||||
func shortID(id string) string {
|
||||
const n = 8
|
||||
if len(id) <= n {
|
||||
return id
|
||||
}
|
||||
return id[:n]
|
||||
}
|
||||
|
||||
// fmtTime formats a timestamp for display, or "" when zero.
|
||||
func fmtTime(t time.Time) string {
|
||||
if t.IsZero() {
|
||||
|
||||
@@ -130,17 +130,18 @@ func (s *Server) consoleLedger(c *gin.Context) {
|
||||
// the template — only a funded order can be reversed.
|
||||
func ledgerRow(r payments.LedgerReportRow) adminconsole.LedgerRow {
|
||||
row := adminconsole.LedgerRow{
|
||||
At: fmtTime(r.CreatedAt),
|
||||
AccountID: r.AccountID.String(),
|
||||
Kind: r.Kind,
|
||||
Source: r.Source,
|
||||
Origin: r.Origin,
|
||||
ChipsDelta: r.ChipsDelta,
|
||||
Order: r.OrderID,
|
||||
Provider: r.Provider,
|
||||
Shop: r.Shop,
|
||||
Refundable: r.Kind == "fund" && r.OrderID != "",
|
||||
Title: snapshotTitle(r.Snapshot),
|
||||
At: fmtTime(r.CreatedAt),
|
||||
AccountID: r.AccountID.String(),
|
||||
AccountShort: shortID(r.AccountID.String()),
|
||||
Kind: r.Kind,
|
||||
Source: r.Source,
|
||||
Origin: r.Origin,
|
||||
ChipsDelta: r.ChipsDelta,
|
||||
Order: r.OrderID,
|
||||
Provider: r.Provider,
|
||||
Shop: r.Shop,
|
||||
Refundable: r.Kind == "fund" && r.OrderID != "",
|
||||
Title: snapshotTitle(r.Snapshot),
|
||||
}
|
||||
if r.HasMoney() {
|
||||
row.Money = fmtMoney(r.Money)
|
||||
|
||||
@@ -59,10 +59,11 @@ func (s *Server) consoleMyNalog(c *gin.Context) {
|
||||
}
|
||||
for _, cn := range queue.Cancels {
|
||||
view.Cancels = append(view.Cancels, adminconsole.MyNalogCancelRow{
|
||||
LedgerID: cn.LedgerID.String(),
|
||||
AccountID: cn.AccountID.String(),
|
||||
ReceiptUUID: cn.ReceiptUUID,
|
||||
Failed: cn.CancelStatus == payments.MyNalogCancelFailed,
|
||||
LedgerID: cn.LedgerID.String(),
|
||||
AccountID: cn.AccountID.String(),
|
||||
AccountShort: shortID(cn.AccountID.String()),
|
||||
ReceiptUUID: cn.ReceiptUUID,
|
||||
Failed: cn.CancelStatus == payments.MyNalogCancelFailed,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -97,15 +98,16 @@ func fmtMinor(minor int64, cur payments.Currency) string {
|
||||
// the tax service has issued one.
|
||||
func (s *Server) myNalogRow(in payments.MyNalogIncome, inn string, loc *time.Location) adminconsole.MyNalogRow {
|
||||
row := adminconsole.MyNalogRow{
|
||||
LedgerID: in.LedgerID.String(),
|
||||
AccountID: in.AccountID.String(),
|
||||
At: in.OperationTime.In(loc).Format("2006-01-02 15:04"),
|
||||
Amount: in.Amount.String(),
|
||||
Name: s.mynalog.ReceiptName(in),
|
||||
Status: in.Status,
|
||||
Attempts: in.Attempts,
|
||||
LastError: in.LastError,
|
||||
ReceiptUUID: in.ReceiptUUID,
|
||||
LedgerID: in.LedgerID.String(),
|
||||
AccountID: in.AccountID.String(),
|
||||
AccountShort: shortID(in.AccountID.String()),
|
||||
At: in.OperationTime.In(loc).Format("2006-01-02 15:04"),
|
||||
Amount: in.Amount.String(),
|
||||
Name: s.mynalog.ReceiptName(in),
|
||||
Status: in.Status,
|
||||
Attempts: in.Attempts,
|
||||
LastError: in.LastError,
|
||||
ReceiptUUID: in.ReceiptUUID,
|
||||
}
|
||||
if in.ReceiptUUID != "" && inn != "" {
|
||||
row.ReceiptURL = s.mynalog.ReceiptURL(inn, in.ReceiptUUID)
|
||||
|
||||
Reference in New Issue
Block a user