Skip to content

Commit

Permalink
fix/status-mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
awasthi21 committed Nov 20, 2024
1 parent 89cec8b commit b367cad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions crates/hyperswitch_connectors/src/connectors/elavon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,12 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Ela
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Get)
.method(Method::Post)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.set_body(types::PaymentsSyncType::get_request_body(
self, req, connectors,
)?)
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
.build(),
))
Expand Down Expand Up @@ -515,7 +518,7 @@ impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Elavon {
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Get)
.method(Method::Post)
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundSyncType::get_headers(self, req, connectors)?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub enum TransactionType {
pub enum SyncTransactionType {
Sale,
AuthOnly,
Return,
}

#[derive(Debug, Serialize)]
Expand Down Expand Up @@ -526,7 +527,7 @@ fn map_payment_status(
impl From<&ElavonPaymentsResponse> for enums::RefundStatus {
fn from(item: &ElavonPaymentsResponse) -> Self {
if item.is_successful() {
Self::Pending
Self::Success
} else {
Self::Failure
}
Expand Down Expand Up @@ -554,6 +555,7 @@ impl From<&ElavonSyncResponse> for enums::AttemptStatus {
TransactionSyncStatus::STL => match item.ssl_transaction_type {
SyncTransactionType::Sale => Self::Charged,
SyncTransactionType::AuthOnly => Self::Authorized,
SyncTransactionType::Return => Self::Pending,
},
TransactionSyncStatus::PST
| TransactionSyncStatus::FPR
Expand Down
2 changes: 1 addition & 1 deletion cypress-tests/cypress/e2e/PaymentUtils/Elavon.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const connectorDetails = {
Response: {
status: 200,
body: {
status: "pending",
status: "succeeded",
},
},
},
Expand Down

0 comments on commit b367cad

Please sign in to comment.