feat(connector): [Noon] Add Card Mandates and Webhooks Support (#1243)

Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com>
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
SamraatBansal
2023-06-05 15:06:59 +05:30
committed by GitHub
parent fc6acd04cb
commit ba8a17d66f
16 changed files with 256 additions and 34 deletions

View File

@ -393,9 +393,13 @@ pub fn validate_request_amount_and_amount_to_capture(
pub fn validate_mandate(
req: impl Into<api::MandateValidationFields>,
is_confirm_operation: bool,
) -> RouterResult<Option<api::MandateTxnType>> {
) -> CustomResult<Option<api::MandateTxnType>, errors::ApiErrorResponse> {
let req: api::MandateValidationFields = req.into();
match req.is_mandate() {
match req.validate_and_get_mandate_type().change_context(
errors::ApiErrorResponse::MandateValidationFailed {
reason: "Expected one out of mandate_id and mandate_data but got both".to_string(),
},
)? {
Some(api::MandateTxnType::NewMandateTxn) => {
validate_new_mandate_request(req, is_confirm_operation)?;
Ok(Some(api::MandateTxnType::NewMandateTxn))