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 May 20, 2024
1 parent 4707994 commit f55467d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions crates/router/src/connector/payone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use router_env::{instrument, tracing};
use self::transformers as payone;
#[cfg(feature = "payouts")]
use crate::services;
#[cfg(feature = "payouts")]
use crate::utils::get_current_date_time_in_rfc1123_format;
use crate::{
configs::settings,
consts,
Expand All @@ -31,8 +33,6 @@ use crate::{
},
utils::BytesExt,
};
#[cfg(feature = "payouts")]
use crate::utils::get_current_date_time_in_rfc1123_format;
#[derive(Debug, Clone)]
pub struct Payone;

Expand Down
31 changes: 17 additions & 14 deletions crates/router/src/connector/payone/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,17 @@ use crate::{
utils::OptionExt,
};
#[cfg(not(feature = "payouts"))]
use crate::{core::errors, types::{self,api,storage::enums as storage_enums}};
use crate::{
core::errors,
types::{self, api, storage::enums as storage_enums},
};

pub struct PayoneRouterData<T> {
pub amount:String,
pub amount: String,
pub router_data: T,
}

impl<T>
TryFrom<(
&api::CurrencyUnit,
storage_enums::Currency,
i64,
T,
)> for PayoneRouterData<T>
{
impl<T> TryFrom<(&api::CurrencyUnit, storage_enums::Currency, i64, T)> for PayoneRouterData<T> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
(_currency_unit, _currency, amount, item): (
Expand Down Expand Up @@ -147,7 +143,10 @@ impl TryFrom<PayoneRouterData<&types::PayoutsRouterData<api::PoFulfill>>>
match request.payout_type.to_owned() {
storage_enums::PayoutType::Card => {
let amount_of_money: AmountOfMoney = AmountOfMoney {
amount: item.amount.parse::<i64>().change_context(errors::ConnectorError::ParsingFailed)?,
amount: item
.amount
.parse::<i64>()
.change_context(errors::ConnectorError::ParsingFailed)?,
currency_code: item.router_data.request.destination_currency.to_string(),
};
let card_issuer =
Expand Down Expand Up @@ -208,7 +207,9 @@ impl TryFrom<&PayoutMethodData> for CardAndCardIssuer {
.change_context(errors::ConnectorError::MissingRequiredField {
field_name: "payout_method_data.card.holder_name",
})?,
expiry_date: match card.get_card_expiry_month_year_2_digit_with_delimiter("".to_string()) {
expiry_date: match card
.get_card_expiry_month_year_2_digit_with_delimiter("".to_string())
{
Ok(date) => date,
Err(_) => Err(errors::ConnectorError::MissingRequiredField {
field_name: "payout_method_data.card.expiry_date",
Expand Down Expand Up @@ -260,8 +261,10 @@ impl ForeignFrom<PayoneStatus> for storage_enums::PayoutStatus {
fn foreign_from(payone_status: PayoneStatus) -> Self {
match payone_status {
PayoneStatus::AccountCredited => Self::Success,
PayoneStatus::RejectedCredit | PayoneStatus::Rejected |
PayoneStatus::Cancelled | PayoneStatus::Reversed => Self::Cancelled,
PayoneStatus::RejectedCredit
| PayoneStatus::Rejected
| PayoneStatus::Cancelled
| PayoneStatus::Reversed => Self::Cancelled,
PayoneStatus::Created
| PayoneStatus::PendingApproval
| PayoneStatus::PayoutRequested => Self::Pending,
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use nanoid::nanoid;
use qrcode;
use serde::de::DeserializeOwned;
use serde_json::Value;
use time::{format_description, OffsetDateTime};
use tracing_futures::Instrument;
use uuid::Uuid;

Expand All @@ -56,7 +57,6 @@ use crate::{
transformers::ForeignFrom,
},
};
use time::{format_description, OffsetDateTime};

pub mod error_parser {
use std::fmt::Display;
Expand Down

0 comments on commit f55467d

Please sign in to comment.