Class: Spree::SolidusSixSaferpay::OrderNotFoundHandler

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

Overview

This handler can be overridden by host applications to manage control flow if no order 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_number:) ⇒ OrderNotFoundHandler

Returns a new instance of OrderNotFoundHandler.



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

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

Instance Attribute Details

#controller_contextObject (readonly)

Returns the value of attribute controller_context.



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

def controller_context
  @controller_context
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



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

def order_number
  @order_number
end

Class Method Details

.call(controller_context:, order_number:) ⇒ Object



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

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

Instance Method Details

#callObject



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

def call
  ::SolidusSixSaferpay::ErrorHandler.handle(
    StandardError.new("No solidus order could be found for number #{order_number}")
  )
end