Class: BaseSendWebhookJob
Instance Method Summary
collapse
Instance Method Details
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/jobs/base_send_webhook_job.rb', line 4
def perform(govpay_id:, status:, callback_url:, signing_secret:)
body = webhook_body(govpay_id:, status:)
Rails.logger.warn "[DefraRubyMocks] [BaseSendWebhookJob] sending #{webhook_type} webhook " \
"for #{govpay_id}, status \"#{status}\" to #{callback_url}"
RestClient::Request.execute(
method: :post,
url: callback_url,
payload: body.to_json,
headers: { "Pay-Signature": webhook_signature(body, signing_secret) }
)
rescue StandardError => e
Rails.logger.error "[DefraRubyMocks] [BaseSendWebhookJob] error sending " \
"#{webhook_type} webhook to #{callback_url}: #{e}"
end
|