configuration

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PreviousSecretKeyPattern string = "^sk_(test_)?(\\w{8})-(\\w{4})-(\\w{4})-(\\w{4})-(\\w{12})$"
	PreviousPublicKeyPattern string = "^pk_(test_)?(\\w{8})-(\\w{4})-(\\w{4})-(\\w{4})-(\\w{12})$"
	DefaultSecretKeyPattern  string = "^sk_(sbox_)?[a-z2-7]{26}[a-z2-7*#$=]$"
	DefaultPublicKeyPattern  string = "^pk_(sbox_)?[a-z2-7]{26}[a-z2-7*#$=]$"
)
View Source
const (
	Vault                       = "vault"
	VaultInstruments            = "vault:instruments"
	VaultTokenization           = "vault:tokenization"
	Gateway                     = "gateway"
	GatewayPayment              = "gateway:payment"
	GatewayPaymentDetails       = "gateway:payment-details"
	GatewayPaymentAuthorization = "gateway:payment-authorizations"
	GatewayPaymentVoids         = "gateway:payment-voids"
	GatewayPaymentCaptures      = "gateway:payment-captures"
	GatewayPaymentRefunds       = "gateway:payment-refunds"
	Fx                          = "fx"
	PayoutsBankDetails          = "payouts:bank-details"
	SessionsApp                 = "sessions:app"
	SessionsBrowser             = "sessions:browser"
	Disputes                    = "disputes"
	DisputesView                = "disputes:view"
	DisputesProvideEvidence     = "disputes:provide-evidence"
	DisputesAccept              = "disputes:accept"
	DisputesSchemeFiles         = "disputes:scheme-files"
	Marketplace                 = "marketplace"
	Accounts                    = "accounts"
	Flow                        = "flow"
	FlowWorkflows               = "flow:workflows"
	FlowEvents                  = "flow:events"
	Files                       = "files"
	FilesRetrieve               = "files:retrieve"
	FilesUpload                 = "files:upload"
	FilesDownload               = "files:download"
	Transfers                   = "transfers"
	TransfersCreate             = "transfers:create"
	TransfersView               = "transfers:view"
	Balances                    = "balances"
	BalancesView                = "balances:view"
	Middleware                  = "middleware"
	MiddlewareGateway           = "middleware:gateway"
	MiddlewarePaymentContext    = "middleware:payment-context"
	MiddlewareMerchantsSecret   = "middleware:merchants-secret"
	MiddlewareMerchantsPublic   = "middleware:merchants-public"
	Reports                     = "reports"
	ReportsView                 = "reports:view"
	VaultCardMetadata           = "vault:card-metadata"
	FinancialActions            = "financial-actions"
	FinancialActionsView        = "financial-actions:view"
	IssuingClient               = "issuing:client"
	IssuingCardMgmt             = "issuing:card-mgmt"
	IssuingControlsRead         = "issuing:controls-read"
	IssuingControlsWrite        = "issuing:controls-write"
	PaymentContexts             = "Payment Contexts"
)

Variables

This section is empty.

Functions

func DefaultLogger

func DefaultLogger() *log.Logger

Types

type AuthorizationType

type AuthorizationType string
const (
	PublicKey        AuthorizationType = "PUBLIC_KEY"
	SecretKey        AuthorizationType = "SECRET_KEY"
	PublicKeyOrOauth AuthorizationType = "PUBLIC_KEY_OR_OAUTH"
	SecretKeyOrOauth AuthorizationType = "SECRET_KEY_OR_OAUTH"
	OAuth            AuthorizationType = "OAUTH"
	CustomAuth       AuthorizationType = "CUSTOM"
)

type CheckoutEnv

type CheckoutEnv struct {
	// contains filtered or unexported fields
}

func NewEnvironment

func NewEnvironment(
	baseUri string,
	authorizationUri string,
	filesUri string,
	transfersUri string,
	balancesUri string,
	isSandbox bool,
) *CheckoutEnv

func Production

func Production() *CheckoutEnv

func Sandbox

func Sandbox() *CheckoutEnv

func (*CheckoutEnv) AuthorizationUri

func (e *CheckoutEnv) AuthorizationUri() string

func (*CheckoutEnv) BalancesUri

func (e *CheckoutEnv) BalancesUri() string

func (*CheckoutEnv) BaseUri

func (e *CheckoutEnv) BaseUri() string

func (*CheckoutEnv) FilesUri

func (e *CheckoutEnv) FilesUri() string

func (*CheckoutEnv) IsSandbox

func (e *CheckoutEnv) IsSandbox() bool

func (*CheckoutEnv) TransfersUri

func (e *CheckoutEnv) TransfersUri() string

type Configuration

type Configuration struct {
	Credentials          SdkCredentials
	EnableTelemetry      bool
	Environment          Environment
	EnvironmentSubdomain *EnvironmentSubdomain
	HttpClient           http.Client
	Logger               StdLogger
}

func NewConfiguration

