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(connector): [DEUTSCHE] Trim spaces in IBAN #5977

Closed
wants to merge 13 commits into from

Conversation

deepanshu-iiitu
Copy link
Contributor

@deepanshu-iiitu deepanshu-iiitu commented Sep 20, 2024

Type of Change

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

Description

Trim the spaces in IBAN before sending it in SEPA Mandate Post and Direct Debit requests for Deutsche Bank.

Additional Changes

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

Motivation and Context

#5976

How did you test it?

Request:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_2QpEeK0ByPRkb2DPBxHfad4i1WxQO3hZSuVzlFcg9mTrLFUHRpGfE0SCuQwZjGEb' \
--data '{
    "amount": 9000,
    "currency": "EUR",
    "confirm": true,
    "profile_id": "pro_EuXuxP2KVO0m1tlDWSau",
    "customer_id": "customer123",
    "payment_method": "bank_debit",
    "payment_method_type": "sepa",
    "payment_method_data": {
        "bank_debit": {
            "sepa_bank_debit": {
                "iban": "DE87 1234 5678 1234 5678 90"
            }
        }
    },
    "billing": {
        "address": {
            "first_name": "joseph",
            "last_name": "doe"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline"
    },
    "setup_future_usage": "off_session"
}'

Response:

{
    "payment_id": "pay_THxTbiKwV1xv7Tmkqe8I",
    "merchant_id": "merchant_1725539597",
    "status": "requires_customer_action",
    "amount": 9000,
    "net_amount": 9000,
    "amount_capturable": 9000,
    "amount_received": null,
    "connector": "deutschebank",
    "client_secret": "pay_THxTbiKwV1xv7Tmkqe8I_secret_hx91jywe0lywBW5UrLb0",
    "created": "2024-09-20T11:05:32.884Z",
    "currency": "EUR",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": null,
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": null,
    "payment_method": "bank_debit",
    "payment_method_data": {
        "bank_debit": {
            "sepa": {
                "iban": "DE87 **** **** **** **78 90",
                "bank_account_holder_name": null
            }
        },
        "billing": null
    },
    "payment_token": "token_LBU2etjaOq7pdJhAPHMk",
    "shipping": null,
    "billing": {
        "address": {
            "city": null,
            "country": null,
            "line1": null,
            "line2": null,
            "line3": null,
            "zip": null,
            "state": null,
            "first_name": "joseph",
            "last_name": "doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "9999999999",
    "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_THxTbiKwV1xv7Tmkqe8I/merchant_1725539597/pay_THxTbiKwV1xv7Tmkqe8I_1"
    },
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "sepa",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "customer123",
        "created_at": 1726830332,
        "expires": 1726833932,
        "secret": "epk_fb2f1bbac4204fc2841fd2b74a295fa0"
    },
    "manual_retry_allowed": null,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_EuXuxP2KVO0m1tlDWSau",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_MZAsrTowXuzpeXl4DMj2",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-09-20T11:20:32.884Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_R9MnbGoavSYoxTmxMiS2",
    "payment_method_status": null,
    "updated": "2024-09-20T11:05:35.073Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": 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

@deepanshu-iiitu deepanshu-iiitu added A-connector-integration Area: Connector integration C-bug Category: Bug labels Sep 20, 2024
@deepanshu-iiitu deepanshu-iiitu self-assigned this Sep 20, 2024
@deepanshu-iiitu deepanshu-iiitu requested a review from a team as a code owner September 20, 2024 11:01
Copy link

semanticdiff-com bot commented Sep 20, 2024

Review changes with SemanticDiff.

Analyzed 34 of 34 files.

Overall, the semantic diff is 28% smaller than the GitHub diff.

File Information
Filename Status
✔️ crates/router/src/types/storage/payment_method.rs Analyzed
✔️ crates/router/src/core/payments.rs Analyzed
✔️ crates/router/src/core/payments/helpers.rs Analyzed
✔️ crates/router/src/core/payments/tokenization.rs 17.21% smaller
✔️ crates/router/src/core/payments/operations/payment_confirm.rs Analyzed
✔️ crates/router/src/core/payments/operations/payment_create.rs 50.0% smaller
✔️ crates/router/src/core/payments/operations/payment_response.rs 41.95% smaller
✔️ crates/router/src/core/payments/operations/payment_update.rs Analyzed
✔️ crates/router/src/core/errors/utils.rs 14.98% smaller
✔️ crates/router/src/connector/wellsfargo/transformers.rs Analyzed
✔️ crates/router/src/connector/stripe/transformers.rs Analyzed
✔️ crates/router/src/connector/payme/transformers.rs Analyzed
✔️ crates/router/src/connector/payeezy/transformers.rs Analyzed
✔️ crates/router/src/connector/nuvei/transformers.rs Analyzed
✔️ crates/router/src/connector/noon/transformers.rs Analyzed
✔️ crates/router/src/connector/nexinets/transformers.rs Analyzed
✔️ crates/router/src/connector/multisafepay/transformers.rs Analyzed
✔️ crates/router/src/connector/gocardless/transformers.rs Analyzed
✔️ crates/router/src/connector/globalpay/transformers.rs Analyzed
✔️ crates/router/src/connector/cybersource/transformers.rs Analyzed
✔️ crates/router/src/connector/braintree/transformers.rs Analyzed
✔️ crates/router/src/connector/bankofamerica/transformers.rs Analyzed
✔️ crates/router/src/connector/bamboraapac/transformers.rs Analyzed
✔️ crates/router/src/connector/authorizedotnet/transformers.rs Analyzed
✔️ crates/router/src/connector/adyen/transformers.rs Analyzed
✔️ crates/router/src/connector/aci/transformers.rs Analyzed
✔️ crates/hyperswitch_interfaces/src/errors.rs Analyzed
✔️ crates/hyperswitch_domain_models/src/router_data.rs Analyzed
✔️ crates/hyperswitch_domain_models/src/router_response_types.rs Analyzed
✔️ crates/hyperswitch_connectors/src/connectors/deutschebank.rs 47.65% smaller
✔️ crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs Analyzed
✔️ crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs Analyzed
✔️ crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs 27.68% smaller
✔️ crates/api_models/src/payments.rs Analyzed

@deepanshu-iiitu deepanshu-iiitu linked an issue Sep 20, 2024 that may be closed by this pull request
2 tasks
Base automatically changed from mandate-sepa-deutsche to main September 20, 2024 11:41
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-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] [DEUTSCHEBANK] Trim the spaces in IBAN
1 participant