text
stringlengths 70
351k
| source
stringclasses 4
values |
|---|---|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/ebanx.rs<|crate|> router<|connector|> ebanx anchor=should_refund_succeeded_payment_multiple_times 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="263" end="274">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="262" end="262">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="301" end="319">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="278" end="296">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/ebanx.rs" role="context" start="243" end="259">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="230" end="239">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/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_refund_succeeded_payment_multiple_times 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="270" end="281">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="269" end="269">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="308" end="326">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: PaymentMethodData::Card(Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="285" end="303">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/elavon.rs" role="context" start="250" end="266">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="237" end="246">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/elavon.rs" role="context" start="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="48" end="50">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/taxjar.rs<|crate|> router<|connector|> taxjar anchor=should_refund_succeeded_payment_multiple_times 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="263" end="274">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="262" end="262">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="301" end="319">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="278" end="296">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/taxjar.rs" role="context" start="243" end="259">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="230" end="239">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/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_refund_succeeded_payment_multiple_times 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="264" end="275">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="263" end="263">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="302" end="320">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: PaymentMethodData::Card(Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="279" end="297">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/fiservemea.rs" role="context" start="244" end="260">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="231" end="240">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/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_refund_succeeded_payment_multiple_times 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="264" end="275">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="263" end="263">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="302" end="320">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: PaymentMethodData::Card(Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="279" end="297">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/recurly.rs" role="context" start="244" end="260">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/recurly.rs" role="context" start="231" end="240">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/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_refund_succeeded_payment_multiple_times 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="263" end="274">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="262" end="262">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="301" end="319">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="278" end="296">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/placetopay.rs" role="context" start="243" end="259">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="230" end="239">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/placetopay.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/bamboraapac.rs<|crate|> router<|connector|> bamboraapac anchor=should_refund_succeeded_payment_multiple_times 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="263" end="274">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="262" end="262">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="301" end="319">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="278" end="296">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/bamboraapac.rs" role="context" start="243" end="259">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="230" end="239">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/bamboraapac.rs" role="context" start="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/moneris.rs<|crate|> router<|connector|> moneris anchor=should_refund_succeeded_payment_multiple_times kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="264" end="275">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="263" end="263">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="302" end="320">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: PaymentMethodData::Card(Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="279" end="297">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/moneris.rs" role="context" start="244" end="260">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/moneris.rs" role="context" start="231" end="240">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/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
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/nexixpay.rs<|crate|> router<|connector|> nexixpay anchor=should_refund_succeeded_payment_multiple_times 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="264" end="275">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="263" end="263">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="302" end="320">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: PaymentMethodData::Card(Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="279" end="297">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/nexixpay.rs" role="context" start="244" end="260">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="231" end="240">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/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/configs/settings.rs<|crate|> router anchor=deserialize_merchant_ids kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/configs/settings.rs" role="context" start="1319" end="1327">
fn deserialize_merchant_ids<'de, D>(
deserializer: D,
) -> Result<HashSet<id_type::MerchantId>, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
deserialize_merchant_ids_inner(s).map_err(serde::de::Error::custom)
}
<file_sep path="hyperswitch/crates/router/src/configs/settings.rs" role="context" start="1318" end="1318">
use std::{
collections::{HashMap, HashSet},
path::PathBuf,
sync::Arc,
};
use common_utils::{ext_traits::ConfigExt, id_type, types::theme::EmailThemeConfig};
use serde::Deserialize;
<file_sep path="hyperswitch/crates/router/src/configs/settings.rs" role="context" start="1378" end="1404">
fn test_payment_method_and_payment_method_types() {
use diesel_models::enums::{PaymentMethod, PaymentMethodType};
let input_map: HashMap<String, String> = HashMap::from([
("bank_transfer".to_string(), "ach,bacs".to_string()),
("wallet".to_string(), "paypal,venmo".to_string()),
]);
let deserializer: MapDeserializer<
'_,
std::collections::hash_map::IntoIter<String, String>,
ValueError,
> = input_map.into_deserializer();
let result = deserialize_hashmap::<'_, _, PaymentMethod, PaymentMethodType>(deserializer);
let expected_result = HashMap::from([
(
PaymentMethod::BankTransfer,
HashSet::from([PaymentMethodType::Ach, PaymentMethodType::Bacs]),
),
(
PaymentMethod::Wallet,
HashSet::from([PaymentMethodType::Paypal, PaymentMethodType::Venmo]),
),
]);
assert!(result.is_ok());
assert_eq!(result.unwrap(), expected_result);
}
<file_sep path="hyperswitch/crates/router/src/configs/settings.rs" role="context" start="1330" end="1362">
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
#[derive(Deserialize)]
struct Inner {
base_url: String,
schema: String,
accounts_schema: String,
redis_key_prefix: String,
clickhouse_database: String,
user: TenantUserConfig,
}
let hashmap = <HashMap<id_type::TenantId, Inner>>::deserialize(deserializer)?;
Ok(Self(
hashmap
.into_iter()
.map(|(key, value)| {
(
key.clone(),
Tenant {
tenant_id: key,
base_url: value.base_url,
schema: value.schema,
accounts_schema: value.accounts_schema,
redis_key_prefix: value.redis_key_prefix,
clickhouse_database: value.clickhouse_database,
user: value.user,
},
)
})
.collect(),
))
}
<file_sep path="hyperswitch/crates/router/src/configs/settings.rs" role="context" start="1282" end="1317">
fn deserialize_merchant_ids_inner(
value: impl AsRef<str>,
) -> Result<HashSet<id_type::MerchantId>, String> {
let (values, errors) = value
.as_ref()
.trim()
.split(',')
.map(|s| {
let trimmed = s.trim();
id_type::MerchantId::wrap(trimmed.to_owned()).map_err(|error| {
format!(
"Unable to deserialize `{}` as `MerchantId`: {error}",
trimmed
)
})
})
.fold(
(HashSet::new(), Vec::new()),
|(mut values, mut errors), result| match result {
Ok(t) => {
values.insert(t);
(values, errors)
}
Err(error) => {
errors.push(error);
(values, errors)
}
},
);
if !errors.is_empty() {
Err(format!("Some errors occurred:\n{}", errors.join("\n")))
} else {
Ok(values)
}
}
<file_sep path="hyperswitch/crates/router/src/configs/settings.rs" role="context" start="1263" end="1280">
fn deserialize_optional_hashset<'a, D, T>(deserializer: D) -> Result<Option<HashSet<T>>, D::Error>
where
D: serde::Deserializer<'a>,
T: Eq + std::str::FromStr + std::hash::Hash,
<T as std::str::FromStr>::Err: std::fmt::Display,
{
use serde::de::Error;
<Option<String>>::deserialize(deserializer).map(|value| {
value.map_or(Ok(None), |inner: String| {
let list = deserialize_hashset_inner(inner).map_err(D::Error::custom)?;
match list.len() {
0 => Ok(None),
_ => Ok(Some(list)),
}
})
})?
}
<file_sep path="hyperswitch/crates/router/tests/utils.rs" role="context" start="399" end="401">
pub struct Error {
pub message: Message,
}
<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/payme.rs<|crate|> router<|connector|> payme anchor=should_refund_succeeded_payment_multiple_times 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="334" end="345">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 100,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="333" end="333">
use common_utils::{pii::Email, types::MinorUnit};
use diesel_models::types::OrderDetailsWithAmount;
use router::types::{self, domain, storage::enums, PaymentAddress};
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="373" end="411">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
amount: 100,
currency: enums::Currency::ILS,
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
order_details: Some(vec![OrderDetailsWithAmount {
product_name: "iphone 13".to_string(),
quantity: 1,
amount: MinorUnit::new(100),
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()),
..PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"internal_server_error".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="350" end="368">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Refund Sync flow not supported by Payme connector",
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="315" end="330">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="302" end="311">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/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/crates/router/tests/connectors/utils.rs" role="context" start="923" end="923">
pub struct PaymentRefundType(pub types::RefundsData);
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/types/api.rs<|crate|> router anchor=new kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/types/api.rs" role="context" start="133" end="145">
pub fn new(
payment_method_sub_type: api_enums::PaymentMethodType,
connector: ConnectorData,
business_sub_label: Option<String>,
payment_method_type: api_enums::PaymentMethod,
) -> Self {
Self {
payment_method_sub_type,
connector,
business_sub_label,
payment_method_type,
}
}
<file_sep path="hyperswitch/crates/router/src/types/api.rs" role="context" start="132" end="132">
pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Clone, Debug)]
pub struct SessionConnectorData {
pub payment_method_sub_type: api_enums::PaymentMethodType,
pub payment_method_type: api_enums::PaymentMethod,
pub connector: ConnectorData,
pub business_sub_label: Option<String>,
}
impl SessionConnectorData {
pub fn new(
payment_method_sub_type: api_enums::PaymentMethodType,
connector: ConnectorData,
business_sub_label: Option<String>,
payment_method_type: api_enums::PaymentMethod,
) -> Self {
Self {
payment_method_sub_type,
connector,
business_sub_label,
payment_method_type,
}
}
<file_sep path="hyperswitch/crates/router/src/types/api.rs" role="context" start="198" end="209">
fn foreign_try_from(from: ConnectorData) -> Result<Self, Self::Error> {
match RoutableConnectors::foreign_try_from(from.connector_name) {
Ok(connector) => Ok(Self {
choice_kind: api_routing::RoutableChoiceKind::FullStruct,
connector,
merchant_connector_id: from.merchant_connector_id,
}),
Err(e) => Err(common_utils::errors::ValidationError::InvalidValue {
message: format!("This is not a routable connector: {:?}", e),
})?,
}
}
<file_sep path="hyperswitch/crates/router/src/types/api.rs" role="context" start="187" end="194">
pub fn convert_connector_data_to_routable_connectors(
connectors: &[ConnectorData],
) -> CustomResult<Vec<RoutableConnectorChoice>, common_utils::errors::ValidationError> {
connectors
.iter()
.map(|connector_data| RoutableConnectorChoice::foreign_try_from(connector_data.clone()))
.collect()
}
<file_sep path="hyperswitch/crates/router/src/types/api.rs" role="context" start="287" end="579">
pub fn convert_connector(
connector_name: &str,
) -> CustomResult<ConnectorEnum, errors::ApiErrorResponse> {
match enums::Connector::from_str(connector_name) {
Ok(name) => match name {
enums::Connector::Aci => Ok(ConnectorEnum::Old(Box::new(connector::Aci::new()))),
enums::Connector::Adyen => {
Ok(ConnectorEnum::Old(Box::new(connector::Adyen::new())))
}
enums::Connector::Adyenplatform => Ok(ConnectorEnum::Old(Box::new(
connector::Adyenplatform::new(),
))),
enums::Connector::Airwallex => {
Ok(ConnectorEnum::Old(Box::new(&connector::Airwallex)))
}
// enums::Connector::Amazonpay => {
// Ok(ConnectorEnum::Old(Box::new(connector::Amazonpay)))
// }
enums::Connector::Authorizedotnet => {
Ok(ConnectorEnum::Old(Box::new(&connector::Authorizedotnet)))
}
enums::Connector::Bambora => Ok(ConnectorEnum::Old(Box::new(&connector::Bambora))),
enums::Connector::Bamboraapac => {
Ok(ConnectorEnum::Old(Box::new(connector::Bamboraapac::new())))
}
enums::Connector::Bankofamerica => {
Ok(ConnectorEnum::Old(Box::new(&connector::Bankofamerica)))
}
enums::Connector::Billwerk => {
Ok(ConnectorEnum::Old(Box::new(connector::Billwerk::new())))
}
enums::Connector::Bitpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Bitpay::new())))
}
enums::Connector::Bluesnap => {
Ok(ConnectorEnum::Old(Box::new(connector::Bluesnap::new())))
}
enums::Connector::Boku => Ok(ConnectorEnum::Old(Box::new(connector::Boku::new()))),
enums::Connector::Braintree => {
Ok(ConnectorEnum::Old(Box::new(connector::Braintree::new())))
}
enums::Connector::Cashtocode => {
Ok(ConnectorEnum::Old(Box::new(connector::Cashtocode::new())))
}
enums::Connector::Chargebee => {
Ok(ConnectorEnum::Old(Box::new(connector::Chargebee::new())))
}
enums::Connector::Checkout => {
Ok(ConnectorEnum::Old(Box::new(connector::Checkout::new())))
}
enums::Connector::Coinbase => {
Ok(ConnectorEnum::Old(Box::new(&connector::Coinbase)))
}
enums::Connector::Coingate => {
Ok(ConnectorEnum::Old(Box::new(connector::Coingate::new())))
}
enums::Connector::Cryptopay => {
Ok(ConnectorEnum::Old(Box::new(connector::Cryptopay::new())))
}
enums::Connector::CtpMastercard => {
Ok(ConnectorEnum::Old(Box::new(&connector::CtpMastercard)))
}
enums::Connector::CtpVisa => Ok(ConnectorEnum::Old(Box::new(
connector::UnifiedAuthenticationService::new(),
))),
enums::Connector::Cybersource => {
Ok(ConnectorEnum::Old(Box::new(connector::Cybersource::new())))
}
enums::Connector::Datatrans => {
Ok(ConnectorEnum::Old(Box::new(connector::Datatrans::new())))
}
enums::Connector::Deutschebank => {
Ok(ConnectorEnum::Old(Box::new(connector::Deutschebank::new())))
}
enums::Connector::Digitalvirgo => {
Ok(ConnectorEnum::Old(Box::new(connector::Digitalvirgo::new())))
}
enums::Connector::Dlocal => Ok(ConnectorEnum::Old(Box::new(&connector::Dlocal))),
#[cfg(feature = "dummy_connector")]
enums::Connector::DummyConnector1 => Ok(ConnectorEnum::Old(Box::new(
&connector::DummyConnector::<1>,
))),
#[cfg(feature = "dummy_connector")]
enums::Connector::DummyConnector2 => Ok(ConnectorEnum::Old(Box::new(
&connector::DummyConnector::<2>,
))),
#[cfg(feature = "dummy_connector")]
enums::Connector::DummyConnector3 => Ok(ConnectorEnum::Old(Box::new(
&connector::DummyConnector::<3>,
))),
#[cfg(feature = "dummy_connector")]
enums::Connector::DummyConnector4 => Ok(ConnectorEnum::Old(Box::new(
&connector::DummyConnector::<4>,
))),
#[cfg(feature = "dummy_connector")]
enums::Connector::DummyConnector5 => Ok(ConnectorEnum::Old(Box::new(
&connector::DummyConnector::<5>,
))),
#[cfg(feature = "dummy_connector")]
enums::Connector::DummyConnector6 => Ok(ConnectorEnum::Old(Box::new(
&connector::DummyConnector::<6>,
))),
#[cfg(feature = "dummy_connector")]
enums::Connector::DummyConnector7 => Ok(ConnectorEnum::Old(Box::new(
&connector::DummyConnector::<7>,
))),
enums::Connector::Ebanx => {
Ok(ConnectorEnum::Old(Box::new(connector::Ebanx::new())))
}
enums::Connector::Elavon => {
Ok(ConnectorEnum::Old(Box::new(connector::Elavon::new())))
}
// enums::Connector::Facilitapay => {
// Ok(ConnectorEnum::Old(Box::new(connector::Facilitapay)))
// }
enums::Connector::Fiserv => {
Ok(ConnectorEnum::Old(Box::new(connector::Fiserv::new())))
}
enums::Connector::Fiservemea => {
Ok(ConnectorEnum::Old(Box::new(connector::Fiservemea::new())))
}
enums::Connector::Fiuu => Ok(ConnectorEnum::Old(Box::new(connector::Fiuu::new()))),
enums::Connector::Forte => {
Ok(ConnectorEnum::Old(Box::new(connector::Forte::new())))
}
enums::Connector::Getnet => {
Ok(ConnectorEnum::Old(Box::new(connector::Getnet::new())))
}
enums::Connector::Globalpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Globalpay::new())))
}
enums::Connector::Globepay => {
Ok(ConnectorEnum::Old(Box::new(connector::Globepay::new())))
}
enums::Connector::Gocardless => {
Ok(ConnectorEnum::Old(Box::new(&connector::Gocardless)))
}
enums::Connector::Hipay => {
Ok(ConnectorEnum::Old(Box::new(connector::Hipay::new())))
}
enums::Connector::Helcim => {
Ok(ConnectorEnum::Old(Box::new(connector::Helcim::new())))
}
enums::Connector::Iatapay => {
Ok(ConnectorEnum::Old(Box::new(connector::Iatapay::new())))
}
enums::Connector::Inespay => {
Ok(ConnectorEnum::Old(Box::new(connector::Inespay::new())))
}
enums::Connector::Itaubank => {
Ok(ConnectorEnum::Old(Box::new(connector::Itaubank::new())))
}
enums::Connector::Jpmorgan => {
Ok(ConnectorEnum::Old(Box::new(connector::Jpmorgan::new())))
}
enums::Connector::Juspaythreedsserver => Ok(ConnectorEnum::Old(Box::new(
connector::Juspaythreedsserver::new(),
))),
enums::Connector::Klarna => {
Ok(ConnectorEnum::Old(Box::new(connector::Klarna::new())))
}
enums::Connector::Mollie => {
// enums::Connector::Moneris => Ok(ConnectorEnum::Old(Box::new(connector::Moneris))),
Ok(ConnectorEnum::Old(Box::new(connector::Mollie::new())))
}
enums::Connector::Moneris => {
Ok(ConnectorEnum::Old(Box::new(connector::Moneris::new())))
}
enums::Connector::Nexixpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Nexixpay::new())))
}
enums::Connector::Nmi => Ok(ConnectorEnum::Old(Box::new(connector::Nmi::new()))),
enums::Connector::Nomupay => {
Ok(ConnectorEnum::Old(Box::new(connector::Nomupay::new())))
}
enums::Connector::Noon => Ok(ConnectorEnum::Old(Box::new(connector::Noon::new()))),
enums::Connector::Novalnet => {
Ok(ConnectorEnum::Old(Box::new(connector::Novalnet::new())))
}
enums::Connector::Nuvei => Ok(ConnectorEnum::Old(Box::new(&connector::Nuvei))),
enums::Connector::Opennode => {
Ok(ConnectorEnum::Old(Box::new(&connector::Opennode)))
}
enums::Connector::Paybox => {
Ok(ConnectorEnum::Old(Box::new(connector::Paybox::new())))
}
// "payeezy" => Ok(ConnectorIntegrationEnum::Old(Box::new(&connector::Payeezy)), As psync and rsync are not supported by this connector, it is added as template code for future usage
enums::Connector::Payme => {
Ok(ConnectorEnum::Old(Box::new(connector::Payme::new())))
}
enums::Connector::Payone => {
Ok(ConnectorEnum::Old(Box::new(connector::Payone::new())))
}
enums::Connector::Payu => Ok(ConnectorEnum::Old(Box::new(connector::Payu::new()))),
enums::Connector::Placetopay => {
Ok(ConnectorEnum::Old(Box::new(connector::Placetopay::new())))
}
enums::Connector::Powertranz => {
Ok(ConnectorEnum::Old(Box::new(&connector::Powertranz)))
}
enums::Connector::Prophetpay => {
Ok(ConnectorEnum::Old(Box::new(&connector::Prophetpay)))
}
enums::Connector::Razorpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Razorpay::new())))
}
enums::Connector::Rapyd => {
Ok(ConnectorEnum::Old(Box::new(connector::Rapyd::new())))
}
enums::Connector::Recurly => {
Ok(ConnectorEnum::Old(Box::new(connector::Recurly::new())))
}
enums::Connector::Redsys => {
Ok(ConnectorEnum::Old(Box::new(connector::Redsys::new())))
}
enums::Connector::Shift4 => {
Ok(ConnectorEnum::Old(Box::new(connector::Shift4::new())))
}
enums::Connector::Square => Ok(ConnectorEnum::Old(Box::new(&connector::Square))),
enums::Connector::Stax => Ok(ConnectorEnum::Old(Box::new(&connector::Stax))),
enums::Connector::Stripe => {
Ok(ConnectorEnum::Old(Box::new(connector::Stripe::new())))
}
enums::Connector::Stripebilling => Ok(ConnectorEnum::Old(Box::new(
connector::Stripebilling::new(),
))),
enums::Connector::Wise => Ok(ConnectorEnum::Old(Box::new(connector::Wise::new()))),
enums::Connector::Worldline => {
Ok(ConnectorEnum::Old(Box::new(&connector::Worldline)))
}
enums::Connector::Worldpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Worldpay::new())))
}
enums::Connector::Xendit => {
Ok(ConnectorEnum::Old(Box::new(connector::Xendit::new())))
}
enums::Connector::Mifinity => {
Ok(ConnectorEnum::Old(Box::new(connector::Mifinity::new())))
}
enums::Connector::Multisafepay => {
Ok(ConnectorEnum::Old(Box::new(connector::Multisafepay::new())))
}
enums::Connector::Netcetera => {
Ok(ConnectorEnum::Old(Box::new(&connector::Netcetera)))
}
enums::Connector::Nexinets => {
Ok(ConnectorEnum::Old(Box::new(&connector::Nexinets)))
}
// enums::Connector::Nexixpay => {
// Ok(ConnectorEnum::Old(Box::new(&connector::Nexixpay)))
// }
enums::Connector::Paypal => {
Ok(ConnectorEnum::Old(Box::new(connector::Paypal::new())))
}
enums::Connector::Paystack => {
Ok(ConnectorEnum::Old(Box::new(connector::Paystack::new())))
}
// enums::Connector::Thunes => Ok(ConnectorEnum::Old(Box::new(connector::Thunes))),
enums::Connector::Trustpay => {
Ok(ConnectorEnum::Old(Box::new(connector::Trustpay::new())))
}
enums::Connector::Tsys => Ok(ConnectorEnum::Old(Box::new(connector::Tsys::new()))),
// enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new(
// connector::UnifiedAuthenticationService,
// ))),
enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))),
enums::Connector::Wellsfargo => {
Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new())))
}
// enums::Connector::Wellsfargopayout => {
// Ok(Box::new(connector::Wellsfargopayout::new()))
// }
enums::Connector::Zen => Ok(ConnectorEnum::Old(Box::new(&connector::Zen))),
enums::Connector::Zsl => Ok(ConnectorEnum::Old(Box::new(&connector::Zsl))),
enums::Connector::Plaid => {
Ok(ConnectorEnum::Old(Box::new(connector::Plaid::new())))
}
enums::Connector::Signifyd
| enums::Connector::Riskified
| enums::Connector::Gpayments
| enums::Connector::Threedsecureio
| enums::Connector::Taxjar => {
Err(report!(errors::ConnectorError::InvalidConnectorName)
.attach_printable(format!("invalid connector name: {connector_name}")))
.change_context(errors::ApiErrorResponse::InternalServerError)
}
},
Err(_) => Err(report!(errors::ConnectorError::InvalidConnectorName)
.attach_printable(format!("invalid connector name: {connector_name}")))
.change_context(errors::ApiErrorResponse::InternalServerError),
}
}
<file_sep path="hyperswitch/crates/router/src/types/api.rs" role="context" start="642" end="650">
fn convert_connector(
connector_name: enums::TaxConnectors,
) -> CustomResult<ConnectorEnum, errors::ApiErrorResponse> {
match connector_name {
enums::TaxConnectors::Taxjar => {
Ok(ConnectorEnum::Old(Box::new(connector::Taxjar::new())))
}
}
}
<file_sep path="hyperswitch/crates/router/src/types/api.rs" role="context" start="117" end="122">
pub struct ConnectorData {
pub connector: ConnectorEnum,
pub connector_name: types::Connector,
pub get_token: GetToken,
pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
<file_sep path="hyperswitch/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/up.sql" role="context" start="54" end="70">
ADD COLUMN redirection_data JSONB,
ADD COLUMN connector_payment_data TEXT,
ADD COLUMN connector_token_details JSONB;
-- Change the type of the column from JSON to JSONB
ALTER TABLE merchant_connector_account
ADD COLUMN IF NOT EXISTS feature_metadata JSONB;
ALTER TABLE payment_methods
ADD COLUMN IF NOT EXISTS locker_fingerprint_id VARCHAR(64),
ADD COLUMN IF NOT EXISTS payment_method_type_v2 VARCHAR(64),
ADD COLUMN IF NOT EXISTS payment_method_subtype VARCHAR(64);
ALTER TABLE refund
ADD COLUMN IF NOT EXISTS id VARCHAR(64),
ADD COLUMN IF NOT EXISTS merchant_reference_id VARCHAR(64),
ADD COLUMN IF NOT EXISTS connector_id VARCHAR(64);
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/utils/currency.rs<|crate|> router anchor=save_forex_data_to_local_cache kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="119" end="126">
async fn save_forex_data_to_local_cache(
exchange_rates_cache_entry: FxExchangeRatesCacheEntry,
) -> CustomResult<(), ForexError> {
let mut local = FX_EXCHANGE_RATES_CACHE.write().await;
*local = Some(exchange_rates_cache_entry);
logger::debug!("forex_log: forex saved in cache");
Ok(())
}
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="118" end="118">
use common_utils::{date_time, errors::CustomResult, events::ApiEventMetric, ext_traits::AsyncExt};
use crate::{
logger,
routes::app::settings::{Conversion, DefaultExchangeRates},
services, SessionState,
};
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="149" end="154">
fn from(value: Conversion) -> Self {
Self {
to_factor: value.to_factor,
from_factor: value.from_factor,
}
}
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="130" end="145">
fn try_from(value: DefaultExchangeRates) -> Result<Self, Self::Error> {
let mut conversion_usable: HashMap<enums::Currency, CurrencyFactors> = HashMap::new();
for (curr, conversion) in value.conversion {
let enum_curr = enums::Currency::from_str(curr.as_str())
.change_context(ForexError::ConversionError)
.attach_printable("Unable to Convert currency received")?;
conversion_usable.insert(enum_curr, CurrencyFactors::from(conversion));
}
let base_curr = enums::Currency::from_str(value.base_currency.as_str())
.change_context(ForexError::ConversionError)
.attach_printable("Unable to convert base currency")?;
Ok(Self {
base_currency: base_curr,
conversion: conversion_usable,
})
}
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="115" end="117">
async fn retrieve_forex_from_local_cache() -> Option<FxExchangeRatesCacheEntry> {
FX_EXCHANGE_RATES_CACHE.read().await.clone()
}
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="110" end="112">
fn is_expired(&self, data_expiration_delay: u32) -> bool {
self.timestamp + i64::from(data_expiration_delay) < date_time::now_unix_timestamp()
}
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="252" end="262">
async fn save_forex_data_to_cache_and_redis(
state: &SessionState,
forex: FxExchangeRatesCacheEntry,
) -> CustomResult<(), ForexError> {
save_forex_data_to_redis(state, &forex)
.await
.async_and_then(|_rates| release_redis_lock(state))
.await
.async_and_then(|_val| save_forex_data_to_local_cache(forex.clone()))
.await
}
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="264" end="282">
async fn call_forex_api_if_redis_data_expired(
state: &SessionState,
redis_data: FxExchangeRatesCacheEntry,
data_expiration_delay: u32,
) -> CustomResult<FxExchangeRatesCacheEntry, ForexError> {
match is_redis_expired(Some(redis_data.clone()).as_ref(), data_expiration_delay).await {
Some(redis_forex) => {
// Valid data present in redis
let exchange_rates = FxExchangeRatesCacheEntry::new(redis_forex.as_ref().clone());
logger::debug!("forex_log: forex response found in redis");
save_forex_data_to_local_cache(exchange_rates.clone()).await?;
Ok(exchange_rates)
}
None => {
// redis expired
call_forex_api_and_save_data_to_cache_and_redis(state, Some(redis_data)).await
}
}
}
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="41" end="80">
pub enum ForexError {
#[error("API error")]
ApiError,
#[error("API timeout")]
ApiTimeout,
#[error("API unresponsive")]
ApiUnresponsive,
#[error("Conversion error")]
ConversionError,
#[error("Could not acquire the lock for cache entry")]
CouldNotAcquireLock,
#[error("Provided currency not acceptable")]
CurrencyNotAcceptable,
#[error("Forex configuration error: {0}")]
ConfigurationError(String),
#[error("Incorrect entries in default Currency response")]
DefaultCurrencyParsingError,
#[error("Entry not found in cache")]
EntryNotFound,
#[error("Forex data unavailable")]
ForexDataUnavailable,
#[error("Expiration time invalid")]
InvalidLogExpiry,
#[error("Error reading local")]
LocalReadError,
#[error("Error writing to local cache")]
LocalWriteError,
#[error("Json Parsing error")]
ParsingError,
#[error("Aws Kms decryption error")]
AwsKmsDecryptionFailed,
#[error("Error connecting to redis")]
RedisConnectionError,
#[error("Not able to release write lock")]
RedisLockReleaseFailed,
#[error("Error writing to redis")]
RedisWriteError,
#[error("Not able to acquire write lock")]
WriteLockNotAcquired,
}
<file_sep path="hyperswitch/crates/router/src/utils/currency.rs" role="context" start="30" end="33">
pub struct FxExchangeRatesCacheEntry {
pub data: Arc<ExchangeRates>,
timestamp: i64,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/trustpay.rs<|crate|> router<|connector|> trustpay anchor=should_refund_auto_captured_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<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="144" end="144">
use router::types::{self, api, domain, storage::enums, BrowserInformation};
<file_sep path="hyperswitch/crates/router/tests/connectors/trustpay.rs" role="context" start="189" end="208">
async fn should_fail_payment_for_incorrect_card_number() {
let payment_authorize_data = types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: cards::CardNumber::from_str("1234567891011").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()),
..utils::PaymentAuthorizeType::default().0
};
let response = CONNECTOR
.make_payment(Some(payment_authorize_data), get_default_payment_info())
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Errors { code: 61, description: \"invalid payment data (country or brand)\" }".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/trustpay.rs" role="context" start="162" end="184">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(
get_default_payment_authorize_data(),
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
None,
)
.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="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="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
})
}
<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/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/wellsfargo.rs<|crate|> router<|connector|> wellsfargo anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/wellsfargo.rs" role="context" start="126" end="126">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/wellsfargo.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/crates/router/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/noon.rs<|crate|> router<|connector|> noon anchor=should_refund_manually_captured_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="134" end="148">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/noon.rs" role="context" start="133" end="133">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="173" end="196">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/noon.rs" role="context" start="152" end="169">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="116" end="130">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="41" end="43">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/amazonpay.rs<|crate|> router<|connector|> amazonpay anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/amazonpay.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/amazonpay.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/payme.rs<|crate|> router<|connector|> payme anchor=should_refund_manually_captured_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="198" end="212">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/payme.rs" role="context" start="197" end="197">
use router::types::{self, domain, storage::enums, PaymentAddress};
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="237" end="260">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/payme.rs" role="context" start="216" end="232">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="177" end="194">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Void flow not supported by Payme connector".to_string()
);
}
<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="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/crates/router/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/boku.rs<|crate|> router<|connector|> boku anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/boku.rs" role="context" start="126" end="126">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/boku.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/paystack.rs<|crate|> router<|connector|> paystack anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/paystack.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/paystack.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/inespay.rs<|crate|> router<|connector|> inespay anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/inespay.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/inespay.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/chargebee.rs<|crate|> router<|connector|> chargebee anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/chargebee.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/chargebee.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs<|crate|> router<|connector|> juspaythreedsserver anchor=should_refund_manually_captured_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="134" end="148">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/juspaythreedsserver.rs" role="context" start="133" end="133">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="173" end="196">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/juspaythreedsserver.rs" role="context" start="152" end="169">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="116" end="130">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/datatrans.rs<|crate|> router<|connector|> datatrans anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/datatrans.rs" role="context" start="126" end="126">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/datatrans.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/novalnet.rs<|crate|> router<|connector|> novalnet anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/novalnet.rs" role="context" start="126" end="126">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/novalnet.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/prophetpay.rs<|crate|> router<|connector|> prophetpay anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/prophetpay.rs" role="context" start="126" end="126">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/prophetpay.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs<|crate|> router<|connector|> wellsfargopayout anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/wellsfargopayout.rs" role="context" start="126" end="126">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/wellsfargopayout.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargopayout.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
<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_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/coingate.rs" role="context" start="126" end="126">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/coingate.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/jpmorgan.rs<|crate|> router<|connector|> jpmorgan anchor=should_refund_manually_captured_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="134" end="148">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/jpmorgan.rs" role="context" start="133" end="133">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="173" end="196">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/jpmorgan.rs" role="context" start="152" end="169">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="116" end="130">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/paybox.rs<|crate|> router<|connector|> paybox anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/paybox.rs" role="context" start="126" end="126">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/paybox.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs<|crate|> router<|connector|> unified_authentication_service anchor=should_refund_manually_captured_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/unified_authentication_service.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/unified_authentication_service.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.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/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
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/dummyconnector.rs<|crate|> router<|connector|> dummyconnector anchor=should_refund_manually_captured_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="130" end="144">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/dummyconnector.rs" role="context" start="129" end="129">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="169" end="192">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/dummyconnector.rs" role="context" start="148" end="165">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="112" end="126">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="40" end="42">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/globepay.rs<|crate|> router<|connector|> globepay anchor=should_refund_manually_captured_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="129" end="143">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/globepay.rs" role="context" start="128" end="128">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="168" end="191">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/globepay.rs" role="context" start="147" end="164">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/globepay.rs" role="context" start="111" end="125">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="39" end="41">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/fiserv.rs<|crate|> router<|connector|> fiserv anchor=should_refund_manually_captured_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="162" end="176">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/fiserv.rs" role="context" start="161" end="161">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="203" end="227">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
tokio::time::sleep(std::time::Duration::from_secs(7)).await;
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/fiserv.rs" role="context" start="181" end="198">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiserv.rs" role="context" start="143" end="157">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("TIMEOUT".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/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/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/powertranz.rs<|crate|> router<|connector|> powertranz anchor=should_refund_manually_captured_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/powertranz.rs" role="context" start="131" end="145">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/powertranz.rs" role="context" start="130" end="130">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/powertranz.rs" role="context" start="171" end="194">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/powertranz.rs" role="context" start="149" end="166">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/powertranz.rs" role="context" start="113" end="127">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/powertranz.rs" role="context" start="89" end="109">
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/powertranz.rs" role="context" start="43" end="45">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/powertranz.rs" role="context" start="39" end="41">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/payone.rs<|crate|> router<|connector|> payone anchor=should_refund_manually_captured_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/payone.rs" role="context" start="126" end="126">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/payone.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payone.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/deutschebank.rs<|crate|> router<|connector|> deutschebank anchor=should_refund_manually_captured_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/deutschebank.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/deutschebank.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/facilitapay.rs<|crate|> router<|connector|> facilitapay anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/facilitapay.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/facilitapay.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.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/facilitapay.rs" role="context" start="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/volt.rs<|crate|> router<|connector|> volt anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/volt.rs" role="context" start="126" end="126">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/volt.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/hipay.rs<|crate|> router<|connector|> hipay anchor=should_refund_manually_captured_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/hipay.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/hipay.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/itaubank.rs<|crate|> router<|connector|> itaubank anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/itaubank.rs" role="context" start="126" end="126">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/itaubank.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/mifinity.rs<|crate|> router<|connector|> mifinity anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/mifinity.rs" role="context" start="126" end="126">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/mifinity.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/mifinity.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/bankofamerica.rs<|crate|> router<|connector|> bankofamerica anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/bankofamerica.rs" role="context" start="127" end="127">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/bankofamerica.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bankofamerica.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/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_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/redsys.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/redsys.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/redsys.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/stripebilling.rs<|crate|> router<|connector|> stripebilling anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/stripebilling.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/stripebilling.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/stripebilling.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/airwallex.rs<|crate|> router<|connector|> airwallex anchor=should_refund_manually_captured_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/airwallex.rs" role="context" start="183" end="197">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/airwallex.rs" role="context" start="182" end="182">
use router::types::{self, domain, storage::enums, AccessToken};
<file_sep path="hyperswitch/crates/router/tests/connectors/airwallex.rs" role="context" start="226" end="249">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/airwallex.rs" role="context" start="203" end="220">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/airwallex.rs" role="context" start="163" end="177">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/airwallex.rs" role="context" start="138" end="158">
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/airwallex.rs" role="context" start="52" end="71">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
access_token: get_access_token(),
address: Some(types::PaymentAddress::new(
None,
None,
Some(Address {
address: Some(AddressDetails {
first_name: Some(Secret::new("John".to_string())),
last_name: Some(Secret::new("Doe".to_string())),
..Default::default()
}),
phone: None,
email: None,
}),
None,
)),
..Default::default()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/airwallex.rs" role="context" start="72" end="92">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: cards::CardNumber::from_str("4035501000000008").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),
router_return_url: Some("https://google.com".to_string()),
complete_authorize_url: Some("https://google.com".to_string()),
..utils::PaymentAuthorizeType::default().0
})
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/tsys.rs<|crate|> router<|connector|> tsys anchor=should_refund_succeeded_payment_multiple_times kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="302" end="313">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(250),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="301" end="301">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="345" end="363">
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_cvc: Secret::new("".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"The value of element cvv2 is not valid.".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="317" end="340">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(100),
None,
get_default_payment_info(),
)
.await
.unwrap();
tokio::time::sleep(Duration::from_secs(10)).await;
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/tsys.rs" role="context" start="282" end="298">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(230),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/tsys.rs" role="context" start="262" end="278">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(
payment_method_details(220),
Some(types::RefundsData {
refund_amount: 220,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<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
}
<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/utils.rs" role="context" start="923" end="923">
pub struct PaymentRefundType(pub types::RefundsData);
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/checkout.rs<|crate|> router<|connector|> checkout anchor=should_refund_manually_captured_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="134" end="148">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/checkout.rs" role="context" start="133" end="133">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="175" end="198">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/checkout.rs" role="context" start="153" end="170">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/checkout.rs" role="context" start="115" end="129">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/billwerk.rs<|crate|> router<|connector|> billwerk anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/billwerk.rs" role="context" start="127" end="127">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/billwerk.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/billwerk.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/ebanx.rs<|crate|> router<|connector|> ebanx anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/ebanx.rs" role="context" start="126" end="126">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/ebanx.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/ebanx.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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_refund_manually_captured_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="134" end="148">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/elavon.rs" role="context" start="133" end="133">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="173" end="196">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/elavon.rs" role="context" start="152" end="169">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/elavon.rs" role="context" start="116" end="130">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/taxjar.rs" role="context" start="126" end="126">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/taxjar.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/taxjar.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/iatapay.rs<|crate|> router<|connector|> iatapay anchor=payment_method_details kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/iatapay.rs" role="context" start="86" end="93">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
router_return_url: Some("https://hyperswitch.io".to_string()),
webhook_url: Some("https://hyperswitch.io".to_string()),
currency: enums::Currency::EUR,
..PaymentAuthorizeType::default().0
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/iatapay.rs" role="context" start="85" end="85">
use router::types::{self, api, storage::enums, AccessToken};
<file_sep path="hyperswitch/crates/router/tests/connectors/iatapay.rs" role="context" start="109" end="130">
async fn should_fail_for_refund_on_unsuccessed_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let refund_response = CONNECTOR
.refund_payment(
get_connector_transaction_id(response.response).unwrap(),
Some(types::RefundsData {
refund_amount: response.request.amount,
webhook_url: Some("https://hyperswitch.io".to_string()),
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap_err().code,
"BAD_REQUEST".to_string(),
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/iatapay.rs" role="context" start="99" end="105">
async fn should_only_create_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::AuthenticationPending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/iatapay.rs" role="context" start="57" end="84">
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::NL),
..Default::default()
}),
phone: Some(PhoneDetails {
number: Some(Secret::new("9123456789".to_string())),
country_code: Some("+91".to_string()),
}),
email: None,
}),
None,
None,
)),
access_token: get_access_token(),
..Default::default()
})
}
<file_sep path="hyperswitch/crates/router/tests/connectors/iatapay.rs" role="context" start="40" end="53">
fn get_access_token() -> Option<AccessToken> {
let connector = IatapayTest {};
match connector.get_auth_token() {
types::ConnectorAuthType::SignatureKey {
api_key,
key1: _,
api_secret: _,
} => Some(AccessToken {
token: api_key,
expires: 60 * 5,
}),
_ => None,
}
}
<file_sep path="hyperswitch/crates/router/tests/connectors/utils.rs" role="context" start="919" end="919">
pub struct PaymentAuthorizeType(pub types::PaymentsAuthorizeData);
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/fiservemea.rs<|crate|> router<|connector|> fiservemea anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/fiservemea.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/fiservemea.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/fiservemea.rs" role="context" start="42" end="44">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/placetopay.rs<|crate|> router<|connector|> placetopay anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/placetopay.rs" role="context" start="126" end="126">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/placetopay.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/placetopay.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/bamboraapac.rs<|crate|> router<|connector|> bamboraapac anchor=should_refund_manually_captured_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="127" end="141">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/bamboraapac.rs" role="context" start="126" end="126">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="166" end="189">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/bamboraapac.rs" role="context" start="145" end="162">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/bamboraapac.rs" role="context" start="41" end="43">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/nexixpay.rs<|crate|> router<|connector|> nexixpay anchor=should_refund_manually_captured_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="128" end="142">
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
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/nexixpay.rs" role="context" start="127" end="127">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="167" end="190">
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
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/nexixpay.rs" role="context" start="146" end="163">
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/nexixpay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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/services/authentication/blacklist.rs<|crate|> router anchor=invalidate_role_cache kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="61" end="68">
async fn invalidate_role_cache(state: &SessionState, role_id: &str) -> RouterResult<()> {
let redis_conn = get_redis_connection(state)?;
redis_conn
.delete_key(&authz::get_cache_key_from_role_id(role_id).as_str().into())
.await
.map(|_| ())
.change_context(ApiErrorResponse::InternalServerError)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="60" end="60">
use crate::{
consts::{JWT_TOKEN_TIME_IN_SECS, ROLE_BLACKLIST_PREFIX, USER_BLACKLIST_PREFIX},
core::errors::{ApiErrorResponse, RouterResult},
routes::app::SessionStateInfo,
};
use crate::{
core::errors::{UserErrors, UserResult},
routes::SessionState,
services::authorization as authz,
};
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="85" end="98">
pub async fn check_role_in_blacklist<A: SessionStateInfo>(
state: &A,
role_id: &str,
token_expiry: u64,
) -> RouterResult<bool> {
let token = format!("{}{}", ROLE_BLACKLIST_PREFIX, role_id);
let token_issued_at = expiry_to_i64(token_expiry - JWT_TOKEN_TIME_IN_SECS)?;
let redis_conn = get_redis_connection(state)?;
redis_conn
.get_key::<Option<i64>>(&token.as_str().into())
.await
.change_context(ApiErrorResponse::InternalServerError)
.map(|timestamp| timestamp > Some(token_issued_at))
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="70" end="83">
pub async fn check_user_in_blacklist<A: SessionStateInfo>(
state: &A,
user_id: &str,
token_expiry: u64,
) -> RouterResult<bool> {
let token = format!("{}{}", USER_BLACKLIST_PREFIX, user_id);
let token_issued_at = expiry_to_i64(token_expiry - JWT_TOKEN_TIME_IN_SECS)?;
let redis_conn = get_redis_connection(state)?;
redis_conn
.get_key::<Option<i64>>(&token.as_str().into())
.await
.change_context(ApiErrorResponse::InternalServerError)
.map(|timestamp| timestamp > Some(token_issued_at))
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="42" end="58">
pub async fn insert_role_in_blacklist(state: &SessionState, role_id: &str) -> UserResult<()> {
let role_blacklist_key = format!("{}{}", ROLE_BLACKLIST_PREFIX, role_id);
let expiry =
expiry_to_i64(JWT_TOKEN_TIME_IN_SECS).change_context(UserErrors::InternalServerError)?;
let redis_conn = get_redis_connection(state).change_context(UserErrors::InternalServerError)?;
redis_conn
.set_key_with_expiry(
&role_blacklist_key.as_str().into(),
date_time::now_unix_timestamp(),
expiry,
)
.await
.change_context(UserErrors::InternalServerError)?;
invalidate_role_cache(state, role_id)
.await
.change_context(UserErrors::InternalServerError)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="26" end="39">
pub async fn insert_user_in_blacklist(state: &SessionState, user_id: &str) -> UserResult<()> {
let user_blacklist_key = format!("{}{}", USER_BLACKLIST_PREFIX, user_id);
let expiry =
expiry_to_i64(JWT_TOKEN_TIME_IN_SECS).change_context(UserErrors::InternalServerError)?;
let redis_conn = get_redis_connection(state).change_context(UserErrors::InternalServerError)?;
redis_conn
.set_key_with_expiry(
&user_blacklist_key.as_str().into(),
date_time::now_unix_timestamp(),
expiry,
)
.await
.change_context(UserErrors::InternalServerError)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="127" end="133">
fn get_redis_connection<A: SessionStateInfo>(state: &A) -> RouterResult<Arc<RedisConnectionPool>> {
state
.store()
.get_redis_conn()
.change_context(ApiErrorResponse::InternalServerError)
.attach_printable("Failed to get redis connection")
}
<file_sep path="hyperswitch/crates/router/src/core/errors.rs" role="context" start="31" end="31">
pub type RouterResult<T> = CustomResult<T, ApiErrorResponse>;
<file_sep path="hyperswitch/crates/api_models/src/errors/types.rs" role="context" start="86" end="100">
pub enum ApiErrorResponse {
Unauthorized(ApiError),
ForbiddenCommonResource(ApiError),
ForbiddenPrivateResource(ApiError),
Conflict(ApiError),
Gone(ApiError),
Unprocessable(ApiError),
InternalServerError(ApiError),
NotImplemented(ApiError),
ConnectorError(ApiError, #[serde(skip_serializing)] StatusCode),
NotFound(ApiError),
MethodNotAllowed(ApiError),
BadRequest(ApiError),
DomainError(ApiError),
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/services/authentication/blacklist.rs<|crate|> router anchor=check_in_blacklist kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="148" end="156">
async fn check_in_blacklist<A>(&self, state: &A) -> RouterResult<bool>
where
A: SessionStateInfo + Sync,
{
Ok(
check_user_in_blacklist(state, &self.user_id, self.exp).await?
|| check_role_in_blacklist(state, &self.role_id, self.exp).await?,
)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="147" end="147">
use crate::{
consts::{JWT_TOKEN_TIME_IN_SECS, ROLE_BLACKLIST_PREFIX, USER_BLACKLIST_PREFIX},
core::errors::{ApiErrorResponse, RouterResult},
routes::app::SessionStateInfo,
};
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="173" end="178">
async fn check_in_blacklist<A>(&self, state: &A) -> RouterResult<bool>
where
A: SessionStateInfo + Sync,
{
check_user_in_blacklist(state, &self.user_id, self.exp).await
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="162" end="167">
async fn check_in_blacklist<A>(&self, state: &A) -> RouterResult<bool>
where
A: SessionStateInfo + Sync,
{
check_user_in_blacklist(state, &self.user_id, self.exp).await
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="135" end="137">
fn expiry_to_i64(expiry: u64) -> RouterResult<i64> {
i64::try_from(expiry).change_context(ApiErrorResponse::InternalServerError)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="127" end="133">
fn get_redis_connection<A: SessionStateInfo>(state: &A) -> RouterResult<Arc<RedisConnectionPool>> {
state
.store()
.get_redis_conn()
.change_context(ApiErrorResponse::InternalServerError)
.attach_printable("Failed to get redis connection")
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="85" end="98">
pub async fn check_role_in_blacklist<A: SessionStateInfo>(
state: &A,
role_id: &str,
token_expiry: u64,
) -> RouterResult<bool> {
let token = format!("{}{}", ROLE_BLACKLIST_PREFIX, role_id);
let token_issued_at = expiry_to_i64(token_expiry - JWT_TOKEN_TIME_IN_SECS)?;
let redis_conn = get_redis_connection(state)?;
redis_conn
.get_key::<Option<i64>>(&token.as_str().into())
.await
.change_context(ApiErrorResponse::InternalServerError)
.map(|timestamp| timestamp > Some(token_issued_at))
}
<file_sep path="hyperswitch/crates/router/src/services/authentication/blacklist.rs" role="context" start="70" end="83">
pub async fn check_user_in_blacklist<A: SessionStateInfo>(
state: &A,
user_id: &str,
token_expiry: u64,
) -> RouterResult<bool> {
let token = format!("{}{}", USER_BLACKLIST_PREFIX, user_id);
let token_issued_at = expiry_to_i64(token_expiry - JWT_TOKEN_TIME_IN_SECS)?;
let redis_conn = get_redis_connection(state)?;
redis_conn
.get_key::<Option<i64>>(&token.as_str().into())
.await
.change_context(ApiErrorResponse::InternalServerError)
.map(|timestamp| timestamp > Some(token_issued_at))
}
<file_sep path="hyperswitch/crates/router/src/core/errors.rs" role="context" start="31" end="31">
pub type RouterResult<T> = CustomResult<T, ApiErrorResponse>;
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/services/api/client.rs<|crate|> router anchor=get_base_client kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/services/api/client.rs" role="context" start="58" end="67">
fn get_base_client(proxy_config: &Proxy) -> CustomResult<reqwest::Client, ApiClientError> {
Ok(DEFAULT_CLIENT
.get_or_try_init(|| {
get_client_builder(proxy_config)?
.build()
.change_context(ApiClientError::ClientConstructionFailed)
.attach_printable("Failed to construct base client")
})?
.clone())
}
<file_sep path="hyperswitch/crates/router/src/services/api/client.rs" role="context" start="57" end="57">
use reqwest::multipart::Form;
use crate::{
configs::settings::Proxy,
consts::BASE64_ENGINE,
core::errors::{ApiClientError, CustomResult},
routes::SessionState,
};
<file_sep path="hyperswitch/crates/router/src/services/api/client.rs" role="context" start="101" end="122">
pub fn create_identity_from_certificate_and_key(
encoded_certificate: masking::Secret<String>,
encoded_certificate_key: masking::Secret<String>,
) -> Result<reqwest::Identity, error_stack::Report<ApiClientError>> {
let decoded_certificate = BASE64_ENGINE
.decode(encoded_certificate.expose())
.change_context(ApiClientError::CertificateDecodeFailed)?;
let decoded_certificate_key = BASE64_ENGINE
.decode(encoded_certificate_key.expose())
.change_context(ApiClientError::CertificateDecodeFailed)?;
let certificate = String::from_utf8(decoded_certificate)
.change_context(ApiClientError::CertificateDecodeFailed)?;
let certificate_key = String::from_utf8(decoded_certificate_key)
.change_context(ApiClientError::CertificateDecodeFailed)?;
let key_chain = format!("{}{}", certificate_key, certificate);
reqwest::Identity::from_pem(key_chain.as_bytes())
.change_context(ApiClientError::CertificateDecodeFailed)
}
<file_sep path="hyperswitch/crates/router/src/services/api/client.rs" role="context" start="71" end="99">
pub fn create_client(
proxy_config: &Proxy,
client_certificate: Option<masking::Secret<String>>,
client_certificate_key: Option<masking::Secret<String>>,
) -> CustomResult<reqwest::Client, ApiClientError> {
match (client_certificate, client_certificate_key) {
(Some(encoded_certificate), Some(encoded_certificate_key)) => {
let client_builder = get_client_builder(proxy_config)?;
let identity = create_identity_from_certificate_and_key(
encoded_certificate.clone(),
encoded_certificate_key,
)?;
let certificate_list = create_certificate(encoded_certificate)?;
let client_builder = certificate_list
.into_iter()
.fold(client_builder, |client_builder, certificate| {
client_builder.add_root_certificate(certificate)
});
client_builder
.identity(identity)
.use_rustls_tls()
.build()
.change_context(ApiClientError::ClientConstructionFailed)
.attach_printable("Failed to construct client with certificate and certificate key")
}
_ => get_base_client(proxy_config),
}
}
<file_sep path="hyperswitch/crates/router/src/services/api/client.rs" role="context" start="21" end="56">
fn get_client_builder(
proxy_config: &Proxy,
) -> CustomResult<reqwest::ClientBuilder, ApiClientError> {
let mut client_builder = reqwest::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.pool_idle_timeout(Duration::from_secs(
proxy_config
.idle_pool_connection_timeout
.unwrap_or_default(),
));
let proxy_exclusion_config =
reqwest::NoProxy::from_string(&proxy_config.bypass_proxy_hosts.clone().unwrap_or_default());
// Proxy all HTTPS traffic through the configured HTTPS proxy
if let Some(url) = proxy_config.https_url.as_ref() {
client_builder = client_builder.proxy(
reqwest::Proxy::https(url)
.change_context(ApiClientError::InvalidProxyConfiguration)
.attach_printable("HTTPS proxy configuration error")?
.no_proxy(proxy_exclusion_config.clone()),
);
}
// Proxy all HTTP traffic through the configured HTTP proxy
if let Some(url) = proxy_config.http_url.as_ref() {
client_builder = client_builder.proxy(
reqwest::Proxy::http(url)
.change_context(ApiClientError::InvalidProxyConfiguration)
.attach_printable("HTTP proxy configuration error")?
.no_proxy(proxy_exclusion_config),
);
}
Ok(client_builder)
}
<file_sep path="hyperswitch/crates/router/src/configs/settings.rs" role="context" start="743" end="748">
pub struct Proxy {
pub http_url: Option<String>,
pub https_url: Option<String>,
pub idle_pool_connection_timeout: Option<u64>,
pub bypass_proxy_hosts: Option<String>,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/cybersource.rs<|crate|> router<|connector|> cybersource anchor=should_refund_succeeded_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="266" end="280">
async fn should_refund_succeeded_payment() {
let connector = Cybersource {};
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::Pending,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="265" end="265">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="299" end="316">
async fn should_partially_refund_succeeded_payment() {
let connector = Cybersource {};
let refund_response = connector
.make_payment_and_refund(
get_default_payment_authorize_data(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Pending,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="283" end="297">
async fn should_refund_manually_captured_payment() {
let connector = Cybersource {};
let response = connector
.auth_capture_and_refund(
get_default_payment_authorize_data(),
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Pending,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="252" end="264">
async fn should_fail_capture_for_invalid_payment() {
let connector = Cybersource {};
let response = connector
.capture_payment("12345".to_string(), None, get_default_payment_info())
.await
.unwrap();
let err = response.response.unwrap_err();
assert_eq!(
err.message,
"Declined - One or more fields in the request contains invalid data"
);
assert_eq!(err.code, "InvalidData".to_string());
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="227" end="250">
async fn should_fail_void_payment_for_reversed_payment() {
let connector = Cybersource {};
// Authorize
let authorize_response = connector
.make_payment(
get_default_payment_authorize_data(),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
// Void
let void_response = connector
.void_payment("6736046645576085004953".to_string(), None, None)
.await
.unwrap();
let res = void_response.response.unwrap_err();
assert_eq!(
res.message,
"Decline - The authorization has already been reversed."
);
}
<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="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="12" end="12">
struct Cybersource;
<file_sep path="hyperswitch/crates/router/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/connector/dummyconnector.rs<|crate|> router anchor=get_request_body kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/connector/dummyconnector.rs" role="context" start="474" end="481">
fn get_request_body(
&self,
req: &types::RefundsRouterData<api::Execute>,
_connectors: &settings::Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = transformers::DummyConnectorRefundRequest::try_from(req)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
<file_sep path="hyperswitch/crates/router/src/connector/dummyconnector.rs" role="context" start="473" end="473">
use common_utils::{consts as common_consts, request::RequestContent};
use crate::{
configs::settings,
connector::utils as connector_utils,
core::errors::{self, CustomResult},
events::connector_api_logs::ConnectorEvent,
headers,
services::{
self,
request::{self, Mask},
ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,
},
types::{
self,
api::{self, ConnectorCommon, ConnectorCommonExt},
ErrorResponse, Response,
},
utils::BytesExt,
};
<file_sep path="hyperswitch/crates/router/src/connector/dummyconnector.rs" role="context" start="502" end="520">
fn handle_response(
&self,
data: &types::RefundsRouterData<api::Execute>,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
let response: transformers::RefundResponse = res
.response
.parse_struct("transformers RefundResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
<file_sep path="hyperswitch/crates/router/src/connector/dummyconnector.rs" role="context" start="483" end="500">
fn build_request(
&self,
req: &types::RefundsRouterData<api::Execute>,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
let request = services::RequestBuilder::new()
.method(services::Method::Post)
.url(&types::RefundExecuteType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundExecuteType::get_headers(
self, req, connectors,
)?)
.set_body(types::RefundExecuteType::get_request_body(
self, req, connectors,
)?)
.build();
Ok(Some(request))
}
<file_sep path="hyperswitch/crates/router/src/connector/dummyconnector.rs" role="context" start="462" end="472">
fn get_url(
&self,
req: &types::RefundsRouterData<api::Execute>,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}/{}/refund",
self.base_url(connectors),
req.request.connector_transaction_id
))
}
<file_sep path="hyperswitch/crates/router/src/connector/dummyconnector.rs" role="context" start="458" end="460">
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
<file_sep path="hyperswitch/crates/router/src/connector/dummyconnector.rs" role="context" start="231" end="251">
fn build_request(
&self,
req: &types::PaymentsAuthorizeRouterData,
connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
Ok(Some(
services::RequestBuilder::new()
.method(services::Method::Post)
.url(&types::PaymentsAuthorizeType::get_url(
self, req, connectors,
)?)
.attach_default_headers()
.headers(types::PaymentsAuthorizeType::get_headers(
self, req, connectors,
)?)
.set_body(types::PaymentsAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
<file_sep path="hyperswitch/crates/router/src/types.rs" role="context" start="160" end="160">
pub type RefundsRouterData<F> = RouterData<F, RefundsData, RefundsResponseData>;
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/cybersource.rs<|crate|> router<|connector|> cybersource anchor=should_refund_manually_captured_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="283" end="297">
async fn should_refund_manually_captured_payment() {
let connector = Cybersource {};
let response = connector
.auth_capture_and_refund(
get_default_payment_authorize_data(),
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Pending,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="282" end="282">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="320" end="337">
async fn should_partially_refund_manually_captured_payment() {
let connector = Cybersource {};
let response = connector
.auth_capture_and_refund(
get_default_payment_authorize_data(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Pending,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="299" end="316">
async fn should_partially_refund_succeeded_payment() {
let connector = Cybersource {};
let refund_response = connector
.make_payment_and_refund(
get_default_payment_authorize_data(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Pending,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="266" end="280">
async fn should_refund_succeeded_payment() {
let connector = Cybersource {};
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::Pending,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/cybersource.rs" role="context" start="252" end="264">
async fn should_fail_capture_for_invalid_payment() {
let connector = Cybersource {};
let response = connector
.capture_payment("12345".to_string(), None, get_default_payment_info())
.await
.unwrap();
let err = response.response.unwrap_err();
assert_eq!(
err.message,
"Declined - One or more fields in the request contains invalid data"
);
assert_eq!(err.code, "InvalidData".to_string());
}
<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="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="12" end="12">
struct Cybersource;
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/connector/utils.rs<|crate|> router anchor=get_header_field 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="2002" end="2014">
fn get_header_field(
field: Option<&http::HeaderValue>,
) -> CustomResult<&str, errors::ConnectorError> {
field
.map(|header_value| {
header_value
.to_str()
.change_context(errors::ConnectorError::WebhookSignatureNotFound)
})
.ok_or(report!(
errors::ConnectorError::WebhookSourceVerificationFailed
))?
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2001" end="2001">
use std::{
collections::{HashMap, HashSet},
str::FromStr,
};
use common_utils::{
date_time,
errors::{ParsingError, ReportSwitchExt},
ext_traits::StringExt,
id_type,
pii::{self, Email, IpAddress},
types::{AmountConvertor, MinorUnit},
};
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="2027" end="2031">
pub fn get_connector_meta(
connector_meta: Option<serde_json::Value>,
) -> Result<serde_json::Value, Error> {
connector_meta.ok_or_else(missing_field_err("connector_meta_data"))
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="2016" end="2025">
pub fn to_boolean(string: String) -> bool {
let str = string.as_str();
match str {
"true" => true,
"false" => false,
"yes" => true,
"no" => false,
_ => false,
}
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="1995" end="2000">
pub fn get_http_header<'a>(
key: &str,
headers: &'a http::HeaderMap,
) -> CustomResult<&'a str, errors::ConnectorError> {
get_header_field(headers.get(key))
}
<file_sep path="hyperswitch/crates/router/src/connector/utils.rs" role="context" start="1988" end="1993">
pub fn get_header_key_value<'a>(
key: &str,
headers: &'a actix_web::http::header::HeaderMap,
) -> CustomResult<&'a str, errors::ConnectorError> {
get_header_field(headers.get(key))
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/connector/netcetera.rs<|crate|> router anchor=build_endpoint 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="225" end="232">
fn build_endpoint(
base_url: &str,
connector_metadata: &Option<common_utils::pii::SecretSerdeValue>,
) -> CustomResult<String, errors::ConnectorError> {
let metadata = netcetera::NetceteraMetaData::try_from(connector_metadata)?;
let endpoint_prefix = metadata.endpoint_prefix;
Ok(base_url.replace("{{merchant_endpoint_prefix}}", &endpoint_prefix))
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="224" end="224">
use common_utils::{ext_traits::ByteSliceExt, request::RequestContent};
use transformers as netcetera;
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="255" end="257">
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="247" end="253">
fn get_headers(
&self,
req: &types::authentication::PreAuthNRouterData,
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="207" end="222">
fn get_external_authentication_details(
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<ExternalAuthenticationPayload, errors::ConnectorError> {
let webhook_body: netcetera::ResultsResponseData = request
.body
.parse_struct("netcetera ResultsResponseData")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(ExternalAuthenticationPayload {
trans_status: webhook_body
.trans_status
.unwrap_or(common_enums::TransactionStatus::InformationOnly),
authentication_value: webhook_body.authentication_value,
eci: webhook_body.eci,
})
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera.rs" role="context" start="196" end="205">
fn get_webhook_resource_object(
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
let webhook_body_value: netcetera::ResultsResponseData = request
.body
.parse_struct("netcetera ResultsResponseDatae")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(Box::new(webhook_body_value))
}
<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="259" end="266">
fn get_url(
&self,
req: &types::authentication::PreAuthNRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?;
Ok(format!("{}/3ds/versioning", base_url,))
}
<file_sep path="hyperswitch/crates/router/src/connector/netcetera/transformers.rs" role="context" start="261" end="269">
pub struct NetceteraMetaData {
pub mcc: Option<String>,
pub merchant_country_code: Option<String>,
pub merchant_name: Option<String>,
pub endpoint_prefix: String,
pub three_ds_requestor_name: Option<String>,
pub three_ds_requestor_id: Option<String>,
pub merchant_configuration_id: Option<String>,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/services/authentication/cookies.rs<|crate|> router anchor=create_cookie 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="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="64" end="64">
use cookie::Cookie;
use cookie::{
time::{Duration, OffsetDateTime},
SameSite,
};
use masking::{ExposeInterface, Secret};
use crate::{
consts::JWT_TOKEN_COOKIE_NAME,
core::errors::{ApiErrorResponse, RouterResult},
};
<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="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="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="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)))
}
<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)))
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/src/services/authentication.rs<|crate|> router anchor=is_ephemeral_auth kind=fn pack=symbol_neighborhood lang=rust role_window=k3 hops=1<|meta_end|>
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="3777" end="3787">
pub fn is_ephemeral_auth<A: SessionStateInfo + Sync + Send>(
headers: &HeaderMap,
) -> RouterResult<Box<dyn AuthenticateAndFetch<AuthenticationData, A>>> {
let api_key = get_api_key(headers)?;
if !api_key.starts_with("epk") {
Ok(Box::new(HeaderAuth(ApiKeyAuth)))
} else {
Ok(Box::new(EphemeralKeyAuth))
}
}
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="3776" end="3776">
use actix_web::http::header::HeaderMap;
use crate::{
core::{
api_keys,
errors::{self, utils::StorageErrorExt, RouterResult},
},
headers,
routes::app::SessionStateInfo,
services::api,
types::{domain, storage},
utils::OptionExt,
};
pub type AuthenticationDataWithUserId = (AuthenticationData, String);
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="3799" end="3810">
pub async fn decode_jwt<T>(token: &str, state: &impl SessionStateInfo) -> RouterResult<T>
where
T: serde::de::DeserializeOwned,
{
let conf = state.conf();
let secret = conf.secrets.get_inner().jwt_secret.peek().as_bytes();
let key = DecodingKey::from_secret(secret);
decode::<T>(token, &key, &Validation::new(Algorithm::HS256))
.map(|decoded| decoded.claims)
.change_context(errors::ApiErrorResponse::InvalidJwtToken)
}
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="3789" end="3797">
pub fn is_jwt_auth(headers: &HeaderMap) -> bool {
let header_map_struct = HeaderMapStruct::new(headers);
match header_map_struct.get_auth_string_from_header() {
Ok(auth_str) => auth_str.starts_with("Bearer"),
Err(_) => get_cookie_from_header(headers)
.and_then(cookies::get_jwt_from_cookies)
.is_ok(),
}
}
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="3744" end="3774">
pub async fn get_ephemeral_or_other_auth<T>(
headers: &HeaderMap,
is_merchant_flow: bool,
payload: Option<&impl ClientSecretFetch>,
) -> RouterResult<(
Box<dyn AuthenticateAndFetch<AuthenticationData, T>>,
api::AuthFlow,
bool,
)>
where
T: SessionStateInfo + Sync + Send,
ApiKeyAuth: AuthenticateAndFetch<AuthenticationData, T>,
PublishableKeyAuth: AuthenticateAndFetch<AuthenticationData, T>,
EphemeralKeyAuth: AuthenticateAndFetch<AuthenticationData, T>,
{
let api_key = get_api_key(headers)?;
if api_key.starts_with("epk") {
Ok((Box::new(EphemeralKeyAuth), api::AuthFlow::Client, true))
} else if is_merchant_flow {
Ok((
Box::new(HeaderAuth(ApiKeyAuth)),
api::AuthFlow::Merchant,
false,
))
} else {
let payload = payload.get_required_value("ClientSecretFetch")?;
let (auth, auth_flow) = check_client_secret_and_get_auth(headers, payload)?;
Ok((auth, auth_flow, false))
}
}
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="3709" end="3742">
pub fn check_client_secret_and_get_auth<T>(
headers: &HeaderMap,
payload: &impl ClientSecretFetch,
) -> RouterResult<(
Box<dyn AuthenticateAndFetch<AuthenticationData, T>>,
api::AuthFlow,
)>
where
T: SessionStateInfo + Sync + Send,
ApiKeyAuth: AuthenticateAndFetch<AuthenticationData, T>,
PublishableKeyAuth: AuthenticateAndFetch<AuthenticationData, T>,
{
let api_key = get_api_key(headers)?;
if api_key.starts_with("pk_") {
payload
.get_client_secret()
.check_value_present("client_secret")
.map_err(|_| errors::ApiErrorResponse::MissingRequiredField {
field_name: "client_secret",
})?;
return Ok((
Box::new(HeaderAuth(PublishableKeyAuth)),
api::AuthFlow::Client,
));
}
if payload.get_client_secret().is_some() {
return Err(errors::ApiErrorResponse::InvalidRequestData {
message: "client_secret is not a valid parameter".to_owned(),
}
.into());
}
Ok((Box::new(HeaderAuth(ApiKeyAuth)), api::AuthFlow::Merchant))
}
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="3812" end="3814">
pub fn get_api_key(headers: &HeaderMap) -> RouterResult<&str> {
get_header_value_by_key("api-key".into(), headers)?.get_required_value("api_key")
}
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="1506" end="1508">
pub fn new(headers: &'a HeaderMap) -> Self {
HeaderMapStruct { headers }
}
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="1772" end="1772">
pub struct EphemeralKeyAuth;
<file_sep path="hyperswitch/crates/router/src/services/authentication.rs" role="context" start="378" end="378">
pub struct HeaderAuth<I>(pub I);
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/bluesnap.rs<|crate|> router<|connector|> bluesnap anchor=should_partially_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="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="95" end="95">
use router::types::{self, domain, storage::enums, ConnectorAuthType, PaymentAddress};
<file_sep path="hyperswitch/crates/router/tests/connectors/bluesnap.rs" role="context" start="141" end="155">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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/crates/router/tests/connectors/utils.rs" role="context" start="920" end="920">
pub struct PaymentCaptureType(pub types::PaymentsCaptureData);
<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/wellsfargo.rs<|crate|> router<|connector|> wellsfargo anchor=should_partially_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="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="67" end="67">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/wellsfargo.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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/crates/router/tests/connectors/utils.rs" role="context" start="920" end="920">
pub struct PaymentCaptureType(pub types::PaymentsCaptureData);
<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/zsl.rs<|crate|> router<|connector|> zsl anchor=should_partially_capture_authorized_payment kind=fn pack=symbol_neighborhood lang=rust role_window=k2 hops=2<|meta_end|>
<file_sep path="hyperswitch/crates/router/tests/connectors/zsl.rs" role="context" start="46" end="59">
async fn should_partially_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(
payment_method_details(),
Some(types::PaymentsCaptureData {
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::AuthenticationPending);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/zsl.rs" role="context" start="45" end="45">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/zsl.rs" role="context" start="40" end="42">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/zsl.rs" role="context" start="36" end="38">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/utils.rs" role="context" start="920" end="920">
pub struct PaymentCaptureType(pub types::PaymentsCaptureData);
<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_partially_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="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="74" end="74">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/noon.rs" role="context" start="116" end="130">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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/crates/router/tests/connectors/utils.rs" role="context" start="920" end="920">
pub struct PaymentCaptureType(pub types::PaymentsCaptureData);
<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_partially_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="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="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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/crates/router/tests/connectors/utils.rs" role="context" start="920" end="920">
pub struct PaymentCaptureType(pub types::PaymentsCaptureData);
<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_partially_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="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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/amazonpay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_refund_succeeded_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="315" end="330">
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="314" end="314">
use common_utils::{pii::Email, types::MinorUnit};
use diesel_models::types::OrderDetailsWithAmount;
use router::types::{self, domain, storage::enums, PaymentAddress};
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="350" end="368">
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Refund Sync flow not supported by Payme connector",
);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="334" end="345">
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 100,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="302" end="311">
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), 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/payme.rs" role="context" start="275" end="298">
async fn should_sync_auto_captured_payment() {
let authorize_response = CONNECTOR
.make_payment(payment_method_details(), 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(),
),
capture_method: Some(enums::CaptureMethod::Automatic),
..Default::default()
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Charged,);
}
<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/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/src/connector/dummyconnector/transformers.rs" role="context" start="304" end="309">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
<file_sep path="hyperswitch/crates/api_models/src/refunds.rs" role="context" start="378" end="384">
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Pending,
Review,
}
|
symbol_neighborhood
|
<|meta_start|><|file|> hyperswitch/crates/router/tests/connectors/payme.rs<|crate|> router<|connector|> payme anchor=should_partially_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="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="133" end="133">
use common_utils::{pii::Email, types::MinorUnit};
use diesel_models::types::OrderDetailsWithAmount;
use router::types::{self, domain, storage::enums, PaymentAddress};
<file_sep path="hyperswitch/crates/router/tests/connectors/payme.rs" role="context" start="177" end="194">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Void flow not supported by Payme connector".to_string()
);
}
<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="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="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/crates/router/tests/connectors/utils.rs" role="context" start="920" end="920">
pub struct PaymentCaptureType(pub types::PaymentsCaptureData);
<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_partially_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="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="68" end="68">
use router::{
types::{self, api, storage::enums,
}};
<file_sep path="hyperswitch/crates/router/tests/connectors/xendit.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="67" end="67">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/boku.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/paystack.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/inespay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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_partially_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="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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/chargebee.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="74" end="74">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/juspaythreedsserver.rs" role="context" start="116" end="130">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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/datatrans.rs<|crate|> router<|connector|> datatrans anchor=should_partially_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="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="67" end="67">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/datatrans.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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_partially_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="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="66" end="66">
use router::types::{self, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/netcetera.rs" role="context" start="108" end="122">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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_partially_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="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="67" end="67">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/novalnet.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="67" end="67">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/prophetpay.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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/coingate.rs<|crate|> router<|connector|> coingate anchor=should_partially_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="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="67" end="67">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/coingate.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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_partially_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="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="74" end="74">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/jpmorgan.rs" role="context" start="116" end="130">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="44" end="46">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="67" end="67">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/paybox.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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/unified_authentication_service.rs<|crate|> router<|connector|> unified_authentication_service anchor=should_partially_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/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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/unified_authentication_service.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/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="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="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
}
<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_partially_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="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="70" end="70">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/dummyconnector.rs" role="context" start="112" end="126">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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/powertranz.rs<|crate|> router<|connector|> powertranz anchor=should_partially_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/powertranz.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/powertranz.rs" role="context" start="70" end="70">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/powertranz.rs" role="context" start="113" end="127">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/powertranz.rs" role="context" start="89" end="109">
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/powertranz.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/powertranz.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/powertranz.rs" role="context" start="43" end="45">
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
<file_sep path="hyperswitch/crates/router/tests/connectors/powertranz.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/razorpay.rs<|crate|> router<|connector|> razorpay anchor=should_partially_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="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="67" end="67">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/razorpay.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/deutschebank.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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_partially_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="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="72" end="72">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/opayo.rs" role="context" start="114" end="128">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="42" end="44">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/getnet.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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/facilitapay.rs<|crate|> router<|connector|> facilitapay anchor=should_partially_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/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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<file_sep path="hyperswitch/crates/router/tests/connectors/facilitapay.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/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="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="38" end="40">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="67" end="67">
use router::types::{self, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/volt.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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="37" end="39">
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
<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/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_partially_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="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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/fiuu.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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_partially_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="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="68" end="68">
use router::types::{self, api, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/hipay.rs" role="context" start="110" end="124">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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_partially_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="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="67" end="67">
use router::types::{self, api, domain, storage::enums};
<file_sep path="hyperswitch/crates/router/tests/connectors/itaubank.rs" role="context" start="109" end="123">
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
<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="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="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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.