mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
fix(connector): [Gigadat] Fix the Wasm/api-contract (#9628)
This commit is contained in:
@ -7167,9 +7167,9 @@ key1 = "TokenEx ID"
|
||||
|
||||
[gigadat]
|
||||
[gigadat.connector_auth.SignatureKey]
|
||||
api_key = "Username"
|
||||
api_secret = "Password"
|
||||
key1 = "Compaign Id"
|
||||
api_key = "Access Token"
|
||||
api_secret = "Security Token"
|
||||
key1 = "Campaign ID"
|
||||
[[gigadat.bank_redirect]]
|
||||
payment_method_type = "interac"
|
||||
[gigadat.metadata.site]
|
||||
|
||||
@ -5904,9 +5904,9 @@ api_key = "API Key"
|
||||
|
||||
[gigadat]
|
||||
[gigadat.connector_auth.SignatureKey]
|
||||
api_key = "Username"
|
||||
api_secret = "Password"
|
||||
key1 = "Compaign Id"
|
||||
api_key = "Access Token"
|
||||
api_secret = "Security Token"
|
||||
key1 = "Campaign ID"
|
||||
[[gigadat.bank_redirect]]
|
||||
payment_method_type = "interac"
|
||||
[gigadat.metadata.site]
|
||||
|
||||
@ -7145,9 +7145,9 @@ api_key = "API Key"
|
||||
|
||||
[gigadat]
|
||||
[gigadat.connector_auth.SignatureKey]
|
||||
api_key = "Username"
|
||||
api_secret = "Password"
|
||||
key1 = "Compaign Id"
|
||||
api_key = "Access Token"
|
||||
api_secret = "Security Token"
|
||||
key1 = "Campaign ID"
|
||||
[[gigadat.bank_redirect]]
|
||||
payment_method_type = "interac"
|
||||
[gigadat.metadata.site]
|
||||
|
||||
@ -124,7 +124,11 @@ impl ConnectorCommon for Gigadat {
|
||||
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
|
||||
let auth = gigadat::GigadatAuthType::try_from(auth_type)
|
||||
.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));
|
||||
Ok(vec![(
|
||||
headers::AUTHORIZATION.to_string(),
|
||||
@ -448,7 +452,11 @@ impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Gigadat
|
||||
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
|
||||
let auth = gigadat::GigadatAuthType::try_from(&req.connector_auth_type)
|
||||
.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));
|
||||
Ok(vec![
|
||||
(
|
||||
|
||||
@ -67,6 +67,7 @@ pub struct GigadatCpiRequest {
|
||||
pub transaction_id: String,
|
||||
#[serde(rename = "type")]
|
||||
pub transaction_type: GidadatTransactionType,
|
||||
pub sandbox: bool,
|
||||
pub name: Secret<String>,
|
||||
pub email: Email,
|
||||
pub mobile: Secret<String>,
|
||||
@ -95,9 +96,11 @@ impl TryFrom<&GigadatRouterData<&PaymentsAuthorizeRouterData>> for GigadatCpiReq
|
||||
let email = router_data.get_billing_email()?;
|
||||
let mobile = router_data.get_billing_phone_number()?;
|
||||
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()?;
|
||||
|
||||
Ok(Self {
|
||||
user_id: router_data.get_customer_id()?,
|
||||
site: metadata.site,
|
||||
@ -107,6 +110,7 @@ impl TryFrom<&GigadatRouterData<&PaymentsAuthorizeRouterData>> for GigadatCpiReq
|
||||
transaction_id: router_data.connector_request_reference_id.clone(),
|
||||
transaction_type: GidadatTransactionType::Cpi,
|
||||
name,
|
||||
sandbox,
|
||||
email,
|
||||
mobile,
|
||||
})
|
||||
@ -126,8 +130,8 @@ impl TryFrom<&GigadatRouterData<&PaymentsAuthorizeRouterData>> for GigadatCpiReq
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GigadatAuthType {
|
||||
pub campaign_id: Secret<String>,
|
||||
pub username: Secret<String>,
|
||||
pub password: Secret<String>,
|
||||
pub access_token: Secret<String>,
|
||||
pub security_token: Secret<String>,
|
||||
}
|
||||
|
||||
impl TryFrom<&ConnectorAuthType> for GigadatAuthType {
|
||||
@ -140,8 +144,8 @@ impl TryFrom<&ConnectorAuthType> for GigadatAuthType {
|
||||
key1,
|
||||
api_secret,
|
||||
} => Ok(Self {
|
||||
password: api_secret.to_owned(),
|
||||
username: api_key.to_owned(),
|
||||
security_token: api_secret.to_owned(),
|
||||
access_token: api_key.to_owned(),
|
||||
campaign_id: key1.to_owned(),
|
||||
}),
|
||||
_ => 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 redirect_url = format!(
|
||||
"{}/webflow?transaction={}&token={}",
|
||||
"{}webflow?transaction={}&token={}",
|
||||
base_url,
|
||||
item.data.connector_request_reference_id,
|
||||
item.response.token.peek()
|
||||
|
||||
Reference in New Issue
Block a user