feat(connector): [ZSL] add connector template code (#4285)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: SamraatBansal <55536657+SamraatBansal@users.noreply.github.com>
This commit is contained in:
AkshayaFoiger
2024-04-10 18:55:33 +05:30
committed by GitHub
parent 3963219e44
commit 086516b7b3
22 changed files with 589 additions and 34 deletions

View File

@ -306,7 +306,7 @@ async fn should_sync_refund() {
);
}
// Cards Negative scenerios
// Cards Negative scenarios
// Creates a payment with incorrect CVC.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_cvc() {

View File

@ -65,3 +65,4 @@ mod wise;
mod worldline;
mod worldpay;
mod zen;
mod zsl;

View File

@ -206,3 +206,9 @@ api_key="API Key"
[ebanx]
api_key="API Key"
[zsl]
api_key="API Key"
key1= "Merchant id"

View File

@ -0,0 +1,59 @@
use router::types::{self, storage::enums};
use test_utils::connector_auth;
use crate::utils::{self, ConnectorActions};
struct ZslTest;
impl ConnectorActions for ZslTest {}
impl utils::Connector for ZslTest {
fn get_data(&self) -> types::api::ConnectorData {
use router::connector::Zsl;
types::api::ConnectorData {
connector: Box::new(&Zsl),
connector_name: types::Connector::Adyen,
// Added as Dummy connector as template code is added for future usage
get_token: types::api::GetToken::Connector,
merchant_connector_id: None,
}
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.zsl
.expect("Missing connector authentication configuration")
.into(),
)
}
fn get_name(&self) -> String {
"zsl".to_string()
}
}
static CONNECTOR: ZslTest = ZslTest {};
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
// Partially captures a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(
payment_method_details(),
Some(types::PaymentsCaptureData {
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::AuthenticationPending);
}