-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(mandate_kv): add kv support for mandate #4275
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
akshay-97
force-pushed
the
mandate_kv_support
branch
from
April 4, 2024 18:48
fa4d3ae
to
76c381c
Compare
dracarys18
requested changes
Apr 5, 2024
crates/diesel_models/src/mandate.rs
Outdated
Comment on lines
185
to
216
impl MandateNew { | ||
pub fn from_new(&self) -> Mandate { | ||
Mandate { | ||
id: 0i32, | ||
mandate_id: self.mandate_id.clone(), | ||
customer_id: self.customer_id.clone(), | ||
merchant_id: self.merchant_id.clone(), | ||
payment_method_id: self.payment_method_id.clone(), | ||
mandate_status: self.mandate_status.clone(), | ||
mandate_type: self.mandate_type.clone(), | ||
customer_accepted_at: self.customer_accepted_at.clone(), | ||
customer_ip_address: self.customer_ip_address.clone(), | ||
customer_user_agent: self.customer_user_agent.clone(), | ||
network_transaction_id: self.network_transaction_id.clone(), | ||
previous_attempt_id: self.previous_attempt_id.clone(), | ||
created_at: self | ||
.created_at | ||
.clone() | ||
.unwrap_or_else(common_utils::date_time::now), | ||
mandate_amount: self.mandate_amount.clone(), | ||
mandate_currency: self.mandate_currency.clone(), | ||
amount_captured: self.amount_captured.clone(), | ||
connector: self.connector.clone(), | ||
connector_mandate_id: self.connector_mandate_id.clone(), | ||
start_date: self.start_date.clone(), | ||
end_date: self.end_date.clone(), | ||
metadata: self.metadata.clone(), | ||
connector_mandate_ids: self.connector_mandate_ids.clone(), | ||
original_payment_id: self.original_payment_id.clone(), | ||
merchant_connector_id: self.merchant_connector_id.clone(), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use impl From<> here
Comment on lines
85
to
84
|
||
pub async fn update_by_merchant_id_mandate_id_drainer( | ||
conn: &PgPooledConn, | ||
merchant_id: &str, | ||
mandate_id: &str, | ||
mandate: MandateUpdateInternal, | ||
) -> StorageResult<Self> { | ||
generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>( | ||
conn, | ||
dsl::merchant_id | ||
.eq(merchant_id.to_owned()) | ||
.and(dsl::mandate_id.eq(mandate_id.to_owned())), | ||
mandate, | ||
) | ||
.await? | ||
.first() | ||
.cloned() | ||
.ok_or_else(|| { | ||
report!(errors::DatabaseError::NotFound) | ||
.attach_printable("Error while updating mandate") | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems redundant you can change the above function to accomodate this
akshay-97
force-pushed
the
mandate_kv_support
branch
from
April 5, 2024 10:24
7774146
to
0a76b82
Compare
akshay-97
force-pushed
the
mandate_kv_support
branch
from
April 10, 2024 15:15
26682d7
to
dffa098
Compare
akshay-97
changed the title
feat(mandate_kv) add kv support for mandate
enhancement(mandate_kv): add kv support for mandate
Apr 10, 2024
akshay-97
changed the title
enhancement(mandate_kv): add kv support for mandate
feat(mandate_kv): add kv support for mandate
Apr 10, 2024
jarnura
previously approved these changes
Apr 10, 2024
dracarys18
previously approved these changes
Apr 10, 2024
jarnura
approved these changes
Apr 12, 2024
dracarys18
approved these changes
Apr 12, 2024
14 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
Mandate table is being written to db in payment flow, this change moves all db writes and updates to kv
Additional Changes
Motivation and Context
Mandate table is being written to db in payment flow, this change moves all db writes and updates to kv
How did you test it?
sanity check on payment flow
test list:
Checklist
cargo +nightly fmt --all
cargo clippy