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

feat(router): Make payment_method_subtype optional in payment_attempt [V2] #7568

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

Conversation

AnuthaDev
Copy link
Contributor

@AnuthaDev AnuthaDev commented Mar 19, 2025

Type of Change

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

Description

  • Added diesel migration to make payment_method_subtype Nullable in payment_attempt table
  • Made payment_method_subtype an Option in request and response structs

Additional Changes

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

Motivation and Context

Closes #7567

How did you test it?

  1. Payments - Confirm:
curl --location 'http://localhost:8080/v2/payments/12345_pay_0195adf1544079139067663acdbff178/confirm-intent' \
--header 'x-client-secret: 12345_pay_0195adf1544079139067663acdbff178_secret_0195adf154487933ae61c8ca769286b0' \
--header 'x-profile-id: pro_6XA4kopfg4VAYLy2jNzW' \
--header 'Content-Type: application/json' \
--header 'api-key: pk_dev_196e797040ba4ecbb064ee14e53c8817' \
--data '{
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",
            "card_exp_month": "05",
            "card_exp_year": "25",
            "card_holder_name": "John Doe",
            "card_cvc": "100"
        }
    },
    "payment_method_type": "card"
    
}'

Response:

{
    "id": "12345_pay_0195adf1544079139067663acdbff178",
    "status": "requires_capture",
    "amount": {
        "order_amount": 100,
        "currency": "USD",
        "shipping_cost": null,
        "order_tax_amount": null,
        "external_tax_calculation": "skip",
        "surcharge_calculation": "skip",
        "surcharge_amount": null,
        "tax_on_surcharge": null,
        "net_amount": 100,
        "amount_to_capture": null,
        "amount_capturable": 100,
        "amount_captured": 0
    },
    "customer_id": null,
    "connector": "stripe",
    "client_secret": "12345_pay_0195adf1544079139067663acdbff178_secret_0195adf154487933ae61c8ca769286b0",
    "created": "2025-03-19T10:27:09.001Z",
    "payment_method_data": {
        "billing": null
    },
    "payment_method_type": "card",
    "payment_method_subtype": null,
    "connector_transaction_id": "pi_3R4Jq8D5R7gDAGff1B5K8RjQ",
    "connector_reference_id": null,
    "merchant_connector_id": "mca_vwmIHkB372B5SHcDO0wC",
    "browser_info": null,
    "error": null,
    "shipping": null,
    "billing": null,
    "attempts": null,
    "connector_token_details": {
        "token": "pm_1R4Jq8D5R7gDAGffQmkzcinv",
        "connector_token_request_reference_id": "q0miVgxYfHkoOfwax6"
    },
    "payment_method_id": null,
    "next_action": null,
    "return_url": "https://google.com/success",
    "authentication_type": "no_three_ds",
    "authentication_type_applied": "no_three_ds"
}

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

@AnuthaDev AnuthaDev added A-core Area: Core flows M-database-changes Metadata: This PR involves database schema changes M-api-contract-changes Metadata: This PR involves API contract changes api-v2 labels Mar 19, 2025
@AnuthaDev AnuthaDev added this to the February 2025 Release milestone Mar 19, 2025
@AnuthaDev AnuthaDev self-assigned this Mar 19, 2025
@AnuthaDev AnuthaDev marked this pull request as ready for review March 19, 2025 10:28
@AnuthaDev AnuthaDev requested review from a team as code owners March 19, 2025 10:28
swangi-kumari
swangi-kumari previously approved these changes Mar 19, 2025
Copy link
Contributor

@swangi-kumari swangi-kumari left a comment

Choose a reason for hiding this comment

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

Reviewed connector files.

Chethan-rao
Chethan-rao previously approved these changes Mar 19, 2025
@AnuthaDev AnuthaDev dismissed stale reviews from Chethan-rao and swangi-kumari via 0448a3b March 20, 2025 10:21
Narayanbhat166
Narayanbhat166 previously approved these changes Mar 20, 2025
swangi-kumari
swangi-kumari previously approved these changes Mar 20, 2025
Chethan-rao
Chethan-rao previously approved these changes Mar 20, 2025
jarnura
jarnura previously approved these changes Mar 20, 2025
@AnuthaDev AnuthaDev changed the title feat(router): Make payment_method_subtype optional [V2] feat(router): Make payment_method_subtype optional in payment_attempt [V2] Mar 21, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Mar 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows api-v2 M-api-contract-changes Metadata: This PR involves API contract changes M-database-changes Metadata: This PR involves database schema changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(router): Make payment_method_subtype optional
6 participants