mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
feat: ACH transfers (#905)
This commit is contained in:
committed by
GitHub
parent
39405bb478
commit
23bca66b81
@ -459,6 +459,7 @@ pub enum PaymentMethod {
|
||||
PayLater,
|
||||
Wallet,
|
||||
BankRedirect,
|
||||
BankTransfer,
|
||||
Crypto,
|
||||
BankDebit,
|
||||
}
|
||||
|
||||
@ -46,6 +46,7 @@ pub struct PaymentAttempt {
|
||||
pub payment_method_data: Option<serde_json::Value>,
|
||||
pub business_sub_label: Option<String>,
|
||||
pub straight_through_algorithm: Option<serde_json::Value>,
|
||||
pub preprocessing_step_id: Option<String>,
|
||||
// providing a location to store mandate details intermediately for transaction
|
||||
pub mandate_details: Option<storage_enums::MandateDataType>,
|
||||
}
|
||||
@ -93,6 +94,7 @@ pub struct PaymentAttemptNew {
|
||||
pub payment_method_data: Option<serde_json::Value>,
|
||||
pub business_sub_label: Option<String>,
|
||||
pub straight_through_algorithm: Option<serde_json::Value>,
|
||||
pub preprocessing_step_id: Option<String>,
|
||||
pub mandate_details: Option<storage_enums::MandateDataType>,
|
||||
}
|
||||
|
||||
@ -166,6 +168,12 @@ pub enum PaymentAttemptUpdate {
|
||||
error_code: Option<Option<String>>,
|
||||
error_message: Option<Option<String>>,
|
||||
},
|
||||
PreprocessingUpdate {
|
||||
status: storage_enums::AttemptStatus,
|
||||
payment_method_id: Option<Option<String>>,
|
||||
connector_metadata: Option<serde_json::Value>,
|
||||
preprocessing_step_id: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
|
||||
@ -192,6 +200,7 @@ pub struct PaymentAttemptUpdateInternal {
|
||||
payment_experience: Option<storage_enums::PaymentExperience>,
|
||||
business_sub_label: Option<String>,
|
||||
straight_through_algorithm: Option<serde_json::Value>,
|
||||
preprocessing_step_id: Option<String>,
|
||||
}
|
||||
|
||||
impl PaymentAttemptUpdate {
|
||||
@ -214,6 +223,10 @@ impl PaymentAttemptUpdate {
|
||||
browser_info: pa_update.browser_info.or(source.browser_info),
|
||||
modified_at: common_utils::date_time::now(),
|
||||
payment_token: pa_update.payment_token.or(source.payment_token),
|
||||
connector_metadata: pa_update.connector_metadata.or(source.connector_metadata),
|
||||
preprocessing_step_id: pa_update
|
||||
.preprocessing_step_id
|
||||
.or(source.preprocessing_step_id),
|
||||
..source
|
||||
}
|
||||
}
|
||||
@ -364,6 +377,19 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
||||
error_message,
|
||||
..Default::default()
|
||||
},
|
||||
PaymentAttemptUpdate::PreprocessingUpdate {
|
||||
status,
|
||||
payment_method_id,
|
||||
connector_metadata,
|
||||
preprocessing_step_id,
|
||||
} => Self {
|
||||
status: Some(status),
|
||||
payment_method_id,
|
||||
modified_at: Some(common_utils::date_time::now()),
|
||||
connector_metadata,
|
||||
preprocessing_step_id,
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,6 +142,21 @@ impl PaymentAttempt {
|
||||
.await
|
||||
}
|
||||
|
||||
#[instrument(skip(conn))]
|
||||
pub async fn find_by_merchant_id_preprocessing_id(
|
||||
conn: &PgPooledConn,
|
||||
merchant_id: &str,
|
||||
preprocessing_id: &str,
|
||||
) -> StorageResult<Self> {
|
||||
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
|
||||
conn,
|
||||
dsl::merchant_id
|
||||
.eq(merchant_id.to_owned())
|
||||
.and(dsl::preprocessing_step_id.eq(preprocessing_id.to_owned())),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[instrument(skip(conn))]
|
||||
pub async fn find_by_payment_id_merchant_id_attempt_id(
|
||||
conn: &PgPooledConn,
|
||||
|
||||
@ -321,6 +321,7 @@ diesel::table! {
|
||||
payment_method_data -> Nullable<Jsonb>,
|
||||
business_sub_label -> Nullable<Varchar>,
|
||||
straight_through_algorithm -> Nullable<Jsonb>,
|
||||
preprocessing_step_id -> Nullable<Varchar>,
|
||||
mandate_details -> Nullable<Jsonb>,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user