Skip to content

Commit

Permalink
Some Minor Fixes on Formatting and Typos
Browse files Browse the repository at this point in the history
  • Loading branch information
shivanshbhatnagar18 committed Oct 23, 2023
1 parent 514c18c commit ea100cf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
8 changes: 1 addition & 7 deletions crates/router/src/connector/rapyd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,7 @@ impl
&self,
req: &types::PaymentsCaptureRouterData,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
let connector_router_data = rapyd::RapydRouterData::try_from((
&self.get_currency_unit(),
req.request.currency,
req.request.capture_method,
req,
))?;
let req_obj = rapyd::CaptureRequest::try_from(&connector_router_data)?;
let req_obj = rapyd::CaptureRequest::try_from(&req)?;
let rapyd_req = types::RequestBody::log_and_get_request_body(
&req_obj,
utils::Encode::<rapyd::CaptureRequest>::encode_to_string_of_json,
Expand Down
29 changes: 20 additions & 9 deletions crates/router/src/connector/rapyd/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<T>
types::storage::enums::Currency,
i64,
T,
)> for ZenRouterData<T>
)> for RapydRouterData<T>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
Expand All @@ -36,7 +36,7 @@ impl<T>
T,
),
) -> Result<Self, Self::Error> {
let amount = utils::get_amount_as_string(currency_unit, amount, currency)?;
let amount = item.amount.to_owned();
Ok(Self {
amount,
router_data: item,
Expand Down Expand Up @@ -102,10 +102,15 @@ pub struct RapydWallet {

impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &RapydRouterData<&types::PaymentsAuthorizeRouterData>) -> Result<Self, Self::Error> {
let (capture, payment_method_options) = match item.payment_method {
fn try_from(
item: &RapydRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
let (capture, payment_method_options) = match item.router_data.payment_method {
diesel_models::enums::PaymentMethod::Card => {
let three_ds_enabled = matches!(item.auth_type, enums::AuthenticationType::ThreeDs);
let three_ds_enabled = matches!(
item.router_data.auth_type,
enums::AuthenticationType::ThreeDs
);
let payment_method_options = PaymentMethodOptions {
three_ds: three_ds_enabled,
};
Expand Down Expand Up @@ -179,9 +184,9 @@ pub struct RapydAuthType {
pub secret_key: Secret<String>,
}

impl TryFrom<&RapydRouterData<&types::ConnectorAuthType>> for RapydAuthType {
impl TryFrom<&types::ConnectorAuthType> for RapydAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &RapydRouterData<&types::ConnectorAuthType>) -> Result<Self, Self::Error> {
fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
if let types::ConnectorAuthType::BodyKey { api_key, key1 } = auth_type {
Ok(Self {
access_key: api_key.to_owned(),
Expand Down Expand Up @@ -311,7 +316,11 @@ impl<F> TryFrom<&RapydRouterData<&types::RefundsRouterData<F>>> for RapydRefundR
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &RapydRouterData<&types::RefundsRouterData<F>>) -> Result<Self, Self::Error> {
Ok(Self {
payment: item.router_data.request.connector_transaction_id.to_string(),
payment: item
.router_data
.request
.connector_transaction_id
.to_string(),
amount: Some(item.router_data.request.refund_amount),
currency: Some(item.router_data.request.currency),
})
Expand Down Expand Up @@ -413,7 +422,9 @@ pub struct CaptureRequest {

impl TryFrom<&RapydRouterData<&types::PaymentsCaptureRouterData>> for CaptureRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &RapydRouterData<&types::PaymentsCaptureRouterData>) -> Result<Self, Self::Error> {
fn try_from(
item: &RapydRouterData<&types::PaymentsCaptureRouterData>,
) -> Result<Self, Self::Error> {
Ok(Self {
amount: Some(item.router_data.request.amount_to_capture),
receipt_email: None,
Expand Down

0 comments on commit ea100cf

Please sign in to comment.