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(payout): [Payone] add payone connector #4553
base: main
Are you sure you want to change the base?
Conversation
Required CI checks are failing, could you address that |
59714bb
to
4a9d2b1
Compare
crates/router/src/connector/utils.rs
Outdated
@@ -1096,6 +1096,7 @@ pub trait CardData { | |||
fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String>; | |||
fn get_expiry_year_4_digit(&self) -> Secret<String>; | |||
fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, errors::ConnectorError>; | |||
fn get_expiry_date_as_mmyy(&self) -> Result<Secret<String>, errors::ConnectorError>; |
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.
No need of this util, you can use this function get_card_expiry_month_year_2_digit_with_delimiter
crates/router/src/core/admin.rs
Outdated
api_enums::Connector::Payone => { | ||
payone::transformers::PayoneAuthType::try_from(val)?; | ||
Ok(()) | ||
} |
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 place this in alphabetical order
connector: Box::new(&Payone), | ||
connector_name: types::Connector::Adyen, |
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 suppose you need to change the name to Payone
connector: Box::new(&Payone), | |
connector_name: types::Connector::Adyen, | |
connector: Box::new(&Payone), | |
connector_name: types::Connector::Payone, |
@@ -282,6 +285,7 @@ impl ConnectorConfig { | |||
Connector::Noon => Ok(connector_data.noon), | |||
Connector::Nuvei => Ok(connector_data.nuvei), | |||
Connector::Payme => Ok(connector_data.payme), | |||
Connector::Payone => Err("Use get_payout_connector_config".to_string()), |
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.
What is the difference between Ebanx
and Payone
? why are we throwing error here?
pub fn get_current_date_time() -> CustomResult<String, errors::ConnectorError> { | ||
let format = format_description::parse( | ||
"[weekday repr:short], [day] [month repr:short] [year] [hour]:[minute]:[second] GMT", | ||
) | ||
.change_context(errors::ConnectorError::InvalidDateFormat)?; | ||
OffsetDateTime::now_utc() | ||
.format(&format) | ||
.change_context(errors::ConnectorError::InvalidDateFormat) | ||
} |
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 create the utils function in an generalized manner so that the format can be passed as an argument. @KiranKBR
currency_code: item.router_data.request.destination_currency.to_string(), | ||
}; | ||
let _card_issuer = | ||
CardAndCardIssuer::try_from(&item.router_data.get_payout_method_data()?)?; |
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 try_from
is not required rather add a match on payment_method_data
and then impl a try_from
to return the whole Object card_payout_method_specific_input
|
||
let card_payout_method_specific_input: CardPayoutMethodSpecificInput = | ||
CardPayoutMethodSpecificInput { | ||
#[allow(clippy::as_conversions)] |
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 is this lint added?
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.
For CI checks
match issuer { | ||
CardIssuer::Master => Ok(Self::MasterCard), | ||
CardIssuer::Visa => Ok(Self::Visa), | ||
_ => Err(errors::ConnectorError::NotImplemented( | ||
get_unimplemented_payment_method_error_message("payone"), | ||
) | ||
.into()), | ||
} | ||
} | ||
} |
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 not covering all the card issuer networks?
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.
Those are not implemented
}), | ||
..item.data | ||
}) | ||
#[allow(dead_code)] |
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 dead_code
?
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.
Also Serialize
is not required in the derives as this is response.
Please take care of this at all the applicable places
PayoneStatus::RejectedCredit | PayoneStatus::Rejected => Self::Cancelled, | ||
PayoneStatus::Cancelled | PayoneStatus::Reversed => Self::Cancelled, |
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.
PayoneStatus::RejectedCredit | PayoneStatus::Rejected => Self::Cancelled, | |
PayoneStatus::Cancelled | PayoneStatus::Reversed => Self::Cancelled, | |
PayoneStatus::RejectedCredit | PayoneStatus::Rejected | | |
PayoneStatus::Cancelled | PayoneStatus::Reversed => Self::Cancelled, |
9b1bf75
to
4707994
Compare
f55467d
to
f314bea
Compare
195e1c4
to
5bced6f
Compare
bdd0ba5
to
3f722ef
Compare
message: errors | ||
.iter() | ||
.map(|error| format!("{} : {}", error.code, error.message)) | ||
.collect::<Vec<_>>() |
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.
Define the type of the vector
errors | ||
.iter() | ||
.map(|error| format!("{} : {}", error.code, error.message)) | ||
.collect::<Vec<_>>() |
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.
Define the type of the vector
let code = first_error.map(|error| error.code.clone()); | ||
Ok(ErrorResponse { | ||
status_code: res.status_code, | ||
code: code.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()), |
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.
Discuss with @sai-harsha-vardhan , how retries work, and then decide how the error_code should be populated
_ => Err(errors::ConnectorError::NotImplemented( | ||
get_unimplemented_payment_method_error_message("Payone"), | ||
))?, | ||
} |
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.
Remove this default
}, | ||
PayoutMethodData::Bank(_) | PayoutMethodData::Wallet(_) => { | ||
Err(errors::ConnectorError::NotImplemented( | ||
get_unimplemented_payment_method_error_message("Payout"), |
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.
get_unimplemented_payment_method_error_message("Payout"), | |
get_unimplemented_payment_method_error_message("Payone"), |
1e02c9f
to
ce8e06f
Compare
…one-payout-flows
Type of Change
Description
Payone is Payout connector and I have implemented payout fulfill flow
How did you test it?
I tested them through postman and here these are the requests and responses
Merchant Connector:
response:
Payout Creation:
response:
Additional Changes
Motivation and Context
4902
Checklist
cargo +nightly fmt --all
cargo clippy