feat(connector): fail payment authorize when capture_method is manual_method (#1893)

Co-authored-by: hrithikeshvm <vmhrithikesh@gmail.com>
Co-authored-by: Sai Harsha Vardhan <56996463+sai-harsha-vardhan@users.noreply.github.com>
This commit is contained in:
Hrithikesh
2023-08-23 18:42:47 +05:30
committed by GitHub
parent f0cc0fba16
commit bca9d5013b
49 changed files with 790 additions and 120 deletions

View File

@ -10,6 +10,7 @@ use common_utils::{
errors::ReportSwitchExt,
pii::{self, Email, IpAddress},
};
use diesel_models::enums;
use error_stack::{report, IntoReport, ResultExt};
use masking::{ExposeInterface, Secret};
use once_cell::sync::Lazy;
@ -972,6 +973,25 @@ pub fn to_currency_base_unit(
.change_context(errors::ConnectorError::RequestEncodingFailed)
}
pub fn construct_not_implemented_error_report(
capture_method: enums::CaptureMethod,
connector_name: &str,
) -> error_stack::Report<errors::ConnectorError> {
errors::ConnectorError::NotImplemented(format!("{} for {}", capture_method, connector_name))
.into()
}
pub fn construct_not_supported_error_report(
capture_method: enums::CaptureMethod,
connector_name: &'static str,
) -> error_stack::Report<errors::ConnectorError> {
errors::ConnectorError::NotSupported {
message: capture_method.to_string(),
connector: connector_name,
}
.into()
}
pub fn to_currency_base_unit_with_zero_decimal_check(
amount: i64,
currency: diesel_models::enums::Currency,