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(dynamic_fields): Multiple SDK queries fixed #7380

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

Conversation

Sweta-Kumari-Sharma
Copy link
Contributor

@Sweta-Kumari-Sharma Sweta-Kumari-Sharma commented Feb 26, 2025

Type of Change

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

Description

Multiple SDK queries fixed:

  1. Modified field_type text to some unique enum
  2. Corrected multiple required fields
  3. Voucher payments error billing.phone.number is required fixed
  4. Cashapp and Swish payment_experience fixed.
  5. Preprocessing to be done only for Givex in gift_cards

Additional Changes

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

Motivation and Context

https://github.com/juspay/hyperswitch-cloud/issues/8623

How did you test it?

Voucher payment

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_7u1WfwhlOfuf9PlZpwf54Ejwwi7d6cEBn51jXQiQXBzoQEY4C0CMB8ddkJ6ES0GZ' \
--data-raw '{
    "amount": 1000,
    "currency": "JPY",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "voucher",
    "payment_method_type": "seven_eleven",
	"payment_method_data": {
    	"voucher": {
        	"seven_eleven": {}
    	},
    	"billing": {
        	"address": {
            	"first_name": "joseph",
            	"last_name": "Doe"
        	},
        	"phone": {
            	"number": "9123456789",
            	"country_code": ""
        	},
        	"email": "[email protected]"
    	}
	}


}'

Response

{
    "payment_id": "pay_uoGRFxEqHLGs9mJHh4gs",
    "merchant_id": "merchant_1740480565",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "adyen",
    "client_secret": "pay_uoGRFxEqHLGs9mJHh4gs_secret_iWcNQpBKiRXtrJE3Ywei",
    "created": "2025-02-25T16:02:51.611Z",
    "currency": "JPY",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "voucher",
    "payment_method_data": {
        "voucher": {
            "seven_eleven": {
                "first_name": null,
                "last_name": null,
                "email": null,
                "phone_number": null
            }
        },
        "billing": {
            "address": {
                "city": null,
                "country": null,
                "line1": null,
                "line2": null,
                "line3": null,
                "zip": null,
                "state": null,
                "first_name": "joseph",
                "last_name": "Doe"
            },
            "phone": {
                "number": "9123456789",
                "country_code": ""
            },
            "email": "[email protected]"
        }
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_uoGRFxEqHLGs9mJHh4gs/merchant_1740480565/pay_uoGRFxEqHLGs9mJHh4gs_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "seven_eleven",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": null,
    "connector_transaction_id": "XZ6J6GDVKX2R3M75",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "XZ6J6GDVKX2R3M75",
    "payment_link": null,
    "profile_id": "pro_XQL7oWxF1wAf4kznf1Ti",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_uzopYnVyxTBm7bzDBhJI",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-25T16:17:51.611Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-02-25T16:02:56.270Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": null
}

Other refactoring is related to SDK and Dashboard WASM, so no need to test.

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

@Sweta-Kumari-Sharma Sweta-Kumari-Sharma added the C-refactor Category: Refactor label Feb 26, 2025
@Sweta-Kumari-Sharma Sweta-Kumari-Sharma self-assigned this Feb 26, 2025
@Sweta-Kumari-Sharma Sweta-Kumari-Sharma requested review from a team as code owners February 26, 2025 07:27
Copy link

semanticdiff-com bot commented Feb 26, 2025

@Sweta-Kumari-Sharma Sweta-Kumari-Sharma linked an issue Feb 26, 2025 that may be closed by this pull request
@Sweta-Kumari-Sharma Sweta-Kumari-Sharma force-pushed the dynamic-fields-adyen branch 4 times, most recently from 668ff2b to a55ec20 Compare March 5, 2025 11:26
AkshayaFoiger
AkshayaFoiger previously approved these changes Mar 7, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

This will force us to add county_code in the dynamic fields even when the connector doesn't require country_code as a mandatory field (rare scenarios)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] Multiple SDK queries fixed
2 participants