Skip to content

Commit

Permalink
Adyen: add applepay/googlepay support (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
fobilow authored Jul 16, 2024
1 parent 8e251d1 commit 07fcb4d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
27 changes: 22 additions & 5 deletions connectorconfig/adyen.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ const (
)

type AdyenCredentials struct {
Environment AdyenEnvironment `json:"environment" yaml:"environment" validate:"required,oneof=sandbox production"`
MerchantAccount string `json:"merchantAccount" yaml:"merchantAccount" validate:"required"`
ApiKey *string `json:"apiKey" yaml:"apiKey" validate:"required"`
ApiPrefix string `json:"apiPrefix" yaml:"apiPrefix" validate:"required"`
HMACKey *string `json:"hmacKey" yaml:"hmacKey" validate:"required"`
Environment AdyenEnvironment `json:"environment" yaml:"environment" validate:"required,oneof=sandbox production"`
MerchantAccount string `json:"merchantAccount" yaml:"merchantAccount" validate:"required"`
ApiKey *string `json:"apiKey" yaml:"apiKey" validate:"required"`
ApiPrefix string `json:"apiPrefix" yaml:"apiPrefix" validate:"required"`
HMACKey *string `json:"hmacKey" yaml:"hmacKey" validate:"required"`
GooglePay *GooglePayCredentials `json:"googlePay,omitempty" yaml:"googlePay,omitempty"`
ApplePay *ApplePayCredentials `json:"applePay,omitempty" yaml:"applePay,omitempty"`
}

func (c *AdyenCredentials) GetMID() string {
Expand Down Expand Up @@ -99,3 +101,18 @@ func (c *AdyenCredentials) IsRecoveryAgent() bool {
func (c *AdyenCredentials) Supports3RI() bool {
return false
}

func (c *AdyenCredentials) GetGooglePayParams() map[string]string {
return map[string]string{
"gateway": "adyen",
"gatewayMerchantId": c.GetGooglePay().GetGoogleCardMerchantId(),
}
}

func (c *AdyenCredentials) GetGooglePay() *GooglePayCredentials {
return c.GooglePay
}

func (c *AdyenCredentials) GetApplePay() *ApplePayCredentials {
return c.ApplePay
}
4 changes: 3 additions & 1 deletion connectorconfig/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ var LibraryRegister = map[Library]LibraryDef{
DisplayName: "Adyen",
Credentials: func() Credentials { return &AdyenCredentials{} },
SupportsMethod: func(methodType chtype.PaymentMethodType, methodProvider chtype.PaymentMethodProvider) bool {
return methodType == chtype.PAYMENT_METHOD_TYPE_CARD
return methodType == chtype.PAYMENT_METHOD_TYPE_CARD ||
(methodType == chtype.PAYMENT_METHOD_TYPE_DIGITALWALLET && methodProvider == chtype.PAYMENT_METHOD_PROVIDER_APPLEPAY) ||
(methodType == chtype.PAYMENT_METHOD_TYPE_DIGITALWALLET && methodProvider == chtype.PAYMENT_METHOD_PROVIDER_GOOGLEPAY)
},
},
LibraryApplePay: {
Expand Down

0 comments on commit 07fcb4d

Please sign in to comment.