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(router): fixed integrity check failures in case of 3ds flow in sync flow #5279

Merged

Conversation

sahkal
Copy link
Contributor

@sahkal sahkal commented Jul 10, 2024

Type of Change

  • Bugfix

Description

we have implemented integrity checks for stripe, we have implemented integrity in authorise, sync, capture and refund, refund sync

but, where in sync flow we check amount, currency and amount_captured.

the bug is in 3ds flow, where after the transaction is completed we do a sync with the connector, but our trackers are not updated at this point.

In 3ds transaction we rely on connector sync to update our trackers, since integrity checks happens with data before post update trackers we were comparing MinorUnit(0) our amount captured to Some(MinorUnit(x)) amount received by the connector.

due, to this there was a data mismatch issue, which led to integrity check failure.

How did you test it?

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_GBcnEyXku3rLhERWs4Lb5EVGFWWmVxRIC9vbpDa3QYoVcsjxdQEkMpXo1s8beKnD' \
--data-raw '
{
    "amount": 600,
    "currency": "USD",
    "payment_link": true,
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "stripesavecard_1234",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://google.com",
    "setup_future_usage": "on_session",
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "routing": {
        "type": "single",
        "data": "stripe"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "session_expiry": 2423545,
    "payment_link_config": {
        "theme": "#3B845E",
        "logo": "https://i.pinimg.com/736x/4d/83/5c/4d835ca8aafbbb15f84d07d926fda473.jpg",
        "seller_name": "sahkal",
        "sdk_layout": "spaced_accordion",
        
        "enabled_saved_payment_method":true
    }
}'

Do, 3ds transaction with stripe it should pass.

Screen.Recording.2024-07-11.at.1.57.53.PM.mov

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

@sahkal sahkal added A-core Area: Core flows C-refactor Category: Refactor labels Jul 10, 2024
@sahkal sahkal added this to the July 2024 Release milestone Jul 10, 2024
@sahkal sahkal self-assigned this Jul 10, 2024
@sahkal sahkal requested a review from a team as a code owner July 10, 2024 15:07
@sahkal sahkal requested review from a team as code owners July 10, 2024 16:51
@sahkal sahkal changed the title refactor(router): fixed capture bug in sbx refactor(router): fixed surcharge 3ds flow failure in case of sync flow Jul 10, 2024
@sahkal sahkal changed the title refactor(router): fixed surcharge 3ds flow failure in case of sync flow fix(router): fixed surcharge 3ds flow failure in case of sync flow Jul 10, 2024
@sahkal sahkal changed the title fix(router): fixed surcharge 3ds flow failure in case of sync flow fix(router): fixed integrity check failures in case of surcharge 3ds flow failure in sync flow Jul 10, 2024
@sahkal sahkal changed the title fix(router): fixed integrity check failures in case of surcharge 3ds flow failure in sync flow fix(router): fixed integrity check failures in case of surcharge 3ds flow in sync flow Jul 10, 2024
@sahkal sahkal changed the title fix(router): fixed integrity check failures in case of surcharge 3ds flow in sync flow fix(router): fixed integrity check failures in case of 3ds flow in sync flow Jul 11, 2024
@sahkal sahkal added C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jul 11, 2024
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This function can be inline

hrithikesh026
hrithikesh026 previously approved these changes Jul 11, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 11, 2024
Merged via the queue into main with commit 6d372ef Jul 12, 2024
17 checks passed
@Gnanasundari24 Gnanasundari24 deleted the 5919-bug-integrity-check-failed-for-surcharge-3ds-flow branch July 12, 2024 00:04
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jul 12, 2024
pixincreate added a commit that referenced this pull request Jul 16, 2024
…ositives

* 'main' of github.com:juspay/hyperswitch:
  refactor(cypress): correction of cypress tests env variables for Payment method list (#5299)
  chore(version): 2024.07.12.0
  fix(router): fixed integrity check failures in case of 3ds flow in sync flow (#5279)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows C-bug Category: Bug C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants