defaultimpl

package
v0.0.0-...-1f8cd32 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: BSD-3-Clause, MIT Imports: 24 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// V1HMAC represent the authorization type for the HMAC algorithm, version 1
	V1HMAC = "v1HMAC"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationType

type AuthorizationType string

AuthorizationType represents the type of authentication that is used. Here only v1HMAC

type DefaultAuthenticator

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

DefaultAuthenticator represents the default implementation of an authenticator

func NewDefaultAuthenticator

func NewDefaultAuthenticator(authType AuthorizationType, apiKeyID string, secretAPIKey string) (*DefaultAuthenticator, error)

NewDefaultAuthenticator creates a DefaultAuthenticator with the given authType, apiKeyID and secretAPIKey

  • Based on the Authenticationtype value both the Ingenico ePayments platform and the merchant know which security implementation is used. A version number is used for backward compatibility in the future.
  • The apiKeyID is an identifier for the secret API key. The apiKeyID can be retrieved from the Configuration Center This identifier is visible in the HTTP request and is also used to identify the correct account.
  • secretAPIKey is a shared secret. The shared secret can be retrieved from the Configuration Center. An apiKeyID and secretAPIKey always go hand-in-hand, the difference is that secretAPIKey is never visible in the HTTP request. This secret is used as input for the HMAC algorithm.

func (DefaultAuthenticator) CreateSimpleAuthenticationSignature

func (a DefaultAuthenticator) CreateSimpleAuthenticationSignature(httpMethod string, resourceURI url.URL, requestHeaders []communication.Header) (output string, err error)

CreateSimpleAuthenticationSignature creates an authentication signature for the given httpMethod, resourceURI and requestHeaders

type DefaultConnection

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

DefaultConnection is the default implementation for the connection interface. Supports Pooling, and is thread safe.

func NewDefaultConnection

func NewDefaultConnection(socketTimeout, connectTimeout, keepAliveTimeout, idleTimeout time.Duration, maxConnections int, proxy *url.URL) (*DefaultConnection, error)

NewDefaultConnection creates a new object that implements Connection, and initializes it

func (*DefaultConnection) Close

func (c *DefaultConnection) Close() error

Close implements the io.Closer interface

func (*DefaultConnection) CloseExpiredConnections

func (c *DefaultConnection) CloseExpiredConnections()

CloseExpiredConnections closes all expired HTTP connections.

func (*DefaultConnection) CloseIdleConnections

func (c *DefaultConnection) CloseIdleConnections(t time.Duration)

CloseIdleConnections closes all HTTP connections that have been idle for the specified time. This should also include all expired HTTP connections. timespan represents the time spent idle Note: in the current implementation, it is only possible to close the connection after a predetermined time Therefore, this implementation ignores the parameter, and instead uses the preconfigured one

func (*DefaultConnection) Delete

func (c *DefaultConnection) Delete(uri url.URL, headerList []communication.Header, handler communication.ResponseHandler) (interface{}, error)

Delete sends a DELETE request to the Ingenico ePayments platform and calls the given response handler with the response.

func (*DefaultConnection) DisableLogging

func (c *DefaultConnection) DisableLogging()

DisableLogging implements the logging.Capable interface Disables logging

func (*DefaultConnection) EnableLogging

func (c *DefaultConnection) EnableLogging(l logging.CommunicatorLogger)

EnableLogging implements the logging.Capable interface Enables logging to the given CommunicatorLogger

func (*DefaultConnection) Get

func (c *DefaultConnection) Get(uri url.URL, headerList []communication.Header, handler communication.ResponseHandler) (interface{}, error)

Get sends a GET request to the Ingenico ePayments platform and calls the given response handler with the response.

func (*DefaultConnection) Post

func (c *DefaultConnection) Post(uri url.URL, headerList []communication.Header, body string, handler communication.ResponseHandler) (interface{}, error)

Post sends a POST request to the Ingenico ePayments platform and calls the given response handler with the response.

func (*DefaultConnection) PostMultipart

func (c *DefaultConnection) PostMultipart(uri url.URL, headerList []communication.Header, body *communication.MultipartFormDataObject, handler communication.ResponseHandler) (interface{}, error)

PostMultipart sends a multipart/form-data POST request to the Ingenico ePayments platform and calls the given response handler with the response.

func (*DefaultConnection) Put

func (c *DefaultConnection) Put(uri url.URL, headerList []communication.Header, body string, handler communication.ResponseHandler) (interface{}, error)

Put sends a PUT request to the Ingenico ePayments platform and returns the response.

func (*DefaultConnection) PutMultipart

func (c *DefaultConnection) PutMultipart(uri url.URL, headerList []communication.Header, body *communication.MultipartFormDataObject, handler communication.ResponseHandler) (interface{}, error)

PutMultipart sends a multipart/form-data POST request to the Ingenico ePayments platform and calls the given response handler with the response.

func (*DefaultConnection) SetBodyObfuscator

func (c *DefaultConnection) SetBodyObfuscator(bodyObfuscator obfuscation.BodyObfuscator)

SetBodyObfuscator sets the body obfuscator to use.

func (*DefaultConnection) SetHeaderObfuscator

func (c *DefaultConnection) SetHeaderObfuscator(headerObfuscator obfuscation.HeaderObfuscator)

SetHeaderObfuscator sets the header obfuscator to use.

type DefaultMarshaller

type DefaultMarshaller struct {
}

DefaultMarshaller represents the default implementation of the JSON Marshaller

func NewDefaultMarshaller

func NewDefaultMarshaller() (*DefaultMarshaller, error)

NewDefaultMarshaller creates a DefaultMarshaller

func (*DefaultMarshaller) Marshal

func (m *DefaultMarshaller) Marshal(v interface{}) (string, error)

Marshal encodes the given value using json.Marshal

func (*DefaultMarshaller) Unmarshal

func (m *DefaultMarshaller) Unmarshal(data string, v interface{}) error

Unmarshal decodes the given data into the given value using json.Unmarshal

func (*DefaultMarshaller) UnmarshalFromReader

func (m *DefaultMarshaller) UnmarshalFromReader(reader io.Reader, v interface{}) error

UnmarshalFromReader decodes the data from the given reader into the given value using json.NewDecoder

Jump to

Keyboard shortcuts

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