gnunet-gns-registrar

GNU Name System registrar
Log | Files | Refs | README

commit 65c567d69aa456ea53e55ac2f593a13b3e56f73d
parent f2955fb0de0d7a2e31ac921107a031f91bab2c3d
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Tue, 12 Dec 2023 20:13:22 +0100

Update taler-go to 1.0.0

Diffstat:
Mgo.mod | 2+-
Mpkg/rest/gnsregistrar.go | 21++++++---------------
2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/go.mod b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/google/uuid v1.4.0 github.com/gorilla/mux v1.8.1 - github.com/schanzen/taler-go v0.0.5 + github.com/schanzen/taler-go v1.0.0 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e golang.org/x/text v0.14.0 gopkg.in/ini.v1 v1.67.0 diff --git a/pkg/rest/gnsregistrar.go b/pkg/rest/gnsregistrar.go @@ -166,18 +166,6 @@ func generateRegistrationId() string { return uuid.New().String() } -// FIXME: Implement https://docs.taler.net/design-documents/051-fractional-digits.html and move to taler-go -func (t *Registrar) localizedAmountString() (string) { - var currencySpec = talerutil.CurrencySpecification{ - Name: "KUDOS", - NumFractionalNormalDigits: 2, - AllUnitNames: map[int]string{ - 0: "KUDOS", - }, - } - return t.RegistrationCost.Format(currencySpec) -} - func (t *Registrar) landingPage(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") @@ -413,6 +401,7 @@ func (t *Registrar) editRegistration(w http.ResponseWriter, r *http.Request) { registeredUntilStr := registeredUntil.Format(time.DateTime) remainingDays := int64(time.Until(registeredUntil).Hours() / 24) extendedExpiration := time.UnixMicro(int64(regMetadata.Expiration)).Add(t.RelativeRegistrationExpiration).Format(time.DateTime) + cost, _ := t.RegistrationCost.Format() fullData := map[string]interface{}{ "label": vars["label"], "zkey": value, @@ -422,7 +411,7 @@ func (t *Registrar) editRegistration(w http.ResponseWriter, r *http.Request) { "registeredUntil": registeredUntilStr, "token": r.URL.Query().Get("token"), "error": r.URL.Query().Get("error"), - "cost": t.localizedAmountString(), + "cost": cost, "suffixHint": t.SuffixHint, } t.EditTpl.Execute(w, fullData) @@ -535,6 +524,7 @@ func (t *Registrar) buyPage(w http.ResponseWriter, r *http.Request) { } } encodedPng := base64.StdEncoding.EncodeToString(qrPng) + cost, _ := t.RegistrationCost.Format() fullData := map[string]interface{}{ "qrCode": template.URL("data:image/png;base64," + encodedPng), "payto": template.URL(payto), @@ -542,7 +532,7 @@ func (t *Registrar) buyPage(w http.ResponseWriter, r *http.Request) { "registrationId": regId, "label": vars["label"], "error": errorMsg, - "cost": t.localizedAmountString(), + "cost": cost, "suffixHint": t.SuffixHint, } t.BuyTpl.Execute(w, fullData) @@ -699,10 +689,11 @@ func (t *Registrar) namePage(w http.ResponseWriter, r *http.Request) { remainingDays = int64(time.Until(registeredUntil).Hours() / 24) } } + cost, _ := t.RegistrationCost.Format() fullData := map[string]interface{}{ "label": vars["label"], "error": r.URL.Query().Get("error"), - "cost": t.localizedAmountString(), + "cost": cost, "available": regMetadata == nil, "currentValue": value, "suffixHint": t.SuffixHint,