Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNilMarshaller occurs when the provided marshaller is nil ErrNilMarshaller = errors.New("nil marshaller") // ErrNilSecretKeyStore occurs when the provided secretKeyStore is nil // Deprecated: use validation.ErrNilSecretKeyStore instead ErrNilSecretKeyStore = validation.ErrNilSecretKeyStore )
var ( // ErrInvalidKey occurs when the keyID is empty ErrInvalidKey = errors.New("invalid keyID") // ErrInvalidSecret occurs when the given secretKey is empty ErrInvalidSecret = errors.New("invalid secret") )
Functions ¶
This section is empty.
Types ¶
type APIVersionMismatchError ¶
type APIVersionMismatchError struct {
// contains filtered or unexported fields
}
APIVersionMismatchError represents an error because a webhooks event has an API version that this version of the SDK does not support.
func NewAPIVersionMismatchError ¶
func NewAPIVersionMismatchError(eventAPIVersion, sdkAPIVersion string) (*APIVersionMismatchError, error)
NewAPIVersionMismatchError creates a APIVersionMismatchError with the given eventAPIVersion and sdkAPIVersion
func (*APIVersionMismatchError) Error ¶
func (ame *APIVersionMismatchError) Error() string
Error implements the error interface
func (*APIVersionMismatchError) EventAPIVersion ¶
func (ame *APIVersionMismatchError) EventAPIVersion() string
EventAPIVersion represents the APIVersion found in the event
func (*APIVersionMismatchError) SDKAPIVersion ¶
func (ame *APIVersionMismatchError) SDKAPIVersion() string
SDKAPIVersion represents the APIVersion found in the SDK
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
Helper is the Ingenico ePayments platform webhooks helper. Immutable and thread-safe.
func CreateHelper ¶
func CreateHelper(secretKeyStore SecretKeyStore) (*Helper, error)
CreateHelper creates a Helper that will use the given secretKeyStore
func NewHelper ¶
func NewHelper(marshaller communicator.Marshaller, secretKeyStore SecretKeyStore) (*Helper, error)
NewHelper creates an Helper with the given marshaller and secretKeyStore
func (*Helper) Unmarshal ¶
func (h *Helper) Unmarshal(body string, requestHeaders []communication.Header) (*webhooks.Event, error)
Unmarshal unmarshalls the given body and validates it using the requestHeaders
Can return any of the following errors: SignatureValidationError if the body could not be validated successfully APIVersionMismatchError if the resulting event has an API version that this version of the SDK does not support
type HelperBuilder ¶
type HelperBuilder struct { Marshaller communicator.Marshaller SecretKeyStore SecretKeyStore }
HelperBuilder is used to build Helper objects
func CreateHelperBuilder ¶
func CreateHelperBuilder(secretKeyStore SecretKeyStore) (*HelperBuilder, error)
CreateHelperBuilder creates a HelperBuilder that will use the given secretKeyStore
func NewHelperBuilder ¶
func NewHelperBuilder() *HelperBuilder
NewHelperBuilder creates a HelperBuilder object
func (*HelperBuilder) Build ¶
func (h *HelperBuilder) Build() (*Helper, error)
Build creates the Helper object
func (*HelperBuilder) WithMarshaller ¶
func (h *HelperBuilder) WithMarshaller(marshaller communicator.Marshaller) *HelperBuilder
WithMarshaller sets the marshaller
func (*HelperBuilder) WithSecretKeyStore ¶
func (h *HelperBuilder) WithSecretKeyStore(secretKeyStore SecretKeyStore) *HelperBuilder
WithSecretKeyStore sets the secretKeyStore
type InMemorySecretKeyStore ¶
type InMemorySecretKeyStore struct{}
InMemorySecretKeyStore is an in-memory secret key store. This implementation can be used in applications where secret keys can be specified at application startup. Thread-safe.
func NewInMemorySecretKeyStore ¶
func NewInMemorySecretKeyStore() (*InMemorySecretKeyStore, error)
NewInMemorySecretKeyStore returns the singleton instance of the InMemorySecretKeyStore
func (*InMemorySecretKeyStore) Clear ¶
func (ks *InMemorySecretKeyStore) Clear()
Clear empties the key store
func (*InMemorySecretKeyStore) GetSecretKey ¶
func (ks *InMemorySecretKeyStore) GetSecretKey(keyID string) (string, error)
GetSecretKey returns the secretKey associated with the given keyID
Can return any of the following errors: SecretKeyNotAvailableError if there is no secretKey with the given keyID
func (*InMemorySecretKeyStore) RemoveSecretKey ¶
func (ks *InMemorySecretKeyStore) RemoveSecretKey(keyID string)
RemoveSecretKey removes the given keyID and it's associated secretKey
func (*InMemorySecretKeyStore) StoreSecretKey ¶
func (ks *InMemorySecretKeyStore) StoreSecretKey(keyID, secretKey string) error
StoreSecretKey stores the given keyID, secretKey pair
Can return any of the following errors: ErrInvalidKey if the keyID is empty ErrInvalidSecret if the secretKey is empty
type SecretKeyNotAvailableError ¶
type SecretKeyNotAvailableError struct {
// contains filtered or unexported fields
}
SecretKeyNotAvailableError represents an error that causes a secret key to not be available.
func NewSecretKeyNotAvailableError ¶
func NewSecretKeyNotAvailableError(keyID string) (*SecretKeyNotAvailableError, error)
NewSecretKeyNotAvailableError creates a SecretKeyNotAvailableError with the given keyID
func (*SecretKeyNotAvailableError) Error ¶
func (ske *SecretKeyNotAvailableError) Error() string
Error implements the Error interface
func (*SecretKeyNotAvailableError) KeyID ¶
func (ske *SecretKeyNotAvailableError) KeyID() string
KeyID returns the keyID which produced the error
type SecretKeyStore ¶
type SecretKeyStore validation.SecretKeyStore
SecretKeyStore represents a store of secret keys. Implementations could store secret keys in a database, on disk, etc. Thread-safe.
type SignatureValidationError ¶
type SignatureValidationError struct {
// contains filtered or unexported fields
}
SignatureValidationError represents an error while validating webhooks signatures.
func NewSignatureValidationError ¶
func NewSignatureValidationError(message string) (*SignatureValidationError, error)
NewSignatureValidationError creates a SignatureValidationError with the given message
func (*SignatureValidationError) Error ¶
func (sve *SignatureValidationError) Error() string
Error implements the Error interface