Skip to content

Commit

Permalink
add merchantDescriptor to adyen, braintree, checkout, and paysafe (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomK authored Nov 18, 2024
1 parent 46337a0 commit 11155f8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
16 changes: 9 additions & 7 deletions connectorconfig/adyen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package connectorconfig

import (
"encoding/json"

"github.com/chargehive/configuration/environment"
"github.com/chargehive/configuration/v1/connector"
"github.com/chargehive/proto/golang/chargehive/chtype"
Expand All @@ -15,13 +16,14 @@ 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"`
GooglePay *GooglePayCredentials `json:"googlePay,omitempty" yaml:"googlePay,omitempty"`
ApplePay *ApplePayCredentials `json:"applePay,omitempty" yaml:"applePay,omitempty"`
Environment AdyenEnvironment `json:"environment" yaml:"environment" validate:"required,oneof=sandbox production"`
MerchantAccount string `json:"merchantAccount" yaml:"merchantAccount" validate:"required"`
MerchantDescriptor string `json:"merchantDescriptor" yaml:"merchantDescriptor" validate:"-"`
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
19 changes: 10 additions & 9 deletions connectorconfig/braintree.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ const (

// https://articles.braintreepayments.com/control-panel/important-gateway-credentials
type BraintreeCredentials struct {
PublicKey *string `json:"publicKey" yaml:"publicKey" validate:"required,gt=0"`
PrivateKey *string `json:"privateKey" yaml:"privateKey" validate:"required,gt=0"`
MerchantID string `json:"merchantID" yaml:"merchantID" validate:"required"`
MerchantAccountID string `json:"merchantAccountID" yaml:"merchantAccountID" validate:"-"`
Currency string `json:"currency" yaml:"currency" validate:"oneof=AED AMD AOA ARS AUD AWG AZN BAM BBD BDT BGN BIF BMD BND BOB BRL BSD BWP BYN BZD CAD CHF CLP CNY COP CRC CVE CZK DJF DKK DOP DZD EGP ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR ISK JMD JPY KES KGS KHR KMF KRW KYD KZT LAK LBP LKR LRD LSL LTL MAD MDL MKD MNT MOP MUR MVR MWK MXN MYR MZN NAD NGN NIO NOK NPR NZD PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SEK SGD SHP SLL SOS SRD STD SVC SYP SZL THB TJS TOP TRY TTD TWD TZS UAH UGX USD UYU UZS VES VND VUV WST XAF XCD XOF XPF YER ZAR ZMK ZWD"`
Environment BraintreeEnvironment `json:"environment" yaml:"environment" validate:"oneof=sandbox production"`
GooglePay *GooglePayCredentials `json:"googlePay,omitempty" yaml:"googlePay,omitempty"`
ApplePay *ApplePayCredentials `json:"applePay,omitempty" yaml:"applePay,omitempty"`
TokenizationKey string `json:"tokenizationKey,omitempty" yaml:"tokenizationKey,omitempty" validate:"required_with=GooglePayEmbedded ApplePay,omitempty,gt=0"`
PublicKey *string `json:"publicKey" yaml:"publicKey" validate:"required,gt=0"`
PrivateKey *string `json:"privateKey" yaml:"privateKey" validate:"required,gt=0"`
MerchantID string `json:"merchantID" yaml:"merchantID" validate:"required"`
MerchantAccountID string `json:"merchantAccountID" yaml:"merchantAccountID" validate:"-"`
MerchantDescriptor string `json:"merchantDescriptor" yaml:"merchantDescriptor" validate:"-"`
Currency string `json:"currency" yaml:"currency" validate:"oneof=AED AMD AOA ARS AUD AWG AZN BAM BBD BDT BGN BIF BMD BND BOB BRL BSD BWP BYN BZD CAD CHF CLP CNY COP CRC CVE CZK DJF DKK DOP DZD EGP ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR ISK JMD JPY KES KGS KHR KMF KRW KYD KZT LAK LBP LKR LRD LSL LTL MAD MDL MKD MNT MOP MUR MVR MWK MXN MYR MZN NAD NGN NIO NOK NPR NZD PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SEK SGD SHP SLL SOS SRD STD SVC SYP SZL THB TJS TOP TRY TTD TWD TZS UAH UGX USD UYU UZS VES VND VUV WST XAF XCD XOF XPF YER ZAR ZMK ZWD"`
Environment BraintreeEnvironment `json:"environment" yaml:"environment" validate:"oneof=sandbox production"`
GooglePay *GooglePayCredentials `json:"googlePay,omitempty" yaml:"googlePay,omitempty"`
ApplePay *ApplePayCredentials `json:"applePay,omitempty" yaml:"applePay,omitempty"`
TokenizationKey string `json:"tokenizationKey,omitempty" yaml:"tokenizationKey,omitempty" validate:"required_with=GooglePayEmbedded ApplePay,omitempty,gt=0"`
}

func (c *BraintreeCredentials) GetMID() string {
Expand Down
1 change: 1 addition & 0 deletions connectorconfig/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type CheckoutCredentials struct {
Platform *string `json:"platform" yaml:"platform" validate:"required,oneof=default previous"`
ProcessingChannelID string `json:"processingChannelId" yaml:"processingChannelId"`
MerchantID string `json:"merchantID" yaml:"merchantID" validate:"required"`
MerchantDescriptor string `json:"merchantDescriptor" yaml:"merchantDescriptor" validate:"-"`
Currency string `json:"currency" yaml:"currency" validate:"oneof=AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BHD BIF BMD BND BOB BRL BSD BTN BWP BYN BZD CAD CDF CHF CLF CLP CNY COP CRC CUP CVE CZK DJF DKK DOP DZD EEK EGP ERN ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR IQD IRR ISK JMD JOD JPY KES KGS KHR KMF KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL LTL LVL LYD MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MYR MZN NAD NGN NIO NOK NPR NZD OMR PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SDG SEK SGD SHP SLL SOS SRD STD SVC SYP SZL THB TJS TMT TND TOP TRY TTD TWD TZS UAH UGX USD UYU UZS VEF VND VUV WST XAF XCD XOF XPF YER ZAR ZMW ZWL"`
Environment CheckoutEnvironment `json:"environment" yaml:"environment" validate:"oneof=sandbox production"`
GooglePay *GooglePayCredentials `json:"googlePay,omitempty" yaml:"googlePay,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions connectorconfig/paysafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
type PaySafeCredentials struct {
Acquirer string `json:"acquirer" yaml:"acquirer" validate:"-"`
MerchantURL string `json:"merchantURL" yaml:"merchantURL" validate:"required"`
MerchantDescriptor string `json:"merchantDescriptor" yaml:"merchantDescriptor" validate:"-"`
AccountID string `json:"accountID" yaml:"accountID" validate:"required"`
APIUsername *string `json:"apiUsername" yaml:"apiUsername" validate:"required,gt=0"`
APIPassword *string `json:"apiPassword" yaml:"apiPassword" validate:"required,gt=0"`
Expand Down

0 comments on commit 11155f8

Please sign in to comment.