-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(router): Add support for Proxy api #7901
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
Conversation
crates/api_models/src/proxy.rs
Outdated
#[derive(Debug, ToSchema, Clone, Deserialize, Serialize)] | ||
pub enum TokenType { | ||
TokenizationId, | ||
PaymentMethodId |
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.
When would we use PaymentMethodId here?
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 ll be using payment method sdk to collect payment method data from customer, then will be stored in payment method table, now merchant can use payment method id for proxy
crates/router/src/core/proxy.rs
Outdated
.map(|pos| start + pos + 2) | ||
.unwrap_or(result.len()); | ||
|
||
if let Ok((_, token_ref)) = parse_token(&result[start..end]) { |
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.
instead of slicing, can use get methods to avoid any kind of panics?
crates/router/src/core/proxy.rs
Outdated
|
||
while result.contains("{{") && result.contains("}}") { | ||
let start = result.find("{{").unwrap(); | ||
let end = result[start..] |
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.
Could we try to use nom parser for multi token parsing logic as well somehow instead of manual parsing?
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.
yeah, will be taking this multi token parsing in following pr, for now, reverted back these changes
crates/router/src/core/proxy.rs
Outdated
|
||
Ok(Value::Object(new_obj)) | ||
} | ||
Value::String(s) => (!utils::contains_token(&s)) |
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.
This can't determine if token is present deterministically, can't be throwing error if parse_token fails
7238311
d1f2cb7
Type of Chantge
Description
The Proxy allows you to use tokens with HTTP APIs without needing to access sensitive data directly within your systems. This enables solving both these problems securely while keeping your systems out of compliance scope.
proxy takes any connector request, replaces the token with payment method data from locker.
the field and its literal should be of this format -
"number": "{{$card_number}}",
card_number
is the key stored in vault against actual card number valueAdditional Changes
Motivation and Context
How did you test it?
Create a payment method
response -
Checklist
cargo +nightly fmt --all
cargo clippy