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(connector): [AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment #4841

Merged
merged 4 commits into from
Jun 3, 2024

Conversation

deepanshu-iiitu
Copy link
Contributor

@deepanshu-iiitu deepanshu-iiitu commented May 31, 2024

Type of Change

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

Description

Support payment_method_id in recurring mandate payment for connector Authorizedotnet.

Additional Changes

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

Motivation and Context

#4840

How did you test it?

  • Payment Intent Create (Zero):
    Request:
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_8aib7npeItergz3tpMqm1iqsMXrAdiw8VjVdjiVUWLMUSRWR34DrRDGJPmy2mcMm' \
--data '{
    "amount": 0,
    "currency": "USD",
    "confirm": false,
    "customer_id": "tester799"
}'

Response:

{
    "payment_id": "pay_hduDivSEknVCYLL3ekxX",
    "merchant_id": "merchant_1717157151",
    "status": "requires_payment_method",
    "amount": 0,
    "net_amount": 0,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "API_KEY_HERE",
    "created": "2024-06-03T09:25:42.690Z",
    "currency": "USD",
    "customer_id": "tester799",
    "customer": {
        "id": "tester799",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": 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": null,
    "payment_method": null,
    "payment_method_data": null,
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": null,
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "tester799",
        "created_at": 1717406742,
        "expires": 1717410342,
        "secret": "epk_6d3c1f24d50e48ebb08373224ef23d5a"
    },
    "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_lxWuQ5I3AgeVdF3GLB03",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-06-03T09:40:42.690Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-06-03T09:25:42.781Z",
    "charges": null,
    "frm_metadata": null
}
  • Payment Confirm (Zero):
    Request:
curl --location 'http://localhost:8080/payments/pay_jKXxp9HeQV41lRZW4TsV/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: API_KEY_HERE' \
--data '{
    "setup_future_usage": "off_session",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_type": "setup_mandate",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "07",
            "card_exp_year": "26",
            "card_holder_name": "Joseph Does",
            "card_cvc": "123"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline"
    }
}'

Response:

{
    "payment_id": "pay_hduDivSEknVCYLL3ekxX",
    "merchant_id": "merchant_1717157151",
    "status": "succeeded",
    "amount": 0,
    "net_amount": 0,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "authorizedotnet",
    "client_secret": "pay_hduDivSEknVCYLL3ekxX_secret_iJjHlRGKZhNU4XJto9AD",
    "created": "2024-06-03T09:25:42.690Z",
    "currency": "USD",
    "customer_id": "tester799",
    "customer": {
        "id": "tester799",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "1111",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "07",
            "card_exp_year": "26",
            "card_holder_name": "Joseph Does",
            "payment_checks": null,
            "authentication_data": 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": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_lxWuQ5I3AgeVdF3GLB03",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_F6pucFwthqPFPERwAhf8",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-06-03T09:40:42.690Z",
    "fingerprint": null,
    "browser_info": {
        "language": null,
        "time_zone": null,
        "ip_address": "::1",
        "user_agent": null,
        "color_depth": null,
        "java_enabled": null,
        "screen_width": null,
        "accept_header": null,
        "screen_height": null,
        "java_script_enabled": null
    },
    "payment_method_id": "pm_D0ahV0rd04bLhjjYrV2I",
    "payment_method_status": null,
    "updated": "2024-06-03T09:28:35.781Z",
    "charges": null,
    "frm_metadata": null
}
  • Payment Intent Create (Non-Zero):
    Request:
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: API_KEY_HERE' \
--data '{
    "amount": 370,
    "currency": "USD",
    "confirm": false,
    "customer_id": "tester799"
}'

Response:

{
    "payment_id": "pay_ZBSRCNSVIqDtDcw6IsUz",
    "merchant_id": "merchant_1717157151",
    "status": "requires_payment_method",
    "amount": 370,
    "net_amount": 370,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": null,
    "client_secret": "pay_ZBSRCNSVIqDtDcw6IsUz_secret_uZouNfEDWSG1goR8XmeG",
    "created": "2024-06-03T09:27:07.982Z",
    "currency": "USD",
    "customer_id": "tester799",
    "customer": {
        "id": "tester799",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": 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": null,
    "payment_method": null,
    "payment_method_data": null,
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": null,
    "statement_descriptor_name": null,
    "statement_descriptor_suffix": null,
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "tester799",
        "created_at": 1717406827,
        "expires": 1717410427,
        "secret": "epk_9301e21e18a54abe870465212fee94d2"
    },
    "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_lxWuQ5I3AgeVdF3GLB03",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": null,
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-06-03T09:42:07.982Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-06-03T09:27:08.012Z",
    "charges": null,
    "frm_metadata": null
}
  • Payment Confirm (Non-Zero):

Request:

curl --location 'http://localhost:8080/payments/pay_ZBSRCNSVIqDtDcw6IsUz/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: API_KEY_HERE' \
--data '{
    "setup_future_usage": "off_session",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_type": "setup_mandate",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "07",
            "card_exp_year": "26",
            "card_holder_name": "Joseph Does",
            "card_cvc": "123"
        }
    },
    "customer_acceptance": {
        "acceptance_type": "offline"
    }
}'

Response:

