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(pm_list): add required fields for giropay #3194

Merged
merged 42 commits into from
Feb 12, 2024

Conversation

AkshayaFoiger
Copy link
Contributor

@AkshayaFoiger AkshayaFoiger commented Dec 21, 2023

Type of Change

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

Description

Resolves #3622

Test Cases

  1. Create a giropay payment with mollie with empty payment method object. The payment should succeed.
{
  "amount": 1000,
  "currency": "EUR",
  "confirm": true,
  "capture_method": "automatic",
  "capture_on": "2022-09-10T10:11:12Z",
  "amount_to_capture": 1000,
  "customer_id": "StripeCustomer",
  "email": "[email protected]",
  "name": "John Doe",
  "phone": "999999999",
  "phone_country_code": "+65",
  "description": "Its my first payment request",
  "authentication_type": "three_ds",
  "return_url": "https://google.com",
  "statement_descriptor_name": "joseph",
  "statement_descriptor_suffix": "JS",
  "payment_method": "bank_redirect",
  "payment_method_type": "giropay",
  "payment_method_data": {
    "bank_redirect": {
      "giropay": {
      }
    }
  }
}

Must be tested for each of this connectors

1.ACI

Required fields: 
    payment_method_data.bank_redirect.giropay.country
  1. Adyen
None
  1. GlobalPayments
Required fields: 
    billing.address.country
  1. Mollie
None
  1. Nuvie
Required fields: 
     email
     billing.address.first_name
     billing.address.last_name
     billing.address.country
  1. Paypal
Required fields: 
     payment_method_data.bank_redirect.giropay.billing_details.billing_name
     payment_method_data.bank_redirect.giropay.country
  1. Shift4
None
  1. Stripe
Required fields 
     payment_method_data.bank_redirect.giropay.billing_details.billing_name
  1. Trustpay
Required fields: 
     billing.address.first_name
     billing.address.line1
     billing.address.city
     billing.address.zip
     billing.address.country

-> Create a payment with confirm false

-> list payment methods, with client secret and publishable key

curl --location 'http://localhost:8080/account/payment_methods?client_secret={{client_secret}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:{{api_key}}' \
--data ''

Required fields must be populated, according to the connector

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

@AkshayaFoiger AkshayaFoiger added A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement M-api-contract-changes Metadata: This PR involves API contract changes labels Dec 21, 2023
@AkshayaFoiger AkshayaFoiger self-assigned this Dec 21, 2023
@AkshayaFoiger AkshayaFoiger requested review from a team as code owners December 21, 2023 15:05
Comment on lines 1261 to 1269
billing_details: Option<BankRedirectBilling>,

/// The country for bank payment
#[schema(value_type = CountryAlpha2, example = "US")]
country: api_enums::CountryAlpha2,
country: Option<api_enums::CountryAlpha2>,

/// The preferred language
#[schema(example = "en")]
preferred_language: String,
preferred_language: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we have changes for Sofort pm type in this pr? I observed there was another PR for sofort, please undo these changes if not necessary

Copy link
Contributor Author

@AkshayaFoiger AkshayaFoiger Dec 31, 2023

Choose a reason for hiding this comment

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

Yes, there is another separate PR for Sofort. Sofort changes appeared in this branch as dynamic_field/giropay branch is built upon dynamic_field/sofort branch whilst the PR pointed to main.
Now Sofort changes are removed. Requesting your review

@AkshayaFoiger AkshayaFoiger changed the base branch from main to dynamic_field/sofort December 31, 2023 15:14
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "giropay.billing_details",
})?
.billing_name
Copy link
Contributor

Choose a reason for hiding this comment

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

is billing_name mandatory?
if yes, please use get_billing_name() method from utils to throw the error.

Comment on lines 1644 to 1648
country: country
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "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.

please add utils function get_billing_country for BankRedirectBilling and reuse this function in other places as well

.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "giropay.billing_details",
})?
.billing_name
Copy link
Contributor

Choose a reason for hiding this comment

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

please use the utils method - get_billing_name() here

@AkshayaFoiger AkshayaFoiger 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 Jan 18, 2024
@ArjunKarthik ArjunKarthik changed the base branch from dynamic_field/sofort to main January 24, 2024 10:23
@AkshayaFoiger AkshayaFoiger changed the base branch from main to dynamic_field/sofort January 29, 2024 07:38
Comment on lines +4507 to +4514
(
enums::Connector::Adyen,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
common: HashMap::new(),
}
),
Copy link
Contributor

Choose a reason for hiding this comment

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

if Adyen supports mandates, could you please confirm if this config is present in toml file?

[mandates.supported_payment_methods]
bank_redirect.giropay

Could you please check for other connectors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adyen supports mandates. I will add it to the config files

Copy link
Member

Choose a reason for hiding this comment

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

Also, make sure you update the env files which is located at https://github.com/juspay/hyperswitch/tree/main/config/deployments

@AkshayaFoiger AkshayaFoiger added S-waiting-on-author Status: This PR is incomplete or needs to address review comments and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jan 29, 2024
@AkshayaFoiger AkshayaFoiger 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 Jan 30, 2024
Base automatically changed from dynamic_field/sofort to main January 30, 2024 09:23
"payment_method_data.bank_redirect.giropay.country".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.bank_redirect.giropay.country".to_string(),
display_name: "bank_account_iban".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

why is the display name bank_account_iban for field country?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was a typo. Changed it

@AkshayaFoiger AkshayaFoiger linked an issue Feb 12, 2024 that may be closed by this pull request
2 tasks
@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 12, 2024
Merged via the queue into main with commit 33df352 Feb 12, 2024
24 of 27 checks passed
@likhinbopanna likhinbopanna deleted the dynamic_field/giropay branch February 12, 2024 08:10
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement M-api-contract-changes Metadata: This PR involves API contract changes
Projects
No open projects
Status: Candidate
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add required fields for giropay
5 participants