Skip to content

Commit a693e69

Browse files
authored
add config for pagos realtime account updater (#251)
1 parent 8293fc4 commit a693e69

File tree

2 files changed

+85
-3
lines changed

2 files changed

+85
-3
lines changed

connectorconfig/library.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ const (
5555
LibraryRecaptcha Library = "recaptcha"
5656

5757
// Updater Libraries
58-
LibraryPaySafeAccountUpdater Library = "paysafe-accountupdater"
59-
LibraryTokenExAccountUpdater Library = "tokenex-accountupdater"
60-
LibraryTokenExApiAccountUpdater Library = "tokenex-api-accountupdater"
58+
LibraryPaySafeAccountUpdater Library = "paysafe-accountupdater"
59+
LibraryTokenExAccountUpdater Library = "tokenex-accountupdater"
60+
LibraryTokenExApiAccountUpdater Library = "tokenex-api-accountupdater"
61+
LibraryPagosRealtimeAccountUpdater Library = "pagos-realtime-accountupdater"
6162

6263
// Scheduler Libraries
6364
LibraryStickyIO Library = "sticky-io"
@@ -410,4 +411,11 @@ var LibraryRegister = map[Library]LibraryDef{
410411
return methodType == chtype.PAYMENT_METHOD_TYPE_CARD
411412
},
412413
},
414+
LibraryPagosRealtimeAccountUpdater: {
415+
DisplayName: "Pagos Realtime Account Updater",
416+
Credentials: func() Credentials { return &PagosRealtimeAccountUpdaterCredentials{} },
417+
SupportsMethod: func(methodType chtype.PaymentMethodType, methodProvider chtype.PaymentMethodProvider) bool {
418+
return methodType == chtype.PAYMENT_METHOD_TYPE_CARD
419+
},
420+
},
413421
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package connectorconfig
2+
3+
import (
4+
"encoding/json"
5+
6+
"github.com/chargehive/configuration/environment"
7+
"github.com/chargehive/configuration/v1/connector"
8+
"github.com/chargehive/proto/golang/chargehive/chtype"
9+
)
10+
11+
type PagosRealtimeAccountUpdaterCredentials struct {
12+
MerchantId string `json:"merchantId" yaml:"merchantId"`
13+
}
14+
15+
func (c *PagosRealtimeAccountUpdaterCredentials) GetMID() string {
16+
return c.MerchantId
17+
}
18+
19+
func (c *PagosRealtimeAccountUpdaterCredentials) GetLibrary() Library {
20+
return LibraryPagosRealtimeAccountUpdater
21+
}
22+
23+
func (c *PagosRealtimeAccountUpdaterCredentials) GetSupportedTypes() []LibraryType {
24+
return []LibraryType{LibraryTypeMethodUpdater}
25+
}
26+
27+
func (c *PagosRealtimeAccountUpdaterCredentials) Validate() error {
28+
return nil
29+
}
30+
31+
func (c *PagosRealtimeAccountUpdaterCredentials) GetSecureFields() []*string {
32+
return []*string{}
33+
}
34+
35+
func (c *PagosRealtimeAccountUpdaterCredentials) ToConnector() connector.Connector {
36+
con := connector.Connector{Library: string(c.GetLibrary())}
37+
con.Configuration, _ = json.Marshal(c)
38+
return con
39+
}
40+
41+
func (c *PagosRealtimeAccountUpdaterCredentials) FromJson(input []byte) error {
42+
return json.Unmarshal(input, c)
43+
}
44+
45+
func (c *PagosRealtimeAccountUpdaterCredentials) SupportsSca() bool {
46+
return false
47+
}
48+
49+
func (c *PagosRealtimeAccountUpdaterCredentials) SupportsMethod(methodType chtype.PaymentMethodType, methodProvider chtype.PaymentMethodProvider) bool {
50+
if !c.GetLibrary().SupportsMethod(methodType, methodProvider) {
51+
return false
52+
}
53+
return true
54+
}
55+
56+
func (c *PagosRealtimeAccountUpdaterCredentials) SupportsCountry(country string) bool {
57+
return true
58+
}
59+
60+
func (c *PagosRealtimeAccountUpdaterCredentials) CanPlanModeUse(environment.Mode) bool {
61+
return true
62+
}
63+
64+
func (c *PagosRealtimeAccountUpdaterCredentials) IsRecoveryAgent() bool {
65+
return false
66+
}
67+
68+
func (c *PagosRealtimeAccountUpdaterCredentials) Supports3RI() bool {
69+
return false
70+
}
71+
72+
func (c *PagosRealtimeAccountUpdaterCredentials) IsAccountUpdater() bool {
73+
return true
74+
}

0 commit comments

Comments
 (0)