Files
rupakrajak 79aa8f3d3d feat:H1083-L1-L3-L4-L5 [Payment Authorise and Sync] + [Refunds and Sync] + [Redirection Flow (BNPL)] + [3DS Payment and Sync] for MultiSafePay (#658)
Co-authored-by: Zaid <syed.zaidali@juspay.in>
Co-authored-by: Rajak Rupakkumar Asishkumar <rajak.rupakkumar@juspay.in>
Co-authored-by: Jagan Elavarasan <jaganelavarasan@gmail.com>
2023-02-27 23:34:26 +00:00

82 lines
2.1 KiB
Rust

use router::types::ConnectorAuthType;
use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)]
pub(crate) struct ConnectorAuthentication {
pub aci: Option<BodyKey>,
pub adyen: Option<BodyKey>,
pub airwallex: Option<BodyKey>,
pub authorizedotnet: Option<BodyKey>,
pub bambora: Option<BodyKey>,
pub bluesnap: Option<BodyKey>,
pub checkout: Option<BodyKey>,
pub cybersource: Option<SignatureKey>,
pub dlocal: Option<SignatureKey>,
pub fiserv: Option<SignatureKey>,
pub globalpay: Option<HeaderKey>,
pub multisafepay: Option<HeaderKey>,
pub nuvei: Option<SignatureKey>,
pub payu: Option<BodyKey>,
pub rapyd: Option<BodyKey>,
pub shift4: Option<HeaderKey>,
pub stripe: Option<HeaderKey>,
pub worldpay: Option<BodyKey>,
pub worldline: Option<SignatureKey>,
}
impl ConnectorAuthentication {
pub(crate) fn new() -> Self {
#[allow(clippy::expect_used)]
toml::from_str(
&std::fs::read_to_string("tests/connectors/auth.toml")
.expect("connector authentication config file not found"),
)
.expect("Failed to read connector authentication config file")
}
}
#[derive(Debug, Deserialize, Clone)]
pub(crate) struct HeaderKey {
pub api_key: String,
}
impl From<HeaderKey> for ConnectorAuthType {
fn from(key: HeaderKey) -> Self {
Self::HeaderKey {
api_key: key.api_key,
}
}
}
#[derive(Debug, Deserialize, Clone)]
pub(crate) struct BodyKey {
pub api_key: String,
pub key1: String,
}
impl From<BodyKey> for ConnectorAuthType {
fn from(key: BodyKey) -> Self {
Self::BodyKey {
api_key: key.api_key,
key1: key.key1,
}
}
}
#[derive(Debug, Deserialize, Clone)]
pub(crate) struct SignatureKey {
pub api_key: String,
pub key1: String,
pub api_secret: String,
}
impl From<SignatureKey> for ConnectorAuthType {
fn from(key: SignatureKey) -> Self {
Self::SignatureKey {
api_key: key.api_key,
key1: key.key1,
api_secret: key.api_secret,
}
}
}