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

fix(cybersource): Add truncation logic for administrative area #7343

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cookieg13
Copy link
Contributor

@cookieg13 cookieg13 commented Feb 21, 2025

Type of Change

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

Description

Cybersource throws error if state length exceeds 20 characters, to fix this this PR addes truncation of state at Hyperswitch end

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?

Make /payments with state greater than 20 characters

curl --location --request POST 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_eM1Lq0Ebo27JrIBD9t71RWadvwqQzRuDLoLNSYsYYJkFE6SfIpHzGbxFF3MVedWL' \
--data-raw '{
    "amount": 700,
    "currency": "USD",
    "confirm": true,
    "payment_link": false,
    "amount_to_capture": 700,
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method_data": {
        "card": {
            "card_number": "4917610000000000",
            "card_exp_month": "03",
            "card_exp_year": "30",
            "card_cvc": "737"
        },
        "billing": {
            "address": {
                "line1": "1467",
                "line2": "CA",
                "city": "ABCD",
                "state": "Bourgogne-Franche-Comte",
                "zip": "94122",
                "country": "FR",
                "first_name": "john",
                "last_name": "doe"
            }
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "browser_info": {
        "color_depth": 24,
        "java_enabled": true,
        "java_script_enabled": true,
        "language": "en-GB",
        "screen_height": 720,
        "screen_width": 1280,
        "time_zone": -330,
        "ip_address": "208.127.127.193",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0"
    }
}'

Output

Screenshot 2025-02-21 at 16 42 43 Screenshot 2025-02-21 at 16 53 45

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

@cookieg13 cookieg13 added this to the February 2025 Release milestone Feb 21, 2025
@cookieg13 cookieg13 self-assigned this Feb 21, 2025
@cookieg13 cookieg13 requested a review from a team as a code owner February 21, 2025 11:00
Copy link

semanticdiff-com bot commented Feb 21, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs  35% smaller
  crates/scheduler/src/utils.rs  0% smaller

@cookieg13 cookieg13 force-pushed the cybersourceFix branch 3 times, most recently from 6dded85 to 043a1a0 Compare February 21, 2025 14:27
@cookieg13 cookieg13 requested a review from a team as a code owner February 21, 2025 14:34
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.

Scheduler changes look good to me!

@cookieg13 cookieg13 added the A-connector-integration Area: Connector integration label Feb 24, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 24, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants