fix(connector): [Gigadat] Fix the Wasm/api-contract (#9628)

This commit is contained in:
awasthi21
2025-09-30 21:18:03 +05:30
committed by GitHub
parent c1f8b961a0
commit 172af8c23c
5 changed files with 30 additions and 18 deletions

View File

@ -7167,9 +7167,9 @@ key1 = "TokenEx ID"
[gigadat] [gigadat]
[gigadat.connector_auth.SignatureKey] [gigadat.connector_auth.SignatureKey]
api_key = "Username" api_key = "Access Token"
api_secret = "Password" api_secret = "Security Token"
key1 = "Compaign Id" key1 = "Campaign ID"
[[gigadat.bank_redirect]] [[gigadat.bank_redirect]]
payment_method_type = "interac" payment_method_type = "interac"
[gigadat.metadata.site] [gigadat.metadata.site]

View File

@ -5904,9 +5904,9 @@ api_key = "API Key"
[gigadat] [gigadat]
[gigadat.connector_auth.SignatureKey] [gigadat.connector_auth.SignatureKey]
api_key = "Username" api_key = "Access Token"
api_secret = "Password" api_secret = "Security Token"
key1 = "Compaign Id" key1 = "Campaign ID"
[[gigadat.bank_redirect]] [[gigadat.bank_redirect]]
payment_method_type = "interac" payment_method_type = "interac"
[gigadat.metadata.site] [gigadat.metadata.site]

View File

@ -7145,9 +7145,9 @@ api_key = "API Key"
[gigadat] [gigadat]
[gigadat.connector_auth.SignatureKey] [gigadat.connector_auth.SignatureKey]
api_key = "Username" api_key = "Access Token"
api_secret = "Password" api_secret = "Security Token"
key1 = "Compaign Id" key1 = "Campaign ID"
[[gigadat.bank_redirect]] [[gigadat.bank_redirect]]
payment_method_type = "interac" payment_method_type = "interac"
[gigadat.metadata.site] [gigadat.metadata.site]

View File

@ -124,7 +124,11 @@ impl ConnectorCommon for Gigadat {
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = gigadat::GigadatAuthType::try_from(auth_type) let auth = gigadat::GigadatAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?; .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let auth_key = format!("{}:{}", auth.username.peek(), auth.password.peek()); let auth_key = format!(
"{}:{}",
auth.access_token.peek(),
auth.security_token.peek()
);
let auth_header = format!("Basic {}", consts::BASE64_ENGINE.encode(auth_key)); let auth_header = format!("Basic {}", consts::BASE64_ENGINE.encode(auth_key));
Ok(vec![( Ok(vec![(
headers::AUTHORIZATION.to_string(), headers::AUTHORIZATION.to_string(),
@ -448,7 +452,11 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Gigadat
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = gigadat::GigadatAuthType::try_from(&req.connector_auth_type) let auth = gigadat::GigadatAuthType::try_from(&req.connector_auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?; .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let auth_key = format!("{}:{}", auth.username.peek(), auth.password.peek()); let auth_key = format!(
"{}:{}",
auth.access_token.peek(),
auth.security_token.peek()
);
let auth_header = format!("Basic {}", consts::BASE64_ENGINE.encode(auth_key)); let auth_header = format!("Basic {}", consts::BASE64_ENGINE.encode(auth_key));
Ok(vec![ Ok(vec![
( (

View File

@ -67,6 +67,7 @@ pub struct GigadatCpiRequest {
pub transaction_id: String, pub transaction_id: String,
#[serde(rename = "type")] #[serde(rename = "type")]
pub transaction_type: GidadatTransactionType, pub transaction_type: GidadatTransactionType,
pub sandbox: bool,
pub name: Secret<String>, pub name: Secret<String>,
pub email: Email, pub email: Email,
pub mobile: Secret<String>, pub mobile: Secret<String>,
@ -95,9 +96,11 @@ impl TryFrom<&GigadatRouterData<&PaymentsAuthorizeRouterData>> for GigadatCpiReq
let email = router_data.get_billing_email()?; let email = router_data.get_billing_email()?;
let mobile = router_data.get_billing_phone_number()?; let mobile = router_data.get_billing_phone_number()?;
let currency = item.router_data.request.currency; let currency = item.router_data.request.currency;
let sandbox = match item.router_data.test_mode {
Some(true) => true,
Some(false) | None => false,
};
let user_ip = router_data.request.get_browser_info()?.get_ip_address()?; let user_ip = router_data.request.get_browser_info()?.get_ip_address()?;
Ok(Self { Ok(Self {
user_id: router_data.get_customer_id()?, user_id: router_data.get_customer_id()?,
site: metadata.site, site: metadata.site,
@ -107,6 +110,7 @@ impl TryFrom<&GigadatRouterData<&PaymentsAuthorizeRouterData>> for GigadatCpiReq
transaction_id: router_data.connector_request_reference_id.clone(), transaction_id: router_data.connector_request_reference_id.clone(),
transaction_type: GidadatTransactionType::Cpi, transaction_type: GidadatTransactionType::Cpi,
name, name,
sandbox,
email, email,
mobile, mobile,
}) })
@ -126,8 +130,8 @@ impl TryFrom<&GigadatRouterData<&PaymentsAuthorizeRouterData>> for GigadatCpiReq
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct GigadatAuthType { pub struct GigadatAuthType {
pub campaign_id: Secret<String>, pub campaign_id: Secret<String>,
pub username: Secret<String>, pub access_token: Secret<String>,
pub password: Secret<String>, pub security_token: Secret<String>,
} }
impl TryFrom<&ConnectorAuthType> for GigadatAuthType { impl TryFrom<&ConnectorAuthType> for GigadatAuthType {
@ -140,8 +144,8 @@ impl TryFrom<&ConnectorAuthType> for GigadatAuthType {
key1, key1,
api_secret, api_secret,
} => Ok(Self { } => Ok(Self {
password: api_secret.to_owned(), security_token: api_secret.to_owned(),
username: api_key.to_owned(), access_token: api_key.to_owned(),
campaign_id: key1.to_owned(), campaign_id: key1.to_owned(),
}), }),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
@ -206,7 +210,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, GigadatPaymentResponse, T, PaymentsResp
let base_url = CONNECTOR_BASE_URL; let base_url = CONNECTOR_BASE_URL;
let redirect_url = format!( let redirect_url = format!(
"{}/webflow?transaction={}&token={}", "{}webflow?transaction={}&token={}",
base_url, base_url,
item.data.connector_request_reference_id, item.data.connector_request_reference_id,
item.response.token.peek() item.response.token.peek()