Skip to content

Commit c6fcf29

Browse files
chore(events): making events nanosecond level precision (#8759)
1 parent 640d055 commit c6fcf29

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

crates/router/src/services/kafka/dispute_event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ pub struct KafkaDisputeEvent<'a> {
2929
pub connector_created_at: Option<OffsetDateTime>,
3030
#[serde(default, with = "time::serde::timestamp::nanoseconds::option")]
3131
pub connector_updated_at: Option<OffsetDateTime>,
32-
#[serde(default, with = "time::serde::timestamp::nanoseconds")]
32+
#[serde(with = "time::serde::timestamp::nanoseconds")]
3333
pub created_at: OffsetDateTime,
34-
#[serde(default, with = "time::serde::timestamp::nanoseconds")]
34+
#[serde(with = "time::serde::timestamp::nanoseconds")]
3535
pub modified_at: OffsetDateTime,
3636
pub connector: &'a String,
3737
pub evidence: &'a Secret<serde_json::Value>,

crates/router/src/services/kafka/fraud_check_event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub struct KafkaFraudCheckEvent<'a> {
1111
pub payment_id: &'a common_utils::id_type::PaymentId,
1212
pub merchant_id: &'a common_utils::id_type::MerchantId,
1313
pub attempt_id: &'a String,
14-
#[serde(default, with = "time::serde::timestamp::milliseconds")]
14+
#[serde(with = "time::serde::timestamp::nanoseconds")]
1515
pub created_at: OffsetDateTime,
1616
pub frm_name: &'a String,
1717
pub frm_transaction_id: Option<&'a String>,
@@ -22,7 +22,7 @@ pub struct KafkaFraudCheckEvent<'a> {
2222
pub frm_error: Option<&'a String>,
2323
pub payment_details: Option<serde_json::Value>,
2424
pub metadata: Option<serde_json::Value>,
25-
#[serde(default, with = "time::serde::timestamp::milliseconds")]
25+
#[serde(with = "time::serde::timestamp::nanoseconds")]
2626
pub modified_at: OffsetDateTime,
2727
pub last_step: FraudCheckLastStep,
2828
pub payment_capture_method: Option<storage_enums::CaptureMethod>, // In postFrm, we are updating capture method from automatic to manual. To store the merchant actual capture method, we are storing the actual capture method in payment_capture_method. It will be useful while approving the FRM decision.

crates/router/src/services/kafka/payment_attempt_event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ pub struct KafkaPaymentAttemptEvent<'a> {
156156
pub payment_method: storage_enums::PaymentMethod,
157157
pub connector_transaction_id: Option<&'a String>,
158158
pub authentication_type: storage_enums::AuthenticationType,
159-
#[serde(with = "time::serde::timestamp")]
159+
#[serde(with = "time::serde::timestamp::nanoseconds")]
160160
pub created_at: OffsetDateTime,
161-
#[serde(with = "time::serde::timestamp")]
161+
#[serde(with = "time::serde::timestamp::nanoseconds")]
162162
pub modified_at: OffsetDateTime,
163-
#[serde(default, with = "time::serde::timestamp::option")]
163+
#[serde(default, with = "time::serde::timestamp::nanoseconds::option")]
164164
pub last_synced: Option<OffsetDateTime>,
165165
pub cancellation_reason: Option<&'a String>,
166166
pub amount_to_capture: Option<MinorUnit>,

crates/router/src/services/kafka/payment_intent_event.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ pub struct KafkaPaymentIntentEvent<'a> {
7474
pub return_url: Option<&'a common_types::Url>,
7575
pub metadata: Option<&'a Secret<Value>>,
7676
pub statement_descriptor: Option<&'a common_types::StatementDescriptor>,
77-
#[serde(with = "time::serde::timestamp")]
77+
#[serde(with = "time::serde::timestamp::nanoseconds")]
7878
pub created_at: OffsetDateTime,
79-
#[serde(with = "time::serde::timestamp")]
79+
#[serde(with = "time::serde::timestamp::nanoseconds")]
8080
pub modified_at: OffsetDateTime,
81-
#[serde(default, with = "time::serde::timestamp::option")]
81+
#[serde(default, with = "time::serde::timestamp::nanoseconds::option")]
8282
pub last_synced: Option<OffsetDateTime>,
8383
pub setup_future_usage: storage_enums::FutureUsage,
8484
pub off_session: bool,
@@ -97,7 +97,7 @@ pub struct KafkaPaymentIntentEvent<'a> {
9797
pub surcharge_applicable: Option<bool>,
9898
pub request_incremental_authorization: RequestIncrementalAuthorization,
9999
pub authorization_count: Option<i32>,
100-
#[serde(with = "time::serde::timestamp")]
100+
#[serde(with = "time::serde::timestamp::nanoseconds")]
101101
pub session_expiry: OffsetDateTime,
102102
pub request_external_three_ds_authentication: common_enums::External3dsAuthenticationRequest,
103103
pub frm_metadata: Option<Secret<&'a Value>>,

crates/router/src/services/kafka/refund_event.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ pub struct KafkaRefundEvent<'a> {
3131
pub sent_to_gateway: &'a bool,
3232
pub refund_error_message: Option<&'a String>,
3333
pub refund_arn: Option<&'a String>,
34-
#[serde(default, with = "time::serde::timestamp::nanoseconds")]
34+
#[serde(with = "time::serde::timestamp::nanoseconds")]
3535
pub created_at: OffsetDateTime,
36-
#[serde(default, with = "time::serde::timestamp::nanoseconds")]
36+
#[serde(with = "time::serde::timestamp::nanoseconds")]
3737
pub modified_at: OffsetDateTime,
3838
pub description: Option<&'a String>,
3939
pub attempt_id: &'a String,
@@ -95,9 +95,9 @@ pub struct KafkaRefundEvent<'a> {
9595
pub sent_to_gateway: &'a bool,
9696
pub refund_error_message: Option<&'a String>,
9797
pub refund_arn: Option<&'a String>,
98-
#[serde(default, with = "time::serde::timestamp")]
98+
#[serde(with = "time::serde::timestamp::nanoseconds")]
9999
pub created_at: OffsetDateTime,
100-
#[serde(default, with = "time::serde::timestamp")]
100+
#[serde(with = "time::serde::timestamp::nanoseconds")]
101101
pub modified_at: OffsetDateTime,
102102
pub description: Option<&'a String>,
103103
pub attempt_id: &'a id_type::GlobalAttemptId,

0 commit comments

Comments
 (0)