Class: DefraRubyMocks::GovpayTestHelpersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DefraRubyMocks::GovpayTestHelpersController
- Defined in:
- app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb
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.
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 29 def send_payment_webhook Rails.logger.warn "MOCKS: Sending payment webhook for #{params[:govpay_id]}, status #{params[:payment_status]}" %w[govpay_id payment_status callback_url signing_secret].each do |p| raise StandardError, "Missing parameter: '#{p}'" unless params[p].present? end SendPaymentWebhookJob.perform_later( govpay_id: params[:govpay_id], status: params[: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 |
# File 'app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb', line 46 def send_refund_webhook Rails.logger.warn "MOCKS: Sending refund webhook for #{params[:govpay_id]}, status #{params[:refund_status]}" %w[govpay_id refund_status callback_url signing_secret].each do |p| raise StandardError, "Missing parameter: '#{p}'" unless params[p].present? end SendRefundWebhookJob.perform_later( govpay_id: params[:govpay_id], status: params[: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.
11 12 13 14 15 16 17 |
# File 'app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb', line 11 def set_test_payment_response_status Rails.logger.info "MOCKS: Setting payment response status to #{params[:status]}" AwsBucketService.write(s3_bucket_name, "test_payment_response_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 25 26 |
# File 'app/controllers/defra_ruby_mocks/govpay_test_helpers_controller.rb', line 20 def set_test_refund_response_status Rails.logger.info "MOCKS: Setting refund response status to #{params[:status]}" AwsBucketService.write(s3_bucket_name, "test_refund_response_status", params[:status]) head 200 end |