Skip to content

Commit

Permalink
feature config issues solved
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranKBR committed May 13, 2024
1 parent 82c8fe4 commit 25a8001
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
9 changes: 4 additions & 5 deletions crates/router/src/connector/payone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ use base64::Engine;
#[cfg(feature = "payouts")]
use common_utils::request::RequestContent;
use error_stack::{report, ResultExt};
#[cfg(feature = "payouts")]
use masking::{ExposeInterface, PeekInterface};
use ring::hmac;
#[cfg(feature = "payouts")]
use router_env::{instrument, tracing};
use time::{format_description, OffsetDateTime};

use self::transformers as payone;
#[cfg(feature = "payouts")]
use crate::services;
use crate::{
configs::settings,
consts,
core::errors::{self, CustomResult},
events::connector_api_logs::ConnectorEvent,
headers, logger,
headers,
services::{
self,
request::{self, Mask},
ConnectorIntegration, ConnectorValidation,
},
Expand All @@ -35,6 +35,7 @@ use crate::{

#[derive(Debug, Clone)]
pub struct Payone;

impl Payone {
pub fn generate_signature(
&self,
Expand Down Expand Up @@ -127,7 +128,6 @@ where
authorization_header.to_string().into(),
),
];
logger::debug!(" build headers ");

Ok(headers)
}
Expand Down Expand Up @@ -239,7 +239,6 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Payone {}

impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Payone {}
#[cfg(feature = "payouts")]
impl api::Payouts for Payone {}

#[cfg(feature = "payouts")]
Expand Down
26 changes: 13 additions & 13 deletions crates/router/src/connector/payone/transformers.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
#[cfg(feature = "payouts")]
use api_models::payouts::PayoutMethodData;
#[cfg(feature = "payouts")]
use cards::CardNumber;
#[cfg(feature = "payouts")]
use error_stack::ResultExt;
use masking::{ExposeInterface, Secret};
use masking::Secret;
#[cfg(feature = "payouts")]
use regex::Regex;
use serde::{Deserialize, Serialize};

use crate::{
connector::utils::{get_unimplemented_payment_method_error_message, CardIssuer, CARD_REGEX},
utils::OptionExt,
};
use crate::connector::utils::{get_unimplemented_payment_method_error_message, CardIssuer};

#[cfg(feature = "payouts")]
type Error = error_stack::Report<errors::ConnectorError>;
use crate::connector::utils::CardData;

#[cfg(feature = "payouts")]
use crate::{
connector::utils::RouterData,
connector::utils::{CardData, RouterData, CARD_REGEX},
core::errors,
logger,
types::{self, storage::enums as storage_enums, transformers::ForeignFrom},
utils::OptionExt,
};
#[cfg(not(feature = "payouts"))]
use crate::{core::errors, types};

pub struct PayoneRouterData<T> {
pub amount: i64,
Expand Down Expand Up @@ -124,6 +127,7 @@ pub struct Card {
expiry_date: Secret<String>,
}

#[cfg(feature = "payouts")]
impl Card {
fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
for (k, v) in CARD_REGEX.iter() {
Expand Down Expand Up @@ -187,7 +191,6 @@ pub enum Gateway {
impl TryFrom<CardIssuer> for Gateway {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(issuer: CardIssuer) -> Result<Self, Self::Error> {
logger::debug!("it is in PayoutCreateRequest Gateway debug");
match issuer {
CardIssuer::Master => Ok(Self::MasterCard),
CardIssuer::Visa => Ok(Self::Visa),
Expand All @@ -214,10 +217,7 @@ impl TryFrom<&PayoutMethodData> for Card {
field_name: "payout_method_data.card.holder_name",
})?,
expiry_date: match card.get_expiry_date_as_mmyy() {
Ok(date) => {
logger::debug!("date date {}", date.clone().expose());
date
}
Ok(date) => date,
Err(_) => Err(errors::ConnectorError::MissingRequiredField {
field_name: "payout_method_data.card.expiry_date",
})?,
Expand Down

0 comments on commit 25a8001

Please sign in to comment.