Skip to content

Commit

Permalink
chore: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperswitch-bot[bot] committed Nov 13, 2024
1 parent 8c724f3 commit cb74035
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion crates/api_models/src/disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::de::Error;
use time::PrimitiveDateTime;
use utoipa::ToSchema;

use super::enums::{DisputeStage, DisputeStatus, Currency};
use super::enums::{Currency, DisputeStage, DisputeStatus};
use crate::{admin::MerchantConnectorInfo, files};

#[derive(Clone, Debug, Serialize, ToSchema, Eq, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/compatibility/stripe/webhooks.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(feature = "payouts")]
use api_models::payouts as payout_models;
use api_models::{
enums::{DisputeStatus, MandateStatus, Currency},
enums::{Currency, DisputeStatus, MandateStatus},
webhooks::{self as api},
};
#[cfg(feature = "payouts")]
Expand Down
32 changes: 15 additions & 17 deletions crates/router/src/connector/braintree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -997,23 +997,21 @@ impl api::IncomingWebhook for Braintree {
let response = decode_webhook_payload(notif.bt_payload.replace('\n', "").as_bytes())?;

match response.dispute {
Some(dispute_data) => {
Ok(api::disputes::DisputePayload {
amount: connector_utils::to_currency_lower_unit(
dispute_data.amount_disputed.to_string(),
dispute_data.currency_iso_code,
)?,
currency: dispute_data.currency_iso_code,
dispute_stage: transformers::get_dispute_stage(dispute_data.kind.as_str())?,
connector_dispute_id: dispute_data.id,
connector_reason: dispute_data.reason,
connector_reason_code: dispute_data.reason_code,
challenge_required_by: dispute_data.reply_by_date,
connector_status: dispute_data.status,
created_at: dispute_data.created_at,
updated_at: dispute_data.updated_at,
})
}
Some(dispute_data) => Ok(api::disputes::DisputePayload {
amount: connector_utils::to_currency_lower_unit(
dispute_data.amount_disputed.to_string(),
dispute_data.currency_iso_code,
)?,
currency: dispute_data.currency_iso_code,
dispute_stage: transformers::get_dispute_stage(dispute_data.kind.as_str())?,
connector_dispute_id: dispute_data.id,
connector_reason: dispute_data.reason,
connector_reason_code: dispute_data.reason_code,
challenge_required_by: dispute_data.reply_by_date,
connector_status: dispute_data.status,
created_at: dispute_data.created_at,
updated_at: dispute_data.updated_at,
}),
None => Err(errors::ConnectorError::WebhookResourceObjectNotFound)?,
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/router/src/connector/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use hyperswitch_domain_models::{
SyncIntegrityObject,
},
};
use masking::{ExposeInterface, Secret, Deserialize};
use masking::{Deserialize, ExposeInterface, Secret};
use once_cell::sync::Lazy;
use regex::Regex;
use serde::Serializer;
Expand Down Expand Up @@ -3149,4 +3149,4 @@ where
use serde::de::Error;
let output = <&str>::deserialize(v)?;
output.to_uppercase().parse::<T>().map_err(D::Error::custom)
}
}
4 changes: 1 addition & 3 deletions crates/router/src/utils/user/sample_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,7 @@ pub async fn generate_sample_data(
merchant_connector_id: payment_attempt.merchant_connector_id.clone(),
dispute_amount: amount * 100,
organization_id: org_id.clone(),
dispute_currency: payment_intent
.currency
.unwrap_or_default(),
dispute_currency: payment_intent.currency.unwrap_or_default(),
})
} else {
None
Expand Down

0 comments on commit cb74035

Please # to comment.