Skip to content

Commit

Permalink
feat(connector): implement pre auth flow for gpayments (#4692)
Browse files Browse the repository at this point in the history
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
hrithikesh026 and hyperswitch-bot[bot] authored May 30, 2024
1 parent 971ef1f commit bed42ce
Show file tree
Hide file tree
Showing 18 changed files with 632 additions and 67 deletions.
4 changes: 2 additions & 2 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub enum Connector {
Globalpay,
Globepay,
Gocardless,
// Gpayments, Added as template code for future usage
Gpayments,
Helcim,
Iatapay,
Klarna,
Expand Down Expand Up @@ -210,7 +210,7 @@ impl Connector {
| Self::Globalpay
| Self::Globepay
| Self::Gocardless
// | Self::Gpayments Added as template code for future usage
| Self::Gpayments
| Self::Helcim
| Self::Iatapay
| Self::Klarna
Expand Down
2 changes: 1 addition & 1 deletion crates/connector_configs/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl ConnectorConfig {
Connector::Globalpay => Ok(connector_data.globalpay),
Connector::Globepay => Ok(connector_data.globepay),
Connector::Gocardless => Ok(connector_data.gocardless),
// Connector::Gpayments => Ok(connector_data.gpayments), Added as template code for future usage
Connector::Gpayments => Ok(connector_data.gpayments),
Connector::Helcim => Ok(connector_data.helcim),
Connector::Klarna => Ok(connector_data.klarna),
Connector::Mollie => Ok(connector_data.mollie),
Expand Down
40 changes: 39 additions & 1 deletion crates/diesel_models/src/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ pub struct AuthenticationNew {

#[derive(Debug)]
pub enum AuthenticationUpdate {
PreAuthenticationVersionCallUpdate {
maximum_supported_3ds_version: common_utils::types::SemanticVersion,
message_version: common_utils::types::SemanticVersion,
},
PreAuthenticationThreeDsMethodCall {
threeds_server_transaction_id: String,
three_ds_method_data: Option<String>,
three_ds_method_url: Option<String>,
acquirer_bin: Option<String>,
acquirer_merchant_id: Option<String>,
connector_metadata: Option<serde_json::Value>,
},
PreAuthenticationUpdate {
threeds_server_transaction_id: String,
maximum_supported_3ds_version: common_utils::types::SemanticVersion,
Expand All @@ -116,6 +128,7 @@ pub enum AuthenticationUpdate {
acs_reference_number: Option<String>,
acs_trans_id: Option<String>,
acs_signed_content: Option<String>,
connector_metadata: Option<serde_json::Value>,
authentication_status: common_enums::AuthenticationStatus,
ds_trans_id: Option<String>,
},
Expand Down Expand Up @@ -283,7 +296,6 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
error_code,
error_message,
authentication_status: Some(authentication_status),

connector_authentication_id,
authentication_type: None,
authentication_lifecycle_status: None,
Expand Down Expand Up @@ -342,6 +354,7 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
acs_reference_number,
acs_trans_id,
acs_signed_content,
connector_metadata,
authentication_status,
ds_trans_id,
} => Self {
Expand All @@ -353,6 +366,7 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
acs_reference_number,
acs_trans_id,
acs_signed_content,
connector_metadata,
authentication_status: Some(authentication_status),
ds_trans_id,
..Default::default()
Expand All @@ -369,6 +383,30 @@ impl From<AuthenticationUpdate> for AuthenticationUpdateInternal {
authentication_status: Some(authentication_status),
..Default::default()
},
AuthenticationUpdate::PreAuthenticationVersionCallUpdate {
maximum_supported_3ds_version,
message_version,
} => Self {
maximum_supported_version: Some(maximum_supported_3ds_version),
message_version: Some(message_version),
..Default::default()
},
AuthenticationUpdate::PreAuthenticationThreeDsMethodCall {
threeds_server_transaction_id,
three_ds_method_data,
three_ds_method_url,
acquirer_bin,
acquirer_merchant_id,
connector_metadata,
} => Self {
threeds_server_transaction_id: Some(threeds_server_transaction_id),
three_ds_method_data,
three_ds_method_url,
acquirer_bin,
acquirer_merchant_id,
connector_metadata,
..Default::default()
},
}
}
}
12 changes: 11 additions & 1 deletion crates/hyperswitch_domain_models/src/router_response_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub mod disputes;
pub mod fraud_check;
use std::collections::HashMap;

use common_utils::{request::Method, types::MinorUnit};
use common_utils::{request::Method, types as common_types, types::MinorUnit};
pub use disputes::{AcceptDisputeResponse, DefendDisputeResponse, SubmitEvidenceResponse};

use crate::router_request_types::{authentication::AuthNFlowType, ResponseId};
Expand Down Expand Up @@ -205,6 +205,15 @@ pub struct MandateRevokeResponseData {

#[derive(Debug, Clone)]
pub enum AuthenticationResponseData {
PreAuthVersionCallResponse {
maximum_supported_3ds_version: common_types::SemanticVersion,
},
PreAuthThreeDsMethodCallResponse {
threeds_server_transaction_id: String,
three_ds_method_data: Option<String>,
three_ds_method_url: Option<String>,
connector_metadata: Option<serde_json::Value>,
},
PreAuthNResponse {
threeds_server_transaction_id: String,
maximum_supported_3ds_version: common_utils::types::SemanticVersion,
Expand All @@ -219,6 +228,7 @@ pub enum AuthenticationResponseData {
authn_flow_type: AuthNFlowType,
authentication_value: Option<String>,
trans_status: common_enums::TransactionStatus,
connector_metadata: Option<serde_json::Value>,
ds_trans_id: Option<String>,
},
PostAuthNResponse {
Expand Down
2 changes: 1 addition & 1 deletion crates/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ qrcode = "0.14.0"
rand = "0.8.5"
rand_chacha = "0.3.1"
regex = "1.10.4"
reqwest = { version = "0.11.27", features = ["json", "native-tls", "gzip", "multipart"] }
reqwest = { version = "0.11.27", features = ["json", "native-tls","__rustls", "gzip", "multipart"] }
ring = "0.17.8"
roxmltree = "0.19.0"
rust_decimal = { version = "1.35.0", features = ["serde-with-float", "serde-with-str"] }
Expand Down
Loading

0 comments on commit bed42ce

Please sign in to comment.