Class: DefraRubyMocks::WorldpayController

Inherits:
ApplicationController show all
Defined in:
app/controllers/defra_ruby_mocks/worldpay_controller.rb

Instance Method Summary collapse

Instance Method Details

#dispatcherObject



17
18
19
20
21
22
# File 'app/controllers/defra_ruby_mocks/worldpay_controller.rb', line 17

def dispatcher
  success_url = params[:successURL]
  redirect_to WorldpayResponseService.run(success_url)
rescue StandardError
  head 500
end

#payments_serviceObject



8
9
10
11
12
13
14
15
# File 'app/controllers/defra_ruby_mocks/worldpay_controller.rb', line 8

def payments_service
  @values = WorldpayRequestHandlerService.run(convert_request_body_to_xml)

  render_payment_response if @values[:request_type] == :payment
  render_refund_response if @values[:request_type] == :refund
rescue StandardError
  head 500
end