Skip to content

Commit

Permalink
transfermer status update
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranKBR committed May 20, 2024
1 parent 9b2f176 commit e3eab66
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions crates/router/src/connector/mifinity/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl<F, T>
Ok(Self {
status: enums::AttemptStatus::AuthenticationPending,
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::NoResponseId,
resource_id: types::ResponseId::ConnectorTransactionId(trace_id.clone()),
redirection_data: Some(services::RedirectForm::Mifinity {
initialization_token,
}),
Expand Down Expand Up @@ -358,10 +358,17 @@ impl<F, T>
.iter()
.map(|payload| payload.payment_response.transaction_reference.clone())
.collect();
let status = &item.response.payload.clone().first().unwrap().status;
let status = item
.response
.payload
.first()
.map(|payload| payload.to_owned().status.clone())
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "status",
})?;

Ok(Self {
status: enums::AttemptStatus::from(&status.clone()),
status: enums::AttemptStatus::from(status),
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(transaction_reference),
redirection_data: None,
Expand All @@ -376,6 +383,15 @@ impl<F, T>
}
}

impl From<MifinityPaymentStatus> for enums::AttemptStatus {
fn from(item: MifinityPaymentStatus) -> Self {
match item {
MifinityPaymentStatus::Successful => Self::Charged,
MifinityPaymentStatus::Failed => Self::Failure,
MifinityPaymentStatus::Pending | MifinityPaymentStatus::NotCompleted => Self::Pending,
}
}
}

//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
Expand Down

0 comments on commit e3eab66

Please sign in to comment.