Class: SpreeAdyen::PaymentSetupSessions::HandleAuthorisation
- Inherits:
-
Object
- Object
- SpreeAdyen::PaymentSetupSessions::HandleAuthorisation
- Defined in:
- app/services/spree_adyen/payment_setup_sessions/handle_authorisation.rb
Overview
Processes an AUTHORISATION webhook for a zero-auth (tokenization-only) setup session. Creates the payment source from the stored payment method ID and transitions the session. Idempotent — safe to invoke for retries.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(setup_session:, event:) ⇒ HandleAuthorisation
constructor
A new instance of HandleAuthorisation.
Constructor Details
#initialize(setup_session:, event:) ⇒ HandleAuthorisation
Returns a new instance of HandleAuthorisation.
7 8 9 10 11 12 |
# File 'app/services/spree_adyen/payment_setup_sessions/handle_authorisation.rb', line 7 def initialize(setup_session:, event:) @setup_session = setup_session @event = event @gateway = setup_session.payment_method @user = setup_session.customer end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/spree_adyen/payment_setup_sessions/handle_authorisation.rb', line 14 def call return setup_session if setup_session.completed? Rails.logger.info("[SpreeAdyen][setup_session=#{setup_session.id}][#{event.psp_reference}]: Processing setup authorisation") if event.success? handle_success else handle_failure end setup_session end |