-
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): [FISERV, HELCIM] Add amount conversion framework to Fiserv, Helcim #7336
base: main
Are you sure you want to change the base?
Conversation
Changed Files
|
|
||
impl Fiserv { | ||
pub fn new() -> &'static Self { | ||
&Self { | ||
amount_converter: &MinorUnitForConnector, |
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.
amount_converter: &MinorUnitForConnector, | |
amount_converter: &FloatMajorUnitForConnector, |
According to the doc, the amount accepted by the connector is in FloatMajorUnit
. Please make the necessary changes accordingly at all relevant places for the Fiserv connector.
@@ -23,22 +23,14 @@ use crate::{ | |||
|
|||
#[derive(Debug, Serialize)] | |||
pub struct FiservRouterData<T> { | |||
pub amount: String, | |||
pub amount: MinorUnit, |
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.
pub amount: MinorUnit, | |
pub amount: FloatMajorUnit, |
@@ -89,8 +81,7 @@ pub struct GooglePayToken { | |||
|
|||
#[derive(Default, Debug, Serialize)] | |||
pub struct Amount { | |||
#[serde(serialize_with = "utils::str_to_f32")] | |||
total: String, | |||
total: MinorUnit, |
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.
total: MinorUnit, | |
total: FloatMajorUnit, |
pub router_data: T, | ||
} | ||
|
||
impl<T> TryFrom<(&api::CurrencyUnit, enums::Currency, i64, T)> for FiservRouterData<T> { | ||
impl<T> TryFrom<(MinorUnit, T)> for FiservRouterData<T> { |
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.
impl<T> TryFrom<(MinorUnit, T)> for FiservRouterData<T> { | |
impl<T> TryFrom<(FloatMajorUnit, T)> for FiservRouterData<T> { |
Type of Change
Description
added FloatMajorUnit for amount conversion for Fiserv
added FloatMajorUnit for amount conversion for Helcim
Additional Changes
Motivation and Context
fixes #6256 and #6019
How did you test it?
Tested through postman:
request:
response: - The payment should be succeeded
response: - The payment should be succeeded
Checklist
cargo +nightly fmt --all
cargo clippy