cashless2ecash

cashless2ecash: pay with cards for digital cash (experimental)
Log | Files | Refs | README

provider.go (1409B)


      1 // This file is part of taler-cashless2ecash.
      2 // Copyright (C) 2024 Joel Häberli
      3 //
      4 // taler-cashless2ecash is free software: you can redistribute it and/or modify it
      5 // under the terms of the GNU Affero General Public License as published
      6 // by the Free Software Foundation, either version 3 of the License,
      7 // or (at your option) any later version.
      8 //
      9 // taler-cashless2ecash is distributed in the hope that it will be useful, but
     10 // WITHOUT ANY WARRANTY; without even the implied warranty of
     11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12 // Affero General Public License for more details.
     13 //
     14 // You should have received a copy of the GNU Affero General Public License
     15 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
     16 //
     17 // SPDX-License-Identifier: AGPL3.0-or-later
     18 
     19 package provider
     20 
     21 import "c2ec/pkg/db"
     22 
     23 // This map contains all clients initialized during the
     24 // startup of the application. The clients SHALL register
     25 // themselfs during the setup!!
     26 var PROVIDER_CLIENTS = map[string]ProviderClient{}
     27 
     28 type ProviderTransaction interface {
     29 	AllowWithdrawal() bool
     30 	AbortWithdrawal() bool
     31 	Confirm(w *db.Withdrawal) error
     32 	Bytes() []byte
     33 }
     34 
     35 type ProviderClient interface {
     36 	SetupClient(provider *db.Provider) error
     37 	GetTransaction(transactionId string) (ProviderTransaction, error)
     38 	Refund(transactionId string) error
     39 	FormatPayto(w *db.Withdrawal) string
     40 }