-
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(core): Inclusion of constraint graph for merchant Payment Method list #4626
Conversation
…ac/cg_inclusion_pm
…erswitch into refac/cg_inclusion_pm
payment_attempt | ||
.and_then(|inner| inner.capture_method) | ||
.and_then(|capture_method| { | ||
(capture_method == common_enums::CaptureMethod::Manual).then(|| { | ||
context_values.push(dir::DirValue::CaptureMethod( | ||
common_enums::CaptureMethod::Manual, | ||
)); | ||
}) | ||
}); |
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.
Moreover will using then in above code will produce some latency or something. Just curious to know why it should be converted to an if.
Using functional style code like this is more appropriate when your code is supposed to return a value (that's what the function signatures of and_then()
and then()
denote. Here we're not returning a value, we're performing an action with side effects, which is non-functional i.e. imperative, hence an if
would be more suitable.
…actor * 'main' of github.com:juspay/hyperswitch: (39 commits) Fix(Cypress): Fixing 3DS payment failure in headless mode (#4807) feat(users): Add redis in Begin and Verify TOTP and create a new API that updates TOTP (#4765) refactor(connector): [Klarna] Refactor Authorize call and configs for prod (#4750) fix: implement StrongEq for Vec<u8> (#4795) refactor(core): move router data response and request models to hyperswitch domain models crate (#4789) chore(version): 2024.05.29.0 refactor: retrieve extended card info config during business profile get call (#4784) refactor(payment_methods): add support for passing ttl to locker entries (#4690) feat(connector): [CRYPTOPAY] Pass network details in payment request (#4779) fix: include client columns in payment attempts response struct (#4761) fix(docker-compose): fix docker compose syntax (#4782) feat(connector): [Iatapay] add upi qr support (#4728) docs(analytics): Add documentation for setting up data services and enabling data features in control center (#4741) chore(version): 2024.05.28.0 feat(connector): [AUTHORIZEDOTNET] Implement non-zero mandates (#4758) feat(core): [Paypal] Add session_token flow for Paypal sdk (#4697) chore(version): 2024.05.27.0 chore: add missing migrations for recently added currencies (#4760) Refactor(core): Inclusion of constraint graph for merchant Payment Method list (#4626) chore(version): 2024.05.24.1 ...
Type of Change
Description
Adds CGraphing for Merchant Pms with all the possible filters applicable as described below.
Addressed in this PR:
1 Creation of Constraint Graph for Merchant Payment Method List:
Created a Constraint Graph with the following filters/Nodes:
From configs and MCA:
From Req:
After Applying all these Filters and creating a Graph for a Merchant MCA with 2 PMT enabled (Credit and Debit) with one connector(Cybersource), We will get a graph equivalent to this
Henceforth, we will verify the constraints by constructing Context from our PaymentIntent and PaymentAttempt.
PM List for Merchant curl:
2 Moka Caching of Pm Filter Graph:
We have even implemented Moka(In memory) Cashing mechanism for our CGraph to minimize the latency. So for every request first the cache value will be checked if present, derived and used else CGraph will be constructed and the cache will be refreshed.
![Screenshot 2024-05-23 at 14 54 28](https://private-user-images.githubusercontent.com/61520228/333131735-ff29e436-743f-43ca-92fb-93447d9a48e9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNzYxNDAsIm5iZiI6MTczOTI3NTg0MCwicGF0aCI6Ii82MTUyMDIyOC8zMzMxMzE3MzUtZmYyOWU0MzYtNzQzZi00M2NhLTkyZmItOTM0NDdkOWE0OGU5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDEyMTA0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyMTdlZjNmNWJmYTQyNDJkNzk5MDJlYmYzMGUwMjRjYWM5YzdhNTQyNDU2ZGVlZTFmMDBiMjc0NmY0M2I0ZjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.TRvn_-1ya1ApSz7r7rqivcnwS2OPIbAFelw9IZZBVrU)
Additional Changes
Motivation and Context
How did you test it?
Testing requires creation/refactoring of our configs:
The configs followed are as follows:-
Flow followed
Request 1: mca create request (Cybersource)
Request 2: mca create request (Stripe)
Request 3: Payment Create Request (with
capture_method = manual
)Request 3: List Merchant Payment Methods
Response
Google pay won't come as we have added in configs allowed country as CN
Payment Type Card(Credit) also won't come as the configs for credit has
not_available_flows = manual
Checklist
cargo +nightly fmt --all
cargo clippy