Skip to content

Conversation

swetasharma03
Copy link
Contributor

@swetasharma03 swetasharma03 commented Jan 29, 2025

Type of Change

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

Description

Trustly and Ideal Bank Redirect payments were failing for Ayden.
Trustly error message: Required object 'paymentMethod' is not provided.
Ideal error message: Could not find issuer for issuerId

For Trustly, populated the paymentMethod to fix the issue.
Ideal is moving to a more centralized infrastructure to process payments, which does not need issuer. So removed issuer field from connector request body.
Reference: https://docs.adyen.com/payment-methods/ideal/api-only/

Multiple PMTs were failing due to this error Required object 'paymentMethod' is not provided. fixed.

Also, cypress test for Giropay and Sofort is removed for connector Adyen. These payment methods have been deprecated and removed in this PR: #7100

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/8251

How did you test it?

No-3DS auto capture
Screenshot 2025-02-10 at 5 25 26 PM

3DS auto capture
Screenshot 2025-02-10 at 5 25 46 PM

No-3DS manual capture
Screenshot 2025-02-10 at 5 26 06 PM

3DS manual capture
Screenshot 2025-02-10 at 5 26 54 PM

Bank Redirect -- All test cases in bank redirect is passed, other than ideal. Ideal's cypress test failing as ideal itself is redirecting to some other origin.

