taler-mailbox

Service for asynchronous wallet-to-wallet payment messages
Log | Files | Refs | Submodules | README | LICENSE

commit 6556849263efcebad73eb5d9c8e7b3a3a1112af0
parent abb71e8fcddf646830983f7b523fb46cc01cd09c
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Tue, 22 Apr 2025 19:31:05 +0200

Update to more recent taler-go

Diffstat:
Mgo.mod | 2+-
Mgo.sum | 6+++---
Mpkg/rest/mailbox.go | 14+++++++++-----
3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/go.mod b/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( git.gnunet.org/gnunet-go.git v0.1.28-0.20220717050634-369422be2512 github.com/gorilla/mux v1.8.0 + github.com/schanzen/taler-go v1.0.6 gopkg.in/ini.v1 v1.66.6 gorm.io/driver/postgres v1.3.8 gorm.io/gorm v1.23.8 - taler.net/taler-go.git v0.0.0-20220719135513-36eb87bf37a3 ) require ( diff --git a/go.sum b/go.sum @@ -104,6 +104,8 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/schanzen/taler-go v1.0.6 h1:qf34AXE6aFBQkcJ3/V25apWcHLPv81JJgBVlSEUZaW0= +github.com/schanzen/taler-go v1.0.6/go.mod h1:+l2TVAPZkF2d15X/XPLYZI5R6PdW6gc6Wft12jrl7tA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -117,7 +119,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -202,5 +204,3 @@ gorm.io/gorm v1.23.6/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.8 h1:h8sGJ+biDgBA1AD1Ha9gFCx7h8npU7AsLdlkX0n2TpE= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -taler.net/taler-go.git v0.0.0-20220719135513-36eb87bf37a3 h1:Nh8luWFYJPdJAXOs+5/utyEgI+wzF699GNk+oIaNI5E= -taler.net/taler-go.git v0.0.0-20220719135513-36eb87bf37a3/go.mod h1:S2B4SOQ77tKb9ku5NFffNJ8b79Z+yNFztm4wNgagwas= diff --git a/pkg/rest/mailbox.go b/pkg/rest/mailbox.go @@ -38,9 +38,9 @@ import ( "gorm.io/driver/postgres" "gorm.io/gorm" "gorm.io/gorm/logger" - "taler.net/taler-go.git/pkg/merchant" - tos "taler.net/taler-go.git/pkg/rest" - talerutil "taler.net/taler-go.git/pkg/util" + "github.com/schanzen/taler-go/pkg/merchant" + tos "github.com/schanzen/taler-go/pkg/rest" + talerutil "github.com/schanzen/taler-go/pkg/util" ) type TalerMailboxBoxySize int @@ -62,6 +62,9 @@ type Mailbox struct { // Merchant object Merchant merchant.Merchant + + // Base URL + BaseUrl string } // VersionResponse is the JSON response of the /config enpoint @@ -219,7 +222,7 @@ func (m *Mailbox) sendMessageResponse(w http.ResponseWriter, r *http.Request) { } if len(entry.OrderID) == 0 { // Add new order for new entry - orderID, newOrderErr := m.Merchant.AddNewOrder(*cost) + orderID, newOrderErr := m.Merchant.AddNewOrder(*cost, "Mailbox message dispatch", m.BaseUrl) if newOrderErr != nil { fmt.Println(newOrderErr) w.WriteHeader(http.StatusInternalServerError) @@ -228,7 +231,7 @@ func (m *Mailbox) sendMessageResponse(w http.ResponseWriter, r *http.Request) { entry.OrderID = orderID } // Check if order paid. - payto, paytoErr := m.Merchant.IsOrderPaid(entry.OrderID) + _, _, payto, paytoErr := m.Merchant.IsOrderPaid(entry.OrderID) if paytoErr != nil { fmt.Println(paytoErr) w.WriteHeader(http.StatusInternalServerError) @@ -370,6 +373,7 @@ func (m *Mailbox) Initialize(cfgfile string) { if m.Cfg.Section("mailbox").Key("production").MustBool(false) { fmt.Println("Production mode enabled") } + m.BaseUrl = m.Cfg.Section("mailbox").Key("base_url").MustString("https://example.com") m.MessageBodyBytes = m.Cfg.Section("mailbox").Key("message_body_bytes").MustInt64(256) psqlconn := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", m.Cfg.Section("mailbox-pq").Key("host").MustString("localhost"),