github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/webhooks/APIVersionMismatchError.go (about) 1 package webhooks 2 3 import ( 4 "github.com/Ingenico-ePayments/connect-sdk-go/webhooks/validation" 5 ) 6 7 // APIVersionMismatchError represents an error because a webhooks event has an API version 8 // that this version of the SDK does not support. 9 type APIVersionMismatchError struct { 10 error *validation.APIVersionMismatchError 11 } 12 13 // Error implements the error interface 14 func (ame *APIVersionMismatchError) Error() string { 15 return ame.error.Error() 16 } 17 18 // EventAPIVersion represents the APIVersion found in the event 19 func (ame *APIVersionMismatchError) EventAPIVersion() string { 20 return ame.error.EventAPIVersion() 21 } 22 23 // SDKAPIVersion represents the APIVersion found in the SDK 24 func (ame *APIVersionMismatchError) SDKAPIVersion() string { 25 return ame.error.SDKAPIVersion() 26 } 27 28 // NewAPIVersionMismatchError creates a APIVersionMismatchError with the given eventAPIVersion and sdkAPIVersion 29 func NewAPIVersionMismatchError(eventAPIVersion, sdkAPIVersion string) (*APIVersionMismatchError, error) { 30 err := validation.NewAPIVersionMismatchError(eventAPIVersion, sdkAPIVersion) 31 32 return &APIVersionMismatchError{err}, nil 33 }