mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
feat(core): Altered the amount field in DisputePayload to StringMinorUnit (#8131)
Co-authored-by: Sayak Bhattacharya <sayak.b@Sayak-Bhattacharya-G092THXJ34.local>
This commit is contained in:
committed by
GitHub
parent
25dfa0ef60
commit
0476361251
@ -4,7 +4,12 @@ use actix_web::FromRequest;
|
||||
#[cfg(feature = "payouts")]
|
||||
use api_models::payouts as payout_models;
|
||||
use api_models::webhooks::{self, WebhookResponseTracker};
|
||||
use common_utils::{errors::ReportSwitchExt, events::ApiEventsType, ext_traits::AsyncExt};
|
||||
use common_utils::{
|
||||
errors::ReportSwitchExt,
|
||||
events::ApiEventsType,
|
||||
ext_traits::AsyncExt,
|
||||
types::{AmountConvertor, StringMinorUnitForConnector},
|
||||
};
|
||||
use diesel_models::ConnectorMandateReferenceId;
|
||||
use error_stack::{report, ResultExt};
|
||||
use hyperswitch_domain_models::{
|
||||
@ -1187,7 +1192,16 @@ async fn get_or_update_dispute_object(
|
||||
profile_id: Some(business_profile.get_id().to_owned()),
|
||||
evidence: None,
|
||||
merchant_connector_id: payment_attempt.merchant_connector_id.clone(),
|
||||
dispute_amount: dispute_details.amount.parse::<i64>().unwrap_or(0),
|
||||
dispute_amount: StringMinorUnitForConnector::convert_back(
|
||||
&StringMinorUnitForConnector,
|
||||
dispute_details.amount,
|
||||
dispute_details.currency,
|
||||
)
|
||||
.change_context(
|
||||
errors::ApiErrorResponse::AmountConversionFailed {
|
||||
amount_type: "MinorUnit",
|
||||
},
|
||||
)?,
|
||||
organization_id: organization_id.clone(),
|
||||
dispute_currency: Some(dispute_details.currency),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user