Skip to content

Commit 8293fc4

Browse files
authored
Add Pagos Network Tokenization (#250)
1 parent 2f409f3 commit 8293fc4

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

connectorconfig/library.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const (
6464

6565
// Tokenization Libraries
6666
LibraryTokenExNetworkTokenization Library = "tokenex-networktokenization"
67+
LibraryPagosNetworkTokenization Library = "pagos-networktokenization"
6768
)
6869

6970
type LibraryType string
@@ -402,4 +403,11 @@ var LibraryRegister = map[Library]LibraryDef{
402403
return methodType == chtype.PAYMENT_METHOD_TYPE_CARD
403404
},
404405
},
406+
LibraryPagosNetworkTokenization: {
407+
DisplayName: "Pagos Network Tokenization",
408+
Credentials: func() Credentials { return &PagosNetworkTokenizationCredentials{} },
409+
SupportsMethod: func(methodType chtype.PaymentMethodType, methodProvider chtype.PaymentMethodProvider) bool {
410+
return methodType == chtype.PAYMENT_METHOD_TYPE_CARD
411+
},
412+
},
405413
}

connectorconfig/pagosnt.go

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 PagosNetworkTokenizationCredentials struct {
12+
MerchantID string `json:"merchantId,omitempty" yaml:"merchantId,omitempty"`
13+
}
14+
15+
func (c *PagosNetworkTokenizationCredentials) GetMID() string {
16+
return c.MerchantID
17+
}
18+
19+
func (c *PagosNetworkTokenizationCredentials) GetLibrary() Library {
20+
return LibraryPagosNetworkTokenization
21+
}
22+
23+
func (c *PagosNetworkTokenizationCredentials) GetSupportedTypes() []LibraryType {
24+
return []LibraryType{LibraryTypeNetworkTokenization}
25+
}
26+
27+
func (c *PagosNetworkTokenizationCredentials) Validate() error {
28+
return nil
29+
}
30+
31+
func (c *PagosNetworkTokenizationCredentials) GetSecureFields() []*string {
32+
return []*string{}
33+
}
34+
35+
func (c *PagosNetworkTokenizationCredentials) 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 *PagosNetworkTokenizationCredentials) FromJson(input []byte) error {
42+
return json.Unmarshal(input, c)
43+
}
44+
45+
func (c *PagosNetworkTokenizationCredentials) SupportsSca() bool {
46+
return false
47+
}
48+
49+
func (c *PagosNetworkTokenizationCredentials) 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 *PagosNetworkTokenizationCredentials) SupportsCountry(country string) bool {
57+
return true
58+
}
59+
60+
func (c *PagosNetworkTokenizationCredentials) CanPlanModeUse(mode environment.Mode) bool {
61+
return true
62+
}
63+
64+
func (c *PagosNetworkTokenizationCredentials) IsRecoveryAgent() bool {
65+
return false
66+
}
67+
68+
func (c *PagosNetworkTokenizationCredentials) Supports3RI() bool {
69+
return false
70+
}
71+
72+
func (c *PagosNetworkTokenizationCredentials) IsAccountUpdater() bool {
73+
return false
74+
}

0 commit comments

Comments
 (0)