Class: DefraRubyMocks::GovpayTestHelpersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DefraRubyMocks::GovpayTestHelpersController
- Includes:
- CanUseAwsS3
- Defined in:
- app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb
Constant Summary
Constants included from CanUseAwsS3
CanUseAwsS3::DEFAULT_LAST_REFUND_REQUEST_TIME
Instance Method Summary collapse
-
#send_payment_webhook ⇒ Object
This schedules a job to send a mock payment webhook.
-
#send_refund_webhook ⇒ Object
This schedules a job to send a mock refund webhook.
-
#set_test_payment_response_status ⇒ Object
The mock will use the value passed in to populate the status field on all future payments.
-
#set_test_refund_response_status ⇒ Object
The mock will use the value passed in to populate the status field on all future refunds.
Instance Method Details
#send_payment_webhook ⇒ Object
This schedules a job to send a mock payment webhook.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb', line 27 def send_payment_webhook Rails.logger.warn "[DefraRubyMocks] [send_payment_webhook] #{params.slice(:govpay_payment_id, :govpay_payment_payment_status)}" %w[govpay_payment_id govpay_payment_status callback_url signing_secret].each do |p| raise StandardError, "Missing parameter: '#{p}'" unless params[p].present? end SendPaymentWebhookJob.perform_later( govpay_payment_id: params[:govpay_payment_id], govpay_payment_status: params[:govpay_payment_status], callback_url: params[:callback_url], signing_secret: params[:signing_secret] ) head 200 end |
#send_refund_webhook ⇒ Object
This schedules a job to send a mock refund webhook.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb', line 46 def send_refund_webhook Rails.logger.warn "[DefraRubyMocks] [send_refund webhook] #{params.slice(:govpay_refund_id, :govpay_payment_id, :govpay_refund_status)}" %w[govpay_payment_id govpay_refund_id govpay_refund_status callback_url signing_secret].each do |p| raise StandardError, "Missing parameter: '#{p}'" unless params[p].present? end SendRefundWebhookJob.perform_later( govpay_payment_id: params[:govpay_payment_id], govpay_refund_id: params[:govpay_refund_id], govpay_refund_status: params[:govpay_refund_status], callback_url: params[:callback_url], signing_secret: params[:signing_secret] ) head 200 end |
#set_test_payment_response_status ⇒ Object
The mock will use the value passed in to populate the status field on all future payments.
13 14 15 16 17 |
# File 'app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb', line 13 def set_test_payment_response_status set_response_status(response_status_filename: "test_payment_response_status", status: params[:status]) head 200 end |
#set_test_refund_response_status ⇒ Object
The mock will use the value passed in to populate the status field on all future refunds.
20 21 22 23 24 |
# File 'app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb', line 20 def set_test_refund_response_status set_response_status(response_status_filename: "test_refund_response_status", status: params[:status]) head 200 end |