Skip to content

Commit

Permalink
add connector_transaction_id to trustpay payments
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshayaFoiger committed Dec 5, 2023
1 parent 8b7a7aa commit f43de21
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/router/src/connector/trustpay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl ConnectorCommon for Trustpay {
.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
reason: reason.or(response_data.description),
attempt_status: None,
connector_transaction_id: None,
connector_transaction_id: response_data.instance_id,
})
}
Err(error_msg) => {
Expand Down Expand Up @@ -374,7 +374,7 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
message: response.status.to_string(),
reason: Some(response.payment_description),
attempt_status: None,
connector_transaction_id: None,
connector_transaction_id: response.instance_id,
})
}

Expand Down
21 changes: 17 additions & 4 deletions crates/router/src/connector/trustpay/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,13 +722,13 @@ fn handle_cards_response(
reason: msg,
status_code,
attempt_status: None,
connector_transaction_id: None,
connector_transaction_id: Some(response.instance_id.clone()),
})
} else {
None
};
let payment_response_data = types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(response.instance_id),
resource_id: types::ResponseId::ConnectorTransactionId(response.instance_id.clone()),
redirection_data,
mandate_reference: None,
connector_metadata: None,
Expand Down Expand Up @@ -825,14 +825,24 @@ fn handle_bank_redirects_sync_response(
reason: reason_info.reason.reject_reason,
status_code,
attempt_status: None,
connector_transaction_id: None,
connector_transaction_id: Some(
response
.payment_information
.references
.payment_request_id
.clone(),
),
})
} else {
None
};
let payment_response_data = types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(
response.payment_information.references.payment_request_id,
response
.payment_information
.references
.payment_request_id
.clone(),
),
redirection_data: None,
mandate_reference: None,
Expand Down Expand Up @@ -1637,16 +1647,19 @@ pub struct Errors {
}

#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct TrustpayErrorResponse {
pub status: i64,
pub description: Option<String>,
pub errors: Option<Vec<Errors>>,
pub instance_id: Option<String>,
}

#[derive(Deserialize)]
pub struct TrustPayTransactionStatusErrorResponse {
pub status: i64,
pub payment_description: String,
pub instance_id: Option<String>,
}

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

0 comments on commit f43de21

Please sign in to comment.