diff --git a/connectorconfig/applestore.go b/connectorconfig/applestore.go new file mode 100644 index 0000000..d27d17c --- /dev/null +++ b/connectorconfig/applestore.go @@ -0,0 +1,77 @@ +package connectorconfig + +import ( + "encoding/json" + + "github.com/chargehive/configuration/environment" + "github.com/chargehive/configuration/v1/connector" + "github.com/chargehive/configuration/v1/scheduler" + "github.com/chargehive/proto/golang/chargehive/chtype" +) + +type AppleStoreCredentials struct { +} + +func (c *AppleStoreCredentials) GetMID() string { + return "" +} + +func (c *AppleStoreCredentials) GetLibrary() Library { + return LibraryAppleStore +} +func (c *AppleStoreCredentials) GetSupportedTypes() []LibraryType { + return []LibraryType{LibraryTypeThirdPartyStore} +} + +func (c *AppleStoreCredentials) Validate() error { + return nil +} + +func (c *AppleStoreCredentials) GetSecureFields() []*string { + return nil +} + +func (c *AppleStoreCredentials) ToConnector() connector.Connector { + con := connector.Connector{Library: string(c.GetLibrary())} + con.Configuration, _ = json.Marshal(c) + return con +} + +func (c *AppleStoreCredentials) FromJson(input []byte) error { + return json.Unmarshal(input, c) +} + +func (c *AppleStoreCredentials) SupportsSca() bool { + return false +} + +func (c *AppleStoreCredentials) SupportsMethod(methodType chtype.PaymentMethodType, methodProvider chtype.PaymentMethodProvider) bool { + if !c.GetLibrary().SupportsMethod(methodType, methodProvider) { + return false + } + return true +} + +func (c *AppleStoreCredentials) SupportsCountry(country string) bool { + return true +} + +func (c *AppleStoreCredentials) CanPlanModeUse(mode environment.Mode) bool { + return true +} + +func (c *AppleStoreCredentials) IsRecoveryAgent() bool { + return false +} + +func (c *AppleStoreCredentials) Supports3RI() bool { + return false +} + +func (c *AppleStoreCredentials) IsAccountUpdater() bool { + return false +} + +func (c *AppleStoreCredentials) SupportedTokenTypes() []scheduler.TokenSource { + return nil +} diff --git a/connectorconfig/library.go b/connectorconfig/library.go index 6a8c29a..e385ced 100644 --- a/connectorconfig/library.go +++ b/connectorconfig/library.go @@ -66,6 +66,9 @@ const ( // Tokenization Libraries LibraryTokenExNetworkTokenization Library = "tokenex-networktokenization" LibraryPagosNetworkTokenization Library = "pagos-networktokenization" + + // Apple Store + LibraryAppleStore Library = "apple-store" ) type LibraryType string @@ -78,6 +81,7 @@ const ( LibraryTypeAuthentication LibraryType = "authentication" LibraryTypeScheduler LibraryType = "scheduler" LibraryTypeNetworkTokenization LibraryType = "networkTokenization" + LibraryTypeThirdPartyStore LibraryType = "thirdPartyStore" ) var LibraryTypeRegister = map[LibraryType]bool{ @@ -418,4 +422,11 @@ var LibraryRegister = map[Library]LibraryDef{ return methodType == chtype.PAYMENT_METHOD_TYPE_CARD }, }, + LibraryAppleStore: { + DisplayName: "Apple Store", + Credentials: func() Credentials { return &AppleStoreCredentials{} }, + SupportsMethod: func(methodType chtype.PaymentMethodType, methodProvider chtype.PaymentMethodProvider) bool { + return false + }, + }, }