feat(payments_v2): payment intent diesel and domain models changes v2#5783
Conversation
| } | ||
|
|
||
| #[cfg(all(feature = "v2", feature = "payment_v2"))] | ||
| pub async fn find_optional_by_merchant_id_merchant_reference_id( |
There was a problem hiding this comment.
| pub async fn find_optional_by_merchant_id_merchant_reference_id( | |
| pub async fn find_optional_by_merchant_reference_id_merchant_id( |
| pub client_secret: Option<&'a String>, | ||
| pub active_attempt_id: String, | ||
| pub attempt_count: i16, | ||
| pub profile_id: Option<&'a id_type::ProfileId>, |
| vec![format!( | ||
| "pi_{}_{}", | ||
| self.merchant_id.get_string_repr(), | ||
| self.merchant_reference_id | ||
| )] |
There was a problem hiding this comment.
This is not required add a note to remove this, id itself will give us unique_constraints
| @@ -24,11 +23,7 @@ pub struct PaymentIntent { | |||
| pub description: Option<String>, | |||
| pub return_url: Option<String>, | |||
| pub metadata: Option<serde_json::Value>, | |||
There was a problem hiding this comment.
Use pii secret value for metadata
There was a problem hiding this comment.
Should we have all the serde json types as Strict types in diesel and domain models?
| @@ -24,11 +23,7 @@ pub struct PaymentIntent { | |||
| pub description: Option<String>, | |||
| pub return_url: Option<String>, | |||
There was a problem hiding this comment.
We can have url::Url type here for return_url
| pub payment_id: common_utils::id_type::PaymentId, | ||
| pub merchant_id: common_utils::id_type::MerchantId, | ||
| pub status: storage_enums::IntentStatus, | ||
| pub amount: MinorUnit, |
There was a problem hiding this comment.
- Make currency also as mandatory field
- Amount captured move to attempt instead of intent
| pub organization_id: common_utils::id_type::OrganizationId, | ||
| pub tax_details: Option<TaxDetails>, | ||
| pub skip_external_tax_calculation: Option<bool>, | ||
| pub merchant_reference_id: String, |
There was a problem hiding this comment.
Add todo to make this a domain type(PaymentMerchantReferenceId)
| pub surcharge_amount: Option<MinorUnit>, | ||
| pub tax_on_surcharge: Option<MinorUnit>, | ||
| // TODO: change this to global id | ||
| pub id: common_utils::id_type::PaymentId, |
There was a problem hiding this comment.
Fields needs to be added intent table
- routing_algorithm_id
- We include a field customer_present, which replaces off_session. Use Enum instead of a boolean
- apply_mit_exemption, type is boolean and default value is false
- introduce surcharge_details,
Struct SurchargeDetails {
surcharge_amount: MinorUnit,
tax_on_surcharge: Option<MinorUnit>
}
surcharge_details: Option<Surcharge_details>
| pub connector_id: Option<String>, | ||
| pub shipping_address_id: Option<String>, | ||
| pub billing_address_id: Option<String>, | ||
| pub statement_descriptor_name: Option<String>, |
There was a problem hiding this comment.
This field should be renamed to statement_descriptor but in database we won't rename instead we add new field
| pub business_country: Option<storage_enums::CountryAlpha2>, | ||
| pub business_label: Option<String>, | ||
| #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)] | ||
| pub order_details: Option<Vec<pii::SecretSerdeValue>>, |
There was a problem hiding this comment.
- Order details can be type instead of a SecretSerdeValue
- connector_metadata as SecretSerdeValue
- feature_metadata as SecretSerdeValue
- allowed_payment_method_types as SecretSerdeValue
- introduce a field called merchant_profile_id and make it mandatory
- introduce a field called payment_link_enabled
- introduce a field called payment_link_config and type as PaymentCreatePaymentLinkConfig
There was a problem hiding this comment.
what is merchant_profile_id we already have a field called profile_id
There was a problem hiding this comment.
introduce a field called payment_link_enabled
Instead of this field being called as payment_link_enabled, how about enable_payment_link since this captures the intent of the merchant.
| pub capture_method: Option<storage_enums::CaptureMethod>, | ||
| pub authentication_type: Option<common_enums::AuthenticationType>, | ||
| pub amount_to_capture: Option<MinorUnit>, | ||
| pub prerouting_algorithm: Option<serde_json::Value>, |
There was a problem hiding this comment.
Is prerouting required? and why this needs to a Value? where we are moving to a routing id based approach.
There was a problem hiding this comment.
Yes, we need this to store the pre routing results when payment methods list call is made
| pub shipping_address: Option<Encryption>, | ||
| pub capture_method: Option<storage_enums::CaptureMethod>, | ||
| pub authentication_type: Option<common_enums::AuthenticationType>, | ||
| pub amount_to_capture: Option<MinorUnit>, |
| @@ -39,40 +34,45 @@ pub struct PaymentIntent { | |||
| pub off_session: Option<bool>, | |||
There was a problem hiding this comment.
This off_session we shouldn't use, instead our logic will be based on apply_mit_exemption
|
All the comments will be addressed in the upcoming PR. We can get this PR merged as there are some dependencies |
apoorvdixit88
left a comment
There was a problem hiding this comment.
Dashboard specific changes look fine.
5e2fd7d
* 'main' of github.com:juspay/hyperswitch: (51 commits) feat(connector): [DEUTSCHEBANK] Integrate SEPA Payments (#5826) feat(payments_v2): payment intent diesel and domain models changes v2 (#5783) feat(connector): [Fiuu] ADD Wasm Configs (#5874) chore(version): 2024.09.13.0 refactor(core): Update shipping_cost and order_tax_amount to net_amount of payment_attempt (#5844) refactor: return optional request body from build_request_v2 in ConnectorIntegrationV2 trait (#5865) feat(refunds): Refunds aggregate api (#5795) refactor: handle redirections for iframed content (#5591) refactor(payment_links): Update API contract for dynamic transaction details and upgrade UI (#5849) fix(router): add payment_method check in `get_mandate_type` (#5828) fix(connector): [ZSL] compare consr_paid_amt with the total amount for identifying partial payments (#5873) feat(connector): [Novalnet] add Payment flows for cards (#5726) chore(version): 2024.09.12.0 fix(router): return `collect_billing_details_from_wallet_connector` if `always_collect_billing_details_from_wallet_connector ` is false in merchant payment method list (#5854) feat(opensearch): add profile_id and organization_id to /search APIs (#5705) build(deps): bump `sqlx` to `0.8.2` (#5859) refactor: Remove unwanted commented lines (#5851) feat(payments): add support for profile aggregates (#5845) Feat(connector): [Fiuu] Add DuitNow/FPX PaymentMethod (#5841) chore: remove Connectors enum dependency from ConnectorIntegrationV2 trait (#5840) ...
Type of Change
Description
This PR refactors the codebase to include all the payment related operations under the v1 feature flag.
This also includes changes to the payment intent diesel and domain models to add new fields that are relevant to the v2 version of application.
Additional Changes
Motivation and Context
How did you test it?
Checklist
cargo +nightly fmt --allcargo clippy