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

refactor(connector): [Adyen] Change country and issuer type to Optional for OpenBankingUk #2993

Merged
merged 6 commits into from
Nov 30, 2023

Conversation

swangi-kumari
Copy link
Contributor

@swangi-kumari swangi-kumari commented Nov 28, 2023

Type of Change

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

Description

In OpenBankingUk, we had two fields issuer and country. But these fields are not required for all the connector, I came with connector Volt which don't need these fields in their request so I made these fields optional.

Additional Changes

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

Motivation and Context

How did you test it?

Using Postman

Test cases

Test Open_banking_ukfor Volt and Adyen Coonector.

Curl For Open Banking Uk for Adyen:
{ "amount": 6540, "currency": "GBP", "confirm": true, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": 6540, "customer_id": "StripeCustomer", "email": "[email protected]", "name": "John Doe", "phone": "999999999", "phone_country_code": "+1", "description": "Its my first payment request", "authentication_type": "no_three_ds", "return_url": "https://google.com/", "payment_method": "bank_redirect", "payment_method_type": "open_banking_uk", "payment_method_data": { "bank_redirect": { "open_banking_uk": { "issuer": "open_bank_success", "country": "GB" } } }, "billing": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "GB", "first_name": "joseph", "last_name": "Doe" }, "phone": { "number": "8056594427", "country_code": "+91" } }, "browser_info": { "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36", "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", "language": "nl-NL", "color_depth": 24, "screen_height": 723, "screen_width": 1536, "time_zone": 0, "java_enabled": true, "java_script_enabled": true, "ip_address": "127.0.0.1" }, "shipping": { "address": { "line1": "1467", "line2": "Harrison Street", "line3": "Harrison Street", "city": "San Fransico", "state": "California", "zip": "94122", "country": "GB", "first_name": "joseph", "last_name": "Doe" }, "phone": { "number": "8056594427", "country_code": "+91" } }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" } }

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

@swangi-kumari swangi-kumari added A-connector-integration Area: Connector integration C-refactor Category: Refactor labels Nov 28, 2023
@swangi-kumari swangi-kumari self-assigned this Nov 28, 2023
@swangi-kumari swangi-kumari marked this pull request as ready for review November 28, 2023 10:02
@swangi-kumari swangi-kumari requested review from a team as code owners November 28, 2023 10:02
api::enums::BankNames::TsbBank => Ok(Self::TsbBank),
api::enums::BankNames::TescoBank => Ok(Self::TescoBank),
api::enums::BankNames::UlsterBank => Ok(Self::UlsterBank),
Some(api::enums::BankNames::OpenBankSuccess) => Ok(Self::RedirectSuccess),
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's have validation for bank names before calling try_from

Some(api::enums::BankNames::Starling) => Ok(Self::Starling),
Some(api::enums::BankNames::TsbBank) => Ok(Self::TsbBank),
Some(api::enums::BankNames::TescoBank) => Ok(Self::TescoBank),
Some(api::enums::BankNames::UlsterBank) => Ok(Self::UlsterBank),
_ => 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 remove default case handling and cover all the cases

@@ -2622,7 +2622,7 @@ fn get_redirect_extra_details(
Some(country.to_owned()),
),
api_models::payments::BankRedirectData::OpenBankingUk { country, .. } => {
(None, Some(country.to_owned()))
(None, country.to_owned())
Copy link
Contributor

Choose a reason for hiding this comment

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

Since country is an optional field, can we have validation for country also

@swangi-kumari swangi-kumari linked an issue Nov 28, 2023 that may be closed by this pull request
2 tasks
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Nov 30, 2023
Merged via the queue into main with commit ab3dac7 Nov 30, 2023
10 of 12 checks passed
@Gnanasundari24 Gnanasundari24 deleted the volt-refactor branch November 30, 2023 07:07
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 C-refactor Category: Refactor
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

[REFACTOR]: Field Type for OpenBankingUk Payment Method
5 participants