test(connector): add and update tests for stripe, cybersource and shift4 connectors (#485)

This commit is contained in:
Jagan
2023-02-01 14:25:39 +05:30
committed by GitHub
parent 3dfd548cb8
commit 5c3c51fbd5
23 changed files with 921 additions and 340 deletions

View File

@ -1,9 +1,11 @@
use error_stack::ResultExt;
use masking::Secret;
use crate::{
core::errors,
pii::PeekInterface,
types::{self, api},
utils::OptionExt,
};
pub fn missing_field_err(
@ -40,6 +42,19 @@ pub trait PaymentsRequestData {
fn get_card(&self) -> Result<api::Card, Error>;
}
pub trait RefundsRequestData {
fn get_connector_refund_id(&self) -> Result<String, Error>;
}
impl RefundsRequestData for types::RefundsData {
fn get_connector_refund_id(&self) -> Result<String, Error> {
self.connector_refund_id
.clone()
.get_required_value("connector_refund_id")
.change_context(errors::ConnectorError::MissingConnectorTransactionID)
}
}
impl PaymentsRequestData for types::PaymentsAuthorizeRouterData {
fn get_attempt_id(&self) -> Result<String, Error> {
self.attempt_id