text
stringlengths
70
351k
source
stringclasses
4 values
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_connector_refund_id(&self) -> Result<String, Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_customer_phone_country_code(&self) -> Result<String, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use masking::{Deserialize, ExposeInterface, Secret}; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_customer_phone( &self, ) -> Result<Secret<String, masking::WithType>, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_customer_email(&self) -> Result<Email, errors::ConnectorError> { self.email .clone() .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "customer_email", }) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use masking::{Deserialize, ExposeInterface, Secret}; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_customer_name( &self, ) -> Result<Secret<String, masking::WithType>, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_customer_id(&self) -> Result<id_type::CustomerId, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use api_models::{ enums::{CanadaStatesAbbreviation, UsStatesAbbreviation}, payments, }; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use hyperswitch_domain_models::{ mandates, network_tokenization::NetworkTokenNumber, payments::payment_attempt::PaymentAttempt, router_request_types::{ AuthoriseIntegrityObject, CaptureIntegrityObject, RefundIntegrityObject, SyncIntegrityObject, }, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; /// Attempts to retrieve the connector mandate reference ID as a `Result<String, Error>`. fn get_connector_mandate_request_reference_id(&self) -> Result<String, Error> { self.mandate_id .as_ref() .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id { Some(payments::MandateReferenceId::ConnectorMandateId(connector_mandate_ids)) => { connector_mandate_ids.get_connector_mandate_request_reference_id() } Some(payments::MandateReferenceId::NetworkMandateId(_)) | None | Some(payments::MandateReferenceId::NetworkTokenWithNTI(_)) => None, }) .ok_or_else(missing_field_err("connector_mandate_request_reference_id")) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn is_mandate_payment(&self) -> bool { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_java_script_enabled(&self) -> Result<bool, Error> { self.java_script_enabled .ok_or_else(missing_field_err("browser_info.java_script_enabled")) }
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_time_zone(&self) -> Result<i32, Error> { self.time_zone .ok_or_else(missing_field_err("browser_info.time_zone")) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_color_depth(&self) -> Result<u8, Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_language(&self) -> Result<String, Error> { self.language .clone() .ok_or_else(missing_field_err("browser_info.language")) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_accept_header(&self) -> Result<String, Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use masking::{Deserialize, ExposeInterface, Secret}; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_ip_address(&self) -> Result<Secret<String, IpAddress>, Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn is_customer_initiated_mandate_payment(&self) -> bool { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn get_total_surcharge_amount(&self) -> Option<i64> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn is_wallet(&self) -> bool { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn is_mandate_payment(&self) -> bool { ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession)) || self .mandate_id .as_ref() .and_then(|mandate_ids| mandate_ids.mandate_reference_id.as_ref()) .is_some() }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use api_models::{ enums::{CanadaStatesAbbreviation, UsStatesAbbreviation}, payments, }; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use hyperswitch_domain_models::{ mandates, network_tokenization::NetworkTokenNumber, payments::payment_attempt::PaymentAttempt, router_request_types::{ AuthoriseIntegrityObject, CaptureIntegrityObject, RefundIntegrityObject, SyncIntegrityObject, }, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn get_optional_network_transaction_id(&self) -> Option<String> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use api_models::{ enums::{CanadaStatesAbbreviation, UsStatesAbbreviation}, payments, }; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use hyperswitch_domain_models::{ mandates, network_tokenization::NetworkTokenNumber, payments::payment_attempt::PaymentAttempt, router_request_types::{ AuthoriseIntegrityObject, CaptureIntegrityObject, RefundIntegrityObject, SyncIntegrityObject, }, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn connector_mandate_id(&self) -> Option<String> { self.mandate_id .as_ref() .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id { Some(payments::MandateReferenceId::ConnectorMandateId(connector_mandate_ids)) => { connector_mandate_ids.get_connector_mandate_id() } Some(payments::MandateReferenceId::NetworkMandateId(_)) | None | Some(payments::MandateReferenceId::NetworkTokenWithNTI(_)) => None, }) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_card(&self) -> Result<domain::Card, Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn get_optional_email(&self) -> Option<Email> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn is_card(&self) -> bool { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use api_models::{ enums::{CanadaStatesAbbreviation, UsStatesAbbreviation}, payments, }; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use hyperswitch_domain_models::{ mandates, network_tokenization::NetworkTokenNumber, payments::payment_attempt::PaymentAttempt, router_request_types::{ AuthoriseIntegrityObject, CaptureIntegrityObject, RefundIntegrityObject, SyncIntegrityObject, }, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn get_split_payment_data(&self) -> Option<common_types::payments::SplitPaymentsRequest> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn is_multiple_capture(&self) -> bool { self.multiple_capture_data.is_some() }
ast_fragments
// file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_redirect_response_payload(&self) -> Result<pii::SecretSerdeValue, Error> { self.redirect_response .as_ref() .and_then(|res| res.payload.to_owned()) .ok_or( errors::ConnectorError::MissingConnectorRedirectionPayload { field_name: "request.redirect_response.payload", } .into(), ) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use diesel_models::{enums, types::OrderDetailsWithAmount}; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use api_models::{ enums::{CanadaStatesAbbreviation, UsStatesAbbreviation}, payments, }; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use diesel_models::{enums, types::OrderDetailsWithAmount}; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; type Error = error_stack::Report<errors::ConnectorError>; fn is_auto_capture(&self) -> Result<bool, Error> { { Some(enums::CaptureMethod::Automatic) | None | Some(enums::CaptureMethod::SequentialAutomatic) => Ok(true),<|fim_suffix|> <|fim_middle|> Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use masking::{Deserialize, ExposeInterface, Secret}; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn get_optional_full_name(&self) -> Option<Secret<String>> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/utils.rs | crate: router use api_models::payouts::{self, PayoutVendorAccountDetails}; use api_models::{ enums::{CanadaStatesAbbreviation, UsStatesAbbreviation}, payments, }; use common_utils::{ date_time, errors::{ParsingError, ReportSwitchExt}, ext_traits::StringExt, id_type, pii::{self, Email, IpAddress}, types::{AmountConvertor, MinorUnit}, }; use diesel_models::{enums, types::OrderDetailsWithAmount}; use crate::{ consts, core::{ errors::{self, ApiErrorResponse, CustomResult}, payments::{types::AuthenticationData, PaymentData}, }, pii::PeekInterface, types::{ self, api, domain, storage::enums as storage_enums, transformers::{ForeignFrom, ForeignTryFrom}, ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId, }, utils::{OptionExt, ValueExt}, }; fn get_optional_country(&self) -> Option<enums::CountryAlpha2> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn build_request( &self, req: &types::authentication::PreAuthNVersionCallRouterData, connectors: &settings::Connectors, ) -> CustomResult<Option<services::Request>, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn build_request( &self, req: &types::authentication::PreAuthNRouterData, connectors: &settings::Connectors, ) -> CustomResult<Option<services::Request>, errors::ConnectorError> { let gpayments_auth_type = gpayments::GpaymentsAuthType::try_from(&req.connector_auth_type)?; Ok(Some( services::RequestBuilder::new() .method(services::Method::Post) .url( &types::authentication::ConnectorPreAuthenticationType::get_url( self, req, connectors, )?, ) .attach_default_headers() .headers( types::authentication::ConnectorPreAuthenticationType::get_headers( self, req, connectors, )?, ) .set_body( types::authentication::ConnectorPreAuthenticationType::get_request_body( self, req, connectors, )?, ) .add_certificate(Some(gpayments_auth_type.certificate)) .add_certificate_key(Some(gpayments_auth_type.private_key)) .build(), )) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn handle_response( &self, data: &types::authentication::ConnectorPostAuthenticationRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult< types::authentication::ConnectorPostAuthenticationRouterData, errors::ConnectorError, > { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn get_url( &self, req: &types::authentication::ConnectorPostAuthenticationRouterData, connectors: &settings::Connectors, ) -> CustomResult<String, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn handle_response( &self, data: &types::authentication::PreAuthNVersionCallRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<types::authentication::PreAuthNVersionCallRouterData, errors::ConnectorError> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn get_request_body( &self, req: &types::authentication::PreAuthNVersionCallRouterData, _connectors: &settings::Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn get_url( &self, req: &types::authentication::PreAuthNVersionCallRouterData, connectors: &settings::Connectors, ) -> CustomResult<String, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn get_headers( &self, req: &types::authentication::PreAuthNVersionCallRouterData, connectors: &settings::Connectors, ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn handle_response( &self, data: &types::authentication::PreAuthNRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<types::authentication::PreAuthNRouterData, errors::ConnectorError> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn build_request( &self, req: &types::authentication::ConnectorPostAuthenticationRouterData, connectors: &settings::Connectors, ) -> CustomResult<Option<services::Request>, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn get_url( &self, req: &types::authentication::ConnectorPostAuthenticationRouterData, connectors: &settings::Connectors, ) -> CustomResult<String, errors::ConnectorError> { let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?; Ok(format!( "{}/api/v2/auth/brw/result?threeDSServerTransID={}", base_url, req.request.threeds_server_transaction_id, )) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn get_headers( &self, req: &types::authentication::ConnectorPostAuthenticationRouterData, connectors: &settings::Connectors, ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn get_request_body( &self, req: &types::authentication::ConnectorAuthenticationRouterData, _connectors: &settings::Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn get_url( &self, req: &types::authentication::ConnectorAuthenticationRouterData, _connectors: &settings::Connectors, ) -> CustomResult<String, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/connector/gpayments.rs | crate: router use common_utils::{ request::RequestContent, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use transformers as gpayments; use crate::{ configs::settings, connector::{gpayments::gpayments_types::GpaymentsConnectorMetaData, utils::to_connector_meta}, core::errors::{self, CustomResult}, events::connector_api_logs::ConnectorEvent, headers, services, services::{request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation}, types::{ self, api::{self, ConnectorCommon, ConnectorCommonExt}, ErrorResponse, Response, }, utils::BytesExt, }; fn build_endpoint( base_url: &str, connector_metadata: &Option<common_utils::pii::SecretSerdeValue>, ) -> CustomResult<String, errors::ConnectorError> { let metadata = gpayments::GpaymentsMetaData::try_from(connector_metadata)?; let endpoint_prefix = metadata.endpoint_prefix; Ok(base_url.replace("{{merchant_endpoint_prefix}}", &endpoint_prefix)) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router use common_utils::date_time; use serde_json::{json, to_string}; use crate::{ connector::utils::{get_card_details, to_connector_meta, CardData}, consts::{BASE64_ENGINE, NO_ERROR_MESSAGE}, core::errors, types::{ self, api::{self, MessageCategory}, authentication::ChallengeParams, }, utils::OptionExt, }; fn try_from( item: types::ResponseRouterData< api::PreAuthentication, ThreedsecureioPreAuthenticationResponse, types::authentication::PreAuthNRequestData, types::authentication::AuthenticationResponseData, >, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router fn from(value: ThreedsecureioTransStatus) -> Self { { ThreedsecureioTransStatus::Y => Self::Success,<|fim_suffix|> <|fim_middle|> ThreedsecureioTransStatus::C => Self::ChallengeRequired, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router use api_models::payments::{DeviceChannel, ThreeDsCompletionIndicator}; fn from(value: ThreeDsCompletionIndicator) -> Self { { ThreeDsCompletionIndicator::Success => Self::Y,<|fim_suffix|> <|fim_middle|> ThreeDsCompletionIndicator::NotAvailable => Self::U, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router use crate::{ connector::utils::{get_card_details, to_connector_meta, CardData}, consts::{BASE64_ENGINE, NO_ERROR_MESSAGE}, core::errors, types::{ self, api::{self, MessageCategory}, authentication::ChallengeParams, }, utils::OptionExt, }; fn try_from( value: &ThreedsecureioRouterData<&types::authentication::PreAuthNRouterData>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router fn from(value: ThreedsecureioTransStatus) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router use api_models::payments::{DeviceChannel, ThreeDsCompletionIndicator}; fn from(value: ThreeDsCompletionIndicator) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router use serde_json::{json, to_string}; fn try_from((amount, router_data): (i64, T)) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router use base64::Engine; use serde_json::{json, to_string}; use crate::{ connector::utils::{get_card_details, to_connector_meta, CardData}, consts::{BASE64_ENGINE, NO_ERROR_MESSAGE}, core::errors, types::{ self, api::{self, MessageCategory}, authentication::ChallengeParams, }, utils::OptionExt, }; fn try_from( item: types::ResponseRouterData< api::Authentication, ThreedsecureioAuthenticationResponse, types::authentication::ConnectorAuthenticationRequestData, types::authentication::AuthenticationResponseData, >, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/threedsecureio/transformers.rs | crate: router use api_models::payments::{DeviceChannel, ThreeDsCompletionIndicator}; use common_utils::date_time; use iso_currency::Currency; use isocountry; use masking::{ExposeInterface, Secret}; use serde_json::{json, to_string}; use crate::{ connector::utils::{get_card_details, to_connector_meta, CardData}, consts::{BASE64_ENGINE, NO_ERROR_MESSAGE}, core::errors, types::{ self, api::{self, MessageCategory}, authentication::ChallengeParams, }, utils::OptionExt, }; fn try_from( item: &ThreedsecureioRouterData<&types::authentication::ConnectorAuthenticationRouterData>, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/payone/transformers.rs | crate: router use api_models::payouts::PayoutMethodData; use common_utils::types::MinorUnit; use crate::connector::{ utils, utils::{get_unimplemented_payment_method_error_message, CardIssuer}, }; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{CardData, PayoutsData, RouterData}, core::errors, types::{self, api, storage::enums as storage_enums, transformers::ForeignFrom}, utils::OptionExt, }; use crate::{core::errors, types}; fn try_from( item: PayoneRouterData<&types::PayoutsRouterData<api::PoFulfill>>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/payone/transformers.rs | crate: router fn foreign_from(payone_status: PayoneStatus) -> Self { { PayoneStatus::AccountCredited => Self::Success,<|fim_suffix|> <|fim_middle|> PayoneStatus::Created | PayoneStatus::PendingApproval | PayoneStatus::PayoutRequested => Self::Pending, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/payone/transformers.rs | crate: router use crate::connector::{ utils, utils::{get_unimplemented_payment_method_error_message, CardIssuer}, }; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{CardData, PayoutsData, RouterData}, core::errors, types::{self, api, storage::enums as storage_enums, transformers::ForeignFrom}, utils::OptionExt, }; use crate::{core::errors, types}; fn try_from(issuer: CardIssuer) -> Result<Self, Self::Error> { { CardIssuer::Master => Ok(Self::MasterCard),<|fim_suffix|> <|fim_middle|> CardIssuer::AmericanExpress | CardIssuer::Maestro | CardIssuer::Discover | CardIssuer::DinersClub | CardIssuer::JCB | CardIssuer::CarteBlanche => Err(errors::ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("payone"), ) .into()), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/payone/transformers.rs | crate: router use common_utils::types::MinorUnit; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{CardData, PayoutsData, RouterData}, core::errors, types::{self, api, storage::enums as storage_enums, transformers::ForeignFrom}, utils::OptionExt, }; use crate::{core::errors, types}; fn try_from( item: types::PayoutsResponseRouterData<F, PayonePayoutFulfillResponse>, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/payone/transformers.rs | crate: router fn foreign_from(payone_status: PayoneStatus) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/payone/transformers.rs | crate: router fn from(error: SubError) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments/transformers.rs | crate: router use base64::Engine; use common_utils::{date_time, types::MinorUnit}; use serde_json::to_string; use super::gpayments_types; use crate::{ connector::{ gpayments::gpayments_types::{ AuthStatus, BrowserInfoCollected, GpaymentsAuthenticationSuccessResponse, }, utils, utils::{get_card_details, CardData}, }, consts::BASE64_ENGINE, core::errors, types::{self, api, api::MessageCategory, authentication::ChallengeParams}, }; fn try_from( item: types::ResponseRouterData< api::PreAuthentication, gpayments_types::GpaymentsPreAuthenticationResponse, types::authentication::PreAuthNRequestData, types::authentication::AuthenticationResponseData, >, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments/transformers.rs | crate: router use base64::Engine; use common_utils::{date_time, types::MinorUnit}; use serde_json::to_string; use crate::{ connector::{ gpayments::gpayments_types::{ AuthStatus, BrowserInfoCollected, GpaymentsAuthenticationSuccessResponse, }, utils, utils::{get_card_details, CardData}, }, consts::BASE64_ENGINE, core::errors, types::{self, api, api::MessageCategory, authentication::ChallengeParams}, }; fn try_from( item: types::ResponseRouterData< api::Authentication, GpaymentsAuthenticationSuccessResponse, types::authentication::ConnectorAuthenticationRequestData, types::authentication::AuthenticationResponseData, >, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments/transformers.rs | crate: router use api_models::payments::DeviceChannel; use common_utils::{date_time, types::MinorUnit}; use masking::{ExposeInterface, Secret}; use serde_json::to_string; use crate::{ connector::{ gpayments::gpayments_types::{ AuthStatus, BrowserInfoCollected, GpaymentsAuthenticationSuccessResponse, }, utils, utils::{get_card_details, CardData}, }, consts::BASE64_ENGINE, core::errors, types::{self, api, api::MessageCategory, authentication::ChallengeParams}, }; fn try_from( item: &GpaymentsRouterData<&types::authentication::ConnectorAuthenticationRouterData>, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments/transformers.rs | crate: router use api_models::payments::DeviceChannel; use common_utils::{date_time, types::MinorUnit}; use masking::{ExposeInterface, Secret}; use serde_json::to_string; use crate::{ connector::{ gpayments::gpayments_types::{ AuthStatus, BrowserInfoCollected, GpaymentsAuthenticationSuccessResponse, }, utils, utils::{get_card_details, CardData}, }, consts::BASE64_ENGINE, core::errors, types::{self, api, api::MessageCategory, authentication::ChallengeParams}, }; fn try_from( item: &GpaymentsRouterData<&types::authentication::ConnectorAuthenticationRouterData>, ) -> Result<Self, Self::Error> { { MessageCategory::Payment => "01".into(),<|fim_suffix|> <|fim_middle|> MessageCategory::NonPayment => "02".into(), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments/transformers.rs | crate: router use common_utils::{date_time, types::MinorUnit}; use crate::{ connector::{ gpayments::gpayments_types::{ AuthStatus, BrowserInfoCollected, GpaymentsAuthenticationSuccessResponse, }, utils, utils::{get_card_details, CardData}, }, consts::BASE64_ENGINE, core::errors, types::{self, api, api::MessageCategory, authentication::ChallengeParams}, }; fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> { { types::ConnectorAuthType::CertificateAuth { certificate, private_key, } => Ok(Self { certificate, private_key, }),<|fim_suffix|> <|fim_middle|> _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments/transformers.rs | crate: router use common_utils::{date_time, types::MinorUnit}; use serde_json::to_string; use super::gpayments_types; use crate::{ connector::{ gpayments::gpayments_types::{ AuthStatus, BrowserInfoCollected, GpaymentsAuthenticationSuccessResponse, }, utils, utils::{get_card_details, CardData}, }, consts::BASE64_ENGINE, core::errors, types::{self, api, api::MessageCategory, authentication::ChallengeParams}, }; fn try_from( value: &GpaymentsRouterData<&types::authentication::PreAuthNRouterData>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments/transformers.rs | crate: router use common_utils::{date_time, types::MinorUnit}; use super::gpayments_types; use crate::{ connector::{ gpayments::gpayments_types::{ AuthStatus, BrowserInfoCollected, GpaymentsAuthenticationSuccessResponse, }, utils, utils::{get_card_details, CardData}, }, consts::BASE64_ENGINE, core::errors, types::{self, api, api::MessageCategory, authentication::ChallengeParams}, }; fn try_from( item: types::ResponseRouterData< api::PreAuthenticationVersionCall, gpayments_types::GpaymentsPreAuthVersionCallResponse, types::authentication::PreAuthNRequestData, types::authentication::AuthenticationResponseData, >, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/gpayments/transformers.rs | crate: router use common_utils::{date_time, types::MinorUnit}; use crate::{ connector::{ gpayments::gpayments_types::{ AuthStatus, BrowserInfoCollected, GpaymentsAuthenticationSuccessResponse, }, utils, utils::{get_card_details, CardData}, }, consts::BASE64_ENGINE, core::errors, types::{self, api, api::MessageCategory, authentication::ChallengeParams}, }; fn try_from( value: &GpaymentsRouterData<&types::authentication::PreAuthNVersionCallRouterData>, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router fn foreign_from( (event_type, status, instant_status): ( AdyenplatformWebhookEventType, AdyenplatformWebhookStatus, Option<AdyenplatformInstantStatus>, ), ) -> Self { match (event_type, status, instant_status) { (AdyenplatformWebhookEventType::PayoutCreated, _, _) => Self::PayoutCreated, (AdyenplatformWebhookEventType::PayoutUpdated, _, Some(instant_status)) => { match (instant_status.status, instant_status.estimated_arrival_time) { (Some(InstantPriorityStatus::Credited), _) | (None, Some(_)) => { Self::PayoutSuccess } _ => Self::PayoutProcessing, } } (AdyenplatformWebhookEventType::PayoutUpdated, status, _) => match status { AdyenplatformWebhookStatus::Authorised | AdyenplatformWebhookStatus::Booked | AdyenplatformWebhookStatus::Received => Self::PayoutCreated, AdyenplatformWebhookStatus::Pending => Self::PayoutProcessing, AdyenplatformWebhookStatus::Failed => Self::PayoutFailure, AdyenplatformWebhookStatus::Returned => Self::PayoutReversed, }, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router fn foreign_from( (event_type, status, instant_status): ( AdyenplatformWebhookEventType, AdyenplatformWebhookStatus, Option<AdyenplatformInstantStatus>, ), ) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router use error_stack::{report, ResultExt}; use super::{AdyenPlatformRouterData, Error}; use crate::{ connector::{ adyen::transformers as adyen, utils::{self, PayoutsData, RouterData}, }, core::errors, types::{self, api::payouts, storage::enums, transformers::ForeignFrom}, }; fn try_from(payout_type: enums::PayoutType) -> Result<Self, Self::Error> { { enums::PayoutType::Bank => Ok(Self::Bank),<|fim_suffix|> <|fim_middle|> enums::PayoutType::Card | enums::PayoutType::Wallet => { Err(report!(errors::ConnectorError::NotSupported { message: "Card or wallet payouts".to_string(), connector: "Adyenplatform", })) } } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router use error_stack::{report, ResultExt}; use super::{AdyenPlatformRouterData, Error}; use crate::{ connector::{ adyen::transformers as adyen, utils::{self, PayoutsData, RouterData}, }, core::errors, types::{self, api::payouts, storage::enums, transformers::ForeignFrom}, }; fn try_from(payout_type: enums::PayoutType) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router use crate::{ connector::{ adyen::transformers as adyen, utils::{self, PayoutsData, RouterData}, }, core::errors, types::{self, api::payouts, storage::enums, transformers::ForeignFrom}, }; fn from(entity: enums::PayoutSendPriority) -> Self { { enums::PayoutSendPriority::Instant => Self::Instant,<|fim_suffix|> <|fim_middle|> enums::PayoutSendPriority::Internal => Self::Internal, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router use crate::{ connector::{ adyen::transformers as adyen, utils::{self, PayoutsData, RouterData}, }, core::errors, types::{self, api::payouts, storage::enums, transformers::ForeignFrom}, }; fn from(entity: enums::PayoutEntityType) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router use super::{AdyenPlatformRouterData, Error}; fn from(adyen_status: AdyenTransferStatus) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router use super::{AdyenPlatformRouterData, Error}; use crate::{ connector::{ adyen::transformers as adyen, utils::{self, PayoutsData, RouterData}, }, core::errors, types::{self, api::payouts, storage::enums, transformers::ForeignFrom}, }; fn try_from( item: types::PayoutsResponseRouterData<F, AdyenTransferResponse>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/adyenplatform/transformers/payouts.rs | crate: router use super::{AdyenPlatformRouterData, Error}; use crate::{ connector::{ adyen::transformers as adyen, utils::{self, PayoutsData, RouterData}, }, core::errors, types::{self, api::payouts, storage::enums, transformers::ForeignFrom}, }; fn try_from( item: &AdyenPlatformRouterData<&types::PayoutsRouterData<F>>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use common_utils::types::MinorUnit; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; use crate::{core::errors, types}; fn try_from(item: &types::PayoutsRouterData<F>) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use api_models::payouts::PayoutMethodData; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; use crate::{core::errors, types}; fn get_payout_bank_details( payout_method_data: PayoutMethodData, address: Option<&hyperswitch_domain_models::address::Address>, entity_type: PayoutEntityType, ) -> Result<WiseBankDetails, errors::ConnectorError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; fn from(entity_type: PayoutEntityType) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router fn from(wise_status: WiseStatus) -> Self { { WiseStatus::Completed => Self::Success,<|fim_suffix|> <|fim_middle|> WiseStatus::Pending | WiseStatus::Processing | WiseStatus::IncomingPaymentWaiting => { Self::Pending } } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use api_models::payouts::PayoutMethodData; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; use crate::{core::errors, types}; fn try_from(payout_method_type: PayoutMethodData) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; fn from(entity_type: PayoutEntityType) -> Self { { PayoutEntityType::Individual | PayoutEntityType::Personal | PayoutEntityType::NonProfit | PayoutEntityType::NaturalPerson => Self::Private,<|fim_suffix|> <|fim_middle|> PayoutEntityType::Company | PayoutEntityType::PublicSector | PayoutEntityType::Business => Self::Business, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router fn from(wise_status: WiseStatus) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use common_utils::types::MinorUnit; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; use crate::{core::errors, types}; fn try_from( item: types::PayoutsResponseRouterData<F, WiseFulfillResponse>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use common_utils::types::MinorUnit; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; use crate::{core::errors, types}; fn try_from( item: types::PayoutsResponseRouterData<F, WisePayoutResponse>, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use common_utils::types::MinorUnit; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; use crate::{core::errors, types}; fn try_from( item: types::PayoutsResponseRouterData<F, WisePayoutQuoteResponse>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use common_utils::types::MinorUnit; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; use crate::{core::errors, types}; fn try_from( item_data: &WiseRouterData<&types::PayoutsRouterData<F>>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router use common_utils::types::MinorUnit; type Error = error_stack::Report<errors::ConnectorError>; use crate::{ connector::utils::{self, PayoutsData, RouterData}, types::{ api::payouts, storage::enums::{self as storage_enums, PayoutEntityType}, }, }; use crate::{core::errors, types}; fn try_from( item: types::PayoutsResponseRouterData<F, WiseRecipientCreateResponse>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/connector/wise/transformers.rs | crate: router fn get_payout_address_details( address: Option<&hyperswitch_domain_models::address::Address>, ) -> Option<WiseAddressDetails> { address.and_then(|add| { add.address.as_ref().map(|a| WiseAddressDetails { country: a.country, country_code: a.country, first_line: a.line1.clone(), post_code: a.zip.clone(), city: a.city.clone(), state: a.state.clone(), }) }) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/plaid/transformers.rs | crate: router use common_utils::types::FloatMajorUnit; use crate::{ connector::utils::is_payment_failure, core::errors, types::{self, api, domain, storage::enums}, }; fn try_from( item: types::ResponseRouterData<F, PlaidSyncResponse, T, types::PaymentsResponseData>, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/plaid/transformers.rs | crate: router use common_utils::types::FloatMajorUnit; use crate::{ connector::utils::is_payment_failure, core::errors, types::{self, api, domain, storage::enums}, }; fn try_from( item: types::ResponseRouterData<F, PlaidPaymentsResponse, T, types::PaymentsResponseData>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/plaid/transformers.rs | crate: router use common_enums::Currency; use common_utils::types::FloatMajorUnit; use crate::{ connector::utils::is_payment_failure, core::errors, types::{self, api, domain, storage::enums}, }; fn try_from(item: &types::PaymentsPostProcessingRouterData) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/plaid/transformers.rs | crate: router use common_utils::types::FloatMajorUnit; use crate::{ connector::utils::is_payment_failure, core::errors, types::{self, api, domain, storage::enums}, }; fn try_from( item: &PlaidRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/plaid/transformers.rs | crate: router fn from(item: PlaidPaymentStatus) -> Self { { PlaidPaymentStatus::PaymentStatusAuthorising => Self::Authorizing,<|fim_suffix|> <|fim_middle|> PlaidPaymentStatus::PaymentStatusInputNeeded => Self::AuthenticationPending, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/plaid/transformers.rs | crate: router use common_utils::types::FloatMajorUnit; use crate::{ connector::utils::is_payment_failure, core::errors, types::{self, api, domain, storage::enums}, }; fn try_from(item: &types::PaymentsSyncRouterData) -> Result<Self, Self::Error> { { types::ResponseId::ConnectorTransactionId(ref id) => Ok(Self { payment_id: id.clone(), }),<|fim_suffix|> <|fim_middle|> _ => Err((errors::ConnectorError::MissingConnectorTransactionID).into()), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/plaid/transformers.rs | crate: router use common_utils::types::FloatMajorUnit; use crate::{ connector::utils::is_payment_failure, core::errors, types::{self, api, domain, storage::enums}, }; fn try_from( item: types::ResponseRouterData<F, PlaidLinkTokenResponse, T, types::PaymentsResponseData>, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/connector/plaid/transformers.rs | crate: router fn from(item: PlaidPaymentStatus) -> Self { match item { PlaidPaymentStatus::PaymentStatusAuthorising => Self::Authorizing, PlaidPaymentStatus::PaymentStatusBlocked | PlaidPaymentStatus::PaymentStatusInsufficientFunds | PlaidPaymentStatus::PaymentStatusRejected => Self::AuthorizationFailed, PlaidPaymentStatus::PaymentStatusCancelled => Self::Voided, PlaidPaymentStatus::PaymentStatusEstablished => Self::Authorized, PlaidPaymentStatus::PaymentStatusExecuted | PlaidPaymentStatus::PaymentStatusSettled | PlaidPaymentStatus::PaymentStatusInitiated => Self::Charged, PlaidPaymentStatus::PaymentStatusFailed => Self::Failure, PlaidPaymentStatus::PaymentStatusInputNeeded => Self::AuthenticationPending, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/connector/nmi/transformers.rs | crate: router use common_utils::{errors::CustomResult, ext_traits::XmlExt, pii::Email, types::FloatMajorUnit}; use crate::{ connector::utils::{ self, AddressDetailsData, PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData, RouterData, }, core::errors, services, types::{self, api, domain, storage::enums, transformers::ForeignFrom, ConnectorAuthType}, }; type Error = Report<errors::ConnectorError>; fn try_from( item: types::ResponseRouterData< api::Void, StandardResponse, T, types::PaymentsResponseData, >, ) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/connector/nmi/transformers.rs | crate: router use common_utils::{errors::CustomResult, ext_traits::XmlExt, pii::Email, types::FloatMajorUnit}; use crate::{ connector::utils::{ self, AddressDetailsData, PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData, RouterData, }, core::errors, services, types::{self, api, domain, storage::enums, transformers::ForeignFrom, ConnectorAuthType}, }; type Error = Report<errors::ConnectorError>; fn try_from( item: types::ResponseRouterData< api::Authorize, StandardResponse, types::PaymentsAuthorizeData, types::PaymentsResponseData, >, ) -> Result<Self, Self::Error> { let (response, status) = match item.response.response { Response::Approved => ( Ok(types::PaymentsResponseData::TransactionResponse { resource_id: types::ResponseId::ConnectorTransactionId( item.response.transactionid.clone(), ), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: Some(item.response.orderid), incremental_authorization_allowed: None, charges: None, }), if let Some(diesel_models::enums::CaptureMethod::Automatic) = item.data.request.capture_method { enums::AttemptStatus::CaptureInitiated } else { enums::AttemptStatus::Authorized }, ), Response::Declined | Response::Error => ( Err(types::ErrorResponse::foreign_from(( item.response, item.http_code, ))), enums::AttemptStatus::Failure, ), }; Ok(Self { status, response, ..item.data }) }
ast_fragments