Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/hyperswitch_connectors/src/connectors/rapyd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use common_utils::{
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt, Encode, StringExt},
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
use error_stack::{Report, ResultExt};
use hyperswitch_domain_models::{
Expand Down Expand Up @@ -55,12 +55,12 @@ use crate::{

#[derive(Clone)]
pub struct Rapyd {
amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync),
amount_converter: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync),
}
impl Rapyd {
pub fn new() -> &'static Self {
&Self {
amount_converter: &MinorUnitForConnector,
amount_converter: &FloatMajorUnitForConnector,
}
}
}
Expand Down Expand Up @@ -97,7 +97,7 @@ impl ConnectorCommon for Rapyd {
}

fn get_currency_unit(&self) -> api::CurrencyUnit {
api::CurrencyUnit::Minor
api::CurrencyUnit::Base
}

fn common_get_content_type(&self) -> &'static str {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use common_enums::enums;
use common_utils::{ext_traits::OptionExt, request::Method, types::MinorUnit};
use common_utils::{ext_traits::OptionExt, request::Method, types::FloatMajorUnit};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::{PaymentMethodData, WalletData},
Expand All @@ -22,12 +22,12 @@ use crate::{

#[derive(Debug, Serialize)]
pub struct RapydRouterData<T> {
pub amount: MinorUnit,
pub amount: FloatMajorUnit,
pub router_data: T,
}

impl<T> From<(MinorUnit, T)> for RapydRouterData<T> {
fn from((amount, router_data): (MinorUnit, T)) -> Self {
impl<T> From<(FloatMajorUnit, T)> for RapydRouterData<T> {
fn from((amount, router_data): (FloatMajorUnit, T)) -> Self {
Self {
amount,
router_data,
Expand All @@ -37,7 +37,7 @@ impl<T> From<(MinorUnit, T)> for RapydRouterData<T> {

#[derive(Default, Debug, Serialize)]
pub struct RapydPaymentsRequest {
pub amount: MinorUnit,
pub amount: FloatMajorUnit,
pub currency: enums::Currency,
pub payment_method: PaymentMethod,
pub payment_method_options: Option<PaymentMethodOptions>,
Expand Down Expand Up @@ -304,7 +304,7 @@ pub struct DisputeResponseData {
#[derive(Default, Debug, Serialize)]
pub struct RapydRefundRequest {
pub payment: String,
pub amount: Option<MinorUnit>,
pub amount: Option<FloatMajorUnit>,
pub currency: Option<enums::Currency>,
}

Expand Down Expand Up @@ -409,7 +409,7 @@ impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for types::Refund

#[derive(Debug, Serialize, Clone)]
pub struct CaptureRequest {
amount: Option<MinorUnit>,
amount: Option<FloatMajorUnit>,
receipt_email: Option<Secret<String>>,
statement_descriptor: Option<String>,
}
Expand Down
Loading