-
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): [Square] change error message from NotSupported to NotImplemented #2875
refactor(connector): [Square] change error message from NotSupported to NotImplemented #2875
Conversation
Hey @nain-F49FF806 , Thanks for PR. |
@swangi-kumari Noted. Saw no one seemed assigned, so just went ahead to have a look at the code before making a comment. On a more fortunate note, I only laid eyes on this today, So hopefully not much time wasted. 🤞 Regards. |
Hey @nain-F49FF806 , |
Hey @nain-F49FF806 , |
81cc996
to
62db8fd
Compare
@swangi-kumari Have rebased onto the most recent |
…to NotImplemented Resolves juspay#2861
1f7be06
to
5b34b38
Compare
match bank_debit_data { | ||
BankDebitData::AchBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( | ||
"Payment Method".to_string(), | ||
utils::get_unimplemented_payment_method_error_message("Square"), | ||
)) | ||
.into_report(), | ||
|
||
BankDebitData::SepaBankDebit { .. } | ||
| BankDebitData::BecsBankDebit { .. } | ||
| BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotSupported { | ||
message: format!("{:?}", item.request.payment_method_data), | ||
connector: "Square", | ||
})?, | ||
| BankDebitData::BacsBankDebit { .. } => Err(errors::ConnectorError::NotImplemented( | ||
utils::get_unimplemented_payment_method_error_message("Square"), |
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 can club all the match arms
and propagate the expected common error.
Please use |
and throw the NotImplemented
error in the end. No need for it to be done twice
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 had assumed the two blocks were kept separate on purpose to have the AchBank
arm generate a report, and the others not.
On second look, it seems the conversion happens automatically for the others anyway, to keep the return type identical.
I shall club them all and also remove the .into_report
altogether. Let me know if that is not as intended.
…stman-runner * 'main' of github.com:juspay/hyperswitch: (22 commits) chore(version): 2024.02.28.0 chore(postman): update Postman collection files fix(connector): [AUTHORIZEDOTNET] Fix status mapping (#3845) refactor(router): added logs health and deep health (#3780) feat(roles): Change list roles, get role and authorization info api to respond with groups (#3837) fix(core): validate amount_to_capture in payment update (#3830) refactor(connector): [Square] change error message from NotSupported to NotImplemented (#2875) feat(router): add connector mit related columns to the payment methods table (#3764) ci(postman): refactor NMI postman collection (#3805) refactor(connector): [Braintree] Mask PII data (#3759) refactor(connector): [Forte] Mask PII data (#3824) refactor(compatibility): added compatibility layer request logs (#3774) refactor(payment_methods): introduce `locker_id` column in `payment_methods` table (#3760) feat(connector): mask pii information in connector request and response for stripe, aci, adyen, airwallex and authorizedotnet (#3678) chore(version): 2024.02.27.0 fix(core): do not construct request if it is already available (#3826) refactor: incorporate `hyperswitch_interface` into router (#3669) feat: add unique constraint restriction for KV (#3723) feat(connector): [Payme] Add Void flow to Payme (#3817) refactor(connector): [Cybersource] Mask PII data (#3786) ...
Type of Change
Description
Consistent error messages for not implemented payment method.
Motivation and Context
Resolves #2861
How did you test it?
payment connector create
create a payment which is not implemented
Payment create
Make any payment for Square for any PM which is not implemented, and see for the error message - it should be payment method not implemented
Checklist
cargo +nightly fmt --all
cargo clippy