Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
use common_enums::{BatchBlocklistJobStatus, BatchBlocklistJobType};
use common_utils::id_type;
use diesel::{
sql_types::Jsonb, AsChangeset, AsExpression, Identifiable, Insertable, Queryable, Selectable,
};
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use crate::schema::batch_blocklist_jobs;
#[derive(Clone, Debug, Identifiable, Queryable, Selectable, Deserialize, Serialize)]
#[diesel(table_name = batch_blocklist_jobs, primary_key(id), check_for_backend(diesel::pg::Pg))]
pub struct BatchBlocklistJob {
pub id: String,
pub merchant_id: id_type::MerchantId,
pub status: BatchBlocklistJobStatus,
pub total_rows: i32,
pub succeeded_rows: i32,
pub failed_rows: i32,
pub created_at: PrimitiveDateTime,
pub updated_at: PrimitiveDateTime,
pub profile_id: Option<id_type::ProfileId>,
// Absent on rows written before exports existed; those are uploads.
pub job_type: Option<BatchBlocklistJobType>,
/// The merchant's own filename for an upload, or the name an export downloads as.
pub file_name: Option<String>,
pub file_key: Option<String>,
pub error_message: Option<String>,
pub expires_at: Option<PrimitiveDateTime>,
pub metadata: Option<BlocklistProfileCloneJobMetadata>,
}
#[derive(Clone, Debug, Insertable, Deserialize, Serialize)]
#[diesel(table_name = batch_blocklist_jobs)]
pub struct BatchBlocklistJobNew {
pub id: String,
pub merchant_id: id_type::MerchantId,
pub status: BatchBlocklistJobStatus,
pub total_rows: i32,
pub succeeded_rows: i32,
pub failed_rows: i32,
pub created_at: PrimitiveDateTime,
pub updated_at: PrimitiveDateTime,
pub profile_id: id_type::ProfileId,
pub job_type: BatchBlocklistJobType,
pub file_name: Option<String>,
pub metadata: Option<BlocklistProfileCloneJobMetadata>,
}
#[derive(Clone, Debug, AsChangeset)]
#[diesel(table_name = batch_blocklist_jobs)]
pub struct BatchBlocklistJobUpdate {
pub status: Option<BatchBlocklistJobStatus>,
pub succeeded_rows: Option<i32>,
pub failed_rows: Option<i32>,
pub total_rows: Option<i32>,
pub file_key: Option<String>,
pub error_message: Option<String>,
pub expires_at: Option<PrimitiveDateTime>,
pub metadata: Option<BlocklistProfileCloneJobMetadata>,
pub updated_at: PrimitiveDateTime,
}
/// Job-level progress for a multi-target profile clone, one entry per target. The generic row
/// counters on the job stay at zero.
#[derive(Clone, Debug, Deserialize, Serialize, AsExpression)]
#[diesel(sql_type = Jsonb)]
pub struct BlocklistProfileCloneJobMetadata {
pub targets: Vec<BlocklistProfileCloneTargetMetadata>,
}
common_utils::impl_to_sql_from_sql_json!(BlocklistProfileCloneJobMetadata);
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BlocklistProfileCloneTargetMetadata {
pub profile_id: id_type::ProfileId,
pub status: BatchBlocklistJobStatus,
pub processed_rows: i32,
pub error_message: Option<String>,
}