Screenshot 2025-02-10 at 5 36 47 PM Screenshot 2025-02-10 at 5 36 56 PM
  1. Trustly
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_6yAsmqONdJRee1Za1RsUCvaXlSG6kp8qU12QlluTaHycTOiojrk2b3huLTRPT2ds' \
--data-raw '{
    "amount": 1000,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 1000,
    "payment_method": "bank_redirect",
    "payment_method_type": "trustly",
    "payment_method_data": {
        "bank_redirect": {
        "trustly": {
            "billing_details": {
            "billing_name": "John Doe"
            },
            "bank_name": "ing",
            "preferred_language": "en",
            "country": "FI"
        }
        }
    },
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
        "first_name": "John",
        "last_name": "Doe",
        "line1": "1467",
        "line2": "Harrison Street",
        "line3": "Harrison Street",
        "city": "San Fransico",
        "state": "California",
        "zip": "94122",
        "country": "FI"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
        "line1": "1467",
        "line2": "Harrison Street",
        "line3": "Harrison Street",
        "city": "San Fransico",
        "state": "California",
        "zip": "94122",
        "country": "US",
        "first_name": "John",
        "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}
'

Response

{
    "payment_id": "pay_VXuewdMlK3cNlnjOG6Ni",
    "merchant_id": "merchant_1738137594",
    "status": "requires_customer_action",
    "amount": 1000,
    "net_amount": 1000,
    "shipping_cost": null,
    "amount_capturable": 1000,
    "amount_received": null,
    "connector": "adyen",
    "client_secret": "pay_VXuewdMlK3cNlnjOG6Ni_secret_iJqTyE7HzC1WPREUTMkm",
    "created": "2025-01-29T11:00:14.555Z",
    "currency": "EUR",
    "customer_id": null,
    "customer": null,
    "description": null,
    "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": "bank_redirect",
    "payment_method_data": {
        "bank_redirect": {
            "type": "BankRedirectResponse",
            "bank_name": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "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_VXuewdMlK3cNlnjOG6Ni/merchant_1738137594/pay_VXuewdMlK3cNlnjOG6Ni_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "trustly",
    "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": "VBLF93X8LV2D97V5",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "VBLF93X8LV2D97V5",
    "payment_link": null,
    "profile_id": "pro_LqHTmp6SEFvZsZEzNevb",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_iC4SXg873LfMdmklc82l",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-29T11:15:14.555Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-29T11:00:15.006Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
  1. Ideal
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_6yAsmqONdJRee1Za1RsUCvaXlSG6kp8qU12QlluTaHycTOiojrk2b3huLTRPT2ds' \
--data-raw '{
    "amount": 100,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 100,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "three_ds",
    "return_url": "https://duck.com",
    "payment_method": "bank_redirect",
    "payment_method_type": "ideal",
    "payment_method_data": {
        "bank_redirect": {
            "ideal": {
                "billing_details": {
                    "billing_name": "Example",
                    "email": "guest@example.com"
                },
                "bank_name": "ing"
            }
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "NL",
            "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": "NL",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "browser_info": {
        "user_agent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "accept_header": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "125.0.0.1"
    },
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ]
}'

Response

{
    "payment_id": "pay_Bs4sZJUYU8Bn6dGeXclU",
    "merchant_id": "merchant_1738137594",
    "status": "requires_customer_action",
    "amount": 100,
    "net_amount": 100,
    "shipping_cost": null,
    "amount_capturable": 100,
    "amount_received": null,
    "connector": "adyen",
    "client_secret": "pay_Bs4sZJUYU8Bn6dGeXclU_secret_AFpcBZamAqPIKy2HqZKP",
    "created": "2025-01-29T10:56:33.114Z",
    "currency": "EUR",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "guest@example.com",
        "phone": "999999999",
        "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": "bank_redirect",
    "payment_method_data": {
        "bank_redirect": {
            "type": "BankRedirectResponse",
            "bank_name": "ing"
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "NL",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "NL",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": [
        {
            "brand": null,
            "amount": 6540,
            "category": null,
            "quantity": 1,
            "tax_rate": null,
            "product_id": null,
            "product_name": "Apple iphone 15",
            "product_type": null,
            "sub_category": null,
            "product_img_link": null,
            "product_tax_code": null,
            "total_tax_amount": null,
            "requires_shipping": null
        }
    ],
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": "http://localhost:8080/payments/redirect/pay_Bs4sZJUYU8Bn6dGeXclU/merchant_1738137594/pay_Bs4sZJUYU8Bn6dGeXclU_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "ideal",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1738148193,
        "expires": 1738151793,
        "secret": "epk_725ec96a42464776b2490a336cd39d60"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": "CRFMZRL9WB7WCCV5",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "CRFMZRL9WB7WCCV5",
    "payment_link": null,
    "profile_id": "pro_LqHTmp6SEFvZsZEzNevb",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_iC4SXg873LfMdmklc82l",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-29T11:11:33.114Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "125.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-29T10:56:33.760Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

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

@swetasharma03 swetasharma03 added the C-bug Category: Bug label Jan 29, 2025
@swetasharma03 swetasharma03 self-assigned this Jan 29, 2025
@swetasharma03 swetasharma03 requested a review from a team as a code owner January 29, 2025 11:57
Copy link

semanticdiff-com bot commented Jan 29, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/connector/adyen/transformers.rs  42% smaller
  cypress-tests/cypress/support/redirectionHandler.js  17% smaller
  cypress-tests/cypress/e2e/configs/Payment/Adyen.js  0% smaller

@swetasharma03 swetasharma03 linked an issue Jan 29, 2025 that may be closed by this pull request
@swetasharma03 swetasharma03 force-pushed the fix-trustly-ideal-inAdyen branch from 85476b4 to c982913 Compare January 29, 2025 12:02
@swetasharma03 swetasharma03 force-pushed the fix-trustly-ideal-inAdyen branch 3 times, most recently from 2c5bc04 to 5c7849b Compare January 30, 2025 16:00
@swetasharma03 swetasharma03 changed the title fix(connector): Trustly and Ideal payments fixed in Ayden fix(connector): Ideal and multiple other failing PMs fixed in Ayden Jan 31, 2025
@swetasharma03 swetasharma03 force-pushed the fix-trustly-ideal-inAdyen branch from e8be534 to 9688786 Compare February 3, 2025 07:17
@swetasharma03 swetasharma03 force-pushed the fix-trustly-ideal-inAdyen branch from c5ac4b1 to 7758dfb Compare February 4, 2025 07:10
Comment on lines 520 to 521
#[serde(rename = "network_token")]
AdyenNetworkCard(Box<AdyenCard>),
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the difference between AdyenNetworkCard and NetworkToken?

PaymentMethodBalance(Box<BalancePmData>),
#[serde(rename = "giftcard")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously giftcard was used as payment method type for AdyenGiftCard, that is why passed this value.
And in the docs also, while making the payment, giftcard type is getting used. For checking the balance, there is some other type like givex is being used.

@@ -597,7 +618,9 @@ pub enum AdyenPaymentMethod<'a> {
Indomaret(Box<DokuBankData>),
#[serde(rename = "doku_alfamart")]
Alfamart(Box<DokuBankData>),
#[serde(rename = "givex")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we hardcoding this value to givex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Givex was used as type for BalancePmData flow previously, and other than this any other type was not being used, that's why this is hardcoded as givex

@swetasharma03 swetasharma03 force-pushed the fix-trustly-ideal-inAdyen branch from bf9e7e4 to f95688f Compare February 6, 2025 08:07
@swetasharma03 swetasharma03 force-pushed the fix-trustly-ideal-inAdyen branch 2 times, most recently from d6414c6 to 7a5ad2e Compare February 14, 2025 06:54
@swetasharma03 swetasharma03 requested a review from a team as a code owner February 14, 2025 06:54
@swetasharma03 swetasharma03 force-pushed the fix-trustly-ideal-inAdyen branch from 7a5ad2e to 8084cc8 Compare February 14, 2025 07:13
@swetasharma03 swetasharma03 force-pushed the fix-trustly-ideal-inAdyen branch from b12a1c0 to c0937c8 Compare February 18, 2025 10:55
@likhinbopanna likhinbopanna added this pull request to the merge queue Feb 25, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Feb 25, 2025
@SanchithHegde SanchithHegde added this pull request to the merge queue Feb 25, 2025
Merged via the queue into main with commit e704d17 Feb 25, 2025
20 of 24 checks passed
@SanchithHegde SanchithHegde deleted the fix-trustly-ideal-inAdyen branch February 25, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Trustly and Ideal Failing Payments for Ayden Fixed
5 participants