Class: Spree::SolidusSixSaferpay::PaymentNotFoundHandler

Inherits:
Object
  • Object
show all
Defined in:
app/services/spree/solidus_six_saferpay/payment_not_found_handler.rb

Overview

This handler can be overridden by host applications to manage control flow if no payment can be found when SIX Saferpay performs the callback request after the user submits a payment. If not overridden, the handler will simply trigger an error.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller_context:, order:) ⇒ PaymentNotFoundHandler

Returns a new instance of PaymentNotFoundHandler.



16
17
18
19
# File 'app/services/spree/solidus_six_saferpay/payment_not_found_handler.rb', line 16

def initialize(controller_context:, order:)
  @controller_context = controller_context
  @order = order
end

Instance Attribute Details

#controller_contextObject (readonly)

Returns the value of attribute controller_context.



10
11
12
# File 'app/services/spree/solidus_six_saferpay/payment_not_found_handler.rb', line 10

def controller_context
  @controller_context
end

#orderObject (readonly)

Returns the value of attribute order.



10
11
12
# File 'app/services/spree/solidus_six_saferpay/payment_not_found_handler.rb', line 10

def order
  @order
end

Class Method Details

.call(controller_context:, order:) ⇒ Object



12
13
14
# File 'app/services/spree/solidus_six_saferpay/payment_not_found_handler.rb', line 12

def self.call(controller_context:, order:)
  new(controller_context: controller_context, order: order).call
end

Instance Method Details

#callObject



21
22
23
24
25
# File 'app/services/spree/solidus_six_saferpay/payment_not_found_handler.rb', line 21

def call
  ::SolidusSixSaferpay::ErrorHandler.handle(
    StandardError.new("No Saferpay Payment found for order #{order.number}")
  )
end