id
stringlengths
11
116
type
stringclasses
1 value
granularity
stringclasses
4 values
content
stringlengths
16
477k
metadata
dict
fn_clm_hyperswitch_connectors_rim), _2063945602217666669
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/utils // Implementation of f::Aberdeenshire), for "Aberdeenshire" => O Antrim), "Antrim and Newtownabbey" => Ok(Self::AntrimAndNewtownabbey), "Ards" => Ok(Self::Ards), "Ards and North Down" => Ok(Self::ArdsAndNorthDown), "Argyll and Bute" => Ok(Self::ArgyllAndBute), "Armagh City and District Council" => Ok(Self::ArmaghCityAndDistrictCouncil), "Armagh, Banbridge and Craigavon" => Ok(Self::ArmaghBanbridgeAndCraigavon), "Ascension Island" => Ok(Self::AscensionIsland), "Ballymena Borough" => Ok(Self::BallymenaBorough), "Ballymoney" => Ok(Self::Ballymoney), "Banbridge" => Ok(Self::Banbridge), "Barnsley" => Ok(Self::Barnsley), "Bath and North East Somerset" => Ok(Self::BathAndNorthEastSomerset), "Bedford" => Ok(Self::Bedford), "Belfast district" => Ok(Self::BelfastDistrict), "Birmingham" => Ok(Self::Birmingham), "Blackburn with Darwen" => Ok(Self::BlackburnWithDarwen), "Blackpool" => Ok(Self::Blackpool), "Blaenau Gwent County Borough" => Ok(Self::BlaenauGwentCountyBorough), "Bolton" => Ok(Self::Bolton), "Bournemouth" => Ok(Self::Bournemouth), "Bracknell Forest" => Ok(Self::BracknellForest), "Bradford" => Ok(Self::Bradford), "Bridgend County Borough" => Ok(Self::BridgendCountyBorough), "Brighton and Hove" => Ok(Self::BrightonAndHove), "Buckinghamshire" => Ok(Self::Buckinghamshire), "Bury" => Ok(Self::Bury), "Caerphilly County Borough" => Ok(Self::CaerphillyCountyBorough), "Calderdale" => Ok(Self::Calderdale), "Cambridgeshire" => Ok(Self::Cambridgeshire), "Carmarthenshire" => Ok(Self::Carmarthenshire), "Carrickfergus Borough Council" => Ok(Self::CarrickfergusBoroughCouncil), "Castlereagh" => Ok(Self::Castlereagh), "Causeway Coast and Glens" => Ok(Self::CausewayCoastAndGlens), "Central Bedfordshire" => Ok(Self::CentralBedfordshire), "Ceredigion" => Ok(Self::Ceredigion), "Cheshire East" => Ok(Self::CheshireEast), "Cheshire West and Chester" => Ok(Self::CheshireWestAndChester), "City and County of Cardiff" => Ok(Self::CityAndCountyOfCardiff), "City and County of Swansea" => Ok(Self::CityAndCountyOfSwansea), "City of Bristol" => Ok(Self::CityOfBristol), "City of Derby" => Ok(Self::CityOfDerby), "City of Kingston upon Hull" => Ok(Self::CityOfKingstonUponHull), "City of Leicester" => Ok(Self::CityOfLeicester), "City of London" => Ok(Self::CityOfLondon), "City of Nottingham" => Ok(Self::CityOfNottingham), "City of Peterborough" => Ok(Self::CityOfPeterborough), "City of Plymouth" => Ok(Self::CityOfPlymouth), "City of Portsmouth" => Ok(Self::CityOfPortsmouth), "City of Southampton" => Ok(Self::CityOfSouthampton), "City of Stoke-on-Trent" => Ok(Self::CityOfStokeOnTrent), "City of Sunderland" => Ok(Self::CityOfSunderland), "City of Westminster" => Ok(Self::CityOfWestminster), "City of Wolverhampton" => Ok(Self::CityOfWolverhampton), "City of York" => Ok(Self::CityOfYork), "Clackmannanshire" => Ok(Self::Clackmannanshire), "Coleraine Borough Council" => Ok(Self::ColeraineBoroughCouncil), "Conwy County Borough" => Ok(Self::ConwyCountyBorough), "Cookstown District Council" => Ok(Self::CookstownDistrictCouncil), "Cornwall" => Ok(Self::Cornwall), "County Durham" => Ok(Self::CountyDurham), "Coventry" => Ok(Self::Coventry), "Craigavon Borough Council" => Ok(Self::CraigavonBoroughCouncil), "Cumbria" => Ok(Self::Cumbria), "Darlington" => Ok(Self::Darlington), "Denbighshire" => Ok(Self::Denbighshire), "Derbyshire" => Ok(Self::Derbyshire), "Derry City and Strabane" => Ok(Self::DerryCityAndStrabane), "Derry City Council" => Ok(Self::DerryCityCouncil), "Devon" => Ok(Self::Devon), "Doncaster" => Ok(Self::Doncaster), "Dorset" => Ok(Self::Dorset), "Down District Council" => Ok(Self::DownDistrictCouncil), "Dudley" => Ok(Self::Dudley), "Dumfries and Galloway" => Ok(Self::DumfriesAndGalloway), "Dundee" => Ok(Self::Dundee), "Dungannon and South Tyrone Borough Council" => { Ok(Self::DungannonAndSouthTyroneBoroughCouncil) } "East Ayrshire" => Ok(Self::EastAyrshire), "East Dunbartonshire" => Ok(Self::EastDunbartonshire), "East Lothian" => Ok(Self::EastLothian), "East Renfrewshire" => Ok(Self::EastRenfrewshire), "East Riding of Yorkshire" => Ok(Self::EastRidingOfYorkshire), "East Sussex" => Ok(Self::EastSussex), "Edinburgh" => Ok(Self::Edinburgh), "England" => Ok(Self::England), "Essex" => Ok(Self::Essex), "Falkirk" => Ok(Self::Falkirk), "Fermanagh and Omagh" => Ok(Self::FermanaghAndOmagh), "Fermanagh District Council" => Ok(Self::FermanaghDistrictCouncil), "Fife" => Ok(Self::Fife), "Flintshire" => Ok(Self::Flintshire), "Gateshead" => Ok(Self::Gateshead), "Glasgow" => Ok(Self::Glasgow), "Gloucestershire" => Ok(Self::Gloucestershire), "Gwynedd" => Ok(Self::Gwynedd), "Halton" => Ok(Self::Halton), "Hampshire" => Ok(Self::Hampshire), "Hartlepool" => Ok(Self::Hartlepool), "Herefordshire" => Ok(Self::Herefordshire), "Hertfordshire" => Ok(Self::Hertfordshire), "Highland" => Ok(Self::Highland), "Inverclyde" => Ok(Self::Inverclyde), "Isle of Wight" => Ok(Self::IsleOfWight), "Isles of Scilly" => Ok(Self::IslesOfScilly), "Kent" => Ok(Self::Kent), "Kirklees" => Ok(Self::Kirklees), "Knowsley" => Ok(Self::Knowsley), "Lancashire" => Ok(Self::Lancashire), "Larne Borough Council" => Ok(Self::LarneBoroughCouncil), "Leeds" => Ok(Self::Leeds), "Leicestershire" => Ok(Self::Leicestershire), "Limavady Borough Council" => Ok(Self::LimavadyBoroughCouncil), "Lincolnshire" => Ok(Self::Lincolnshire), "Lisburn and Castlereagh" => Ok(Self::LisburnAndCastlereagh), "Lisburn City Council" => Ok(Self::LisburnCityCouncil), "Liverpool" => Ok(Self::Liverpool), "London Borough of Barking and Dagenham" => { Ok(Self::LondonBoroughOfBarkingAndDagenham) } "London Borough of Barnet" => Ok(Self::LondonBoroughOfBarnet), "London Borough of Bexley" => Ok(Self::LondonBoroughOfBexley), "London Borough of Brent" => Ok(Self::LondonBoroughOfBrent), "London Borough of Bromley" => Ok(Self::LondonBoroughOfBromley), "London Borough of Camden" => Ok(Self::LondonBoroughOfCamden), "London Borough of Croydon" => Ok(Self::LondonBoroughOfCroydon), "London Borough of Ealing" => Ok(Self::LondonBoroughOfEaling), "London Borough of Enfield" => Ok(Self::LondonBoroughOfEnfield), "London Borough of Hackney" => Ok(Self::LondonBoroughOfHackney), "London Borough of Hammersmith and Fulham" => { Ok(Self::LondonBoroughOfHammersmithAndFulham) } "London Borough of Haringey" => Ok(Self::LondonBoroughOfHaringey), "London Borough of Harrow" => Ok(Self::LondonBoroughOfHarrow), "London Borough of Havering" => Ok(Self::LondonBoroughOfHavering), "London Borough of Hillingdon" => Ok(Self::LondonBoroughOfHillingdon), "London Borough of Hounslow" => Ok(Self::LondonBoroughOfHounslow), "London Borough of Islington" => Ok(Self::LondonBoroughOfIslington), "London Borough of Lambeth" => Ok(Self::LondonBoroughOfLambeth), "London Borough of Lewisham" => Ok(Self::LondonBoroughOfLewisham), "London Borough of Merton" => Ok(Self::LondonBoroughOfMerton), "London Borough of Newham" => Ok(Self::LondonBoroughOfNewham), "London Borough of Redbridge" => Ok(Self::LondonBoroughOfRedbridge), "London Borough of Richmond upon Thames" => { Ok(Self::LondonBoroughOfRichmondUponThames) } "London Borough of Southwark" => Ok(Self::LondonBoroughOfSouthwark), "London Borough of Sutton" => Ok(Self::LondonBoroughOfSutton), "London Borough of Tower Hamlets" => Ok(Self::LondonBoroughOfTowerHamlets), "London Borough of Waltham Forest" => Ok(Self::LondonBoroughOfWalthamForest), "London Borough of Wandsworth" => Ok(Self::LondonBoroughOfWandsworth), "Magherafelt District Council" => Ok(Self::MagherafeltDistrictCouncil), "Manchester" => Ok(Self::Manchester), "Medway" => Ok(Self::Medway), "Merthyr Tydfil County Borough" => Ok(Self::MerthyrTydfilCountyBorough), "Metropolitan Borough of Wigan" => Ok(Self::MetropolitanBoroughOfWigan), "Mid and East Antrim" => Ok(Self::MidAndEastAntrim), "Mid Ulster" => Ok(Self::MidUlster), "Middlesbrough" => Ok(Self::Middlesbrough), "Midlothian" => Ok(Self::Midlothian), "Milton Keynes" => Ok(Self::MiltonKeynes), "Monmouthshire" => Ok(Self::Monmouthshire), "Moray" => Ok(Self::Moray), "Moyle District Council" => Ok(Self::MoyleDistrictCouncil), "Neath Port Talbot County Borough" => Ok(Self::NeathPortTalbotCountyBorough), "Newcastle upon Tyne" => Ok(Self::NewcastleUponTyne), "Newport" => Ok(Self::Newport), "Newry and Mourne District Council" => Ok(Self::NewryAndMourneDistrictCouncil), "Newry, Mourne and Down" => Ok(Self::NewryMourneAndDown), "Newtownabbey Borough Council" => Ok(Self::NewtownabbeyBoroughCouncil), "Norfolk" => Ok(Self::Norfolk), "North Ayrshire" => Ok(Self::NorthAyrshire), "North Down Borough Council" => Ok(Self::NorthDownBoroughCouncil), "North East Lincolnshire" => Ok(Self::NorthEastLincolnshire), "North Lanarkshire" => Ok(Self::NorthLanarkshire), "North Lincolnshire" => Ok(Self::NorthLincolnshire), "North Somerset" => Ok(Self::NorthSomerset), "North Tyneside" => Ok(Self::NorthTyneside), "North Yorkshire" => Ok(Self::NorthYorkshire), "Northamptonshire" => Ok(Self::Northamptonshire), "Northern Ireland" => Ok(Self::NorthernIreland), "Northumberland" => Ok(Self::Northumberland), "Nottinghamshire" => Ok(Self::Nottinghamshire), "Oldham" => Ok(Self::Oldham), "Omagh District Council" => Ok(Self::OmaghDistrictCouncil), "Orkney Islands" => Ok(Self::OrkneyIslands), "Outer Hebrides" => Ok(Self::OuterHebrides), "Oxfordshire" => Ok(Self::Oxfordshire), "Pembrokeshire" => Ok(Self::Pembrokeshire), "Perth and Kinross" => Ok(Self::PerthAndKinross), "Poole" => Ok(Self::Poole), "Powys" => Ok(Self::Powys), "Reading" => Ok(Self::Reading), "Redcar and Cleveland" => Ok(Self::RedcarAndCleveland), "Renfrewshire" => Ok(Self::Renfrewshire), "Rhondda Cynon Taf" => Ok(Self::RhonddaCynonTaf), "Rochdale" => Ok(Self::Rochdale), "Rotherham" => Ok(Self::Rotherham), "Royal Borough of Greenwich" => Ok(Self::RoyalBoroughOfGreenwich), "Royal Borough of Kensington and Chelsea" => { Ok(Self::RoyalBoroughOfKensingtonAndChelsea) } "Royal Borough of Kingston upon Thames" => { Ok(Self::RoyalBoroughOfKingstonUponThames) } "Rutland" => Ok(Self::Rutland), "Saint Helena" => Ok(Self::SaintHelena), "Salford" => Ok(Self::Salford), "Sandwell" => Ok(Self::Sandwell), "Scotland" => Ok(Self::Scotland), "Scottish Borders" => Ok(Self::ScottishBorders), "Sefton" => Ok(Self::Sefton), "Sheffield" => Ok(Self::Sheffield), "Shetland Islands" => Ok(Self::ShetlandIslands), "Shropshire" => Ok(Self::Shropshire), "Slough" => Ok(Self::Slough), "Solihull" => Ok(Self::Solihull), "Somerset" => Ok(Self::Somerset), "South Ayrshire" => Ok(Self::SouthAyrshire), "South Gloucestershire" => Ok(Self::SouthGloucestershire), "South Lanarkshire" => Ok(Self::SouthLanarkshire), "South Tyneside" => Ok(Self::SouthTyneside), "Southend-on-Sea" => Ok(Self::SouthendOnSea), "St Helens" => Ok(Self::StHelens), "Staffordshire" => Ok(Self::Staffordshire), "Stirling" => Ok(Self::Stirling), "Stockport" => Ok(Self::Stockport), "Stockton-on-Tees" => Ok(Self::StocktonOnTees), "Strabane District Council" => Ok(Self::StrabaneDistrictCouncil), "Suffolk" => Ok(Self::Suffolk), "Surrey" => Ok(Self::Surrey), "Swindon" => Ok(Self::Swindon), "Tameside" => Ok(Self::Tameside), "Telford and Wrekin" => Ok(Self::TelfordAndWrekin), "Thurrock" => Ok(Self::Thurrock), "Torbay" => Ok(Self::Torbay), "Torfaen" => Ok(Self::Torfaen), "Trafford" => Ok(Self::Trafford), "United Kingdom" => Ok(Self::UnitedKingdom), "Vale of Glamorgan" => Ok(Self::ValeOfGlamorgan), "Wakefield" => Ok(Self::Wakefield), "Wales" => Ok(Self::Wales), "Walsall" => Ok(Self::Walsall), "Warrington" => Ok(Self::Warrington), "Warwickshire" => Ok(Self::Warwickshire), "West Berkshire" => Ok(Self::WestBerkshire), "West Dunbartonshire" => Ok(Self::WestDunbartonshire), "West Lothian" => Ok(Self::WestLothian), "West Sussex" => Ok(Self::WestSussex), "Wiltshire" => Ok(Self::Wiltshire), "Windsor and Maidenhead" => Ok(Self::WindsorAndMaidenhead), "Wirral" => Ok(Self::Wirral), "Wokingham" => Ok(Self::Wokingham), "Worcestershire" => Ok(Self::Worcestershire), "Wrexham County Borough" => Ok(Self::WrexhamCountyBorough), _ => Err(errors::ConnectorError::InvalidDataFormat { field_name: "address.state", } .into()), }, } } } impl ForeignTryFrom<String> for BelgiumStatesAbbreviation { type Error = error_stack::Report<errors::ConnectorError>; fn foreign_try_from(value: String) -> Result<Self, Self::Error> { let state_abbreviation_check = StringExt::<Self>::parse_enum(value.clone(), "BelgiumStatesAbbreviation"); match state_abbreviation_check { Ok(state_abbreviation) => Ok(state_abbreviation), Err(_) => match value.as_str() { "Antwerp" => Ok(Self::Antwerp), "Br
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 510, "total_crates": null }
fn_clm_hyperswitch_connectors_missing_field_err_2063945602217666669
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/utils pub(crate) fn missing_field_err( message: &'static str, ) -> Box<dyn Fn() -> error_stack::Report<errors::ConnectorError> + 'static> { Box::new(move || { errors::ConnectorError::MissingRequiredField { field_name: message, } .into() }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 491, "total_crates": null }
fn_clm_hyperswitch_connectors_foreign_try_from_2063945602217666669
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/utils // Implementation of PolandStatesAbbreviation for ForeignTryFrom<String> fn foreign_try_from(value: String) -> Result<Self, Self::Error> { let state_abbreviation_check = StringExt::<Self>::parse_enum(value.clone(), "PolandStatesAbbreviation"); match state_abbreviation_check { Ok(state_abbreviation) => Ok(state_abbreviation), Err(_) => match value.as_str() { "Greater Poland" => Ok(Self::GreaterPoland), "Holy Cross" => Ok(Self::HolyCross), "Kuyavia-Pomerania" => Ok(Self::KuyaviaPomerania), "Lesser Poland" => Ok(Self::LesserPoland), "Lower Silesia" => Ok(Self::LowerSilesia), "Lublin" => Ok(Self::Lublin), "Lubusz" => Ok(Self::Lubusz), "Łódź" => Ok(Self::Łódź), "Mazovia" => Ok(Self::Mazovia), "Podlaskie" => Ok(Self::Podlaskie), "Pomerania" => Ok(Self::Pomerania), "Silesia" => Ok(Self::Silesia), "Subcarpathia" => Ok(Self::Subcarpathia), "Upper Silesia" => Ok(Self::UpperSilesia), "Warmia-Masuria" => Ok(Self::WarmiaMasuria), "West Pomerania" => Ok(Self::WestPomerania), _ => Err(errors::ConnectorError::InvalidDataFormat { field_name: "address.state", } .into()), }, } } } im
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 456, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-1542551976586087613
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexinets // Implementation of Nexinets for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: nexinets::NexinetsErrorResponse = res .response .parse_struct("NexinetsErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); let errors = response.errors; let mut message = String::new(); let mut static_message = String::new(); for error in errors.iter() { let field = error.field.to_owned().unwrap_or_default(); let mut msg = String::new(); if !field.is_empty() { msg.push_str(format!("{} : {}", field, error.message).as_str()); } else { error.message.clone_into(&mut msg) } if message.is_empty() { message.push_str(&msg); static_message.push_str(&msg); } else { message.push_str(format!(", {msg}").as_str()); } } let connector_reason = format!("reason : {} , message : {}", response.message, message); Ok(ErrorResponse { status_code: response.status, code: response.code.to_string(), message: static_message, reason: Some(connector_reason), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 471, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-1542551976586087613
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexinets // Implementation of Nexinets for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let transaction_id = req .request .connector_refund_id .clone() .ok_or(errors::ConnectorError::MissingConnectorRefundID)?; let meta: nexinets::NexinetsPaymentsMetadata = to_connector_meta(req.request.connector_metadata.clone())?; let order_id = nexinets::get_order_id(&meta)?; Ok(format!( "{}/orders/{order_id}/transactions/{transaction_id}", self.base_url(connectors) )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 417, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-1542551976586087613
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexinets // Implementation of Nexinets for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-1542551976586087613
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexinets // Implementation of Nexinets for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_-1542551976586087613
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexinets // Implementation of Nexinets for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), )]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 372, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_1918703725894437596
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault // Implementation of HyperswitchVault for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: hyperswitch_vault::HyperswitchVaultErrorResponse = res .response .parse_struct("HyperswitchVaultErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.error.code, message: response.error.error_type, reason: response.error.message, attempt_status: None, connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 439, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_1918703725894437596
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault // Implementation of HyperswitchVault for ConnectorIntegration<CreateConnectorCustomer, ConnectorCustomerData, PaymentsResponseData> fn get_url( &self, _req: &ConnectorCustomerRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}/v2/customers", self.base_url(connectors))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_1918703725894437596
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault // Implementation of HyperswitchVault for ConnectorIntegration<CreateConnectorCustomer, ConnectorCustomerData, PaymentsResponseData> fn get_headers( &self, req: &ConnectorCustomerRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_1918703725894437596
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault // Implementation of HyperswitchVault for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_1918703725894437596
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault // Implementation of HyperswitchVault for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let auth = hyperswitch_vault::HyperswitchVaultAuthType::try_from(&req.connector_auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let api_key = auth.api_key.expose(); let header = vec![ ( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), ), ( headers::AUTHORIZATION.to_string(), format!("api-key={api_key}").into_masked(), ), ( headers::X_PROFILE_ID.to_string(), auth.profile_id.expose().into_masked(), ), ]; Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 374, "total_crates": null }
fn_clm_hyperswitch_connectors_new_2835710600932603677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo // Inherent implementation for Wellsfargo pub fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_2835710600932603677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo // Implementation of Wellsfargo for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result< wellsfargo::WellsfargoErrorResponse, Report<common_utils::errors::ParsingError>, > = res.response.parse_struct("Wellsfargo ErrorResponse"); let error_message = if res.status_code == 401 { constants::CONNECTOR_UNAUTHORIZED_ERROR } else { hyperswitch_interfaces::consts::NO_ERROR_MESSAGE }; match response { Ok(transformers::WellsfargoErrorResponse::StandardError(response)) => { event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); let (code, message, reason) = match response.error_information { Some(ref error_info) => { let detailed_error_info = error_info.details.as_ref().map(|details| { details .iter() .map(|det| format!("{} : {}", det.field, det.reason)) .collect::<Vec<_>>() .join(", ") }); ( error_info.reason.clone(), error_info.reason.clone(), transformers::get_error_reason( Some(error_info.message.clone()), detailed_error_info, None, ), ) } None => { let detailed_error_info = response.details.map(|details| { details .iter() .map(|det| format!("{} : {}", det.field, det.reason)) .collect::<Vec<_>>() .join(", ") }); ( response.reason.clone().map_or( hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), |reason| reason.to_string(), ), response .reason .map_or(error_message.to_string(), |reason| reason.to_string()), transformers::get_error_reason( response.message, detailed_error_info, None, ), ) } }; Ok(ErrorResponse { status_code: res.status_code, code, message, reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Ok(transformers::WellsfargoErrorResponse::AuthenticationError(response)) => { event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), message: response.response.rmsg.clone(), reason: Some(response.response.rmsg), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Ok(transformers::WellsfargoErrorResponse::NotAvailableError(response)) => { event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); let error_response = response .errors .iter() .map(|error_info| { format!( "{}: {}", error_info.error_type.clone().unwrap_or("".to_string()), error_info.message.clone().unwrap_or("".to_string()) ) }) .collect::<Vec<String>>() .join(" & "); Ok(ErrorResponse { status_code: res.status_code, code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), message: error_response.clone(), reason: Some(error_response), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); router_env::logger::error!(deserialization_error =? error_msg); utils::handle_json_response_deserialization_failure(res, "wellsfargo") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 507, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_2835710600932603677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo // Implementation of Wellsfargo for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let date = OffsetDateTime::now_utc(); let wellsfargo_req = self.get_request_body(req, connectors)?; let auth = wellsfargo::WellsfargoAuthType::try_from(&req.connector_auth_type)?; let merchant_account = auth.merchant_account.clone(); let base_url = connectors.wellsfargo.base_url.as_str(); let wellsfargo_host = Url::parse(base_url).change_context(errors::ConnectorError::RequestEncodingFailed)?; let host = wellsfargo_host .host_str() .ok_or(errors::ConnectorError::RequestEncodingFailed)?; let path: String = self .get_url(req, connectors)? .chars() .skip(base_url.len() - 1) .collect(); let sha256 = self.generate_digest(wellsfargo_req.get_inner_value().expose().as_bytes()); let http_method = self.get_http_method(); let signature = self.generate_signature( auth, host.to_string(), path.as_str(), &sha256, date, http_method, )?; let mut headers = vec![ ( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), ), ( headers::ACCEPT.to_string(), "application/hal+json;charset=utf-8".to_string().into(), ), ( "v-c-merchant-id".to_string(), merchant_account.into_masked(), ), ("Date".to_string(), date.to_string().into()), ("Host".to_string(), host.to_string().into()), ("Signature".to_string(), signature.into_masked()), ]; if matches!(http_method, Method::Post | Method::Put | Method::Patch) { headers.push(( "Digest".to_string(), format!("SHA-256={sha256}").into_masked(), )); } Ok(headers) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 418, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_2835710600932603677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo // Implementation of Wellsfargo for ConnectorIntegration< IncrementalAuthorization, PaymentsIncrementalAuthorizationData, PaymentsResponseData, > fn get_url( &self, req: &PaymentsIncrementalAuthorizationRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( "{}pts/v2/payments/{}", self.base_url(connectors), connector_payment_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 409, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_2835710600932603677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo // Implementation of Wellsfargo for ConnectorIntegration< IncrementalAuthorization, PaymentsIncrementalAuthorizationData, PaymentsResponseData, > fn get_headers( &self, req: &PaymentsIncrementalAuthorizationRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_5296017607734766926
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zsl // Implementation of Zsl for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response = serde_urlencoded::from_bytes::<zsl::ZslErrorResponse>(&res.response) .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); let error_reason = zsl::ZslResponseStatus::try_from(response.status.clone())?.to_string(); Ok(ErrorResponse { status_code: res.status_code, code: response.status, message: error_reason.clone(), reason: Some(error_reason), attempt_status: Some(common_enums::AttemptStatus::Failure), connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 445, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_5296017607734766926
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zsl // Implementation of Zsl for ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> fn get_url( &self, _req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}ecp", self.base_url(connectors))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_5296017607734766926
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zsl // Implementation of Zsl for ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> fn get_headers( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_5296017607734766926
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zsl // Implementation of Zsl for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/x-www-form-urlencoded" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_5296017607734766926
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zsl // Implementation of Zsl for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, _req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let header = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), )]; Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 368, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-4875401429173127134
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/braintree // Inherent implementation for Braintree pub const fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, amount_converter_webhooks: &StringMinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-4875401429173127134
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/braintree // Implementation of Braintree for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result<braintree::ErrorResponses, Report<ParsingError>> = res.response.parse_struct("Braintree Error Response"); match response { Ok(braintree::ErrorResponses::BraintreeApiErrorResponse(response)) => { event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); let error_object = response.api_error_response.errors; let error = error_object.errors.first().or(error_object .transaction .as_ref() .and_then(|transaction_error| { transaction_error.errors.first().or(transaction_error .credit_card .as_ref() .and_then(|credit_card_error| credit_card_error.errors.first())) })); let (code, message) = error.map_or( (NO_ERROR_CODE.to_string(), NO_ERROR_MESSAGE.to_string()), |error| (error.code.clone(), error.message.clone()), ); Ok(ErrorResponse { status_code: res.status_code, code, message, reason: Some(response.api_error_response.message), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Ok(braintree::ErrorResponses::BraintreeErrorResponse(response)) => { event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: NO_ERROR_CODE.to_string(), message: NO_ERROR_MESSAGE.to_string(), reason: Some(response.errors), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); logger::error!(deserialization_error =? error_msg); utils::handle_json_response_deserialization_failure(res, "braintree") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 479, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-4875401429173127134
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/braintree // Implementation of Braintree for ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData> fn get_url( &self, _req: &PaymentsCompleteAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(self.base_url(connectors).to_string()) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 411, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-4875401429173127134
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/braintree // Implementation of Braintree for ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData> fn get_headers( &self, req: &PaymentsCompleteAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_-4875401429173127134
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/braintree // Implementation of Braintree for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let mut header = vec![ ( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), ), ( BRAINTREE_VERSION.to_string(), BRAINTREE_VERSION_VALUE.to_string().into(), ), ]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 372, "total_crates": null }
fn_clm_hyperswitch_connectors_new_1148606974069439871
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/noon // Inherent implementation for Noon pub const fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_1148606974069439871
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/noon // Implementation of Noon for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result<noon::NoonErrorResponse, Report<common_utils::errors::ParsingError>> = res.response.parse_struct("NoonErrorResponse"); match response { Ok(noon_error_response) => { event_builder.map(|i| i.set_error_response_body(&noon_error_response)); router_env::logger::info!(connector_response=?noon_error_response); // Adding in case of timeouts, if psync gives 4xx with this code, fail the payment let attempt_status = if noon_error_response.result_code == 19001 { Some(enums::AttemptStatus::Failure) } else { None }; Ok(ErrorResponse { status_code: res.status_code, code: noon_error_response.result_code.to_string(), message: noon_error_response.class_description, reason: Some(noon_error_response.message), attempt_status, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(error_message) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); logger::error!(deserialization_error =? error_message); connector_utils::handle_json_response_deserialization_failure(res, "noon") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 445, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_1148606974069439871
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/noon // Implementation of Noon for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}payment/v1/order/getbyreference/{}", self.base_url(connectors), req.connector_request_reference_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_1148606974069439871
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/noon // Implementation of Noon for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_1148606974069439871
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/noon // Implementation of Noon for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_4386037396781371483
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/breadpay // Inherent implementation for Breadpay pub fn new() -> &'static Self { &Self { amount_converter: &StringMinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_4386037396781371483
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/breadpay // Implementation of Breadpay for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: breadpay::BreadpayErrorResponse = res .response .parse_struct("BreadpayErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.error_type.clone(), message: response.description.clone(), reason: Some(response.description), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 443, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_4386037396781371483
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/breadpay // Implementation of Breadpay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, _req: &RefundSyncRouterData, _connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 413, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_4386037396781371483
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/breadpay // Implementation of Breadpay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_4386037396781371483
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/breadpay // Implementation of Breadpay for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_5712031762172796022
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv // Inherent implementation for Worldpayvantiv pub fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_5712031762172796022
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv // Implementation of Worldpayvantiv for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result<worldpayvantiv::CnpOnlineResponse, _> = connector_utils::deserialize_xml_to_struct(&res.response); match response { Ok(response_data) => { event_builder.map(|i| i.set_response_body(&response_data)); router_env::logger::info!(connector_response=?response_data); Ok(ErrorResponse { status_code: res.status_code, code: response_data.response_code, message: response_data.message.clone(), reason: Some(response_data.message.clone()), attempt_status: None, connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, connector_metadata: None, }) } Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); router_env::logger::error!(deserialization_error =? error_msg); connector_utils::handle_json_response_deserialization_failure(res, "worldpayvantiv") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 447, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_5712031762172796022
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv // Implementation of Worldpayvantiv for ConnectorIntegration<Retrieve, RetrieveFileRequestData, RetrieveFileResponse> fn get_url( &self, req: &RetrieveFileRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_dispute_id = req.request.connector_dispute_id.clone().ok_or( errors::ConnectorError::MissingRequiredField { field_name: "dispute_id", }, )?; Ok(format!( "{}/services/chargebacks/retrieve/{connector_dispute_id}/{}", connectors.worldpayvantiv.third_base_url.to_owned(), req.request.provider_file_id, )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 411, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_5712031762172796022
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv // Implementation of Worldpayvantiv for ConnectorIntegration<Retrieve, RetrieveFileRequestData, RetrieveFileResponse> fn get_headers( &self, req: &RouterData<Retrieve, RetrieveFileRequestData, RetrieveFileResponse>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.get_auth_header(&req.connector_auth_type) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_5712031762172796022
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv // Implementation of Worldpayvantiv for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "text/xml" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-773757900502903155
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/thunes // Inherent implementation for Thunes pub fn new() -> &'static Self { &Self { amount_converter: &StringMinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-773757900502903155
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/thunes // Implementation of Thunes for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: thunes::ThunesErrorResponse = res .response .parse_struct("ThunesErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.code, message: response.message, reason: response.reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 439, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-773757900502903155
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/thunes // Implementation of Thunes for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, _req: &RefundSyncRouterData, _connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 413, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-773757900502903155
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/thunes // Implementation of Thunes for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-773757900502903155
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/thunes // Implementation of Thunes for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-1578604827708669363
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paysafe // Inherent implementation for Paysafe pub fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-1578604827708669363
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paysafe // Implementation of Paysafe for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: paysafe::PaysafeErrorResponse = res .response .parse_struct("PaysafeErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); let detail_message = response .error .details .as_ref() .and_then(|d| d.first().cloned()); let field_error_message = response .error .field_errors .as_ref() .and_then(|f| f.first().map(|fe| fe.error.clone())); let reason = match (detail_message, field_error_message) { (Some(detail), Some(field)) => Some(format!("{detail}, {field}")), (Some(detail), None) => Some(detail), (None, Some(field)) => Some(field), (None, None) => Some(response.error.message.clone()), }; Ok(ErrorResponse { status_code: res.status_code, code: response.error.code, message: response.error.message, reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 459, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-1578604827708669363
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paysafe // Implementation of Paysafe for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_refund_id = req.request.get_connector_refund_id()?; Ok(format!( "{}v1/refunds/{}", self.base_url(connectors), connector_refund_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 409, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-1578604827708669363
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paysafe // Implementation of Paysafe for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-1578604827708669363
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paysafe // Implementation of Paysafe for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-379757573276329184
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nordea // Implementation of None for Nordea pub fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-379757573276329184
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nordea // Implementation of Nordea for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: responses::NordeaErrorResponse = res .response .parse_struct("NordeaErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: get_error_data(response.error.as_ref()) .and_then(|failure| failure.code.clone()) .unwrap_or(NO_ERROR_CODE.to_string()), message: get_error_data(response.error.as_ref()) .and_then(|failure| failure.description.clone()) .unwrap_or(NO_ERROR_MESSAGE.to_string()), reason: get_error_data(response.error.as_ref()) .and_then(|failure| failure.failure_type.clone()), attempt_status: None, connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 471, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_-379757573276329184
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nordea // Implementation of Nordea for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let access_token = req .access_token .clone() .ok_or(errors::ConnectorError::FailedToObtainAuthType)?; let auth = NordeaAuthType::try_from(&req.connector_auth_type)?; let content_type = self.get_content_type().to_string(); let http_method = self.get_http_method(); // Extract host from base URL let nordea_host = Url::parse(self.base_url(connectors)) .change_context(errors::ConnectorError::RequestEncodingFailed)? .host_str() .ok_or(errors::ConnectorError::RequestEncodingFailed)? .to_string(); let nordea_origin_date = date_time::now_rfc7231_http_date() .change_context(errors::ConnectorError::RequestEncodingFailed)?; let full_url = self.get_url(req, connectors)?; let url_parsed = Url::parse(&full_url).change_context(errors::ConnectorError::RequestEncodingFailed)?; let path = url_parsed.path(); let path_with_query = if let Some(query) = url_parsed.query() { format!("{path}?{query}") } else { path.to_string() }; let mut required_headers = vec![ ( headers::CONTENT_TYPE.to_string(), content_type.clone().into(), ), ( headers::AUTHORIZATION.to_string(), format!("Bearer {}", access_token.token.peek()).into_masked(), ), ( "X-IBM-Client-ID".to_string(), auth.client_id.clone().expose().into_masked(), ), ( "X-IBM-Client-Secret".to_string(), auth.client_secret.clone().expose().into_masked(), ), ( "X-Nordea-Originating-Date".to_string(), nordea_origin_date.clone().into_masked(), ), ( "X-Nordea-Originating-Host".to_string(), nordea_host.clone().into_masked(), ), ]; if matches!(http_method, Method::Post | Method::Put | Method::Patch) { let nordea_request = self.get_request_body(req, connectors)?; let sha256_digest = self.generate_digest_from_request(&nordea_request); // Add Digest header required_headers.push(( "Digest".to_string(), sha256_digest.to_string().into_masked(), )); let signature = self.generate_signature( &auth, SignatureParams { content_type: &content_type, host: &nordea_host, path, payload_digest: Some(&sha256_digest), date: &nordea_origin_date, http_method, }, )?; required_headers.push(("Signature".to_string(), signature.into_masked())); } else { // Generate signature without digest for GET requests let signature = self.generate_signature( &auth, SignatureParams { content_type: &content_type, host: &nordea_host, path: &path_with_query, payload_digest: None, date: &nordea_origin_date, http_method, }, )?; required_headers.push(("Signature".to_string(), signature.into_masked())); } Ok(required_headers) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 436, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-379757573276329184
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nordea // Implementation of Nordea for ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> fn get_url( &self, req: &PaymentsSyncRouterData, _connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let id = req.request.connector_transaction_id.clone(); let connector_transaction_id = id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; Ok(format!( "{}{}{}", self.base_url(_connectors), "/personal/v5/payments/", connector_transaction_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 413, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-379757573276329184
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nordea // Implementation of Nordea for ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> fn get_headers( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-6286632636366415807
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform // Inherent implementation for Adyenplatform pub const fn new() -> &'static Self { &Self { #[cfg(feature = "payouts")] amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-6286632636366415807
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform // Implementation of Adyenplatform for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, ConnectorError> { let response: adyenplatform::AdyenTransferErrorResponse = res .response .parse_struct("AdyenTransferErrorResponse") .change_context(ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); let message = if let Some(invalid_fields) = &response.invalid_fields { match serde_json::to_string(invalid_fields) { Ok(invalid_fields_json) => format!( "{}\nInvalid fields: {}", response.title, invalid_fields_json ), Err(_) => response.title.clone(), } } else if let Some(detail) = &response.detail { format!("{}\nDetail: {}", response.title, detail) } else { response.title.clone() }; Ok(ErrorResponse { status_code: res.status_code, code: response.error_code, message, reason: response.detail, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 445, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-6286632636366415807
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform // Implementation of Adyenplatform for ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> fn get_url( &self, _req: &PayoutsRouterData<PoFulfill>, connectors: &Connectors, ) -> CustomResult<String, ConnectorError> { Ok(format!( "{}btl/v4/transfers", connectors.adyenplatform.base_url, )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-6286632636366415807
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform // Implementation of Adyenplatform for ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> fn get_headers( &self, req: &PayoutsRouterData<PoFulfill>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), PayoutFulfillType::get_content_type(self).to_string().into(), )]; let auth = adyenplatform::AdyenplatformAuthType::try_from(&req.connector_auth_type) .change_context(ConnectorError::FailedToObtainAuthType)?; let mut api_key = vec![( headers::AUTHORIZATION.to_string(), auth.api_key.into_masked(), )]; header.append(&mut api_key); Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 386, "total_crates": null }
fn_clm_hyperswitch_connectors_get_request_body_-6286632636366415807
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform // Implementation of Adyenplatform for ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> fn get_request_body( &self, req: &PayoutsRouterData<PoFulfill>, _connectors: &Connectors, ) -> CustomResult<RequestContent, ConnectorError> { let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.destination_currency, )?; let connector_router_data = adyenplatform::AdyenPlatformRouterData::try_from((amount, req))?; let connector_req = adyenplatform::AdyenTransferRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 303, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-6516912250254676916
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/amazonpay // Implementation of None for Amazonpay pub fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-6516912250254676916
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/amazonpay // Implementation of Amazonpay for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: amazonpay::AmazonpayErrorResponse = res .response .parse_struct("AmazonpayErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.reason_code.clone(), message: response.message.clone(), attempt_status: None, connector_transaction_id: None, reason: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 443, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_-6516912250254676916
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/amazonpay // Implementation of Amazonpay for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let http_method = self.get_http_method(); let canonical_uri: String = self.get_url(req, connectors)? .replacen(AMAZON_PAY_API_BASE_URL, "", 1); let mut header = vec![ ( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), ), ( headers::ACCEPT.to_string(), "application/json".to_string().into(), ), ( HEADER_DATE.to_string(), Utc::now() .format("%Y-%m-%dT%H:%M:%SZ") .to_string() .into_masked(), ), ( HEADER_HOST.to_string(), AMAZON_PAY_HOST.to_string().into_masked(), ), (HEADER_REGION.to_string(), "na".to_string().into_masked()), ]; if http_method == Method::Post && Self::get_last_segment(&canonical_uri) != *FINALIZE_SEGMENT.to_string() { header.push(( HEADER_IDEMPOTENCY_KEY.to_string(), req.connector_request_reference_id.clone().into_masked(), )); } let hashed_payload = if http_method == Method::Get { hex::encode(Sha256::digest("".as_bytes())) } else { hex::encode(Sha256::digest( self.get_request_body(req, connectors)? .get_inner_value() .expose() .as_bytes(), )) }; let authorization = self.create_authorization_header( amazonpay::AmazonpayAuthType::try_from(&req.connector_auth_type)?, &canonical_uri, &http_method, &hashed_payload, &header, ); header.push(( headers::AUTHORIZATION.to_string(), authorization.clone().into_masked(), )); Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 416, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-6516912250254676916
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/amazonpay // Implementation of Amazonpay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}/refunds/{}", self.base_url(connectors), req.request.connector_refund_id.clone().unwrap_or_default() )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-6516912250254676916
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/amazonpay // Implementation of Amazonpay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-5174422623353363758
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/signifyd // Implementation of Signifyd for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, ConnectorError> { let response: signifyd::SignifydErrorResponse = res .response .parse_struct("SignifydErrorResponse") .change_context(ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: NO_ERROR_CODE.to_string(), message: response.messages.join(" &"), reason: Some(response.errors.to_string()), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 445, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-5174422623353363758
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/signifyd // Implementation of Signifyd for ConnectorIntegration<RecordReturn, FraudCheckRecordReturnData, FraudCheckResponseData> fn get_url( &self, _req: &FrmRecordReturnRouterData, connectors: &Connectors, ) -> CustomResult<String, ConnectorError> { Ok(format!( "{}{}", self.base_url(connectors), "v3/orders/events/returns/records" )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-5174422623353363758
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/signifyd // Implementation of Signifyd for ConnectorIntegration<RecordReturn, FraudCheckRecordReturnData, FraudCheckResponseData> fn get_headers( &self, req: &FrmRecordReturnRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-5174422623353363758
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/signifyd // Implementation of Signifyd for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_-5174422623353363758
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/signifyd // Implementation of Signifyd for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), )]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 372, "total_crates": null }
fn_clm_hyperswitch_connectors_new_9212033100283166146
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase // Inherent implementation for Coinbase pub fn new() -> &'static Self { &Self { amount_convertor: &StringMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_9212033100283166146
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase // Implementation of Coinbase for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: coinbase::CoinbaseErrorResponse = res .response .parse_struct("CoinbaseErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.error.error_type, message: response.error.message, reason: response.error.code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 439, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_9212033100283166146
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase // Implementation of Coinbase for ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> fn get_url( &self, _req: &PaymentsSyncRouterData, _connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_id = _req .request .connector_transaction_id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; Ok(format!( "{}/charges/{}", self.base_url(_connectors), connector_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 411, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_9212033100283166146
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase // Implementation of Coinbase for ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> fn get_headers( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_9212033100283166146
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase // Implementation of Coinbase for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-6125669946082353839
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payme // Inherent implementation for Payme pub const fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, apple_pay_google_pay_amount_converter: &StringMajorUnitForConnector, amount_converter_webhooks: &StringMinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-6125669946082353839
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payme // Implementation of Payme for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result< payme::PaymeErrorResponse, Report<common_utils::errors::ParsingError>, > = res.response.parse_struct("PaymeErrorResponse"); match response { Ok(response_data) => { event_builder.map(|i| i.set_error_response_body(&response_data)); router_env::logger::info!(connector_response=?response_data); let status_code = match res.status_code { 500..=511 => 200, _ => res.status_code, }; Ok(ErrorResponse { status_code, code: response_data.status_error_code.to_string(), message: response_data.status_error_details.clone(), reason: Some(format!( "{}, additional info: {}", response_data.status_error_details, response_data.status_additional_info )), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); router_env::logger::error!(deserialization_error =? error_msg); utils::handle_json_response_deserialization_failure(res, "payme") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 447, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-6125669946082353839
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payme // Implementation of Payme for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, _req: &RouterData<RSync, RefundsData, RefundsResponseData>, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}api/get-transactions", self.base_url(connectors))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-6125669946082353839
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payme // Implementation of Payme for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RouterData<RSync, RefundsData, RefundsResponseData>, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-6125669946082353839
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payme // Implementation of Payme for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-5386633264143778499
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/xendit // Inherent implementation for Xendit pub fn new() -> &'static Self { &Self { amount_converter: &FloatMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-5386633264143778499
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/xendit // Implementation of Xendit for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let error_response: xendit::XenditErrorResponse = res .response .parse_struct("ErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_error_response_body(&error_response)); router_env::logger::info!(connector_response=?error_response); Ok(ErrorResponse { code: error_response.error_code.clone(), message: error_response.message.clone(), reason: Some(error_response.message.clone()), status_code: res.status_code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 445, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-5386633264143778499
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/xendit // Implementation of Xendit for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_refund_id = req.request.get_connector_refund_id()?; Ok(format!( "{}/refunds/{}", self.base_url(connectors), connector_refund_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 409, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-5386633264143778499
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/xendit // Implementation of Xendit for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let mut headers = self.build_headers(req, connectors)?; if let Some(SplitRefundsRequest::XenditSplitRefund(sub_merchant_data)) = &req.request.split_refunds { headers.push(( xendit::auth_headers::FOR_USER_ID.to_string(), sub_merchant_data.for_user_id.clone().into(), )); }; Ok(headers) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 390, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-5386633264143778499
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/xendit // Implementation of Xendit for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_9131514913175166913
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml // Inherent implementation for Worldpayxml pub fn new() -> &'static Self { &Self { amount_converter: &StringMinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_9131514913175166913
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml // Implementation of Worldpayxml for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result<worldpayxml::PaymentService, _> = utils::deserialize_xml_to_struct(&res.response); match response { Ok(response_data) => { event_builder.map(|i| i.set_error_response_body(&response_data)); router_env::logger::info!(connector_response=?response_data); let (error_code, error_msg) = response_data .reply .as_ref() .and_then(|reply| { reply .error .as_ref() .map(|error| (Some(error.code.clone()), Some(error.message.clone()))) }) .unwrap_or((None, None)); Ok(ErrorResponse { status_code: res.status_code, code: error_code.unwrap_or(consts::NO_ERROR_CODE.to_string()), message: error_msg .clone() .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), reason: error_msg.clone(), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); router_env::logger::error!(deserialization_error =? error_msg); utils::handle_json_response_deserialization_failure(res, "worldpayxml") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 469, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_9131514913175166913
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml // Implementation of Worldpayxml for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, _req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(self.base_url(connectors).to_owned()) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 411, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_9131514913175166913
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml // Implementation of Worldpayxml for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_9131514913175166913
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml // Implementation of Worldpayxml for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "text/xml" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_3190025711212819114
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku // Inherent implementation for Boku pub fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_3190025711212819114
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku // Implementation of Boku for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response_data: Result<boku::BokuErrorResponse, Report<errors::ConnectorError>> = res .response .parse_struct("boku::BokuErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed); match response_data { Ok(response) => { event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.code, message: response.message, reason: response.reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(_) => get_xml_deserialized(res, event_builder), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 441, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_3190025711212819114
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku // Implementation of Boku for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let boku_url = get_country_url( req.connector_meta_data.clone(), self.base_url(connectors).to_string(), )?; Ok(format!("{boku_url}/billing/3.0/query-refund")) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 415, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_3190025711212819114
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku // Implementation of Boku for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let connector_auth = boku::BokuAuthType::try_from(&req.connector_auth_type)?; let boku_url = Self::get_url(self, req, connectors)?; let content_type = Self::common_get_content_type(self); let connector_method = Self::get_http_method(self); let timestamp = OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000; let secret_key = boku::BokuAuthType::try_from(&req.connector_auth_type)? .key_id .expose(); let to_sign = format!( "{} {}\nContent-Type: {}\n{}", connector_method, boku_url, &content_type, timestamp ); let key = hmac::Key::new(hmac::HMAC_SHA256, secret_key.as_bytes()); let tag = hmac::sign(&key, to_sign.as_bytes()); let signature = hex::encode(tag); let auth_val = format!("2/HMAC_SHA256(H+SHA256(E)) timestamp={timestamp}, signature={signature} signed-headers=Content-Type, key-id={}", connector_auth.key_id.peek()); let header = vec![ (headers::CONTENT_TYPE.to_string(), content_type.into()), (headers::AUTHORIZATION.to_string(), auth_val.into_masked()), ]; Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 394, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_3190025711212819114
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku // Implementation of Boku for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-8404843446989730894
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paystack // Inherent implementation for Paystack pub fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-8404843446989730894
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paystack // Implementation of Paystack for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: paystack::PaystackErrorResponse = res .response .parse_struct("PaystackErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); let error_message = paystack::get_error_message(response.clone()); Ok(ErrorResponse { status_code: res.status_code, code: response.code, message: error_message, reason: Some(response.message), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 443, "total_crates": null }