-
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(connector): [AUTHORIZEDOTNET] Add metadata information to connector request #7011
base: main
Are you sure you want to change the base?
Conversation
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.
nit : should we use Btree's here @deepanshu-iiitu?
impl ForeignFrom<Value> for Vec<UserField> { | ||
fn foreign_from(metadata: Value) -> Self { | ||
let hashmap: BTreeMap<String, Value> = | ||
serde_json::from_str(&metadata.to_string()).unwrap_or(BTreeMap::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.
Instead of using unwrap_or
and handling this with a default value throw a deserialization error.
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.
I have resolved it
type Error = error_stack::Report<errors::ConnectorError>; | ||
fn foreign_try_from(metadata: Value) -> Result<Self, Self::Error> { | ||
let hashmap: BTreeMap<String, Value> = serde_json::from_str(&metadata.to_string()) | ||
.change_context(errors::ConnectorError::ResponseDeserializationFailed) |
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 are we throwing ResponseDeserializationFailed
error here?
Lets use RequestEncodingFailedWithReason
error
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.
Thanks, I have resolved it.
Type of Change
Description
This PR is for code changes which sends the metadata passed in payment intent create to authorizedotnet as request payload, as per merchant requirements.
The merchant receives a receipt of the transaction through email, which contains the metadata passed by the merchant in payment intent create request.
Additional Changes
Motivation and Context
All flows have been tested as per the authorizedotnet developer docs:
https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card
How did you test it?
Postman Tests
1. Authorize (Manual)
2. Capture (Manual)
3. Authorize + Capture
4. PSync
5. Refund
6. RSync
7. Cancel/Void
Checklist
cargo +nightly fmt --all
cargo clippy