{
    "payment_id": "pay_ZBSRCNSVIqDtDcw6IsUz",
    "merchant_id": "merchant_1717157151",
    "status": "succeeded",
    "amount": 370,
    "net_amount": 370,
    "amount_capturable": 370,
    "amount_received": null,
    "connector": "authorizedotnet",
    "client_secret": "pay_ZBSRCNSVIqDtDcw6IsUz_secret_uZouNfEDWSG1goR8XmeG",
    "created": "2024-06-03T09:27:07.982Z",
    "currency": "USD",
    "customer_id": "tester799",
    "customer": {
        "id": "tester799",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": null
    },
    "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": "card",
    "payment_method_data": {
        "card": {
            "last4": "1111",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "07",
            "card_exp_year": "26",
            "card_holder_name": "Joseph Does",
            "payment_checks": null,
            "authentication_data": 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": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": null,
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_lxWuQ5I3AgeVdF3GLB03",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_F6pucFwthqPFPERwAhf8",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-06-03T09:42:07.982Z",
    "fingerprint": null,
    "browser_info": {
        "language": null,
        "time_zone": null,
        "ip_address": "::1",
        "user_agent": null,
        "color_depth": null,
        "java_enabled": null,
        "screen_width": null,
        "accept_header": null,
        "screen_height": null,
        "java_script_enabled": null
    },
    "payment_method_id": "pm_KOptxkOcyGWIly77GCiQ",
    "payment_method_status": null,
    "updated": "2024-06-03T09:29:35.382Z",
    "charges": null,
    "frm_metadata": null
}
  • Payments Create - Using payment_method_id:

Request:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: API_KEY_HERE' \
--data '{
    "amount": 400,
    "currency": "USD",
    "confirm": true,
    "customer_id": "tester799",
    
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_D0ahV0rd04bLhjjYrV2I"
    },
    "off_session": true
}'

Response:

{
    "payment_id": "pay_3Z93A6rW7b2qOUHxED2H",
    "merchant_id": "merchant_1717157151",
    "status": "succeeded",
    "amount": 400,
    "net_amount": 400,
    "amount_capturable": 0,
    "amount_received": 400,
    "connector": "authorizedotnet",
    "client_secret": "pay_3Z93A6rW7b2qOUHxED2H_secret_BonNTHUTARbIb2QiWN2o",
    "created": "2024-06-03T09:32:47.521Z",
    "currency": "USD",
    "customer_id": "tester799",
    "customer": {
        "id": "tester799",
        "name": null,
        "email": null,
        "phone": null,
        "phone_country_code": 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": null,
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1111",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "07",
            "card_exp_year": "26",
            "card_holder_name": "Joseph Does",
            "payment_checks": null,
            "authentication_data": 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": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "tester799",
        "created_at": 1717407167,
        "expires": 1717410767,
        "secret": "epk_bf0885fc144047dcb5dad7a35be92057"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "80019529820",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "80019529820",
    "payment_link": null,
    "profile_id": "pro_lxWuQ5I3AgeVdF3GLB03",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_F6pucFwthqPFPERwAhf8",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-06-03T09:47:47.521Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_D0ahV0rd04bLhjjYrV2I",
    "payment_method_status": "active",
    "updated": "2024-06-03T09:32:48.396Z",
    "charges": null,
    "frm_metadata": 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-feature Category: Feature request or enhancement labels May 31, 2024
@deepanshu-iiitu deepanshu-iiitu self-assigned this May 31, 2024
@deepanshu-iiitu deepanshu-iiitu requested a review from a team as a code owner May 31, 2024 12:00
@deepanshu-iiitu deepanshu-iiitu changed the title feat(connector): [AUTHORIZEDOTNET] Support payment_method_id in recur… feat(connector): [AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment May 31, 2024
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jun 3, 2024
Merged via the queue into main with commit a1788b8 Jun 3, 2024
19 checks passed
@Gnanasundari24 Gnanasundari24 deleted the adn-mandate-refactor branch June 3, 2024 11:22
pixincreate added a commit that referenced this pull request Jun 4, 2024
…atus_pt

* 'main' of github.com:juspay/hyperswitch:
  chore(version): 2024.06.04.0
  fix: include client_version and client_source in retried payments (#4826)
  refactor(users): Changes for Home and Signout APIs for TOTP Redis flows (#4851)
  feat(users): Create config for TOTP Issuer (#4776)
  feat(multitenancy): add support for multitenancy and handle the same in router, producer, consumer, drainer and analytics (#4630)
  feat(connector): [AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment (#4841)
  refactor(connector): airwallex convert init payment to preprocessing (#4842)
  feat(router): send `three_ds_requestor_url` in authentication_response for external 3ds flow (#4828)
  feat(consolidated-kafka-events): add consolidated kafka payment events (#4798)
  refactor(connector): [Klarna] Add shipping Address in Klarna Session and Payment Request (#4836)
  fix(connector): make few fields optional in struct NetceteraErrorDetails (#4827)
  chore(cypress): remove logs that expose `globalState` (#4844)
pixincreate added a commit that referenced this pull request Jun 4, 2024
* 'main' of github.com:juspay/hyperswitch:
  feat(cypress): Add service level testing for Payouts (#4744)
  feat(auth): Create and use `SinglePurposeOrLoginTokenAuth` (#4830)
  refactor(connector): [Adyen] handle redirection error response (#4862)
  refactor(api_models): rename Card struct for payouts to avoid overrides in auto generated open API spec (#4861)
  chore(version): 2024.06.04.1
  fix(connector): [Adyen]add required fields for afterpay clearpay (#4858)
  chore(version): 2024.06.04.0
  fix: include client_version and client_source in retried payments (#4826)
  refactor(users): Changes for Home and Signout APIs for TOTP Redis flows (#4851)
  feat(users): Create config for TOTP Issuer (#4776)
  feat(multitenancy): add support for multitenancy and handle the same in router, producer, consumer, drainer and analytics (#4630)
  feat(connector): [AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment (#4841)
  refactor(connector): airwallex convert init payment to preprocessing (#4842)
  feat(router): send `three_ds_requestor_url` in authentication_response for external 3ds flow (#4828)
  feat(consolidated-kafka-events): add consolidated kafka payment events (#4798)
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-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] [AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment
4 participants