Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a3e2b79
refactor(masking): move masking implementations to masking crate
Chethan-rao Sep 12, 2023
a621192
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 13, 2023
b1bc6c7
t Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 14, 2023
9623ec8
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 15, 2023
0333593
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 20, 2023
587549f
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 24, 2023
57b3aad
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 25, 2023
687a4f2
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 25, 2023
9e8ce1f
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 26, 2023
06132d5
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 27, 2023
d06624c
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Sep 28, 2023
c1ef143
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Oct 3, 2023
03673c0
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Oct 6, 2023
663c4fb
Merge branch 'main' of github.com:juspay/hyperswitch
Chethan-rao Oct 6, 2023
b06d0e9
chore: address rust 1.73 clippy lints
Chethan-rao Oct 6, 2023
d81d45a
Merge branch 'main' of github.com:juspay/hyperswitch into rust_1.73_c…
Chethan-rao Oct 6, 2023
bd78a31
Merge branch 'main' of github.com:juspay/hyperswitch into rust_1.73_c…
Chethan-rao Oct 6, 2023
7e00c31
Merge branch 'main' of github.com:juspay/hyperswitch into rust_1.73_c…
Chethan-rao Oct 7, 2023
b662816
refactor: address requested changes
Chethan-rao Oct 7, 2023
ffb9817
Merge branch 'main' of github.com:juspay/hyperswitch into rust_1.73_c…
Chethan-rao Oct 9, 2023
7b7ca50
refactor: address requested changes
Chethan-rao Oct 9, 2023
f94e841
Merge branch 'main' of github.com:juspay/hyperswitch into rust_1.73_c…
Chethan-rao Oct 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/router/src/connector/checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl ConnectorCommon for Checkout {
};

router_env::logger::info!(error_response=?response);
let errors_list = response.error_codes.clone().unwrap_or(vec![]);
let errors_list = response.error_codes.clone().unwrap_or_default();
let option_error_code_message = conn_utils::get_error_code_error_message_based_on_priority(
self.clone(),
errors_list
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/cybersource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl ConnectorCommon for Cybersource {
.response
.parse_struct("Cybersource ErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
let details = response.details.unwrap_or(vec![]);
let details = response.details.unwrap_or_default();
let connector_reason = details
.iter()
.map(|det| format!("{} : {}", det.field, det.reason))
Expand Down
28 changes: 21 additions & 7 deletions crates/router/src/connector/paypal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod transformers;
use std::fmt::Debug;
use std::fmt::{Debug, Write};

use base64::Engine;
use common_utils::ext_traits::ByteSliceExt;
Expand Down Expand Up @@ -169,12 +169,26 @@ impl ConnectorCommon for Paypal {
.parse_struct("Paypal ErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;

let error_reason = response.details.map(|error_details| {
error_details
.iter()
.map(|error| format!("description - {} ; ", error.description))
.collect::<String>()
});
let error_reason = response
.details
.map(|error_details| {
error_details
.iter()
.try_fold::<_, _, CustomResult<_, errors::ConnectorError>>(
String::new(),
|mut acc, error| {
write!(acc, "description - {} ;", error.description)
.into_report()
.change_context(
errors::ConnectorError::ResponseDeserializationFailed,
)
.attach_printable("Failed to concatenate error details")
.map(|_| acc)
},
)
})
.transpose()?;

Ok(ErrorResponse {
status_code: res.status_code,
code: response.name,
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/paypal/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ fn get_headers(
key: &'static str,
) -> CustomResult<String, errors::ConnectorError> {
let header_value = header
.get(key.clone())
.get(key)
.map(|value| value.to_str())
.ok_or(errors::ConnectorError::MissingRequiredField { field_name: key })?
.into_report()
Expand Down
4 changes: 1 addition & 3 deletions crates/router/src/core/payment_methods/cards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,7 @@ pub async fn list_payment_methods(
.0
.get(&payment_method_type)
.map(|required_fields_hm_for_each_connector| {
required_fields_hm
.entry(payment_method)
.or_insert(HashMap::new());
required_fields_hm.entry(payment_method).or_default();
required_fields_hm_for_each_connector
.fields
.get(&connector_variant)
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/core/payments/customers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub async fn update_connector_customer_in_customers(
.and_then(|customer| customer.connector_customer.as_ref())
.and_then(|connector_customer| connector_customer.as_object())
.map(ToOwned::to_owned)
.unwrap_or(serde_json::Map::new());
.unwrap_or_default();

let updated_connector_customer_map =
connector_customer_id.as_ref().map(|connector_customer_id| {
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/core/payments/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ where
status_code.to_string(),
)]
})
.unwrap_or(vec![]);
.unwrap_or_default();
if let Some(payment_confirm_source) = payment_intent.payment_confirm_source {
headers.push((
"payment_confirm_source".to_string(),
Expand Down
5 changes: 1 addition & 4 deletions crates/router/src/core/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1205,10 +1205,7 @@ pub async fn payout_create_db_entries(
.set_recurring(req.recurring.unwrap_or(false))
.set_auto_fulfill(req.auto_fulfill.unwrap_or(false))
.set_return_url(req.return_url.to_owned())
.set_entity_type(
req.entity_type
.unwrap_or(api_enums::PayoutEntityType::default()),
)
.set_entity_type(req.entity_type.unwrap_or_default())
.set_metadata(req.metadata.to_owned())
.set_created_at(Some(common_utils::date_time::now()))
.set_last_modified_at(Some(common_utils::date_time::now()))
Expand Down
8 changes: 3 additions & 5 deletions crates/router/src/services/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,9 @@ pub async fn send_request(
match request.content_type {
Some(ContentType::Json) => client.json(&request.payload),

Some(ContentType::FormData) => client.multipart(
request
.form_data
.unwrap_or_else(reqwest::multipart::Form::new),
),
Some(ContentType::FormData) => {
client.multipart(request.form_data.unwrap_or_default())
}

// Currently this is not used remove this if not required
// If using this then handle the serde_part
Expand Down
2 changes: 0 additions & 2 deletions crates/router/src/types/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ impl ForeignTryFrom<api_models::webhooks::IncomingWebhookEvent> for storage_enum

impl ForeignFrom<storage::Config> for api_types::Config {
fn foreign_from(config: storage::Config) -> Self {
let config = config;
Self {
key: config.key,
value: config.config,
Expand All @@ -472,7 +471,6 @@ impl<'a> ForeignFrom<&'a api_types::ConfigUpdate> for storage::ConfigUpdate {

impl<'a> From<&'a domain::Address> for api_types::Address {
fn from(address: &domain::Address) -> Self {
let address = address;
Self {
address: Some(api_types::AddressDetails {
city: address.city.clone(),
Expand Down