text stringlengths 70 351k | source stringclasses 4 values |
|---|---|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/paystack.rs<|crate|> router<|connector|> paystack anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/chargebee.rs<|crate|> router<|connector|> chargebee anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs<|crate|> router<|connector|> juspaythreedsserver anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="55" end="61">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="54" end="54">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="75" end="88">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="65" end="71">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="48" end="50">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/datatrans.rs<|crate|> router<|connector|> datatrans anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="47" end="47">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/netcetera.rs<|crate|> router<|connector|> netcetera anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="47" end="53">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="46" end="46">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="67" end="80">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="57" end="63">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="40" end="42">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="36" end="38">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/novalnet.rs<|crate|> router<|connector|> novalnet anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="47" end="47">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/prophetpay.rs<|crate|> router<|connector|> prophetpay anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="47" end="47">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs<|crate|> router<|connector|> wellsfargopayout anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="47" end="47">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js" role="context" start="61" end="78">
"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
);
}
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
"[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
function () {
pm.expect(jsonData.status).to.eql("succeeded");
},
);
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/forte.rs<|crate|> router<|connector|> forte anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/forte.rs" role="context" start="85" end="91">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(get_payment_data(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/forte.rs" role="context" start="84" end="84">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/forte.rs" role="context" start="119" end="140">
async fn should_partially_capture_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(get_payment_data(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response.clone()).unwrap();
let connector_meta = utils::get_connector_metadata(authorize_response.response);
let response = CONNECTOR
.capture_payment(
txn_id,
Some(types::PaymentsCaptureData {
connector_meta,
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
//Status of the Payments is always in Pending State, Forte has to settle the sandbox transactions manually
assert_eq!(response.status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/forte.rs" role="context" start="95" end="115">
async fn should_capture_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(get_payment_data(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response.clone()).unwrap();
let connector_meta = utils::get_connector_metadata(authorize_response.response);
let response = CONNECTOR
.capture_payment(
txn_id,
Some(types::PaymentsCaptureData {
connector_meta,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
//Status of the Payments is always in Pending State, Forte has to settle the sandbox transaction manually
assert_eq!(response.status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/forte.rs" role="context" start="54" end="80">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
address: Some(types::PaymentAddress::new(
None,
Some(Address {
address: Some(AddressDetails {
first_name: Some(Secret::new("first".to_string())),
last_name: Some(Secret::new("last".to_string())),
line1: Some(Secret::new("line1".to_string())),
line2: Some(Secret::new("line2".to_string())),
city: Some("city".to_string()),
zip: Some(Secret::new("zip".to_string())),
country: Some(api_models::enums::CountryAlpha2::IN),
..Default::default()
}),
phone: Some(PhoneDetails {
number: Some(Secret::new("9123456789".to_string())),
country_code: Some("+91".to_string()),
}),
email: None,
}),
None,
None,
)),
..Default::default()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/forte.rs" role="context" start="44" end="52">
fn get_payment_data() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: CardNumber::from_str("4111111111111111").unwrap(),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
})
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/coingate.rs<|crate|> router<|connector|> coingate anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="47" end="47">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/jpmorgan.rs<|crate|> router<|connector|> jpmorgan anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="55" end="61">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="54" end="54">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="75" end="88">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="65" end="71">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="48" end="50">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs<|crate|> router<|connector|> unified_authentication_service anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/paypal.rs<|crate|> router<|connector|> paypal anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/paypal.rs" role="context" start="71" end="77">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(get_payment_data(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paypal.rs" role="context" start="70" end="70">
use router::types::{self, domain, storage::enums, AccessToken, ConnectorAuthType};
<file_sep path="hyperswitch/crates/router/tests/connectors/paypal.rs" role="context" start="104" end="124">
async fn should_partially_capture_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(get_payment_data(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = "".to_string();
let connector_meta = utils::get_connector_metadata(authorize_response.response);
let response = CONNECTOR
.capture_payment(
txn_id,
Some(types::PaymentsCaptureData {
connector_meta,
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paypal.rs" role="context" start="81" end="100">
async fn should_capture_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(get_payment_data(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = "".to_string();
let connector_meta = utils::get_connector_metadata(authorize_response.response);
let response = CONNECTOR
.capture_payment(
txn_id,
Some(types::PaymentsCaptureData {
connector_meta,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paypal.rs" role="context" start="58" end="66">
fn get_payment_data() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: cards::CardNumber::from_str("4000020000000000").unwrap(),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paypal.rs" role="context" start="51" end="56">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
access_token: get_access_token(),
..Default::default()
})
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/globepay.rs<|crate|> router<|connector|> globepay anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="50" end="56">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="49" end="49">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="70" end="83">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="60" end="66">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="43" end="45">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="39" end="41">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/fiserv.rs<|crate|> router<|connector|> fiserv anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="76" end="82">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="75" end="75">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="98" end="111">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="87" end="93">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="63" end="68">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
connector_meta_data: Some(json!({"terminalId": "10000001"})),
..utils::PaymentInfo::with_default_billing_name()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="43" end="61">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: cards::CardNumber::from_str("4005550000000019").unwrap(),
card_exp_month: Secret::new("02".to_string()),
card_exp_year: Secret::new("2035".to_string()),
card_cvc: Secret::new("123".to_string()),
card_issuer: None,
card_network: None,
card_type: None,
card_issuing_country: None,
bank_code: None,
nick_name: Some(Secret::new("nick_name".into())),
card_holder_name: Some(Secret::new("card holder name".into())),
}),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
})
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/opayo.rs<|crate|> router<|connector|> opayo anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="53" end="59">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="52" end="52">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="73" end="86">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="63" end="69">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="46" end="48">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="42" end="44">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/facilitapay.rs<|crate|> router<|connector|> facilitapay anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/volt.rs<|crate|> router<|connector|> volt anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="47" end="47">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/fiuu.rs<|crate|> router<|connector|> fiuu anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/itaubank.rs<|crate|> router<|connector|> itaubank anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="47" end="47">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/digitalvirgo.rs<|crate|> router<|connector|> digitalvirgo anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="48" end="48">
use router::{
types::{self, api, storage::enums,
}};
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/helcim.rs<|crate|> router<|connector|> helcim anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="47" end="47">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/plaid.rs<|crate|> router<|connector|> plaid anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="48" end="48">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/mifinity.rs<|crate|> router<|connector|> mifinity anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="47" end="47">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/bankofamerica.rs<|crate|> router<|connector|> bankofamerica anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.rs" role="context" start="48" end="48">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/redsys.rs<|crate|> router<|connector|> redsys anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/stripebilling.rs<|crate|> router<|connector|> stripebilling anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/checkout.rs<|crate|> router<|connector|> checkout anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="50" end="56">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="49" end="49">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="72" end="85">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="61" end="67">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/billwerk.rs<|crate|> router<|connector|> billwerk anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="48" end="48">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/ebanx.rs<|crate|> router<|connector|> ebanx anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="47" end="47">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/elavon.rs<|crate|> router<|connector|> elavon anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="55" end="61">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="54" end="54">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="75" end="88">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="65" end="71">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="48" end="50">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/taxjar.rs<|crate|> router<|connector|> taxjar anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="47" end="47">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/fiservemea.rs<|crate|> router<|connector|> fiservemea anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/recurly.rs<|crate|> router<|connector|> recurly anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/placetopay.rs<|crate|> router<|connector|> placetopay anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="47" end="47">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/bamboraapac.rs<|crate|> router<|connector|> bamboraapac anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="47" end="47">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/nexixpay.rs<|crate|> router<|connector|> nexixpay anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="48" end="48">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/src/utils/user.rs<|crate|> router anchor=get_redis_connection kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/utils/user.rs" role="context" start="135" end="141">
pub fn get_redis_connection(state: &SessionState) -> UserResult<Arc<RedisConnectionPool>> {
state
.store
.get_redis_conn()
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to get redis connection")
}
<file_sep path="hyperswitch/crates/router/src/utils/user.rs" role="context" start="134" end="134">
use std::sync::Arc;
use redis_interface::RedisConnectionPool;
use crate::{
consts::user::{REDIS_SSO_PREFIX, REDIS_SSO_TTL},
core::errors::{StorageError, UserErrors, UserResult},
routes::SessionState,
services::{
authentication::{AuthToken, UserFromToken},
authorization::roles::RoleInfo,
},
types::{
domain::{self, MerchantAccount, UserFromStorage},
transformers::ForeignFrom,
},
};
<file_sep path="hyperswitch/crates/router/src/utils/user.rs" role="context" start="153" end="192">
pub async fn construct_public_and_private_db_configs(
state: &SessionState,
auth_config: &user_api::AuthConfig,
encryption_key: &[u8],
id: String,
) -> UserResult<(Option<Encryption>, Option<serde_json::Value>)> {
match auth_config {
user_api::AuthConfig::OpenIdConnect {
private_config,
public_config,
} => {
let private_config_value = serde_json::to_value(private_config.clone())
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to convert auth config to json")?;
let encrypted_config =
domain::types::crypto_operation::<serde_json::Value, masking::WithType>(
&state.into(),
type_name!(diesel_models::user::User),
domain::types::CryptoOperation::Encrypt(private_config_value.into()),
Identifier::UserAuth(id),
encryption_key,
)
.await
.and_then(|val| val.try_into_operation())
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to encrypt auth config")?;
Ok((
Some(encrypted_config.into()),
Some(
serde_json::to_value(public_config.clone())
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to convert auth config to json")?,
),
))
}
user_api::AuthConfig::Password | user_api::AuthConfig::MagicLink => Ok((None, None)),
}
}
<file_sep path="hyperswitch/crates/router/src/utils/user.rs" role="context" start="144" end="150">
fn foreign_from(from: &user_api::AuthConfig) -> Self {
match *from {
user_api::AuthConfig::OpenIdConnect { .. } => Self::OpenIdConnect,
user_api::AuthConfig::Password => Self::Password,
user_api::AuthConfig::MagicLink => Self::MagicLink,
}
}
<file_sep path="hyperswitch/crates/router/src/utils/user.rs" role="context" start="124" end="133">
pub async fn get_user_from_db_by_email(
state: &SessionState,
email: domain::UserEmail,
) -> CustomResult<UserFromStorage, StorageError> {
state
.global_store
.find_user_by_email(&email)
.await
.map(UserFromStorage::from)
}
<file_sep path="hyperswitch/crates/router/src/utils/user.rs" role="context" start="114" end="122">
pub fn get_verification_days_left(
state: &SessionState,
user: &UserFromStorage,
) -> UserResult<Option<i64>> {
#[cfg(feature = "email")]
return user.get_verification_days_left(state);
#[cfg(not(feature = "email"))]
return Ok(None);
}
<file_sep path="hyperswitch/crates/router/src/utils/user.rs" role="context" start="255" end="268">
pub async fn get_sso_id_from_redis(
state: &SessionState,
oidc_state: Secret<String>,
) -> UserResult<String> {
let connection = get_redis_connection(state)?;
let key = get_oidc_key(&oidc_state.expose());
connection
.get_key::<Option<String>>(&key.into())
.await
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to get sso id from redis")?
.ok_or(UserErrors::SSOFailed)
.attach_printable("Cannot find oidc state in redis. Oidc state invalid or expired")
}
<file_sep path="hyperswitch/crates/router/src/utils/user.rs" role="context" start="241" end="253">
pub async fn set_sso_id_in_redis(
state: &SessionState,
oidc_state: Secret<String>,
sso_id: String,
) -> UserResult<()> {
let connection = get_redis_connection(state)?;
let key = get_oidc_key(&oidc_state.expose());
connection
.set_key_with_expiry(&key.into(), sso_id, REDIS_SSO_TTL)
.await
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to set sso id in redis")
}
<file_sep path="hyperswitch/crates/router/src/core/errors/user.rs" role="context" start="10" end="113">
pub enum UserErrors {
#[error("User InternalServerError")]
InternalServerError,
#[error("InvalidCredentials")]
InvalidCredentials,
#[error("UserNotFound")]
UserNotFound,
#[error("UserExists")]
UserExists,
#[error("LinkInvalid")]
LinkInvalid,
#[error("UnverifiedUser")]
UnverifiedUser,
#[error("InvalidOldPassword")]
InvalidOldPassword,
#[error("EmailParsingError")]
EmailParsingError,
#[error("NameParsingError")]
NameParsingError,
#[error("PasswordParsingError")]
PasswordParsingError,
#[error("UserAlreadyVerified")]
UserAlreadyVerified,
#[error("CompanyNameParsingError")]
CompanyNameParsingError,
#[error("MerchantAccountCreationError: {0}")]
MerchantAccountCreationError(String),
#[error("InvalidEmailError")]
InvalidEmailError,
#[error("DuplicateOrganizationId")]
DuplicateOrganizationId,
#[error("MerchantIdNotFound")]
MerchantIdNotFound,
#[error("MetadataAlreadySet")]
MetadataAlreadySet,
#[error("InvalidRoleId")]
InvalidRoleId,
#[error("InvalidRoleOperation")]
InvalidRoleOperation,
#[error("IpAddressParsingFailed")]
IpAddressParsingFailed,
#[error("InvalidMetadataRequest")]
InvalidMetadataRequest,
#[error("MerchantIdParsingError")]
MerchantIdParsingError,
#[error("ChangePasswordError")]
ChangePasswordError,
#[error("InvalidDeleteOperation")]
InvalidDeleteOperation,
#[error("MaxInvitationsError")]
MaxInvitationsError,
#[error("RoleNotFound")]
RoleNotFound,
#[error("InvalidRoleOperationWithMessage")]
InvalidRoleOperationWithMessage(String),
#[error("RoleNameParsingError")]
RoleNameParsingError,
#[error("RoleNameAlreadyExists")]
RoleNameAlreadyExists,
#[error("TotpNotSetup")]
TotpNotSetup,
#[error("InvalidTotp")]
InvalidTotp,
#[error("TotpRequired")]
TotpRequired,
#[error("InvalidRecoveryCode")]
InvalidRecoveryCode,
#[error("TwoFactorAuthRequired")]
TwoFactorAuthRequired,
#[error("TwoFactorAuthNotSetup")]
TwoFactorAuthNotSetup,
#[error("TOTP secret not found")]
TotpSecretNotFound,
#[error("User auth method already exists")]
UserAuthMethodAlreadyExists,
#[error("Invalid user auth method operation")]
InvalidUserAuthMethodOperation,
#[error("Auth config parsing error")]
AuthConfigParsingError,
#[error("Invalid SSO request")]
SSOFailed,
#[error("profile_id missing in JWT")]
JwtProfileIdMissing,
#[error("Maximum attempts reached for TOTP")]
MaxTotpAttemptsReached,
#[error("Maximum attempts reached for Recovery Code")]
MaxRecoveryCodeAttemptsReached,
#[error("Forbidden tenant id")]
ForbiddenTenantId,
#[error("Error Uploading file to Theme Storage")]
ErrorUploadingFile,
#[error("Error Retrieving file from Theme Storage")]
ErrorRetrievingFile,
#[error("Theme not found")]
ThemeNotFound,
#[error("Theme with lineage already exists")]
ThemeAlreadyExists,
#[error("Invalid field: {0} in lineage")]
InvalidThemeLineage(String),
#[error("Missing required field: email_config")]
MissingEmailConfig,
#[error("Invalid Auth Method Operation: {0}")]
InvalidAuthMethodOperationWithMessage(String),
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/src/services/authentication/cookies.rs<|crate|> router anchor=get_expiry_and_max_age_from_seconds kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/services/authentication/cookies.rs" role="context" start="81" end="85">
fn get_expiry_and_max_age_from_seconds(seconds: i64) -> (OffsetDateTime, Duration) {
let max_age = Duration::seconds(seconds);
let expiry = OffsetDateTime::now_utc().saturating_add(max_age);
(expiry, max_age)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/cookies.rs" role="context" start="80" end="80">
use cookie::{
time::{Duration, OffsetDateTime},
SameSite,
};
<file_sep path="hyperswitch/crates/router/src/services/authentication/cookies.rs" role="context" start="92" end="94">
pub fn get_cookie_header() -> String {
actix_http::header::COOKIE.to_string()
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/cookies.rs" role="context" start="88" end="90">
fn get_set_cookie_header() -> String {
actix_http::header::SET_COOKIE.to_string()
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/cookies.rs" role="context" start="65" end="78">
fn create_cookie<'c>(
token: Secret<String>,
expires: OffsetDateTime,
max_age: Duration,
) -> Cookie<'c> {
Cookie::build((JWT_TOKEN_COOKIE_NAME, token.expose()))
.http_only(true)
.secure(true)
.same_site(SameSite::Strict)
.path("/")
.expires(expires)
.max_age(max_age)
.build()
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/cookies.rs" role="context" start="52" end="62">
pub fn get_jwt_from_cookies(cookies: &str) -> RouterResult<String> {
Cookie::split_parse(cookies)
.find_map(|cookie| {
cookie
.ok()
.filter(|parsed_cookie| parsed_cookie.name() == JWT_TOKEN_COOKIE_NAME)
.map(|parsed_cookie| parsed_cookie.value().to_owned())
})
.ok_or(report!(ApiErrorResponse::InvalidJwtToken))
.attach_printable("Unable to find JWT token in cookies")
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/cookies.rs" role="context" start="25" end="38">
pub fn set_cookie_response<R>(response: R, token: Secret<String>) -> UserResponse<R> {
let jwt_expiry_in_seconds = JWT_TOKEN_TIME_IN_SECS
.try_into()
.map_err(|_| UserErrors::InternalServerError)?;
let (expiry, max_age) = get_expiry_and_max_age_from_seconds(jwt_expiry_in_seconds);
let header_value = create_cookie(token, expiry, max_age)
.to_string()
.into_masked();
let header_key = get_set_cookie_header();
let header = vec![(header_key, header_value)];
Ok(ApplicationResponse::JsonWithHeaders((response, header)))
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/cookies.rs" role="context" start="41" end="50">
pub fn remove_cookie_response() -> UserResponse<()> {
let (expiry, max_age) = get_expiry_and_max_age_from_seconds(0);
let header_key = get_set_cookie_header();
let header_value = create_cookie("".to_string().into(), expiry, max_age)
.to_string()
.into_masked();
let header = vec![(header_key, header_value)];
Ok(ApplicationResponse::JsonWithHeaders(((), header)))
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/cybersource.rs<|crate|> router<|connector|> cybersource anchor=should_make_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="83" end="92">
async fn should_make_payment() {
let response = Cybersource {}
.make_payment(
get_default_payment_authorize_data(),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="82" end="82">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="106" end="119">
async fn should_partially_capture_already_authorized_payment() {
let connector = Cybersource {};
let response = connector
.authorize_and_capture_payment(
get_default_payment_authorize_data(),
Some(types::PaymentsCaptureData {
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await;
assert_eq!(response.unwrap().status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="94" end="104">
async fn should_capture_already_authorized_payment() {
let connector = Cybersource {};
let response = connector
.authorize_and_capture_payment(
get_default_payment_authorize_data(),
None,
get_default_payment_info(),
)
.await;
assert_eq!(response.unwrap().status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="72" end="81">
async fn should_only_authorize_payment() {
let response = Cybersource {}
.authorize_payment(
get_default_payment_authorize_data(),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="64" end="70">
fn get_default_payment_authorize_data() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
currency: enums::Currency::USD,
email: Some(Email::from_str("abc@gmail.com").unwrap()),
..PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="37" end="63">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
address: Some(types::PaymentAddress::new(
None,
Some(Address {
address: Some(AddressDetails {
first_name: Some(Secret::new("first".to_string())),
last_name: Some(Secret::new("last".to_string())),
line1: Some(Secret::new("line1".to_string())),
line2: Some(Secret::new("line2".to_string())),
city: Some("city".to_string()),
zip: Some(Secret::new("zip".to_string())),
country: Some(api_models::enums::CountryAlpha2::IN),
..Default::default()
}),
phone: Some(PhoneDetails {
number: Some(Secret::new("9123456789".to_string())),
country_code: Some("+91".to_string()),
}),
email: None,
}),
None,
None,
)),
..Default::default()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="12" end="12">
struct Cybersource;
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/src/services/openidconnect.rs<|crate|> router anchor=get_redis_connection kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/services/openidconnect.rs" role="context" start="191" end="197">
fn get_redis_connection(state: &SessionState) -> UserResult<std::sync::Arc<RedisConnectionPool>> {
state
.store
.get_redis_conn()
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to get redis connection")
}
<file_sep path="hyperswitch/crates/router/src/services/openidconnect.rs" role="context" start="190" end="190">
use redis_interface::RedisConnectionPool;
use crate::{
consts,
core::errors::{UserErrors, UserResult},
routes::SessionState,
services::api::client,
types::domain::user::UserEmail,
};
<file_sep path="hyperswitch/crates/router/src/services/openidconnect.rs" role="context" start="187" end="189">
fn get_oidc_redis_key(csrf: &str) -> String {
format!("{}OIDC_{}", consts::user::REDIS_SSO_PREFIX, csrf)
}
<file_sep path="hyperswitch/crates/router/src/services/openidconnect.rs" role="context" start="154" end="185">
async fn get_oidc_reqwest_client(
state: &SessionState,
request: oidc::HttpRequest,
) -> Result<oidc::HttpResponse, ApiClientError> {
let client = client::create_client(&state.conf.proxy, None, None)
.map_err(|e| e.current_context().to_owned())?;
let mut request_builder = client
.request(request.method, request.url)
.body(request.body);
for (name, value) in &request.headers {
request_builder = request_builder.header(name.as_str(), value.as_bytes());
}
let request = request_builder
.build()
.map_err(|_| ApiClientError::ClientConstructionFailed)?;
let response = client
.execute(request)
.await
.map_err(|_| ApiClientError::RequestNotSent("OpenIDConnect".to_string()))?;
Ok(oidc::HttpResponse {
status_code: response.status(),
headers: response.headers().to_owned(),
body: response
.bytes()
.await
.map_err(|_| ApiClientError::ResponseDecodingFailed)?
.to_vec(),
})
}
<file_sep path="hyperswitch/crates/router/src/services/openidconnect.rs" role="context" start="16" end="44">
pub async fn get_authorization_url(
state: SessionState,
redirect_url: String,
redirect_state: Secret<String>,
base_url: Secret<String>,
client_id: Secret<String>,
) -> UserResult<url::Url> {
let discovery_document = get_discovery_document(base_url, &state).await?;
let (auth_url, csrf_token, nonce) =
get_oidc_core_client(discovery_document, client_id, None, redirect_url)?
.authorize_url(
oidc_core::CoreAuthenticationFlow::AuthorizationCode,
|| oidc::CsrfToken::new(redirect_state.expose()),
oidc::Nonce::new_random,
)
.add_scope(oidc::Scope::new("email".to_string()))
.url();
// Save csrf & nonce as key value respectively
let key = get_oidc_redis_key(csrf_token.secret());
get_redis_connection(&state)?
.set_key_with_expiry(&key.into(), nonce.secret(), consts::user::REDIS_SSO_TTL)
.await
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to save csrf-nonce in redis")?;
Ok(auth_url)
}
<file_sep path="hyperswitch/crates/router/src/services/openidconnect.rs" role="context" start="137" end="152">
async fn get_nonce_from_redis(
state: &SessionState,
redirect_state: &Secret<String>,
) -> UserResult<oidc::Nonce> {
let redis_connection = get_redis_connection(state)?;
let redirect_state = redirect_state.clone().expose();
let key = get_oidc_redis_key(&redirect_state);
redis_connection
.get_key::<Option<String>>(&key.into())
.await
.change_context(UserErrors::InternalServerError)
.attach_printable("Error Fetching CSRF from redis")?
.map(oidc::Nonce::new)
.ok_or(UserErrors::SSOFailed)
.attach_printable("Cannot find csrf in redis. Csrf invalid or expired")
}
<file_sep path="hyperswitch/crates/router/src/core/errors/user.rs" role="context" start="10" end="113">
pub enum UserErrors {
#[error("User InternalServerError")]
InternalServerError,
#[error("InvalidCredentials")]
InvalidCredentials,
#[error("UserNotFound")]
UserNotFound,
#[error("UserExists")]
UserExists,
#[error("LinkInvalid")]
LinkInvalid,
#[error("UnverifiedUser")]
UnverifiedUser,
#[error("InvalidOldPassword")]
InvalidOldPassword,
#[error("EmailParsingError")]
EmailParsingError,
#[error("NameParsingError")]
NameParsingError,
#[error("PasswordParsingError")]
PasswordParsingError,
#[error("UserAlreadyVerified")]
UserAlreadyVerified,
#[error("CompanyNameParsingError")]
CompanyNameParsingError,
#[error("MerchantAccountCreationError: {0}")]
MerchantAccountCreationError(String),
#[error("InvalidEmailError")]
InvalidEmailError,
#[error("DuplicateOrganizationId")]
DuplicateOrganizationId,
#[error("MerchantIdNotFound")]
MerchantIdNotFound,
#[error("MetadataAlreadySet")]
MetadataAlreadySet,
#[error("InvalidRoleId")]
InvalidRoleId,
#[error("InvalidRoleOperation")]
InvalidRoleOperation,
#[error("IpAddressParsingFailed")]
IpAddressParsingFailed,
#[error("InvalidMetadataRequest")]
InvalidMetadataRequest,
#[error("MerchantIdParsingError")]
MerchantIdParsingError,
#[error("ChangePasswordError")]
ChangePasswordError,
#[error("InvalidDeleteOperation")]
InvalidDeleteOperation,
#[error("MaxInvitationsError")]
MaxInvitationsError,
#[error("RoleNotFound")]
RoleNotFound,
#[error("InvalidRoleOperationWithMessage")]
InvalidRoleOperationWithMessage(String),
#[error("RoleNameParsingError")]
RoleNameParsingError,
#[error("RoleNameAlreadyExists")]
RoleNameAlreadyExists,
#[error("TotpNotSetup")]
TotpNotSetup,
#[error("InvalidTotp")]
InvalidTotp,
#[error("TotpRequired")]
TotpRequired,
#[error("InvalidRecoveryCode")]
InvalidRecoveryCode,
#[error("TwoFactorAuthRequired")]
TwoFactorAuthRequired,
#[error("TwoFactorAuthNotSetup")]
TwoFactorAuthNotSetup,
#[error("TOTP secret not found")]
TotpSecretNotFound,
#[error("User auth method already exists")]
UserAuthMethodAlreadyExists,
#[error("Invalid user auth method operation")]
InvalidUserAuthMethodOperation,
#[error("Auth config parsing error")]
AuthConfigParsingError,
#[error("Invalid SSO request")]
SSOFailed,
#[error("profile_id missing in JWT")]
JwtProfileIdMissing,
#[error("Maximum attempts reached for TOTP")]
MaxTotpAttemptsReached,
#[error("Maximum attempts reached for Recovery Code")]
MaxRecoveryCodeAttemptsReached,
#[error("Forbidden tenant id")]
ForbiddenTenantId,
#[error("Error Uploading file to Theme Storage")]
ErrorUploadingFile,
#[error("Error Retrieving file from Theme Storage")]
ErrorRetrievingFile,
#[error("Theme not found")]
ThemeNotFound,
#[error("Theme with lineage already exists")]
ThemeAlreadyExists,
#[error("Invalid field: {0} in lineage")]
InvalidThemeLineage(String),
#[error("Missing required field: email_config")]
MissingEmailConfig,
#[error("Invalid Auth Method Operation: {0}")]
InvalidAuthMethodOperationWithMessage(String),
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/src/services/authentication/detached.rs<|crate|> router anchor=generate_payload kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/services/authentication/detached.rs" role="context" start="101" end="109">
fn generate_payload(&self) -> String {
append_option(
&self.payload_type.to_string(),
&self
.merchant_id
.as_ref()
.map(|inner| append_api_key(inner.get_string_repr(), &self.key_id)),
)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/detached.rs" role="context" start="121" end="126">
fn append_api_key(prefix: &str, data: &Option<ApiKeyId>) -> String {
match data {
Some(inner) => format!("{}:{}", prefix, inner.get_string_repr()),
None => prefix.to_string(),
}
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/detached.rs" role="context" start="113" end="118">
fn append_option(prefix: &str, data: &Option<String>) -> String {
match data {
Some(inner) => format!("{}:{}", prefix, inner),
None => prefix.to_string(),
}
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/detached.rs" role="context" start="83" end="98">
pub fn verify_checksum(
&self,
headers: &HeaderMap,
algo: impl VerifySignature,
secret: &[u8],
) -> bool {
let output = || {
let checksum = headers.get(HEADER_CHECKSUM)?.to_str().ok()?;
let payload = self.generate_payload();
algo.verify_signature(secret, &hex::decode(checksum).ok()?, payload.as_bytes())
.ok()
};
output().unwrap_or(false)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/detached.rs" role="context" start="37" end="81">
pub fn from_headers(headers: &HeaderMap) -> RouterResult<Self> {
let merchant_id = headers
.get(HEADER_MERCHANT_ID)
.and_then(|value| value.to_str().ok())
.ok_or_else(|| ApiErrorResponse::InvalidRequestData {
message: format!("`{}` header is invalid or not present", HEADER_MERCHANT_ID),
})
.map_err(error_stack::Report::from)
.and_then(|merchant_id| {
MerchantId::try_from(Cow::from(merchant_id.to_string())).change_context(
ApiErrorResponse::InvalidRequestData {
message: format!(
"`{}` header is invalid or not present",
HEADER_MERCHANT_ID
),
},
)
})?;
let auth_type: PayloadType = headers
.get(HEADER_AUTH_TYPE)
.and_then(|inner| inner.to_str().ok())
.ok_or_else(|| ApiErrorResponse::InvalidRequestData {
message: format!("`{}` header not present", HEADER_AUTH_TYPE),
})?
.parse::<PayloadType>()
.change_context(ApiErrorResponse::InvalidRequestData {
message: format!("`{}` header not present", HEADER_AUTH_TYPE),
})?;
let key_id = headers
.get(HEADER_KEY_ID)
.and_then(|value| value.to_str().ok())
.map(|key_id| ApiKeyId::try_from(Cow::from(key_id.to_string())))
.transpose()
.change_context(ApiErrorResponse::InvalidRequestData {
message: format!("`{}` header is invalid or not present", HEADER_KEY_ID),
})?;
Ok(Self {
payload_type: auth_type,
merchant_id: Some(merchant_id),
key_id,
})
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/bluesnap.rs<|crate|> router<|connector|> bluesnap anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/bluesnap.rs" role="context" start="84" end="90">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bluesnap.rs" role="context" start="83" end="83">
use router::types::{self, domain, storage::enums, ConnectorAuthType, PaymentAddress};
<file_sep path="hyperswitch/crates/router/tests/connectors/bluesnap.rs" role="context" start="115" end="135">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bluesnap.rs" role="context" start="96" end="109">
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_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bluesnap.rs" role="context" start="72" end="78">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bluesnap.rs" role="context" start="47" end="65">
fn get_payment_info() -> Option<PaymentInfo> {
Some(PaymentInfo {
address: Some(PaymentAddress::new(
None,
Some(Address {
address: Some(AddressDetails {
first_name: Some(Secret::new("joseph".to_string())),
last_name: Some(Secret::new("Doe".to_string())),
..Default::default()
}),
phone: None,
email: None,
}),
None,
None,
)),
..Default::default()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bluesnap.rs" role="context" start="41" end="46">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
email: Some(Email::from_str("test@gmail.com").unwrap()),
..utils::PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/tsys.rs<|crate|> router<|connector|> tsys anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="60" end="66">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(101), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="59" end="59">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="84" end="97">
async fn should_partially_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(
payment_method_details(130),
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="70" end="80">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(
payment_method_details(100),
None,
get_default_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="46" end="55">
fn payment_method_details(amount: i64) -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
amount,
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: CardNumber::from_str("4111111111111111").unwrap(),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="42" end="44">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/wellsfargo.rs<|crate|> router<|connector|> wellsfargo anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="57" end="57">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/noon.rs<|crate|> router<|connector|> noon anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="65" end="71">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="64" end="64">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="92" end="112">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="75" end="88">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="55" end="61">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="45" end="50">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
currency: enums::Currency::AED,
..utils::PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="41" end="43">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/thunes.rs<|crate|> router<|connector|> thunes anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/thunes.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/thunes.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/thunes.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/thunes.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/thunes.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/thunes.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/amazonpay.rs<|crate|> router<|connector|> amazonpay anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/payme.rs<|crate|> router<|connector|> payme anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="123" end="129">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="122" end="122">
use router::types::{self, domain, storage::enums, PaymentAddress};
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="152" end="172">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="134" end="147">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="113" end="119">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="78" end="108">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "iphone 13".to_string(),
quantity: 1,
amount: MinorUnit::new(1000),
product_img_link: None,
requires_shipping: None,
product_id: None,
category: None,
sub_category: None,
brand: None,
product_type: None,
product_tax_code: None,
tax_rate: None,
total_tax_amount: None,
}]),
router_return_url: Some("https://hyperswitch.io".to_string()),
webhook_url: Some("https://hyperswitch.io".to_string()),
email: Some(Email::from_str("test@gmail.com").unwrap()),
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: cards::CardNumber::from_str("4111111111111111").unwrap(),
card_cvc: Secret::new("123".to_string()),
card_exp_month: Secret::new("10".to_string()),
card_exp_year: Secret::new("2025".to_string()),
..utils::CCardType::default().0
}),
amount: 1000,
..PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="44" end="76">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
address: Some(PaymentAddress::new(
None,
Some(Address {
address: Some(AddressDetails {
city: None,
country: None,
line1: None,
line2: None,
line3: None,
zip: None,
state: None,
first_name: Some(Secret::new("John".to_string())),
last_name: Some(Secret::new("Doe".to_string())),
}),
phone: None,
email: None,
}),
None,
None,
)),
auth_type: None,
access_token: None,
connector_meta_data: None,
connector_customer: None,
payment_method_token: None,
#[cfg(feature = "payouts")]
currency: None,
#[cfg(feature = "payouts")]
payout_method_data: None,
})
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/xendit.rs<|crate|> router<|connector|> xendit anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/xendit.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/xendit.rs" role="context" start="58" end="58">
use router::{
types::{self, api, storage::enums,
}};
<file_sep path="hyperswitch/crates/router/tests/connectors/xendit.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/xendit.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/xendit.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/xendit.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/xendit.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/boku.rs<|crate|> router<|connector|> boku anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/paystack.rs<|crate|> router<|connector|> paystack anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/inespay.rs<|crate|> router<|connector|> inespay anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/chargebee.rs<|crate|> router<|connector|> chargebee anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs<|crate|> router<|connector|> juspaythreedsserver anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="65" end="71">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="64" end="64">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="92" end="112">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="75" end="88">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="55" end="61">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="48" end="50">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/cybersource.rs<|crate|> router<|connector|> cybersource anchor=should_only_authorize_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="72" end="81">
async fn should_only_authorize_payment() {
let response = Cybersource {}
.authorize_payment(
get_default_payment_authorize_data(),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="71" end="71">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="94" end="104">
async fn should_capture_already_authorized_payment() {
let connector = Cybersource {};
let response = connector
.authorize_and_capture_payment(
get_default_payment_authorize_data(),
None,
get_default_payment_info(),
)
.await;
assert_eq!(response.unwrap().status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="83" end="92">
async fn should_make_payment() {
let response = Cybersource {}
.make_payment(
get_default_payment_authorize_data(),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Pending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="64" end="70">
fn get_default_payment_authorize_data() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
currency: enums::Currency::USD,
email: Some(Email::from_str("abc@gmail.com").unwrap()),
..PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="37" end="63">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
address: Some(types::PaymentAddress::new(
None,
Some(Address {
address: Some(AddressDetails {
first_name: Some(Secret::new("first".to_string())),
last_name: Some(Secret::new("last".to_string())),
line1: Some(Secret::new("line1".to_string())),
line2: Some(Secret::new("line2".to_string())),
city: Some("city".to_string()),
zip: Some(Secret::new("zip".to_string())),
country: Some(api_models::enums::CountryAlpha2::IN),
..Default::default()
}),
phone: Some(PhoneDetails {
number: Some(Secret::new("9123456789".to_string())),
country_code: Some("+91".to_string()),
}),
email: None,
}),
None,
None,
)),
..Default::default()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="12" end="12">
struct Cybersource;
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/datatrans.rs<|crate|> router<|connector|> datatrans anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="57" end="57">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/netcetera.rs<|crate|> router<|connector|> netcetera anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="57" end="63">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="56" end="56">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="84" end="104">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="67" end="80">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="47" end="53">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="40" end="42">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="36" end="38">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/novalnet.rs<|crate|> router<|connector|> novalnet anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="57" end="57">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/prophetpay.rs<|crate|> router<|connector|> prophetpay anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs<|crate|> router<|connector|> wellsfargopayout anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="57" end="57">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
<file_sep path="hyperswitch/postman/collection-dir/powertranz/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/event.test.js" role="context" start="61" end="78">
"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
);
}
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
"[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
function () {
pm.expect(jsonData.status).to.eql("succeeded");
},
);
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/coingate.rs<|crate|> router<|connector|> coingate anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="57" end="57">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/jpmorgan.rs<|crate|> router<|connector|> jpmorgan anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="65" end="71">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="64" end="64">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="92" end="112">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="75" end="88">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="55" end="61">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="48" end="50">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/paybox.rs<|crate|> router<|connector|> paybox anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="57" end="57">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/dummyconnector.rs<|crate|> router<|connector|> dummyconnector anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="61" end="67">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="60" end="60">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="88" end="108">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="71" end="84">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="51" end="57">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="44" end="46">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="40" end="42">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/globepay.rs<|crate|> router<|connector|> globepay anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="60" end="66">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="59" end="59">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="87" end="107">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="70" end="83">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="50" end="56">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="43" end="45">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="39" end="41">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/fiserv.rs<|crate|> router<|connector|> fiserv anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="87" end="93">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="86" end="86">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="116" end="137">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="98" end="111">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="76" end="82">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="63" end="68">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
connector_meta_data: Some(json!({"terminalId": "10000001"})),
..utils::PaymentInfo::with_default_billing_name()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="43" end="61">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: cards::CardNumber::from_str("4005550000000019").unwrap(),
card_exp_month: Secret::new("02".to_string()),
card_exp_year: Secret::new("2035".to_string()),
card_cvc: Secret::new("123".to_string()),
card_issuer: None,
card_network: None,
card_type: None,
card_issuing_country: None,
bank_code: None,
nick_name: Some(Secret::new("nick_name".into())),
card_holder_name: Some(Secret::new("card holder name".into())),
}),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/payone.rs<|crate|> router<|connector|> payone anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/razorpay.rs<|crate|> router<|connector|> razorpay anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/razorpay.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/razorpay.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/razorpay.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/razorpay.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/razorpay.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/razorpay.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/razorpay.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/deutschebank.rs<|crate|> router<|connector|> deutschebank anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/opayo.rs<|crate|> router<|connector|> opayo anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="63" end="69">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="62" end="62">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="90" end="110">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="73" end="86">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="53" end="59">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="46" end="48">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="42" end="44">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/getnet.rs<|crate|> router<|connector|> getnet anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/getnet.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/getnet.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/getnet.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/getnet.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/getnet.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/getnet.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/getnet.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/volt.rs<|crate|> router<|connector|> volt anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/fiuu.rs<|crate|> router<|connector|> fiuu anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/hipay.rs<|crate|> router<|connector|> hipay anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/itaubank.rs<|crate|> router<|connector|> itaubank anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="57" end="57">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/digitalvirgo.rs<|crate|> router<|connector|> digitalvirgo anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="58" end="58">
use router::{
types::{self, api, storage::enums,
}};
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/digitalvirgo.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/helcim.rs<|crate|> router<|connector|> helcim anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/helcim.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/plaid.rs<|crate|> router<|connector|> plaid anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="58" end="58">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/plaid.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/mifinity.rs<|crate|> router<|connector|> mifinity anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/redsys.rs<|crate|> router<|connector|> redsys anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/stripebilling.rs<|crate|> router<|connector|> stripebilling anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/gocardless.rs<|crate|> router<|connector|> gocardless anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/gocardless.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/gocardless.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/gocardless.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/gocardless.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/gocardless.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/gocardless.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/gocardless.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/checkout.rs<|crate|> router<|connector|> checkout anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="61" end="67">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="60" end="60">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="90" end="110">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="72" end="85">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="50" end="56">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/billwerk.rs<|crate|> router<|connector|> billwerk anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="58" end="58">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/ebanx.rs<|crate|> router<|connector|> ebanx anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="57" end="57">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/elavon.rs<|crate|> router<|connector|> elavon anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="65" end="71">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="64" end="64">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="92" end="112">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="75" end="88">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="55" end="61">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="48" end="50">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/taxjar.rs<|crate|> router<|connector|> taxjar anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="57" end="57">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/fiservemea.rs<|crate|> router<|connector|> fiservemea anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/recurly.rs<|crate|> router<|connector|> recurly anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/trustpay.rs<|crate|> router<|connector|> trustpay anchor=should_make_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/trustpay.rs" role="context" start="103" end="112">
async fn should_make_payment() {
let authorize_response = CONNECTOR
.make_payment(
get_default_payment_authorize_data(),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/trustpay.rs" role="context" start="102" end="102">
use router::types::{self, api, domain, storage::enums, BrowserInformation};
<file_sep path="hyperswitch/crates/router/tests/connectors/trustpay.rs" role="context" start="145" end="158">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(
get_default_payment_authorize_data(),
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/trustpay.rs" role="context" start="116" end="141">
async fn should_sync_auto_captured_payment() {
let authorize_response = CONNECTOR
.make_payment(
get_default_payment_authorize_data(),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Charged,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
None,
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Charged,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/trustpay.rs" role="context" start="73" end="96">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
address: Some(types::PaymentAddress::new(
None,
Some(Address {
address: Some(AddressDetails {
first_name: Some(Secret::new("first".to_string())),
last_name: Some(Secret::new("last".to_string())),
line1: Some(Secret::new("line1".to_string())),
line2: Some(Secret::new("line2".to_string())),
city: Some("city".to_string()),
zip: Some(Secret::new("zip".to_string())),
country: Some(api_models::enums::CountryAlpha2::IN),
..Default::default()
}),
phone: None,
email: None,
}),
None,
None,
)),
..Default::default()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/trustpay.rs" role="context" start="59" end="71">
fn get_default_payment_authorize_data() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: cards::CardNumber::from_str("4200000000000000").unwrap(),
card_exp_year: Secret::new("25".to_string()),
card_cvc: Secret::new("123".to_string()),
..utils::CCardType::default().0
}),
browser_info: Some(get_default_browser_info()),
router_return_url: Some(String::from("http://localhost:8080")),
..utils::PaymentAuthorizeType::default().0
})
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/placetopay.rs<|crate|> router<|connector|> placetopay anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="57" end="57">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/bamboraapac.rs<|crate|> router<|connector|> bamboraapac anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="58" end="64">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="57" end="57">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="85" end="105">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="68" end="81">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="48" end="54">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/moneris.rs<|crate|> router<|connector|> moneris anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/nexixpay.rs<|crate|> router<|connector|> nexixpay anchor=should_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="59" end="65">
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="58" end="58">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="86" end="106">
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="69" end="82">
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::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="49" end="55">
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/migrations/2023-07-07-091223_create_captures_table/up.sql" role="context" start="1" end="17">
CREATE TYPE "CaptureStatus" AS ENUM (
'started',
'charged',
'pending',
'failed'
);
ALTER TYPE "IntentStatus" ADD VALUE If NOT EXISTS 'partially_captured' AFTER 'requires_capture';
CREATE TABLE captures(
capture_id VARCHAR(64) NOT NULL PRIMARY KEY,
payment_id VARCHAR(64) NOT NULL,
merchant_id VARCHAR(64) NOT NULL,
status "CaptureStatus" NOT NULL,
amount BIGINT NOT NULL,
currency "Currency",
connector VARCHAR(255),
error_message VARCHAR(255),
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/src/connector/utils.rs<|crate|> router anchor=to_currency_base_unit kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2098" end="2105">
pub fn to_currency_base_unit(
amount: i64,
currency: enums::Currency,
) -> Result<String, error_stack::Report<errors::ConnectorError>> {
currency
.to_currency_base_unit(amount)
.change_context(errors::ConnectorError::ParsingFailed)
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2097" end="2097">
use api_models::{
enums::{CanadaStatesAbbreviation, UsStatesAbbreviation},
payments,
};
use common_utils::{
date_time,
errors::{ParsingError, ReportSwitchExt},
ext_traits::StringExt,
id_type,
pii::{self, Email, IpAddress},
types::{AmountConvertor, MinorUnit},
};
use diesel_models::{enums, types::OrderDetailsWithAmount};
use error_stack::{report, ResultExt};
use crate::{
consts,
core::{
errors::{self, ApiErrorResponse, CustomResult},
payments::{types::AuthenticationData, PaymentData},
},
pii::PeekInterface,
types::{
self, api, domain,
storage::enums as storage_enums,
transformers::{ForeignFrom, ForeignTryFrom},
ApplePayPredecryptData, BrowserInformation, PaymentsCancelData, ResponseId,
},
utils::{OptionExt, ValueExt},
};
type Error = error_stack::Report<errors::ConnectorError>;
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2116" end="2122">
pub fn construct_not_implemented_error_report(
capture_method: enums::CaptureMethod,
connector_name: &str,
) -> error_stack::Report<errors::ConnectorError> {
errors::ConnectorError::NotImplemented(format!("{} for {}", capture_method, connector_name))
.into()
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2107" end="2114">
pub fn to_currency_lower_unit(
amount: String,
currency: enums::Currency,
) -> Result<String, error_stack::Report<errors::ConnectorError>> {
currency
.to_currency_lower_unit(amount)
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2084" end="2096">
pub fn get_amount_as_f64(
currency_unit: &api::CurrencyUnit,
amount: i64,
currency: enums::Currency,
) -> Result<f64, error_stack::Report<errors::ConnectorError>> {
let amount = match currency_unit {
api::CurrencyUnit::Base => to_currency_base_unit_asf64(amount, currency)?,
api::CurrencyUnit::Minor => u32::try_from(amount)
.change_context(errors::ConnectorError::ParsingFailed)?
.into(),
};
Ok(amount)
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2072" end="2082">
pub fn get_amount_as_string(
currency_unit: &api::CurrencyUnit,
amount: i64,
currency: enums::Currency,
) -> Result<String, error_stack::Report<errors::ConnectorError>> {
let amount = match currency_unit {
api::CurrencyUnit::Minor => amount.to_string(),
api::CurrencyUnit::Base => to_currency_base_unit(amount, currency)?,
};
Ok(amount)
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2059" end="2070">
pub fn to_currency_base_unit_from_optional_amount(
amount: Option<i64>,
currency: enums::Currency,
) -> Result<String, error_stack::Report<errors::ConnectorError>> {
match amount {
Some(a) => to_currency_base_unit(a, currency),
_ => Err(errors::ConnectorError::MissingRequiredField {
field_name: "amount",
}
.into()),
}
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/src/utils/connector_onboarding.rs<|crate|> router anchor=build_key kind=fn pack=symbol_neighborhood lang=rust role_window=k2 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/utils/connector_onboarding.rs" role="context" start="147" end="157">
fn build_key(
connector_id: &common_utils::id_type::MerchantConnectorAccountId,
connector: enums::Connector,
) -> String {
format!(
"{}_{}_{}",
consts::CONNECTOR_ONBOARDING_CONFIG_PREFIX,
connector,
connector_id.get_string_repr(),
)
}
<file_sep path="hyperswitch/crates/router/src/utils/connector_onboarding.rs" role="context" start="146" end="146">
use crate::{
consts,
core::errors::{ApiErrorResponse, NotImplementedMessage, RouterResult},
routes::{app::settings, SessionState},
types::{self, api::enums},
};
<file_sep path="hyperswitch/crates/router/src/utils/connector_onboarding.rs" role="context" start="128" end="145">
pub async fn get_tracking_id_from_configs(
state: &SessionState,
connector_id: &common_utils::id_type::MerchantConnectorAccountId,
connector: enums::Connector,
) -> RouterResult<String> {
let timestamp = state
.store
.find_config_by_key_unwrap_or(
&build_key(connector_id, connector),
Some(common_utils::date_time::now_unix_timestamp().to_string()),
)
.await
.change_context(ApiErrorResponse::InternalServerError)
.attach_printable("Error getting data from configs table")?
.config;
Ok(format!("{}_{}", connector_id.get_string_repr(), timestamp))
}
<file_sep path="hyperswitch/crates/router/src/utils/connector_onboarding.rs" role="context" start="83" end="126">
pub async fn set_tracking_id_in_configs(
state: &SessionState,
connector_id: &common_utils::id_type::MerchantConnectorAccountId,
connector: enums::Connector,
) -> RouterResult<()> {
let timestamp = common_utils::date_time::now_unix_timestamp().to_string();
let find_config = state
.store
.find_config_by_key(&build_key(connector_id, connector))
.await;
if find_config.is_ok() {
state
.store
.update_config_by_key(
&build_key(connector_id, connector),
ConfigUpdate::Update {
config: Some(timestamp),
},
)
.await
.change_context(ApiErrorResponse::InternalServerError)
.attach_printable("Error updating data in configs table")?;
} else if find_config
.as_ref()
.map_err(|e| e.current_context().is_db_not_found())
.err()
.unwrap_or(false)
{
state
.store
.insert_config(ConfigNew {
key: build_key(connector_id, connector),
config: timestamp,
})
.await
.change_context(ApiErrorResponse::InternalServerError)
.attach_printable("Error inserting data in configs table")?;
} else {
find_config.change_context(ApiErrorResponse::InternalServerError)?;
}
Ok(())
}
<file_sep path="hyperswitch/crates/router/tests/connectors/utils.rs" role="context" start="24" end="44">
pub trait Connector {
fn get_data(&self) -> types::api::ConnectorData;
fn get_auth_token(&self) -> types::ConnectorAuthType;
fn get_name(&self) -> String;
fn get_connector_meta(&self) -> Option<serde_json::Value> {
None
}
/// interval in seconds to be followed when making the subsequent request whenever needed
fn get_request_interval(&self) -> u64 {
5
}
#[cfg(feature = "payouts")]
fn get_payout_data(&self) -> Option<types::api::ConnectorData> {
None
}
}
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/src/connector/netcetera.rs<|crate|> router anchor=get_headers kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="345" end="351">
fn get_headers(
&self,
req: &types::authentication::ConnectorAuthenticationRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="344" end="344">
use common_utils::{ext_traits::ByteSliceExt, request::RequestContent};
use hyperswitch_interfaces::authentication::ExternalAuthenticationPayload;
use crate::{
configs::settings,
core::errors::{self, CustomResult},
events::connector_api_logs::ConnectorEvent,
headers,
services::{self, request, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation},
types::{
self,
api::{self, ConnectorCommon, ConnectorCommonExt},
ErrorResponse, Response,
},
utils::BytesExt,
};
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="357" end="364">
fn get_url(
&self,
req: &types::authentication::ConnectorAuthenticationRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?;
Ok(format!("{}/3ds/authentication", base_url,))
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="353" end="355">
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="329" end="335">
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="310" end="327">
fn handle_response(
&self,
data: &types::authentication::PreAuthNRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<types::authentication::PreAuthNRouterData, errors::ConnectorError> {
let response: netcetera::NetceteraPreAuthenticationResponse = res
.response
.parse_struct("netcetera NetceteraPreAuthenticationResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
types::RouterData::try_from(types::ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="279" end="308">
fn build_request(
&self,
req: &types::authentication::PreAuthNRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
let netcetera_auth_type = netcetera::NetceteraAuthType::try_from(&req.connector_auth_type)?;
Ok(Some(
services::RequestBuilder::new()
.method(services::Method::Post)
.url(
&types::authentication::ConnectorPreAuthenticationType::get_url(
self, req, connectors,
)?,
)
.attach_default_headers()
.headers(
types::authentication::ConnectorPreAuthenticationType::get_headers(
self, req, connectors,
)?,
)
.set_body(
types::authentication::ConnectorPreAuthenticationType::get_request_body(
self, req, connectors,
)?,
)
.add_certificate(Some(netcetera_auth_type.certificate))
.add_certificate_key(Some(netcetera_auth_type.private_key))
.build(),
))
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="389" end="418">
fn build_request(
&self,
req: &types::authentication::ConnectorAuthenticationRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
let netcetera_auth_type = netcetera::NetceteraAuthType::try_from(&req.connector_auth_type)?;
Ok(Some(
services::RequestBuilder::new()
.method(services::Method::Post)
.url(
&types::authentication::ConnectorAuthenticationType::get_url(
self, req, connectors,
)?,
)
.attach_default_headers()
.headers(
types::authentication::ConnectorAuthenticationType::get_headers(
self, req, connectors,
)?,
)
.set_body(
types::authentication::ConnectorAuthenticationType::get_request_body(
self, req, connectors,
)?,
)
.add_certificate(Some(netcetera_auth_type.certificate))
.add_certificate_key(Some(netcetera_auth_type.private_key))
.build(),
))
}
<file_sep path="hyperswitch/crates/router/src/types/authentication.rs" role="context" start="18" end="19">
pub type ConnectorAuthenticationRouterData =
RouterData<api::Authentication, ConnectorAuthenticationRequestData, AuthenticationResponseData>;
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/src/types/domain/user.rs<|crate|> router anchor=try_from kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="382" end="386">
fn try_from(value: MerchantId) -> Result<Self, Self::Error> {
Self::try_from(std::borrow::Cow::from(value.0))
.change_context(UserErrors::MerchantIdParsingError)
.attach_printable("Could not convert user merchant_id to merchant_id type")
}
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="381" end="381">
use std::{
collections::HashSet,
ops::{Deref, Not},
str::FromStr,
};
use api_models::{
admin as admin_api, organization as api_org, user as user_api, user_role as user_role_api,
};
use diesel_models::{
enums::{TotpStatus, UserRoleVersion, UserStatus},
organization::{self as diesel_org, Organization, OrganizationBridge},
user as storage_user,
user_role::{UserRole, UserRoleNew},
};
use crate::{
consts,
core::{
admin,
errors::{UserErrors, UserResult},
},
db::GlobalStorageInterface,
routes::SessionState,
services::{self, authentication::UserFromToken},
types::{domain, transformers::ForeignFrom},
utils::user::password,
};
type InviteeUserRequestWithInvitedUserToken = (user_api::InviteUserRequest, UserFromToken);
type UserMerchantCreateRequestWithToken =
(UserFromStorage, user_api::UserMerchantCreate, UserFromToken);
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="407" end="409">
pub fn get_company_name(&self) -> Option<String> {
self.company_name.clone().map(UserCompanyName::get_secret)
}
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="401" end="403">
fn try_from(company_name: UserCompanyName) -> Result<Self, Self::Error> {
Self::try_new(company_name.get_secret()).change_context(UserErrors::CompanyNameParsingError)
}
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="375" end="377">
pub fn get_secret(&self) -> String {
self.0.clone()
}
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="363" end="373">
pub fn new(merchant_id: String) -> UserResult<Self> {
let merchant_id = merchant_id.trim().to_lowercase().replace(' ', "_");
let is_empty_or_whitespace = merchant_id.is_empty();
let is_all_valid_characters = merchant_id.chars().all(|x| x.is_alphanumeric() || x == '_');
if is_empty_or_whitespace || !is_all_valid_characters {
Err(UserErrors::MerchantIdParsingError.into())
} else {
Ok(Self(merchant_id.to_string()))
}
}
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="1032" end="1054">
fn try_from(
(value, merchant_account_identifier): (
user_api::CreateTenantUserRequest,
MerchantAccountIdentifier,
),
) -> UserResult<Self> {
let user_id = uuid::Uuid::new_v4().to_string();
let email = value.email.clone().try_into()?;
let name = UserName::new(value.name.clone())?;
let password = NewUserPassword {
password: UserPassword::new(value.password.clone())?,
is_temporary: false,
};
let new_merchant = NewUserMerchant::from((value, merchant_account_identifier));
Ok(Self {
user_id,
name,
email,
password: Some(password),
new_merchant,
})
}
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="1414" end="1423">
fn from(value: ProfileLevel) -> Self {
Self {
entity_id: value.profile_id.get_string_repr().to_owned(),
entity_type: EntityType::Profile,
tenant_id: value.tenant_id,
org_id: Some(value.org_id),
merchant_id: Some(value.merchant_id),
profile_id: Some(value.profile_id),
}
}
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="77" end="77">
type Error = error_stack::Report<UserErrors>;
<file_sep path="hyperswitch/crates/router/src/types/domain/user.rs" role="context" start="360" end="360">
pub struct MerchantId(String);
<file_sep path="hyperswitch/crates/router/src/core/errors/user.rs" role="context" start="10" end="113">
pub enum UserErrors {
#[error("User InternalServerError")]
InternalServerError,
#[error("InvalidCredentials")]
InvalidCredentials,
#[error("UserNotFound")]
UserNotFound,
#[error("UserExists")]
UserExists,
#[error("LinkInvalid")]
LinkInvalid,
#[error("UnverifiedUser")]
UnverifiedUser,
#[error("InvalidOldPassword")]
InvalidOldPassword,
#[error("EmailParsingError")]
EmailParsingError,
#[error("NameParsingError")]
NameParsingError,
#[error("PasswordParsingError")]
PasswordParsingError,
#[error("UserAlreadyVerified")]
UserAlreadyVerified,
#[error("CompanyNameParsingError")]
CompanyNameParsingError,
#[error("MerchantAccountCreationError: {0}")]
MerchantAccountCreationError(String),
#[error("InvalidEmailError")]
InvalidEmailError,
#[error("DuplicateOrganizationId")]
DuplicateOrganizationId,
#[error("MerchantIdNotFound")]
MerchantIdNotFound,
#[error("MetadataAlreadySet")]
MetadataAlreadySet,
#[error("InvalidRoleId")]
InvalidRoleId,
#[error("InvalidRoleOperation")]
InvalidRoleOperation,
#[error("IpAddressParsingFailed")]
IpAddressParsingFailed,
#[error("InvalidMetadataRequest")]
InvalidMetadataRequest,
#[error("MerchantIdParsingError")]
MerchantIdParsingError,
#[error("ChangePasswordError")]
ChangePasswordError,
#[error("InvalidDeleteOperation")]
InvalidDeleteOperation,
#[error("MaxInvitationsError")]
MaxInvitationsError,
#[error("RoleNotFound")]
RoleNotFound,
#[error("InvalidRoleOperationWithMessage")]
InvalidRoleOperationWithMessage(String),
#[error("RoleNameParsingError")]
RoleNameParsingError,
#[error("RoleNameAlreadyExists")]
RoleNameAlreadyExists,
#[error("TotpNotSetup")]
TotpNotSetup,
#[error("InvalidTotp")]
InvalidTotp,
#[error("TotpRequired")]
TotpRequired,
#[error("InvalidRecoveryCode")]
InvalidRecoveryCode,
#[error("TwoFactorAuthRequired")]
TwoFactorAuthRequired,
#[error("TwoFactorAuthNotSetup")]
TwoFactorAuthNotSetup,
#[error("TOTP secret not found")]
TotpSecretNotFound,
#[error("User auth method already exists")]
UserAuthMethodAlreadyExists,
#[error("Invalid user auth method operation")]
InvalidUserAuthMethodOperation,
#[error("Auth config parsing error")]
AuthConfigParsingError,
#[error("Invalid SSO request")]
SSOFailed,
#[error("profile_id missing in JWT")]
JwtProfileIdMissing,
#[error("Maximum attempts reached for TOTP")]
MaxTotpAttemptsReached,
#[error("Maximum attempts reached for Recovery Code")]
MaxRecoveryCodeAttemptsReached,
#[error("Forbidden tenant id")]
ForbiddenTenantId,
#[error("Error Uploading file to Theme Storage")]
ErrorUploadingFile,
#[error("Error Retrieving file from Theme Storage")]
ErrorRetrievingFile,
#[error("Theme not found")]
ThemeNotFound,
#[error("Theme with lineage already exists")]
ThemeAlreadyExists,
#[error("Invalid field: {0} in lineage")]
InvalidThemeLineage(String),
#[error("Missing required field: email_config")]
MissingEmailConfig,
#[error("Invalid Auth Method Operation: {0}")]
InvalidAuthMethodOperationWithMessage(String),
}
<file_sep path="hyperswitch/crates/api_models/src/payment_methods.rs" role="context" start="2478" end="2478">
type Error = error_stack::Report<errors::ValidationError>;
| symbol_neighborhood |
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/payeezy.rs<|crate|> router<|connector|> payeezy anchor=should_make_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="268" end="277">
async fn should_make_payment() {
let authorize_response = CONNECTOR
.make_payment(
PayeezyTest::get_payment_data(),
PayeezyTest::get_payment_info(),
)
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="267" end="267">
use router::{
core::errors,
types::{self, storage::enums, PaymentsAuthorizeData},
};
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="286" end="308">
async fn should_refund_auto_captured_payment() {
let captured_response = CONNECTOR.make_payment(None, None).await.unwrap();
assert_eq!(captured_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(captured_response.response.clone());
let connector_meta = utils::get_connector_metadata(captured_response.response);
let response = CONNECTOR
.refund_payment(
txn_id.clone().unwrap(),
Some(types::RefundsData {
refund_amount: 100,
connector_transaction_id: txn_id.unwrap(),
connector_metadata: connector_meta,
..utils::PaymentRefundType::default().0
}),
PayeezyTest::get_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="282" end="282">
async fn should_sync_auto_captured_payment() {}
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="264" end="264">
async fn should_sync_manually_captured_refund() {}
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="218" end="259">
async fn should_partially_refund_manually_captured_payment() {
let authorize_response = CONNECTOR
.authorize_payment(
PayeezyTest::get_payment_data(),
PayeezyTest::get_payment_info(),
)
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response.clone()).unwrap();
let capture_connector_meta = utils::get_connector_metadata(authorize_response.response);
let capture_response = CONNECTOR
.capture_payment(
txn_id.clone(),
Some(types::PaymentsCaptureData {
connector_meta: capture_connector_meta,
..utils::PaymentCaptureType::default().0
}),
PayeezyTest::get_payment_info(),
)
.await
.expect("Capture payment response");
let capture_txn_id =
utils::get_connector_transaction_id(capture_response.response.clone()).unwrap();
let refund_connector_metadata = utils::get_connector_metadata(capture_response.response);
let response = CONNECTOR
.refund_payment(
capture_txn_id.clone(),
Some(types::RefundsData {
refund_amount: 50,
connector_transaction_id: capture_txn_id,
connector_metadata: refund_connector_metadata,
..utils::PaymentRefundType::default().0
}),
PayeezyTest::get_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="57" end="73">
fn get_payment_info() -> Option<PaymentInfo> {
Some(PaymentInfo {
address: Some(types::PaymentAddress::new(
None,
Some(Address {
address: Some(AddressDetails {
..Default::default()
}),
phone: None,
email: None,
}),
None,
None,
)),
..Default::default()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="47" end="55">
fn get_payment_data() -> Option<PaymentsAuthorizeData> {
Some(PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card {
card_number: CardNumber::from_str("4012000033330026").unwrap(),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payeezy.rs" role="context" start="17" end="17">
struct PayeezyTest;
| symbol_neighborhood |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.