-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(connector): [BOA] Populate merchant_defined_information with metadata #3208
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
#[derive(Debug, Serialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct MerchantDefinedInformation { | ||
key: u64, |
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.
u8 is sufficient
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.
The function vector.length() return length as u64 and that is why I have mapped it this way. Should I change it?
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.
Why do you need vector.length(), you can declare a u8 variable initialize it to 1 and increment it while iterating through loop
fn foreign_from(metadata: Value) -> Self { | ||
let m: HashMap<String, Value> = | ||
serde_json::from_str(&metadata.to_string()).unwrap_or(HashMap::new()); | ||
let mut v: Self = Self::new(); |
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.
please use proper naming for the variable
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.
Done
let size = v.length() + 1; | ||
v.push(MerchantDefinedInformation { | ||
key: size, | ||
value: format!("{key} = {value}"), |
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.
Please use delimiter without space.
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.
Done
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.
one minor comment
Type of Change
Description
We need to populate the merchant_defined_information for each payment with data coming from merchant in payment requests metadata.
VAS PR: https://github.com/juspay/hyperswitch-cloud/pull/3715
Additional Changes
Motivation and Context
https://github.com/juspay/hyperswitch-cloud/issues/3713
How did you test it?
Testing can be done by creating a card/gpay/applepay payment and by passing the following metadata in PAYMENTS-CREATE:
"metadata": { "count_tickets": 1, "transaction_number": "5590043" }
You should then be able to see the metadata on BOA dashboard for that payment:

Checklist
cargo +nightly fmt --all
cargo clippy