mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
refactor: add user agent header in outgoing webhooks (#6289)
Co-authored-by: Mrudul Vajpayee <mrudul.vajpayee@mrudulvajpayee-XJWXCWP7HF.local>
This commit is contained in:
@ -13,6 +13,7 @@ use common_utils::{
|
|||||||
use diesel_models::process_tracker::business_status;
|
use diesel_models::process_tracker::business_status;
|
||||||
use error_stack::{report, ResultExt};
|
use error_stack::{report, ResultExt};
|
||||||
use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation};
|
use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation};
|
||||||
|
use hyperswitch_interfaces::consts;
|
||||||
use masking::{ExposeInterface, Mask, PeekInterface, Secret};
|
use masking::{ExposeInterface, Mask, PeekInterface, Secret};
|
||||||
use router_env::{
|
use router_env::{
|
||||||
instrument,
|
instrument,
|
||||||
@ -606,10 +607,16 @@ pub(crate) fn get_outgoing_webhook_request(
|
|||||||
outgoing_webhook: api::OutgoingWebhook,
|
outgoing_webhook: api::OutgoingWebhook,
|
||||||
business_profile: &domain::Profile,
|
business_profile: &domain::Profile,
|
||||||
) -> CustomResult<OutgoingWebhookRequestContent, errors::WebhooksFlowError> {
|
) -> CustomResult<OutgoingWebhookRequestContent, errors::WebhooksFlowError> {
|
||||||
let mut headers = vec![(
|
let mut headers = vec![
|
||||||
|
(
|
||||||
reqwest::header::CONTENT_TYPE.to_string(),
|
reqwest::header::CONTENT_TYPE.to_string(),
|
||||||
mime::APPLICATION_JSON.essence_str().into(),
|
mime::APPLICATION_JSON.essence_str().into(),
|
||||||
)];
|
),
|
||||||
|
(
|
||||||
|
reqwest::header::USER_AGENT.to_string(),
|
||||||
|
consts::USER_AGENT.to_string().into(),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
let transformed_outgoing_webhook = WebhookType::from(outgoing_webhook);
|
let transformed_outgoing_webhook = WebhookType::from(outgoing_webhook);
|
||||||
let payment_response_hash_key = business_profile.payment_response_hash_key.clone();
|
let payment_response_hash_key = business_profile.payment_response_hash_key.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user