-
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(router): add network transaction id support for mit payments #6245
Conversation
@@ -1821,16 +1825,60 @@ pub async fn retrieve_card_with_permanent_token( | |||
})?; | |||
|
|||
if !business_profile.is_network_tokenization_enabled { |
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.
in profile
if the is_network_tokenization_enabled
is false then only the if block will get executed.
Is the below implementation of network_tokenization is in right place?
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.
in
profile
if theis_network_tokenization_enabled
is false then only the if block will get executed.Is the below implementation of network_tokenization is in right place?
Yes, it is in the right place.
This change is required when we do the MIT with the card details stored in locker and network transaction id stored in the payment methods table (it will be populated in the mandate_reference_id
). So in this case the card details retrieved from locker should be used to construct CardDetailsForNetworkTransactionId
as we will not have cvc.
crates/router/src/core/utils.rs
Outdated
@@ -1510,6 +1510,45 @@ pub fn get_incremental_authorization_allowed_value( | |||
} | |||
} | |||
|
|||
pub trait GetPaymentMethodDataForNetworkTransactionId { |
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.
We don't need trait if this function is not polymorphic, instead move this function to impl block of api_models::mandates::RecurringDetails
crates/router/src/core/payments.rs
Outdated
|
||
let cloned_payment_data = payment_data.clone(); | ||
|
||
crate::utils::trigger_payments_webhook( |
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.
crate::utils::trigger_payments_webhook( | |
utils::trigger_payments_webhook( |
crates/router/src/core/payments.rs
Outdated
)); | ||
|
||
// Construct routing data using the selected connector information, which will be set in the payment attempt. | ||
let routing_data = storage::RoutingData { |
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.
Is setting this data in attempt is really needed? because we are storing the necessary information in attempt directly and why another source of truth is required?
crates/router/src/core/payments.rs
Outdated
Ok(mit_first_connector.clone()) | ||
} | ||
|
||
pub async fn filter_eligible_connectors<F, D>( |
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.
function name can be better, this is more generic and what underlying functionality is not expressed fully
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.
Routing related changes seems fine!
Type of Change
Description
Support needs to be added in order to accept the card details and network transaction id in
recurring_details
for an MIT. This will be only in the Sever-to-Server call where the customer is off_session and merchant is initiating the transaction who is a PCI entity and has stored his customer card details and network transaction id.Support needs to be added to accept card details and the network transaction ID in
recurring_details
for a Merchant Initiated Transaction (MIT). This will only apply to the Server-to-Server call, where the customer is off-session, and the merchant, as a PCI entity, initiates the transaction using stored customer card details and the network transaction ID.As in this case we are not creating customer or any payment method entries in hyperswitch we have separate
proxy_for_payments_operation_core
to decouple this flow from the actual payments flow.Additional Changes
Motivation and Context
How did you test it?
-> Create the cybersource connector
-> Make a payment
-> make an off_session payment
-> Recurring payment with
payment_method_id
-> Create payment with recurring details
"type": "network_transaction_id_and_card_details"
-> Retrieve the payment
Test PG_agnostic mandates
-> Create a connector and enable
is_connector_agnostic_mit_enabled
-> Create a off_session payment
-> Using the above payment method id make a recurring payment with other connector
Ran cybersource test cases locally. There are some know test case that have failed.
Checklist
cargo +nightly fmt --all
cargo clippy