feat(revenue_recovery): add support for updating additional card info data from csv to redis#9233
feat(revenue_recovery): add support for updating additional card info data from csv to redis#9233likhinbopanna merged 26 commits intomainfrom
Conversation
Changed Files
|
Removed commented-out code for updating Redis token and parsing card data.
|
Add support to update all possible values in redis , the ones that we internally compute as well. |
|
Why are we just updating if the fields are None . Why not update if we know some fields were inserted with wrong information. We should support both data_correction as well as Backfill. |
| } | ||
|
|
||
| #[derive(Debug, Clone, Serialize)] | ||
| pub enum BackfillError { |
There was a problem hiding this comment.
derive error On this and also move it to some other file
crates/router/src/types/storage/revenue_recovery_redis_operation.rs
Outdated
Show resolved
Hide resolved
crates/router/src/types/storage/revenue_recovery_redis_operation.rs
Outdated
Show resolved
Hide resolved
crates/router/src/types/storage/revenue_recovery_redis_operation.rs
Outdated
Show resolved
Hide resolved
crates/router/src/types/storage/revenue_recovery_redis_operation.rs
Outdated
Show resolved
Hide resolved
crates/router/src/types/storage/revenue_recovery_redis_operation.rs
Outdated
Show resolved
Hide resolved
| card_network: None, | ||
| card_issuer: None, | ||
| card_issuing_country: None, | ||
| daily_retry_history: None, |
There was a problem hiding this comment.
Are we not allowed to update these fields?
There was a problem hiding this comment.
this update is only a fallback when we get an error
| serde = { version = "1.0.219", features = ["derive"] } | ||
| serde_json = "1.0.140" | ||
| strum = { version = "0.26", features = ["derive"] } | ||
| tempfile = "3.8" |
There was a problem hiding this comment.
@AdityaKumaar21 Where are we using this dependency in this crate?
There was a problem hiding this comment.
we are using this in /api_models/src/revenue_recovery_data_backfill.rs ->
RevenueRecoveryDataBackfillForm (it handles large files)
Type of Change
Description
The format of csv:-



here
CustomerReq_IDis the customer token andTokenis the payment token which is used as an identifier in Redis for tokens, ("customer:{}:tokens", customer_id) is used to get token andTokenis used to find the field which we need to update.So, we are parsing the csv and getting the valid records and building a request per record
RevenueRecoveryBackfillRequest, from this request we are fetching the data like expiry month, year, card type, card issuer, card network, any of these fields arenull, we are updating them from the request.Complexity:-
for each valid record we are doing two Redis call, one for get and another for set.
Additional Changes
Motivation and Context
For Revenue recovery service, we are storing data in Redis with format
in last data migration
card_typewas populated asnull, but forSmartretry logic we need fields likecard_type,card_issuer,card_network.So, inorder to work with
Smartretry we need to backfillcard_typedata from merchant csv.How did you test it?
cURL:-
Router log:-

cURL with query param for updating scheduled at time
Router log:-

Redis-cli log(updating scheduledat to null if cut-off time is greater than scheduled at time):-

Checklist
cargo +nightly fmt --allcargo clippy