-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(connector): [DEUTSCHEBANK, FIUU ] Handle 2xx errors given by Connector #6727
base: main
Are you sure you want to change the base?
Conversation
Changed Files
|
Ok(Self { | ||
response: Err(ErrorResponse { | ||
code: response_status.clone(), | ||
message: refund_data.reason.clone().unwrap_or("".to_owned()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we map this to NO_ERROR_MESSAGE in unwrap ?
let response_code = item.response.rc.clone(); | ||
let is_response_success = is_response_success(response_code.clone()); | ||
|
||
if is_response_success { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let response_code = item.response.rc.clone(); | |
let is_response_success = is_response_success(response_code.clone()); | |
if is_response_success { | |
if is_response_success(item.response.rc.clone()) { |
let error_reason = item.response.message.clone(); | ||
let response = Err(get_error_response( | ||
response_code.clone(), | ||
error_reason, | ||
item.http_code, | ||
)); | ||
|
||
Ok(Self { | ||
status: common_enums::AttemptStatus::Failure, | ||
response, | ||
..item.data | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let error_reason = item.response.message.clone(); | |
let response = Err(get_error_response( | |
response_code.clone(), | |
error_reason, | |
item.http_code, | |
)); | |
Ok(Self { | |
status: common_enums::AttemptStatus::Failure, | |
response, | |
..item.data | |
}) | |
Ok(Self { | |
status: common_enums::AttemptStatus::Failure, | |
response: Err(get_error_response( | |
response_code.clone(), | |
item.response.message.clone(), | |
item.http_code, | |
)), | |
..item.data | |
}) |
let error_reason = item.response.message.clone(); | ||
let response = Err(get_error_response( | ||
response_code.clone(), | ||
error_reason, | ||
item.http_code, | ||
)); | ||
|
||
Ok(Self { | ||
status: common_enums::AttemptStatus::Failure, | ||
response, | ||
..item.data | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let error_reason = item.response.message.clone(); | |
let response = Err(get_error_response( | |
response_code.clone(), | |
error_reason, | |
item.http_code, | |
)); | |
Ok(Self { | |
status: common_enums::AttemptStatus::Failure, | |
response, | |
..item.data | |
}) | |
Ok(Self { | |
status: common_enums::AttemptStatus::Failure, | |
response: Err(get_error_response( | |
response_code.clone(), | |
item.response.message.clone(), | |
item.http_code, | |
)), | |
..item.data | |
}) |
let response_code = item.response.rc.clone(); | ||
let is_response_success = is_response_success(response_code.clone()); | ||
|
||
if is_response_success { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let response_code = item.response.rc.clone(); | |
let is_response_success = is_response_success(response_code.clone()); | |
if is_response_success { | |
if is_response_success(item.response.rc.clone()) { |
let error_reason = item.response.message.clone(); | ||
let response = Err(get_error_response( | ||
response_code.clone(), | ||
error_reason, | ||
item.http_code, | ||
)); | ||
|
||
Ok(Self { | ||
status: common_enums::AttemptStatus::Failure, | ||
response, | ||
..item.data | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let error_reason = item.response.message.clone(); | |
let response = Err(get_error_response( | |
response_code.clone(), | |
error_reason, | |
item.http_code, | |
)); | |
Ok(Self { | |
status: common_enums::AttemptStatus::Failure, | |
response, | |
..item.data | |
}) | |
Ok(Self { | |
status: common_enums::AttemptStatus::Failure, | |
response: Err(get_error_response( | |
response_code.clone(), | |
item.response.message.clone(), | |
item.http_code, | |
)), | |
..item.data | |
}) |
let response_code = item.response.rc.clone(); | ||
let is_response_success = is_response_success(response_code.clone()); | ||
|
||
let status = if is_response_success { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let response_code = item.response.rc.clone(); | |
let is_response_success = is_response_success(response_code.clone()); | |
let status = if is_response_success { | |
let status = if is_response_success(item.response.rc.clone()) { |
Some(enums::RefundStatus::Failure) => { | ||
let error_reason = item.response.message.clone(); | ||
let response = Err(get_error_response( | ||
response_code.clone(), | ||
error_reason, | ||
item.http_code, | ||
)); | ||
|
||
Ok(Self { | ||
status: common_enums::AttemptStatus::Failure, | ||
response, | ||
..item.data | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some(enums::RefundStatus::Failure) => { | |
let error_reason = item.response.message.clone(); | |
let response = Err(get_error_response( | |
response_code.clone(), | |
error_reason, | |
item.http_code, | |
)); | |
Ok(Self { | |
status: common_enums::AttemptStatus::Failure, | |
response, | |
..item.data | |
}) | |
} | |
Some(enums::RefundStatus::Failure) => { | |
Ok(Self { | |
status: common_enums::AttemptStatus::Failure, | |
response: Err(get_error_response( | |
response_code.clone(), | |
item.response.message.clone(), | |
item.http_code, | |
)), | |
..item.data | |
}) | |
} |
let response_status = refund_data.status; | ||
let refund_status = match response_status.as_str() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let response_status = refund_data.status; | |
let refund_status = match response_status.as_str() { | |
let refund_status = match refund_data.status.as_str() { |
Ok(Self { | ||
response: Err(ErrorResponse { | ||
code: response_status.clone(), | ||
message: refund_data.reason.clone().unwrap_or("".to_owned()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message: refund_data.reason.clone().unwrap_or("".to_owned()), | |
message: refund_data.reason.clone().unwrap_or(consts::NO_ERROR_MESSAGE), |
@@ -991,6 +991,7 @@ pub struct FiuuRefundSuccessResponse { | |||
#[serde(rename = "RefundID")] | |||
refund_id: i64, | |||
status: String, | |||
reason: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we getting this reason in response. Did you test it?
Type of Change
Description
Additional Changes
Motivation and Context
How did you test it?
Tested manually using Postman
Test Doc
Checklist
cargo +nightly fmt --all
cargo clippy