Class: UnivapayClientSdk::TokenCvvAuthCheckUpdatedHandler
- Inherits:
-
Object
- Object
- UnivapayClientSdk::TokenCvvAuthCheckUpdatedHandler
- Includes:
- CoreLibrary
- Defined in:
- lib/univapay_client_sdk/events/webhooks/token_cvv_auth_check_updated_handler.rb
Overview
TokenCvvAuthCheckUpdatedHandler is responsible for verifying request signatures and parsing incoming tokenCvvAuthCheckUpdated events into strongly typed objects.
Instance Method Summary collapse
-
#initialize ⇒ TokenCvvAuthCheckUpdatedHandler
constructor
Creates a new instance of the TokenCvvAuthCheckUpdatedHandler.
-
#parse_event(request) ⇒ Object
Parse the event.
Constructor Details
#initialize ⇒ TokenCvvAuthCheckUpdatedHandler
Creates a new instance of the TokenCvvAuthCheckUpdatedHandler.
12 |
# File 'lib/univapay_client_sdk/events/webhooks/token_cvv_auth_check_updated_handler.rb', line 12 def initialize; end |
Instance Method Details
#parse_event(request) ⇒ Object
Parse the event.
@return[TokenCvvAuthCheckUpdatedWebhookCallback, UnknownEvent] TokenCvvAuthCheckUpdatedWebhookCallback for successful parsing;
UnknownEvent for unknown events.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/univapay_client_sdk/events/webhooks/token_cvv_auth_check_updated_handler.rb', line 21 def parse_event(request) return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash) raw_body = RackRequestHelper.read_raw_body(request) return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty? # Deserialize payload begin union = UnionTypeLookUp.get(:TokenCvvAuthCheckUpdated) raw = RackRequestHelper.read_raw_body(request) APIHelper.deserialize_union_type(union, raw, false, true) rescue StandardError => e UnknownEvent.new(['Deserialization failed.', e.]) end end |