Skip to content

Commit

Permalink
feat(connector): [Cybersource] Use connector_response_reference_id as…
Browse files Browse the repository at this point in the history
… reference to merchant (juspay#2470)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
rashmibharambe and github-actions[bot] committed Oct 7, 2023
1 parent 5038234 commit a2dfc48
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions crates/router/src/connector/cybersource/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ pub struct CybersourcePaymentsResponse {
id: String,
status: CybersourcePaymentStatus,
error_information: Option<CybersourceErrorInformation>,
client_reference_information: Option<ClientReferenceInformation>,
}

#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ClientReferenceInformation {
code: Option<String>,
}

#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq)]
Expand Down Expand Up @@ -313,12 +320,18 @@ impl<F, T>
status_code: item.http_code,
}),
_ => Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
resource_id: types::ResponseId::ConnectorTransactionId(
item.response.id.clone(),
),
redirection_data: None,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
connector_response_reference_id: item
.response
.client_reference_information
.map(|cref| cref.code)
.unwrap_or(Some(item.response.id)),
}),
},
..item.data
Expand All @@ -331,6 +344,7 @@ impl<F, T>
pub struct CybersourceTransactionResponse {
id: String,
application_information: ApplicationInformation,
client_reference_information: Option<ClientReferenceInformation>,
}

#[derive(Debug, Deserialize)]
Expand Down Expand Up @@ -378,12 +392,16 @@ impl<F, T>
item.response.application_information.status.into(),
),
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data: None,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
connector_response_reference_id: item
.response
.client_reference_information
.map(|cref| cref.code)
.unwrap_or(Some(item.response.id)),
}),
..item.data
})
Expand Down

0 comments on commit a2dfc48

Please sign in to comment.