Skip to content

Commit 2fac436

Browse files
fix(locker): handle card duplication in payouts flow (#4013)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
1 parent ca0aad3 commit 2fac436

File tree

3 files changed

+281
-107
lines changed

3 files changed

+281
-107
lines changed

crates/router/src/core/payment_methods/transformers.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ pub enum StoreLockerReq<'a> {
2727
LockerGeneric(StoreGenericReq<'a>),
2828
}
2929

30+
impl StoreLockerReq<'_> {
31+
pub fn update_requestor_card_reference(&mut self, card_reference: Option<String>) {
32+
match self {
33+
Self::LockerCard(c) => c.requestor_card_reference = card_reference,
34+
Self::LockerGeneric(_) => (),
35+
}
36+
}
37+
}
38+
3039
#[derive(Debug, Deserialize, Serialize)]
3140
pub struct StoreCardReq<'a> {
3241
pub merchant_id: &'a str,

crates/router/src/core/payouts.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,10 @@ pub async fn fulfill_payout(
14521452
.status
14531453
.unwrap_or(payout_attempt.status.to_owned());
14541454
payout_data.payouts.status = status;
1455-
if payout_data.payouts.recurring && payout_data.payouts.payout_method_id.is_none() {
1455+
if payout_data.payouts.recurring
1456+
&& payout_data.payouts.payout_method_id.is_none()
1457+
&& !helpers::is_payout_err_state(status)
1458+
{
14561459
helpers::save_payout_data_to_locker(
14571460
state,
14581461
payout_data,

0 commit comments

Comments
 (0)