-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(core): Add support for v2 payments get intent using merchant reference id #7123
Conversation
Changed Files
|
merchant_reference_id: &common_utils::id_type::PaymentReferenceId, | ||
profile_id: &common_utils::id_type::ProfileId, | ||
) -> StorageResult<Self> { | ||
generics::generic_find_one::<<Self as HasTable>::Table, _, _>( |
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.
can you check if we have this unique index or not?
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 have unique index on merchant_reference_id & profile id in intent table. We can only get unique intent entry by implementing look up table.
cc : @jarnura
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 a distributed setup we will be having many partition, to access data efficiently we need partition_key
. For payments
partition_key is payment_intent global-id
. So to get the partition_key, we need to create a reverse_lookup
table which map merchant_reference_id+profile
to payment_intent global-id
. A constraint based mechanism will be implemented on those tables.
merchant_reference_id: &common_utils::id_type::PaymentReferenceId, | ||
profile_id: &common_utils::id_type::ProfileId, | ||
) -> StorageResult<Self> { | ||
generics::generic_find_one::<<Self as HasTable>::Table, _, _>( |
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 a distributed setup we will be having many partition, to access data efficiently we need partition_key
. For payments
partition_key is payment_intent global-id
. So to get the partition_key, we need to create a reverse_lookup
table which map merchant_reference_id+profile
to payment_intent global-id
. A constraint based mechanism will be implemented on those tables.
crates/router/src/routes/app.rs
Outdated
@@ -555,6 +555,11 @@ impl Payments { | |||
web::resource("/create-intent").route(web::post().to(payments::payments_create_intent)), | |||
); | |||
|
|||
route = route.service( | |||
web::resource("/merchant-reference-id/{merchant_reference_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.
web::resource("/merchant-reference-id/{merchant_reference_id}") | |
web::resource("/ref/{merchant_reference_id}") |
d16f521
…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
This PR adds support for payments get intent in v2 using merchant reference id.
Note : In a distributed setup we will be having many partition, to access data efficiently we need
partition_key
. For payments partition_key ispayment_intent global-id
. So to get the partition_key, we need to create areverse_lookup
table which mapmerchant_reference_id+profile
topayment_intent global-id
. A constraint based mechanism will be implemented on those tables.Additional Changes
Motivation and Context
How did you test it?
Test case 1:
request :
response
Test case 2 :
Invalid merchant reference id
response
Checklist
cargo +nightly fmt --all
cargo clippy