Skip to content
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(connector): [Multisafepay] Add support for Ideal and Giropay #4398

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

TakshPanchal
Copy link

@TakshPanchal TakshPanchal commented Apr 19, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Add iDEAL and Giropay payment processors in Multisafepay connector.

Whole description can be found in #4143 discussion.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Solves the issue #4397

How did you test it?

I have tested the Multisafe payment connector for Giropay and iDeal methods in Postman suit. You can find my fork of Postman's collection below. In Payments - Create iDeal Payment and Payments - Create Giropay Direct in Quick Start are the requests for the payments.

iDeal

By requesting the iDeal payment method with "Ing" bank name, a redirection link can be found, redirecting to the test portal of Multisafepay, where we can see the bank name we selected.
image
image
Also, passing bank names not supported by iDeal raises an Error.
image

Not Passing the bank name in the payment_method_data returns an error, too.
image

Giropay

Giropay doesn't support the direct method, so it is not compulsory to enter bank_name into the payment_method_data. After a successful request to Multisafepay, We will get a redirection link to the Mutisafepay payment's page.
image

Mutisafepay payment page.
image

Run In Postman

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@TakshPanchal TakshPanchal requested review from a team as code owners April 19, 2024 08:53
Copy link
Contributor

@srujanchikke srujanchikke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TakshPanchal, Thanks for the PR! I have few comments, please resolve them. And also please make sure all CI checks are passed after you push final commit.

@@ -181,6 +185,46 @@ pub enum WalletInfo {
GooglePay(GpayInfo),
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these all derives required? If not please remove the redundant ones from all the enums and structs. #[derive(Debug, Serialize, Clone)] should work for requests and #[derive(Debug, Deserialize, Clone)] should work for response.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For BankRedirectInfo and IdealInfo, Eq and PartialEq will be used for comparing different bank's Info that is why Eq is needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please point to the code where you are comparing different bank's info?

BankNames::VanLanschot => Self("0161"),
BankNames::Yoursafe => Self("0806"),
BankNames::Handelsbanken => Self("1235"),
_ => Err(errors::ConnectorError::NotSupported {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use default here, rather mention all the enums. It will help us easily debug any issues when new enum is added.

api::PaymentMethodData::BankRedirect(ref bank_data) => match bank_data {
api::BankRedirectData::Giropay { .. } => Type::Redirect,
api::BankRedirectData::Ideal { .. } => Type::Direct,
_ => Err(errors::ConnectorError::NotImplemented(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, don't use defaults

api::PaymentMethodData::BankRedirect(ref bank_data) => Some(match bank_data {
api::BankRedirectData::Giropay { .. } => Gateway::Giropay,
api::BankRedirectData::Ideal { .. } => Gateway::Ideal,
_ => Err(errors::ConnectorError::NotImplemented(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines 574 to 575
field_name: "eps.bank_name",
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ideal.bank_name .

Comment on lines 2 to 9
AcceptanceType, Address, AddressDetails, Amount, AuthenticationForStartResponse,
BankRedirectData, Card, CryptoData, CustomerAcceptance, HeaderPayload, MandateAmountData,
MandateData, MandateTransactionType, MandateType, MandateValidationFields, NextActionType,
OnlineMandate, PayLaterData, PaymentIdType, PaymentListConstraints,
PaymentListFilterConstraints, PaymentListFilters, PaymentListResponse, PaymentListResponseV2,
PaymentMethodData, PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp,
PaymentRetrieveBody, PaymentRetrieveBodyWithCredentials, PaymentsApproveRequest,
PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this are format changes, please revert them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because I have imported BankRedirectData and Formatting is done after that. So it is just one addition of t he datatype here.

@srujanchikke srujanchikke added A-connector-integration Area: Connector integration S-waiting-on-author Status: This PR is incomplete or needs to address review comments hiring-challenge labels Apr 19, 2024
@srujanchikke
Copy link
Contributor

Hey @TakshPanchal, Your branch has conflicts. Please update it to main.

@TakshPanchal
Copy link
Author

TakshPanchal commented Apr 22, 2024

Hey @TakshPanchal, Your branch has conflicts. Please update it to main.

Yes, I am aware of that, working on it. Thank you.

@TakshPanchal TakshPanchal changed the title Add support for Ideal and Giropay bank redirect in Multisafepay conne… feat(connector): [Multisafepay] Add support for Ideal and Giropay Apr 22, 2024
@TakshPanchal
Copy link
Author

#4397 Linking the issue

@srujanchikke srujanchikke linked an issue Apr 22, 2024 that may be closed by this pull request
2 tasks
@TakshPanchal
Copy link
Author

I think I have to do some changes after resolving these merge conflicts. I will look into that.

@TakshPanchal
Copy link
Author

I have resolved the conflicts and ran clippy. At the end code is compiled and ran successfully.

Copy link
Contributor

@srujanchikke srujanchikke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TakshPanchal Apologies, I missed one review comment last time. Could you please resolve this?

pub issuer_id: Option<String>,
}

pub struct MultisafepayBankNames<'a>(&'a str);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you convert this to an enum. You can use serde rename here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed the change @srujanchikke

@SanchithHegde SanchithHegde added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels May 5, 2024
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Thanks for the PR, @TakshPanchal!

@srujanchikke
Copy link
Contributor

Hey @TakshPanchal , Could you please resolve the conflicts ?

Comment on lines +761 to +764
domain::BankRedirectData::Ideal {
billing_details: _,
bank_name,
country: _,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
domain::BankRedirectData::Ideal {
billing_details: _,
bank_name,
country: _,
domain::BankRedirectData::Ideal {
bank_name,
..

@@ -181,6 +185,46 @@ pub enum WalletInfo {
GooglePay(GpayInfo),
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please point to the code where you are comparing different bank's info?

Comment on lines +68 to +69
Ideal,
Giropay,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add Currency and Country configs for both Ideal and Giropay in config/development.toml, config/deployments/sandbox.toml, config/deployments/integration_test.toml, config/deployments/production.toml for Multisafepay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration hiring-challenge S-waiting-on-review Status: This PR has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Implementing iDEAL and Giropay payment methods with Multisafe
4 participants