commit 9c5230f64d16d46c000c6d4f5842170c51b697ce
parent 961875a79149e303af87b1bbb0f1fc717f275dfd
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Sun, 18 Feb 2024 10:14:19 +0100
Update to taler-go 1.0.3
Diffstat:
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/go.mod b/go.mod
@@ -5,12 +5,12 @@ go 1.18
require (
github.com/gorilla/mux v1.8.0
github.com/jarcoal/httpmock v1.2.0
+ github.com/schanzen/taler-go v1.0.3
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
gnunet v0.1.27
gopkg.in/ini.v1 v1.66.6
gorm.io/driver/postgres v1.3.4
gorm.io/gorm v1.23.4
- taler.net/taler-go.git v0.0.0-20220719135513-36eb87bf37a3
)
require (
diff --git a/internal/util/helper.go b/internal/util/helper.go
@@ -23,8 +23,9 @@ import (
"fmt"
gnunetutil "gnunet/util"
"math/rand"
- talerutil "taler.net/taler-go.git/pkg/util"
"time"
+
+ talerutil "github.com/schanzen/taler-go/pkg/util"
)
// Generates a solution from a challenge and pubkey
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
@@ -46,8 +46,8 @@ import (
"gorm.io/gorm/logger"
"taler.net/taldir/internal/gana"
"taler.net/taldir/internal/util"
- "taler.net/taler-go.git/pkg/merchant"
- tos "taler.net/taler-go.git/pkg/rest"
+ "github.com/schanzen/taler-go/pkg/merchant"
+ tos "github.com/schanzen/taler-go/pkg/rest"
)
// Taldir is the primary object of the Taldir service
@@ -91,6 +91,9 @@ type Taldir struct {
// Monthly fee amount
MonthlyFee string
+
+ // Registrar base URL
+ BaseUrl string
}
// VersionResponse is the JSON response of the /config enpoint
@@ -467,7 +470,8 @@ func (t *Taldir) registerRequest(w http.ResponseWriter, r *http.Request) {
if !cost.IsZero() {
if len(validation.OrderID) == 0 {
// Add new order for new validations
- orderID, newOrderErr := t.Merchant.AddNewOrder(*cost)
+ // FIXME: What is the URL we want to provide here?
+ orderID, newOrderErr := t.Merchant.AddNewOrder(*cost, "Taldir registration", t.BaseUrl)
if newOrderErr != nil {
fmt.Println(newOrderErr)
w.WriteHeader(http.StatusInternalServerError)
@@ -478,7 +482,8 @@ func (t *Taldir) registerRequest(w http.ResponseWriter, r *http.Request) {
// Check if order paid.
// FIXME: Remember that it was activated and paid
- payto, paytoErr := t.Merchant.IsOrderPaid(validation.OrderID)
+ // FIXME: We probably need to handle the return code here (see gns registrar for how)
+ _, payto, paytoErr := t.Merchant.IsOrderPaid(validation.OrderID)
if paytoErr != nil {
fmt.Println(paytoErr)
w.WriteHeader(http.StatusInternalServerError)
@@ -629,6 +634,7 @@ func (t *Taldir) Initialize(cfgfile string) {
fmt.Println("Production mode enabled")
}
+ t.BaseUrl = t.Cfg.Section("taldir").Key("base_url").MustString("http://localhost:11000")
t.Validators = make(map[string]bool)
for _, a := range strings.Split(t.Cfg.Section("taldir").Key("validators").String(), " ") {
t.Validators[a] = true