feat(connector): unified errorCode and errorMessage map error reason as errorMessage in Stripe Connector (#1797)

Co-authored-by: Sahkal Poddar <sahkal.poddar@juspay.in>
Co-authored-by: swangi-kumari <swangi.12015941@lpu.in>
This commit is contained in:
Sahkal Poddar
2023-08-02 20:20:30 +05:30
committed by GitHub
parent 9977f9d40e
commit c464cc510d
3 changed files with 42 additions and 30 deletions

View File

@ -202,12 +202,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -319,12 +320,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -432,12 +434,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -553,12 +556,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -684,12 +688,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -829,12 +834,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -939,12 +945,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -1068,12 +1075,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -1176,12 +1184,13 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -1270,12 +1279,13 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -1405,12 +1415,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -1498,12 +1509,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}
@ -1614,12 +1626,13 @@ impl
code: response
.error
.code
.clone()
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.error
.message
.code
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
reason: response.error.message,
})
}
}

View File

@ -2037,8 +2037,8 @@ impl<F, T>
.as_ref()
.map(|error| types::ErrorResponse {
code: error.code.to_owned(),
message: error.message.to_owned(),
reason: None,
message: error.code.to_owned(),
reason: Some(error.message.to_owned()),
status_code: item.http_code,
});

View File

@ -54,8 +54,7 @@ async fn should_fail_recurring_payment_due_to_authentication(
Event::Assert(Assert::IsPresent("man_")),// mandate id starting with man_
Event::Trigger(Trigger::Click(By::Css("#pm-mandate-btn a"))),
Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
Event::Assert(Assert::IsPresent("authentication_required: Your card was declined. This transaction requires authentication.")),
Event::Assert(Assert::IsPresent("authentication_required: authentication_required")),
]).await?;
Ok(())
}