-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(connector): [DEUTSCHEBANK, FIUU ] Handle 2xx errors given by Connector #6727
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
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?
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.
no @deepanshu-iiitu , not able to test this . reason
is an optional field and will only come in unsucessful refund cases . Not able to test this unsuccesful refund flow locally
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.
You could reach out to @awasthi21 to check if he knows how to trigger unsuccessful refunds.
d27ada7
to
f0239cd
Compare
@@ -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.
You could reach out to @awasthi21 to check if he knows how to trigger unsuccessful refunds.
f0239cd
to
72a8e5e
Compare
Type of Change
Description
DeutscheBank
in case of 2xx errors, because it is currently not handled for 2xx errors. Error message is only consumed for 4xx and 5xx.Fiuu
in case of 2xx errors only in case ofrefunds
. In all other cases where 2xx errors are thrown, code is already handling it.Additional Changes
Motivation and Context
How did you test it?
Tested manually using Postman
Test Doc
Checklist
cargo +nightly fmt --all
cargo clippy