Documentation ¶
Index ¶
- Constants
- Variables
- func CacheExpires(r *http.Response) time.Time
- func PtrBool(v bool) *bool
- func PtrFloat32(v float32) *float32
- func PtrFloat64(v float64) *float64
- func PtrInt(v int) *int
- func PtrInt32(v int32) *int32
- func PtrInt64(v int64) *int64
- func PtrString(v string) *string
- func PtrTime(v time.Time) *time.Time
- func SelectHeaderAccept(accepts []string) string
- func SelectHeaderContentType(contentTypes []string) string
- type APIError
- type APIKey
- type APIResponse
- type BasicAuth
- type Client
- func (c *Client) CallAPI(request *http.Request) (*http.Response, error)
- func (c *Client) Decode(v interface{}, b []byte, contentType string) (err error)
- func (c *Client) MakeHTTPPostRequest(req interface{}, res interface{}, path string, ctxs ...context.Context) (*http.Response, error)
- func (c *Client) PrepareRequest(ctx context.Context, path string, method string, postBody interface{}, ...) (localVarRequest *http.Request, err error)
- type Config
- type Environment
- type NullableBool
- type NullableFloat32
- type NullableFloat64
- type NullableInt
- type NullableInt32
- type NullableInt64
- type NullableString
- type NullableTime
- type ResultCode
- type Service
Constants ¶
const ( LibName = "adyen-go-api-library" LibVersion = "2.0.0" )
Variables ¶
var ( // ContextOAuth2 takes an oauth2.TokenSource as authentication for the Request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the Request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the Request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the Request ContextAPIKey = contextKey("apikey") )
var ErrInvalidNullable = errors.New("nullable cannot have non-zero Value and ExplicitNull simultaneously")
var ResultCodeValues = [...]string{
"AuthenticationFinished",
"AuthenticationNotRequired",
"Authorised",
"Cancelled",
"ChallengeShopper",
"Error",
"IdentifyShopper",
"Pending",
"PresentToShopper",
"Received",
"RedirectShopper",
"Refused",
}
ResultCodeValues should be in same order as the const defined above
Functions ¶
func CacheExpires ¶
CacheExpires helper function to determine remaining time before repeating a Request.
func PtrFloat32 ¶
PtrFloat32 is a helper routine that returns a pointer to given float value.
func PtrFloat64 ¶
PtrFloat64 is a helper routine that returns a pointer to given float value.
func SelectHeaderAccept ¶
SelectHeaderAccept join all accept types and return
func SelectHeaderContentType ¶
SelectHeaderContentType select a content type from the available list.
Types ¶
type APIError ¶
type APIError struct { RawBody []byte Err string Status float64 Message string Code string Type string }
APIError Provides access to the body, error and model on returned errors.
func NewAPIError ¶
NewAPIError returns a new error instance
type APIKey ¶
APIKey provides API key based authentication to a Request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the OpenAPI operation. Operation string `json:"operation,omitempty"` // RequestURL is the Request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the Request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the Response body (which may be nil or empty). // This is provided here as the raw Response.Body() reader will have already // been drained. Payload []byte `json:"-"` }
APIResponse stores the API Response returned by the server.
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
NewAPIResponse returns a new APIResonse object.
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
type BasicAuth ¶
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth provides basic http authentication to a Request passed via context using ContextBasicAuth
type Client ¶
type Client struct {
Cfg *Config
}
Client manages communication with the Adyen API In most cases there should be only one, shared, APIClient.
type Config ¶
type Config struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` MerchantAccount string `json:"merchantAccount,omitempty"` Environment Environment `json:"environment,omitempty"` Endpoint string `json:"endpoint,omitempty"` MarketPayEndpoint string `json:"marketPayEndpoint,omitempty"` ApiKey string `json:"apiKey,omitempty"` ConnectionTimeoutMillis time.Duration `json:"connectionTimeoutMillis,omitempty"` CertificatePath string `json:"certificatePath,omitempty"` //Checkout Specific CheckoutEndpoint string `json:"checkoutEndpoint,omitempty"` //Terminal API Specific TerminalApiCloudEndpoint string `json:"terminalApiCloudEndpoint,omitempty"` TerminalApiLocalEndpoint string `json:"terminalApiLocalEndpoint,omitempty"` TerminalCertificatePath string `json:"terminalCertificatePath,omitempty"` LiveEndpointURLPrefix string `json:"liveEndpointURLPrefix,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` Debug bool `json:"debug,omitempty"` UserAgent string `json:"userAgent,omitempty"` HTTPClient *http.Client }
Config stores the configuration of the API client
func (*Config) AddDefaultHeader ¶
AddDefaultHeader adds a new HTTP header to the default header in the Request
func (*Config) GetCheckoutEndpoint ¶
type Environment ¶
type Environment string
const ( TestEnv Environment = "TEST" LiveEnv Environment = "LIVE" )
type NullableBool ¶
func (NullableBool) MarshalJSON ¶
func (v NullableBool) MarshalJSON() ([]byte, error)
func (*NullableBool) UnmarshalJSON ¶
func (v *NullableBool) UnmarshalJSON(src []byte) error
type NullableFloat32 ¶
func (NullableFloat32) MarshalJSON ¶
func (v NullableFloat32) MarshalJSON() ([]byte, error)
func (*NullableFloat32) UnmarshalJSON ¶
func (v *NullableFloat32) UnmarshalJSON(src []byte) error
type NullableFloat64 ¶
func (NullableFloat64) MarshalJSON ¶
func (v NullableFloat64) MarshalJSON() ([]byte, error)
func (*NullableFloat64) UnmarshalJSON ¶
func (v *NullableFloat64) UnmarshalJSON(src []byte) error
type NullableInt ¶
func (NullableInt) MarshalJSON ¶
func (v NullableInt) MarshalJSON() ([]byte, error)
func (*NullableInt) UnmarshalJSON ¶
func (v *NullableInt) UnmarshalJSON(src []byte) error
type NullableInt32 ¶
func (NullableInt32) MarshalJSON ¶
func (v NullableInt32) MarshalJSON() ([]byte, error)
func (*NullableInt32) UnmarshalJSON ¶
func (v *NullableInt32) UnmarshalJSON(src []byte) error
type NullableInt64 ¶
func (NullableInt64) MarshalJSON ¶
func (v NullableInt64) MarshalJSON() ([]byte, error)
func (*NullableInt64) UnmarshalJSON ¶
func (v *NullableInt64) UnmarshalJSON(src []byte) error
type NullableString ¶
func (NullableString) MarshalJSON ¶
func (v NullableString) MarshalJSON() ([]byte, error)
func (*NullableString) UnmarshalJSON ¶
func (v *NullableString) UnmarshalJSON(src []byte) error
type NullableTime ¶
func (NullableTime) MarshalJSON ¶
func (v NullableTime) MarshalJSON() ([]byte, error)
func (*NullableTime) UnmarshalJSON ¶
func (v *NullableTime) UnmarshalJSON(src []byte) error
type ResultCode ¶
type ResultCode int
const ( AuthenticationFinished ResultCode = iota AuthenticationNotRequired Authorised Cancelled ChallengeShopper Error IdentifyShopper Pending PresentToShopper Received RedirectShopper Refused )
func ResultCodeFromString ¶
func ResultCodeFromString(value string) (ResultCode, error)
func (*ResultCode) MarshalJSON ¶
func (s *ResultCode) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (ResultCode) String ¶
func (s ResultCode) String() string
func (*ResultCode) UnmarshalJSON ¶
func (s *ResultCode) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals a quoted json string to the enum value