-
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
refactor(router): store network_transaction_id
for off_session
payments irrespective of the is_connector_agnostic_mit_enabled
config
#7083
Conversation
Changed Files
|
…d/store-id-everytime
let network_transaction_id = | ||
let network_transaction_id = if payment_data.payment_intent.setup_future_usage | ||
== Some(diesel_models::enums::FutureUsage::OffSession) | ||
{ | ||
if let Some(network_transaction_id) = pm_resp_network_transaction_id { |
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.
what is the purpose of this if let? Just for logger this can be achieved via an if statement as well
…d/store-id-everytime
…yperswitch into ntid/store-id-everytime
529b534
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.
cypress tests lgtm, but not that i think about it, i would suggest you run tests for ntid flow against: cybersource, stripe, at least.
and we disabled stripe few mins back.
cypress-tests/cypress/e2e/spec/Payment/00024-ConnectorAgnosticNTID.cy.js
Show resolved
Hide resolved
cypress-tests/cypress/e2e/spec/Payment/00024-ConnectorAgnosticNTID.cy.js
Show resolved
Hide resolved
cypress-tests/cypress/e2e/spec/Payment/00024-ConnectorAgnosticNTID.cy.js
Show resolved
Hide resolved
…NTID.cy.js Co-authored-by: Pa1NarK <[email protected]>
…NTID.cy.js Co-authored-by: Pa1NarK <[email protected]>
…NTID.cy.js Co-authored-by: Pa1NarK <[email protected]>
…NTID.cy.js Co-authored-by: Pa1NarK <[email protected]>
…unt-configurable * 'main' of github.com:juspay/hyperswitch: (37 commits) refactor(router): add display_name field to connector feature api (#7121) ci(cypress): Add Tests for Customer Deletion and Psync flows (#7158) feat(connector): [DataTrans] ADD 3DS Flow (#6026) chore(version): 2025.02.07.0 chore(connectors): [fiuu] update pm_filters for apple pay and google pay (#7182) feat(router): add `organization_id` in authentication table and add it in authentication events (#7168) fix(dashboard_metadata): mask `poc_email` and `data_value` for DashboardMetadata (#7130) feat(core): Add support for v2 payments get intent using merchant reference id (#7123) refactor(customer): return redacted customer instead of error (#7122) fix(connector): handle unexpected error response from bluesnap connector (#7120) feat(routing): Contract based routing integration (#6761) refactor(dynamic_fields): dynamic fields for Adyen and Stripe, renaming klarnaCheckout, WASM for KlarnaCheckout (#7015) feat(connector): [COINGATE] Add Template PR (#7052) chore(roles): remove redundant variant from PermissionGroup (#6985) refactor(router): store `network_transaction_id` for `off_session` payments irrespective of the `is_connector_agnostic_mit_enabled` config (#7083) chore(connector): [Fiuu] log keys in the PSync response (#7189) ci(cypress): fix nmi and paypal (#7173) chore(version): 2025.02.06.0 chore(postman): update Postman collection files feat(connector): [Deutschebank] Add Access Token Error struct (#7127) ...
Type of Change
Description
Currently, we store the
network_transaction_id
for the setup_mandate/off_session payments only if theis_connector_agnostic_mit_enabled
config is enabled. During the MITs, we refer to this flag to decide whether to use theconnector_mandate_id
or thenetwork_transaction_id
for the MIT.Instead of using the flag for multiple purposes, it should be used solely to determine whether to use the
connector_mandate_id
or thenetwork_transaction_id
for the MIT. Therefore, this change will ensure that thenetwork_transaction_id
is always stored for off-session payments if it is present in the connector response.Additional Changes
Motivation and Context
Instead of using the
is_connector_agnostic_mit_enabled
flag for multiple purposes, it should be used solely to determine whether to use theconnector_mandate_id
or thenetwork_transaction_id
for the MIT. And is the connector is returning thenetwork_transaction_id
for theoff_session
payment it should always be stored.How did you test it?
-> Create a business profile and
is_connector_agnostic_mit_enabled
disabled.Initial CIT
-> Make an off_session payment. Even though the
is_connector_agnostic_mit_enabled
is falsenetwork_transaction_id
should be stored in the payment methods table.-> Db screenshot shown
![image](https://private-user-images.githubusercontent.com/83439957/405486386-a108e721-41ce-46e5-a0dc-0a327a812742.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTMyMTEsIm5iZiI6MTczOTA1MjkxMSwicGF0aCI6Ii84MzQzOTk1Ny80MDU0ODYzODYtYTEwOGU3MjEtNDFjZS00NmU1LWEwZGMtMGEzMjdhODEyNzQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyMTUxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVmNjQ5NDg4YWQ1MWNiNTgzMGMyZGI5MGZkMzY4MzNlMGJiOGU1ZmY3NGQyZWIxMWFhYWMyZDA1YjJjMjg4MTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.AAWj7lXLJzjdDKKfO6xYoYguqe_Rq_gFrMJ9Q2a8yKk)
network_transaction_id
being stored in the payment methods table.Recurring MIT
-> Create a payment for the same customer with confirm false
-> List payment methods using the above client_secret
-> Confirm the payment with the above listed token. Even though
network_transaction_id
is present, as theis_connector_agnostic_mit_enabled
is false the MIT should be processed by usingconnector_mandate_id
.-> Logs showing
![image](https://private-user-images.githubusercontent.com/83439957/405488124-7ec05d70-a8a7-416f-9792-f875c0c689eb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTMyMTEsIm5iZiI6MTczOTA1MjkxMSwicGF0aCI6Ii84MzQzOTk1Ny80MDU0ODgxMjQtN2VjMDVkNzAtYThhNy00MTZmLTk3OTItZjg3NWMwYzY4OWViLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyMTUxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJiMzdiNDI3NzhmZTA3YTIxMDk0YzlhYTA4ODgyNTQ5NWY3MWM0NWY1NDcyNGM2NjVlMTY4OWU0NGI1MTdjNmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.l8tg9VQQQsaaIaRGmrIPe1toWzGxjLytTLwHX4rh6so)
connector_mandate_id
is used for the MITRecurring MIT by passing different connector in the routing.
-> Create a
network_transaction_id
support connector (stripe, adyen or cybersource)-> Create a payment for the same customer
-> List payment methods using the above client_secret
-> Confirm the payment by pass the newly configured connector (the connector that was not used in the initially CIT). Even though cybersource was sent in the routing input, the payment was processed with stripe as the
is_connector_agnostic_mit_enabled
is false andconnector_mandate_id
that is present is of stripe.-> Log showing routing order is
![image](https://private-user-images.githubusercontent.com/83439957/405490004-e4fdde89-891c-4c15-83fd-d428e029bb29.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTMyMTEsIm5iZiI6MTczOTA1MjkxMSwicGF0aCI6Ii84MzQzOTk1Ny80MDU0OTAwMDQtZTRmZGRlODktODkxYy00YzE1LTgzZmQtZDQyOGUwMjliYjI5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyMTUxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM4OWJlNDg0NDRlODZjZjBlNWNhZTI2NDNmYWU5YzE0NTNmM2E2YmFlY2QxZWYxYzhkNjgxOGU5NGMxYTk5ZmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ivP9xefnt1oALTGEauHocabzL8Xi3vs24__h5v83kOA)
[Cybersource, Stripe]
andconnector_mandate_id
was used to process the MITNTID cypress test for stripe
![image](https://private-user-images.githubusercontent.com/83439957/409580190-30ada514-d65a-4302-9c79-df0426e48622.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTMyMTEsIm5iZiI6MTczOTA1MjkxMSwicGF0aCI6Ii84MzQzOTk1Ny80MDk1ODAxOTAtMzBhZGE1MTQtZDY1YS00MzAyLTljNzktZGYwNDI2ZTQ4NjIyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyMTUxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlhMjRjNTE4MTgzMDczOGRjMGE5MGFkMTVhOTUwZTY5YjllZTZlNzllOTUxM2JlMTYzNWFkZDFiYzBmZTFiMjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.GxOxjOuDVsrSdk2kjONlJCxXI9z7xdixi4od3lDxqpA)
![image](https://private-user-images.githubusercontent.com/83439957/409580207-ed17de24-643c-44d7-b6de-6e2ae6e09ed0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTMyMTEsIm5iZiI6MTczOTA1MjkxMSwicGF0aCI6Ii84MzQzOTk1Ny80MDk1ODAyMDctZWQxN2RlMjQtNjQzYy00NGQ3LWI2ZGUtNmUyYWU2ZTA5ZWQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyMTUxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYwOGU3YTI4YjljMzNjZjIwODA5YjU3M2E1NGM3NzljM2YzZTQ4NDU2MGNiYjhkNGE0MTY1OTQxYTdhMmRhYzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.8wxNpzVMygyTBJB6CMzBFqi6qKIwIzjgmYWMXBcbXUg)
NTID cypress test for cybersource
![image](https://private-user-images.githubusercontent.com/83439957/409581039-f36d444a-8123-4577-a0e8-df9dc7762c89.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTMyMTEsIm5iZiI6MTczOTA1MjkxMSwicGF0aCI6Ii84MzQzOTk1Ny80MDk1ODEwMzktZjM2ZDQ0NGEtODEyMy00NTc3LWEwZTgtZGY5ZGM3NzYyYzg5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyMTUxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU2ZjAyZjIwYTE3OWI3MjJkOWYxMWVlNzViYmNjN2U5OGNkYjVjYzc0MTdhZmNhNzliMzUzNmIwNzFlZDI3NWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.g5Nrs3hnQSS78C4ebWiTTjAeisti89-QgLOMGeDOTGQ)
![image](https://private-user-images.githubusercontent.com/83439957/409581145-51568fcd-ccb3-424d-b11f-9d4db468bb39.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTMyMTEsIm5iZiI6MTczOTA1MjkxMSwicGF0aCI6Ii84MzQzOTk1Ny80MDk1ODExNDUtNTE1NjhmY2QtY2NiMy00MjRkLWIxMWYtOWQ0ZGI0NjhiYjM5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIyMTUxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQwZWM2M2ZkMzViYzM0NDIzNGNlNmY1Yjg1NTUwYjkxMmNhNzViNTdmYzEzNzliNWRkOTUyNDNlYzNlODkxZjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.kIspGSZEk5bWqOA4NawteA9R5WlVOu9Uxwha66w87x4)
Checklist
cargo +nightly fmt --all
cargo clippy