Skip to content

Commit

Permalink
Merge pull request #24 from invopop/fix-payment-instr-missing
Browse files Browse the repository at this point in the history
Fix: missing 'cheque' payment instruction method
  • Loading branch information
samlown authored Dec 5, 2024
2 parents e70b522 + 49578b5 commit dfc4147
Show file tree
Hide file tree
Showing 37 changed files with 346 additions and 78 deletions.
7 changes: 6 additions & 1 deletion components/bill/invoice/customer_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion components/bill/invoice/invoice_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 36 additions & 1 deletion components/bill/invoice/lines_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion components/bill/invoice/notes_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 5 additions & 13 deletions components/bill/invoice/payment.templ
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package invoice

import (
"context"
"fmt"
"github.com/invopop/ctxi18n/i18n"
"github.com/invopop/gobl.html/components/t"
"github.com/invopop/gobl/bill"
Expand Down Expand Up @@ -211,20 +212,11 @@ func paymentInstrMethodName(ctx context.Context, inst *pay.Instructions) string
if inst.Detail != "" {
return inst.Detail
}
ctx = i18n.WithScope(ctx, ".methods")
switch inst.Key {
case pay.MeansKeyCard:
return i18n.T(ctx, ".card")
case pay.MeansKeyCreditTransfer:
return i18n.T(ctx, ".credit_transfer")
case pay.MeansKeyCash:
return i18n.T(ctx, ".cash")
case pay.MeansKeyDirectDebit:
return i18n.T(ctx, ".direct_debit")
case pay.MeansKeyOnline:
return i18n.T(ctx, ".online")
key := fmt.Sprintf(".methods.%s", inst.Key)
if !i18n.Has(ctx, key) {
return ""
}
return ""
return i18n.T(ctx, key)
}

func paymentTermsKeyName(ctx context.Context, terms *pay.Terms) string {
Expand Down
Loading

0 comments on commit dfc4147

Please sign in to comment.