Skip to content
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): [Fiuu] Consume error message thrown by connector for Psync flow and make extraP from response struct Secret #6934

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/hyperswitch_connectors/src/connectors/fiuu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ impl webhooks::IncomingWebhook for Fiuu {
serde_urlencoded::from_bytes::<transformers::FiuuWebhooksPaymentResponse>(request.body)
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
let mandate_reference = webhook_payment_response.extra_parameters.as_ref().and_then(|extra_p| {
let mandate_token: Result<ExtraParameters, _> = serde_json::from_str(extra_p);
let mandate_token: Result<ExtraParameters, _> = serde_json::from_str(&extra_p.clone().expose());
match mandate_token {
Ok(token) => {
token.token.as_ref().map(|token| hyperswitch_domain_models::router_flow_types::ConnectorMandateDetails {
Expand All @@ -914,7 +914,7 @@ impl webhooks::IncomingWebhook for Fiuu {
Err(err) => {
router_env::logger::warn!(
"Failed to convert 'extraP' from fiuu webhook response to fiuu::ExtraParameters. \
Input: '{}', Error: {}",
Input: '{:?}', Error: {}",
extra_p,
err
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1168,9 +1168,9 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
let error_response = if status == enums::AttemptStatus::Failure {
Some(ErrorResponse {
status_code: item.http_code,
code: response.stat_code.to_string(),
message: response.stat_name.clone().to_string(),
reason: Some(response.stat_name.clone().to_string()),
code: response.error_code.clone(),
message: response.error_desc.clone(),
reason: Some(response.error_desc),
attempt_status: Some(enums::AttemptStatus::Failure),
connector_transaction_id: None,
})
Expand Down Expand Up @@ -1199,7 +1199,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
status: response.status,
})?;
let mandate_reference = response.extra_parameters.as_ref().and_then(|extra_p| {
let mandate_token: Result<ExtraParameters, _> = serde_json::from_str(extra_p);
let mandate_token: Result<ExtraParameters, _> = serde_json::from_str(&extra_p.clone().expose());
match mandate_token {
Ok(token) => {
token.token.as_ref().map(|token| MandateReference {
Expand All @@ -1212,7 +1212,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
Err(err) => {
router_env::logger::warn!(
"Failed to convert 'extraP' from fiuu webhook response to fiuu::ExtraParameters. \
Input: '{}', Error: {}",
Input: '{:?}', Error: {}",
extra_p,
err
);
Expand All @@ -1228,7 +1228,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
.clone()
.unwrap_or(consts::NO_ERROR_CODE.to_owned()),
message: response
.error_code
.error_desc
.clone()
.unwrap_or(consts::NO_ERROR_MESSAGE.to_owned()),
reason: response.error_desc.clone(),
Expand Down Expand Up @@ -1697,7 +1697,7 @@ pub struct FiuuWebhooksPaymentResponse {
pub error_desc: Option<String>,
pub error_code: Option<String>,
#[serde(rename = "extraP")]
pub extra_parameters: Option<String>,
pub extra_parameters: Option<Secret<String>>,
}

#[derive(Debug, Deserialize, Serialize, Clone)]
Expand Down
Loading