summaryrefslogtreecommitdiff
path: root/c2ec/wallee-client.go
diff options
context:
space:
mode:
Diffstat (limited to 'c2ec/wallee-client.go')
-rw-r--r--c2ec/wallee-client.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/c2ec/wallee-client.go b/c2ec/wallee-client.go
index 87b48cc..2f304d0 100644
--- a/c2ec/wallee-client.go
+++ b/c2ec/wallee-client.go
@@ -7,6 +7,7 @@ import (
"encoding/base64"
"errors"
"fmt"
+ "io"
"strconv"
"strings"
"time"
@@ -42,6 +43,30 @@ func (wt *WalleeTransaction) AllowWithdrawal() bool {
return strings.EqualFold(string(wt.State), string(StateFulfill))
}
+func (wt *WalleeTransaction) AbortWithdrawal() bool {
+ // guaranteed abortion is given when the state of
+ // the transaction is a final state but not the
+ // success case (which is FULFILL)
+ return strings.EqualFold(string(wt.State), string(StateFailed)) ||
+ strings.EqualFold(string(wt.State), string(StateVoided)) ||
+ strings.EqualFold(string(wt.State), string(StateDecline))
+}
+
+func (wt *WalleeTransaction) Bytes() []byte {
+
+ reader, err := NewJsonCodec[WalleeTransaction]().Encode(wt)
+ if err != nil {
+ LogError("wallee-client", err)
+ return make([]byte, 0)
+ }
+ bytes, err := io.ReadAll(reader)
+ if err != nil {
+ LogError("wallee-client", err)
+ return make([]byte, 0)
+ }
+ return bytes
+}
+
func (w *WalleeClient) SetupClient(p *Provider) error {
cfg, err := ConfigForProvider(p.Name)