mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(payouts): add kafka events (#4264)
Co-authored-by: Ivor Dsouza <ivor.dsouza@juspay.in> Co-authored-by: ivor-juspay <138492857+ivor-juspay@users.noreply.github.com> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -40,12 +40,13 @@ impl<T: DatabaseStore> PayoutAttemptInterface for KVRouterStore<T> {
|
||||
async fn insert_payout_attempt(
|
||||
&self,
|
||||
new_payout_attempt: PayoutAttemptNew,
|
||||
payouts: &Payouts,
|
||||
storage_scheme: MerchantStorageScheme,
|
||||
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
|
||||
match storage_scheme {
|
||||
MerchantStorageScheme::PostgresOnly => {
|
||||
self.router_store
|
||||
.insert_payout_attempt(new_payout_attempt, storage_scheme)
|
||||
.insert_payout_attempt(new_payout_attempt, payouts, storage_scheme)
|
||||
.await
|
||||
}
|
||||
MerchantStorageScheme::RedisKv => {
|
||||
@ -129,12 +130,13 @@ impl<T: DatabaseStore> PayoutAttemptInterface for KVRouterStore<T> {
|
||||
&self,
|
||||
this: &PayoutAttempt,
|
||||
payout_update: PayoutAttemptUpdate,
|
||||
payouts: &Payouts,
|
||||
storage_scheme: MerchantStorageScheme,
|
||||
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
|
||||
match storage_scheme {
|
||||
MerchantStorageScheme::PostgresOnly => {
|
||||
self.router_store
|
||||
.update_payout_attempt(this, payout_update, storage_scheme)
|
||||
.update_payout_attempt(this, payout_update, payouts, storage_scheme)
|
||||
.await
|
||||
}
|
||||
MerchantStorageScheme::RedisKv => {
|
||||
@ -254,6 +256,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
|
||||
async fn insert_payout_attempt(
|
||||
&self,
|
||||
new: PayoutAttemptNew,
|
||||
_payouts: &Payouts,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
|
||||
let conn = pg_connection_write(self).await?;
|
||||
@ -272,6 +275,7 @@ impl<T: DatabaseStore> PayoutAttemptInterface for crate::RouterStore<T> {
|
||||
&self,
|
||||
this: &PayoutAttempt,
|
||||
payout: PayoutAttemptUpdate,
|
||||
_payouts: &Payouts,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
|
||||
let conn = pg_connection_write(self).await?;
|
||||
|
||||
@ -2,10 +2,13 @@
|
||||
use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl};
|
||||
use common_utils::ext_traits::Encode;
|
||||
#[cfg(feature = "olap")]
|
||||
use data_models::payouts::{payout_attempt::PayoutAttempt, PayoutFetchConstraints};
|
||||
use data_models::payouts::PayoutFetchConstraints;
|
||||
use data_models::{
|
||||
errors::StorageError,
|
||||
payouts::payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate},
|
||||
payouts::{
|
||||
payout_attempt::PayoutAttempt,
|
||||
payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate},
|
||||
},
|
||||
};
|
||||
#[cfg(feature = "olap")]
|
||||
use diesel::{associations::HasTable, ExpressionMethods, JoinOnDsl, QueryDsl};
|
||||
@ -115,12 +118,13 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
|
||||
&self,
|
||||
this: &Payouts,
|
||||
payout_update: PayoutsUpdate,
|
||||
payout_attempt: &PayoutAttempt,
|
||||
storage_scheme: MerchantStorageScheme,
|
||||
) -> error_stack::Result<Payouts, StorageError> {
|
||||
match storage_scheme {
|
||||
MerchantStorageScheme::PostgresOnly => {
|
||||
self.router_store
|
||||
.update_payout(this, payout_update, storage_scheme)
|
||||
.update_payout(this, payout_update, payout_attempt, storage_scheme)
|
||||
.await
|
||||
}
|
||||
MerchantStorageScheme::RedisKv => {
|
||||
@ -316,6 +320,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
|
||||
&self,
|
||||
this: &Payouts,
|
||||
payout: PayoutsUpdate,
|
||||
_payout_attempt: &PayoutAttempt,
|
||||
_storage_scheme: MerchantStorageScheme,
|
||||
) -> error_stack::Result<Payouts, StorageError> {
|
||||
let conn = pg_connection_write(self).await?;
|
||||
|
||||
Reference in New Issue
Block a user