Skip to content

refactor(required_fields): move pm required fields to pm crate#7539

Merged
Gnanasundari24 merged 51 commits intomainfrom
refactor-pm-required-fields
Apr 21, 2025
Merged

refactor(required_fields): move pm required fields to pm crate#7539
Gnanasundari24 merged 51 commits intomainfrom
refactor-pm-required-fields

Conversation

@jagan-jaya
Copy link
Contributor

@jagan-jaya jagan-jaya commented Mar 17, 2025

Type of Change

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

Description

Use enums in payment_connector_required_fields.rs instead of string for required fields and reduce duplication

Additional Changes

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

Motivation and Context

As part of Payment method crate seperation, optimizing the required fields file

How did you test it?

No behavior change has been made in this PR.
Sanity tests on card forms with billing field input are needed for verification

  1. open demo app and remove billing address from payment_create.
  2. check if the billing address fields are shown in the card form
  3. verify whether the display name for country, email, and phone are shown properly

Original output: original_required_fields.json

New Output: new_required_fields.json

The display names "country", "email", and "zip" replace "bank_account_country", "billing_email", and "billing_zip" as they are more commonly used in other places with counts of 69, 129, and 48 respectively.

git diff /Users/jagan.elavarasan/Desktop/tmp/hyperswitch-1/crates/router/default_required_fields.json /Users/jagan.elavarasan/Desktop/hyperswitch/crates/payment_methods/default_required_fields.json
diff --git a/Users/jagan.elavarasan/Desktop/hyperswitch/crates/router/tests/default_required_fields.json b/Users/jagan.elavarasan/Desktop/tmp/hyperswitch-1/crates/payment_methods/default_required_fields.json
index 161978bfe..ee0ba7e4b 100644
--- a/Users/jagan.elavarasan/Desktop/hyperswitch/crates/router/tests/default_required_fields.json
+++ b/Users/jagan.elavarasan/Desktop/tmp/hyperswitch-1/crates/payment_methods/default_required_fields.json
@@ -486,7 +486,7 @@
                   "mandate": {},
                   "non_mandate": {
                       "billing.address.country": {
-                          "display_name": "bank_account_country",
+                          "display_name": "country",
                           "field_type": {
                               "user_country": {
                                   "options": [
@@ -575,7 +575,7 @@
                   "mandate": {},
                   "non_mandate": {
                       "billing.address.country": {
-                          "display_name": "bank_account_country",
+                          "display_name": "country",
                           "field_type": {
                               "user_country": {
                                   "options": [
@@ -1001,7 +1001,7 @@
                           "value": null
                       },
                       "billing.email": {
-                          "display_name": "billing_email",
+                          "display_name": "email",
                           "field_type": "user_email_address",
                           "required_field": "payment_method_data.billing.email",
                           "value": null
@@ -3365,7 +3365,7 @@
                           "value": null
                       },
                       "billing.address.zip": {
-                          "display_name": "billing_zip",
+                          "display_name": "zip",
                           "field_type": "user_address_pincode",
                           "required_field": "payment_method_data.billing.address.zip",
                           "value": null
@@ -3453,7 +3453,7 @@
                           "value": null
                       },
                       "billing.email": {
-                          "display_name": "email_address",
+                          "display_name": "email",
                           "field_type": "user_email_address",
                           "required_field": "payment_method_data.billing.email",
                           "value": null
@@ -4468,7 +4468,7 @@
                           "value": null
                       },
                       "billing.phone.number": {
-                          "display_name": "phone_number",
+                          "display_name": "phone",
                           "field_type": "user_phone_number",
                           "required_field": "payment_method_data.billing.phone.number",
                           "value": null
@@ -5908,7 +5908,7 @@
                           "value": null
                       },
                       "billing.address.zip": {
-                          "display_name": "billing_zip",
+                          "display_name": "zip",
                           "field_type": "user_address_pincode",
                           "required_field": "payment_method_data.billing.address.zip",
                           "value": null
@@ -5996,7 +5996,7 @@
                           "value": null
                       },
                       "billing.email": {
-                          "display_name": "email_address",
+                          "display_name": "email",
                           "field_type": "user_email_address",
                           "required_field": "payment_method_data.billing.email",
                           "value": null
@@ -7011,7 +7011,7 @@
                           "value": null
                       },
                       "billing.phone.number": {
-                          "display_name": "phone_number",
+                          "display_name": "phone",
                           "field_type": "user_phone_number",
                           "required_field": "payment_method_data.billing.phone.number",
                           "value": null
@@ -7349,7 +7349,7 @@
                           "value": null
                       },
                       "billing.phone.number": {
-                          "display_name": "phone_number",
+                          "display_name": "phone",
                           "field_type": "user_phone_number",
                           "required_field": "payment_method_data.billing.phone.number",
                           "value": null
@@ -7374,13 +7374,13 @@
                       },
                       "shipping.address.line1": {
                           "display_name": "line1",
-                          "field_type": "user_address_line1",
+                          "field_type": "user_shipping_address_line1",
                           "required_field": "shipping.address.line1",
                           "value": null
                       },
                       "shipping.address.line2": {
                           "display_name": "line2",
-                          "field_type": "user_address_line2",
+                          "field_type": "user_shipping_address_line2",
                           "required_field": "shipping.address.line2",
                           "value": null
                       },
@@ -7698,7 +7698,7 @@
                           "value": null
                       },
                       "billing.phone.number": {
-                          "display_name": "phone_number",
+                          "display_name": "phone",
                           "field_type": "user_phone_number",
                           "required_field": "payment_method_data.billing.phone.number",
                           "value": null
@@ -7781,7 +7781,7 @@
                           "value": null
                       },
                       "billing.phone.number": {
-                          "display_name": "phone_number",
+                          "display_name": "phone",
                           "field_type": "user_phone_number",
                           "required_field": "payment_method_data.billing.phone.number",
                           "value": null
@@ -7795,7 +7795,7 @@
               "adyen": {
                   "common": {
                       "billing.address.country": {
-                          "display_name": "billing_country",
+                          "display_name": "country",
                           "field_type": {
                               "user_address_country": {
                                   "options": [
@@ -7860,7 +7860,7 @@
                   "mandate": {},
                   "non_mandate": {
                       "billing.address.country": {
-                          "display_name": "billing_country",
+                          "display_name": "country",
                           "field_type": {
                               "user_address_country": {
                                   "options": [
@@ -7976,7 +7976,7 @@
                           "value": null
                       },
                       "billing.phone.number": {
-                          "display_name": "phone_number",
+                          "display_name": "phone",
                           "field_type": "user_phone_number",
                           "required_field": "payment_method_data.billing.phone.number",
                           "value": null
@@ -8628,7 +8628,7 @@
               "novalnet": {
                   "common": {
                       "billing.email": {
-                          "display_name": "email_address",
+                          "display_name": "email",
                           "field_type": "user_email_address",
                           "required_field": "payment_method_data.billing.email",
                           "value": null
@@ -8999,7 +8999,7 @@
               "novalnet": {
                   "common": {
                       "billing.email": {
-                          "display_name": "email_address",
+                          "display_name": "email",
                           "field_type": "user_email_address",
                           "required_field": "payment_method_data.billing.email",
                           "value": null
@@ -9165,7 +9165,7 @@
                           "value": null
                       },
                       "billing.phone.number": {
-                          "display_name": "phone_number",
+                          "display_name": "phone",
                           "field_type": "user_phone_number",
                           "required_field": "payment_method_data.billing.phone.number",
                           "value": null
@@ -9185,7 +9185,7 @@
                           "value": null
                       },
                       "billing.address.country": {
-                          "display_name": "nationality",
+                          "display_name": "country",
                           "field_type": {
                               "user_country": {
                                   "options": [
@@ -9441,7 +9441,7 @@
                           "value": null
                       },
                       "billing.email": {
-                          "display_name": "email_address",
+                          "display_name": "email",
                           "field_type": "user_email_address",
                           "required_field": "payment_method_data.billing.email",
                           "value": null
@@ -9545,7 +9545,7 @@
               "novalnet": {
                   "common": {
                       "billing.email": {
-                          "display_name": "email_address",
+                          "display_name": "email",
                           "field_type": "user_email_address",
                           "required_field": "payment_method_data.billing.email",
                           "value": null
@@ -9725,5 +9725,4 @@
           }
       }
   }
-
 }
\ No newline at end of file

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

@jagan-jaya jagan-jaya self-assigned this Mar 17, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Mar 17, 2025

@jagan-jaya jagan-jaya added A-connector-integration Area: Connector integration C-refactor Category: Refactor labels Apr 15, 2025
ShankarSinghC
ShankarSinghC previously approved these changes Apr 16, 2025
srujanchikke
srujanchikke previously approved these changes Apr 16, 2025
@jagan-jaya jagan-jaya requested a review from a team as a code owner April 17, 2025 17:44
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Apr 21, 2025
@Gnanasundari24 Gnanasundari24 removed this pull request from the merge queue due to a manual request Apr 21, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Apr 21, 2025
Merged via the queue into main with commit 103a5c1 Apr 21, 2025
16 of 20 checks passed
@Gnanasundari24 Gnanasundari24 deleted the refactor-pm-required-fields branch April 21, 2025 08:33
pixincreate added a commit that referenced this pull request Apr 21, 2025
…acilitapay-pix-pmt

* 'main' of github.com:juspay/hyperswitch: (21 commits)
  refactor(required_fields): move pm required fields to pm crate (#7539)
  fix(connector): [noon] address `next_action_url` being `null` for cards in 3ds payment (#7832)
  refactor(middleware): add middleware to record metrics for request count and duration (#7803)
  chore(version): 2025.04.18.0
  chore(postman): update Postman collection files
  fix(connector): [globalpay] handle edge case where currency comes as empty upon payment decline (#7812)
  refactor(cypress-v2): change `Authorization` and `payment_methods_enabled` for v2 cypress tests (#7805)
  fix(connector): [Cybersource] send type selection indicator for co-batch cards (#7828)
  feat(payment_method): add logic for setup_future_usage downgrade and add filter based on zero mandate config (#7775)
  refactor(accounts): move dashboard_metadata table to accounts_schema and point v2 to v1 dashboard_metadata (#7793)
  chore(analytics): opensearch client creation based on config (#7810)
  ci(postman): update assertion error message for nmi collection (#7765)
  feat: add primary key not null query to generic filter function (#7785)
  chore(version): 2025.04.17.0
  chore: change payment method files ownership to `hyperswitch-payment-methods` (#7808)
  feat(vsaas): modify api key auth to support vsaas cases (#7593)
  ci(cypress): verify mandate id to be `null` if payment id not `succeeded` (#7749)
  feat(connector): [chargebee] consumes required fields to support transaction monitoring (#7774)
  ci(configs): remove vault private key from configs (#7825)
  chore(version): 2025.04.16.0
  ...
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

None yet

Development

Successfully merging this pull request may close these issues.

6 participants