Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions connectorconfig/googleStore.go
Original file line number Diff line number Diff line change
@@ -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 GoogleStoreCredentials struct {
}

func (c *GoogleStoreCredentials) GetMID() string {
return ""
}

func (c *GoogleStoreCredentials) GetLibrary() Library {
return LibraryGoogleStore
}
func (c *GoogleStoreCredentials) GetSupportedTypes() []LibraryType {
return []LibraryType{LibraryTypeThirdPartyStore}
}

func (c *GoogleStoreCredentials) Validate() error {
return nil
}

func (c *GoogleStoreCredentials) GetSecureFields() []*string {
return nil
}

func (c *GoogleStoreCredentials) ToConnector() connector.Connector {
con := connector.Connector{Library: string(c.GetLibrary())}
con.Configuration, _ = json.Marshal(c)
return con
}

func (c *GoogleStoreCredentials) FromJson(input []byte) error {
return json.Unmarshal(input, c)
}

func (c *GoogleStoreCredentials) SupportsSca() bool {
return false
}

func (c *GoogleStoreCredentials) SupportsMethod(methodType chtype.PaymentMethodType, methodProvider chtype.PaymentMethodProvider) bool {
if !c.GetLibrary().SupportsMethod(methodType, methodProvider) {
return false
}
return true
}

func (c *GoogleStoreCredentials) SupportsCountry(country string) bool {
return true
}

func (c *GoogleStoreCredentials) CanPlanModeUse(mode environment.Mode) bool {
return true
}

func (c *GoogleStoreCredentials) IsRecoveryAgent() bool {
return false
}

func (c *GoogleStoreCredentials) Supports3RI() bool {
return false
}

func (c *GoogleStoreCredentials) IsAccountUpdater() bool {
return false
}

func (c *GoogleStoreCredentials) SupportedTokenTypes() []scheduler.TokenSource {
return nil
}
10 changes: 9 additions & 1 deletion connectorconfig/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ const (
LibraryPagosNetworkTokenization Library = "pagos-networktokenization"

// Apple Store
LibraryAppleStore Library = "apple-store"
LibraryAppleStore Library = "apple-store"
LibraryGoogleStore Library = "google-store"
)

type LibraryType string
Expand Down Expand Up @@ -429,4 +430,11 @@ var LibraryRegister = map[Library]LibraryDef{
return false
},
},
LibraryGoogleStore: {
DisplayName: "Google Play Store",
Credentials: func() Credentials { return &GoogleStoreCredentials{} },
SupportsMethod: func(methodType chtype.PaymentMethodType, methodProvider chtype.PaymentMethodProvider) bool {
return false
},
},
}
Loading