func NewConfiguration(
	credentials SdkCredentials,
	enableTelemertry *bool,
	environment Environment,
	client *http.Client,
	logger StdLogger,
) *Configuration

func NewConfigurationWithSubdomain added in v1.1.0

func NewConfigurationWithSubdomain(
	credentials SdkCredentials,
	environment Environment,
	environmentSubdomain *EnvironmentSubdomain,
	client *http.Client,
	logger StdLogger,
) *Configuration

type DefaultKeysSdkCredentials

type DefaultKeysSdkCredentials struct {
	StaticKeys
}

func NewDefaultKeysSdkCredentials

func NewDefaultKeysSdkCredentials(secretKey string, publicKey string) *DefaultKeysSdkCredentials

func (*DefaultKeysSdkCredentials) GetAuthorization

func (f *DefaultKeysSdkCredentials) GetAuthorization(authorizationType AuthorizationType) (*SdkAuthorization, error)

type Environment

type Environment interface {
	BaseUri() string
	AuthorizationUri() string
	FilesUri() string
	TransfersUri() string
	BalancesUri() string
	IsSandbox() bool
}

type EnvironmentSubdomain added in v1.1.0

type EnvironmentSubdomain struct {
	ApiUrl string
}

func NewEnvironmentSubdomain added in v1.1.0

func NewEnvironmentSubdomain(environment Environment, subdomain string) *EnvironmentSubdomain

type OAuthAccessToken

type OAuthAccessToken struct {
	Token          string
	ExpirationDate time.Time
}

func (*OAuthAccessToken) IsValid

func (t *OAuthAccessToken) IsValid() bool

type OAuthSdkCredentials

type OAuthSdkCredentials struct {
	//HttpClient
	ClientId         string
	ClientSecret     string
	AuthorizationUri string
	Scopes           []string
	AccessToken      *OAuthAccessToken
	Log              StdLogger
}

func NewOAuthSdkCredentials

func NewOAuthSdkCredentials(
	clientId,
	clientSecret,
	authorizationUri string,
	scopes []string,
	logger StdLogger,
) (*OAuthSdkCredentials, error)

func (*OAuthSdkCredentials) GetAccessToken

func (f *OAuthSdkCredentials) GetAccessToken() error

func (*OAuthSdkCredentials) GetAuthorization

func (f *OAuthSdkCredentials) GetAuthorization(authorizationType AuthorizationType) (*SdkAuthorization, error)

type OAuthServiceResponse

type OAuthServiceResponse struct {
	AccessToken string        `json:"access_token,omitempty"`
	ExpiresIn   time.Duration `json:"expires_in,omitempty"`
}

type PlatformType

type PlatformType string
const (
	Previous     PlatformType = "PREVIOUS"
	Default      PlatformType = "DEFAULT"
	DefaultOAuth PlatformType = "DEFAULT_OAUTH"
	Custom       PlatformType = "CUSTOM"
)

type PreviousKeysSdkCredentials

type PreviousKeysSdkCredentials struct {
	StaticKeys
}

func NewPreviousKeysSdkCredentials

func NewPreviousKeysSdkCredentials(secretKey string, publicKey string) *PreviousKeysSdkCredentials

func (*PreviousKeysSdkCredentials) GetAuthorization

func (c *PreviousKeysSdkCredentials) GetAuthorization(authorizationType AuthorizationType) (*SdkAuthorization, error)

type SdkAuthorization

type SdkAuthorization struct {
	PlatformType PlatformType
	Credential   string
}

func (*SdkAuthorization) GetAuthorizationHeader

func (s *SdkAuthorization) GetAuthorizationHeader() (string, error)

type SdkBuilder

type SdkBuilder struct {
	EnableTelemetry      *bool
	Environment          Environment
	EnvironmentSubdomain *EnvironmentSubdomain
	HttpClient           *http.Client
	Logger               StdLogger
}

func (*SdkBuilder) GetConfiguration

func (s *SdkBuilder) GetConfiguration(string, string) *Configuration

type SdkCredentials

type SdkCredentials interface {
	GetAuthorization(authorizationType AuthorizationType) (*SdkAuthorization, error)
}

type StaticKeys

type StaticKeys struct {
	SecretKey string
	PublicKey string
}

type StaticKeysBuilder

type StaticKeysBuilder struct {
	SdkBuilder
	PublicKey string
	SecretKey string
}

func (*StaticKeysBuilder) ValidatePublicKey

func (s *StaticKeysBuilder) ValidatePublicKey(regex string) error

func (*StaticKeysBuilder) ValidateSecretKey

func (s *StaticKeysBuilder) ValidateSecretKey(regex string) error

type StdLogger

type StdLogger interface {
	Print(...interface{})
	Printf(string, ...interface{})
	Println(...interface{})

	Fatal(...interface{})
	Fatalf(string, ...interface{})
	Fatalln(...interface{})

	Panic(...interface{})
	Panicf(string, ...interface{})
	Panicln(...interface{})
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL