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): [GETNET] Add cards payment flow #7256

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

Conversation

Sweta-Kumari-Sharma
Copy link
Contributor

@Sweta-Kumari-Sharma Sweta-Kumari-Sharma commented Feb 12, 2025

Type of Change

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

Description

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

How did you test it?

  1. No-3DS AutoCapture
Screenshot 2025-02-17 at 9 29 29 PM
  1. 3DS AutoCapture
Screenshot 2025-02-17 at 9 30 03 PM
  1. No-3DS ManualCapture
Screenshot 2025-02-17 at 9 42 43 PM
  1. 3DS ManualCapture
Screenshot 2025-02-17 at 9 30 38 PM
  1. Void Payment
Screenshot 2025-02-17 at 9 30 57 PM
  1. PSync
Screenshot 2025-02-17 at 9 31 11 PM
  1. Refund Payment
Screenshot 2025-02-17 at 9 32 08 PM
  1. RSync
Screenshot 2025-02-17 at 9 32 20 PM
  1. Connector create
curl --location 'http://localhost:8080/account/merchant_1739434149/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: test_admin' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "getnet",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "4cHLRE-Q7YcAP", 
        "key1":  "515225-GetnetEuropeTEST",
        "api_secret": "5c4a8a42-04a8-4970-a595-262f0ba0a108" 
    },
    "test_mode": true,
    "disabled": false,
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true,
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "GBP"
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "city": "NY",
        "unit": "245"
    },
    "connector_webhook_details": {
        "merchant_secret": "5ac555d4-e7f7-409f-8147-d82c8c10ed53"
    },
    "business_country": "US",
    "business_label": "default"
}'

Response

{
    "connector_type": "payment_processor",
    "connector_name": "getnet",
    "connector_label": "getnet_US_default",
    "merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
    "profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
    "connector_account_details": {
        "auth_type": "SignatureKey",
        "api_key": "4c*********AP",
        "key1": "51*******************ST",
        "api_secret": "5c********************************08"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": {
                        "type": "enable_only",
                        "list": [
                            "GBP"
                        ]
                    },
                    "accepted_countries": {
                        "type": "disable_only",
                        "list": [
                            "HK"
                        ]
                    },
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "connector_webhook_details": {
        "merchant_secret": "5ac555d4-e7f7-409f-8147-d82c8c10ed53",
        "additional_secret": null
    },
    "metadata": {
        "city": "NY",
        "unit": "245"
    },
    "test_mode": true,
    "disabled": false,
    "frm_configs": null,
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "applepay_verified_domains": null,
    "pm_auth_config": null,
    "status": "active",
    "additional_merchant_data": null,
    "connector_wallets_details": null
}
  1. Manual Capture
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data-raw '{
    "amount": 6540,
    "currency": "GBP",
    "amount_to_capture": 6540,
    "confirm": true,
    "profile_id": null,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    
    
    
    "phone_country_code": "+1",
    "routing": { 
        "type": "single",
        "data": "stripe"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": { 
        "card": {
            "card_number": "5413330300001006",
            "card_exp_month": "02",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "card_cvc": "006",
            "card_type": "visa"
        }
    },
    
    "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"
        },
        "email": "[email protected]"
    },
    "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"
        },
        "email": "[email protected]"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "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": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal", 
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900 
}

'

Response

{
    "payment_id": "pay_yeIQORCXdgimJRzZTCVw",
    "merchant_id": "merchant_1739434149",
    "status": "requires_capture",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 6540,
    "amount_received": null,
    "connector": "getnet",
    "client_secret": "pay_yeIQORCXdgimJRzZTCVw_secret_u9VvAVWDu490Tj2lA7Zr",
    "created": "2025-02-13T08:11:07.353Z",
    "currency": "GBP",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1006",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "541333",
            "card_extended_bin": null,
            "card_exp_month": "02",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "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": "[email protected]",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "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": "customer123",
        "created_at": 1739434267,
        "expires": 1739437867,
        "secret": "epk_667d69df4d134fc39f0a61703d75481e"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "068e3efc-4163-4020-96f7-7ed306bffa92",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        }
    },
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-13T08:26:07.353Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.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-02-13T08:11:12.236Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": "test_ord",
    "order_tax_amount": null,
    "connector_mandate_id": null
}
curl --location 'http://localhost:8080/payments/pay_yeIQORCXdgimJRzZTCVw/capture' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data '{
  "amount_to_capture": 6000,
  "statement_descriptor_name": "Joseph",
  "statement_descriptor_prefix" :"joseph",
  "statement_descriptor_suffix": "JS"
}'

Response

{
    "payment_id": "pay_yeIQORCXdgimJRzZTCVw",
    "merchant_id": "merchant_1739434149",
    "status": "partially_captured",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6000,
    "connector": "getnet",
    "client_secret": "pay_yeIQORCXdgimJRzZTCVw_secret_u9VvAVWDu490Tj2lA7Zr",
    "created": "2025-02-13T08:11:07.353Z",
    "currency": "GBP",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1006",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "541333",
            "card_extended_bin": null,
            "card_exp_month": "02",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "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": "[email protected]",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "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": "51cff4a6-6a2b-43f4-8496-9979e55d1621",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        }
    },
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-13T08:26:07.353Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.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": "pm_wSdofMDXLzBUvjp1kh4i",
    "payment_method_status": null,
    "updated": "2025-02-13T08:12:03.769Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": "test_ord",
    "order_tax_amount": null,
    "connector_mandate_id": null
}
  1. Automatic capture
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data-raw '{
    "amount": 6540,
    "currency": "GBP",
    "amount_to_capture": 6540,
    "confirm": true,
    "profile_id": null,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "authentication_type": "no_three_ds",
    "setup_future_usage": "on_session", 
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "customer_id": "customer123",
    
    
    
    "phone_country_code": "+1",
    "routing": { 
        "type": "single",
        "data": "stripe"
    },
    "description": "Its my first payment request",
    "return_url": "https://google.com",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": { 
        "card": {
            "card_number": "5413330300001006",
            "card_exp_month": "02",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "card_cvc": "006",
            "card_type": "visa"
        }
    },
    
    "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"
        },
        "email": "[email protected]"
    },
    "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"
        },
        "email": "[email protected]"
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "order_details": [
        {
            "product_name": "Apple iphone 15",
            "quantity": 1,
            "amount": 6540,
            "account_name": "transaction_processing"
        }
    ],
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "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": "128.0.0.1"
    },
    "customer_acceptance": {
        "acceptance_type": "offline",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "125.0.0.1",
            "user_agent": "amet irure esse"
        }
    },
    
    "connector_metadata": {
        "noon": {
            "order_category": "pay"
        }
    },
    "payment_link": false,
    "payment_link_config": {
        "theme": "",
        "logo": "",
        "seller_name": "",
        "sdk_layout": "",
        "display_sdk_only": false,
        "enabled_saved_payment_method": false
    },
    "payment_type": "normal", 
    "request_incremental_authorization": false,
    "merchant_order_reference_id": "test_ord",
    "session_expiry": 900   
}

'

Response

{
    "payment_id": "pay_VMzczCzFIwowXXE9w8OS",
    "merchant_id": "merchant_1739434149",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "getnet",
    "client_secret": "pay_VMzczCzFIwowXXE9w8OS_secret_vuIqC7LndTSFj11rDMV7",
    "created": "2025-02-13T08:13:27.282Z",
    "currency": "GBP",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1006",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "541333",
            "card_extended_bin": null,
            "card_exp_month": "02",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "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": "[email protected]",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "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": "customer123",
        "created_at": 1739434407,
        "expires": 1739438007,
        "secret": "epk_3dd3731f7cc24c7f8a7df6e8eeae7535"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "839fc50f-02ba-4314-83a6-056595d0bac0",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        }
    },
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-13T08:28:27.282Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.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-02-13T08:13:30.109Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": "test_ord",
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Refund

curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data '{
    "payment_id": "pay_VMzczCzFIwowXXE9w8OS",
    
    "amount": 600,
    "reason": "Customer returned product",
    "refund_type": "instant",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
    
}'

Response

{
    "refund_id": "ref_SCNfNPs3TV8wEk1pVvoS",
    "payment_id": "pay_VMzczCzFIwowXXE9w8OS",
    "amount": 600,
    "currency": "GBP",
    "status": "succeeded",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-02-13T08:14:13.071Z",
    "updated_at": "2025-02-13T08:14:14.387Z",
    "connector": "getnet",
    "profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
    "merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
    "split_refunds": null
}

Void

curl --location 'http://localhost:8080/payments/pay_LQ2EiF97FKn0yt0jgmk5/cancel' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_t9KANvghHomlbRfaxACFCdFQaMNiJbq2EpxojRA0OHbh9Kx5HqGJANqXGUnOk0Gr' \
--data '{
  "cancellation_reason": "requested_by_customer"
}'

Response

{
    "payment_id": "pay_LQ2EiF97FKn0yt0jgmk5",
    "merchant_id": "merchant_1739434149",
    "status": "cancelled",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "getnet",
    "client_secret": "pay_LQ2EiF97FKn0yt0jgmk5_secret_C1NVCNguIV0C3f508eM7",
    "created": "2025-02-13T08:15:07.592Z",
    "currency": "GBP",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1006",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "541333",
            "card_extended_bin": null,
            "card_exp_month": "02",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "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": "[email protected]",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": "requested_by_customer",
    "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": "d89b3a2f-3d0d-4654-91f9-0f2e67f40b49",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        }
    },
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_A7ujgD1s1bxz7eYEXSiy",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_lB9movtztBkl8qeLFQj8",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-13T08:30:07.592Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.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": "pm_8qg5T41lSXYx0qs5KU86",
    "payment_method_status": null,
    "updated": "2025-02-13T08:15:17.782Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": "test_ord",
    "order_tax_amount": null,
    "connector_mandate_id": null
}

PSync

curl --location 'http://localhost:8080/payments/pay_LQ2EiF97FKn0yt0jgmk5?force_sync=true&expand_captures=true&expand_attempts=true' \
--header 'Accept: application/json' \
--header 'api-key: dev_6HkhcQvkti3OGp1PFsRSwRzKaPnitoH7k854sEOKfOkRypAq1PCNScAYw7VrDBcJ'

Response

{
    "payment_id": "pay_qXgED4jGf5ncCz2EO3q8",
    "merchant_id": "merchant_1739379077",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "getnet",
    "client_secret": "pay_qXgED4jGf5ncCz2EO3q8_secret_tiBwvvMYD4dIUewZe8H9",
    "created": "2025-02-12T19:02:54.488Z",
    "currency": "USD",
    "customer_id": "customer123",
    "customer": {
        "id": "customer123",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "9999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": [
        {
            "refund_id": "ref_FXURRXerycqpduKOCtP2",
            "payment_id": "pay_qXgED4jGf5ncCz2EO3q8",
            "amount": 600,
            "currency": "USD",
            "status": "succeeded",
            "reason": "Customer returned product",
            "metadata": {
                "udf1": "value1",
                "new_customer": "true",
                "login_date": "2019-09-10T10:11:12Z"
            },
            "error_message": null,
            "error_code": null,
            "unified_code": null,
            "unified_message": null,
            "created_at": "2025-02-12T19:02:59.241Z",
            "updated_at": "2025-02-12T19:03:02.765Z",
            "connector": "getnet",
            "profile_id": "pro_srQZ4vZCTrjK1XhWzA7t",
            "merchant_connector_id": "mca_UcS43Fo5dQL631cFT4V3",
            "split_refunds": null
        }
    ],
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_qXgED4jGf5ncCz2EO3q8_1",
            "status": "charged",
            "amount": 6540,
            "order_tax_amount": null,
            "currency": "USD",
            "connector": "getnet",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": "b0c93eb0-d018-42e0-ac36-bf4a6e47f51d",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-02-12T19:02:54.488Z",
            "modified_at": "2025-02-12T19:02:56.271Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": "credit",
            "reference_id": null,
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "on_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1006",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "541333",
            "card_extended_bin": null,
            "card_exp_month": "02",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "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": "[email protected]"
    },
    "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": "[email protected]",
    "name": "John Doe",
    "phone": "9999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "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": "b0c93eb0-d018-42e0-ac36-bf4a6e47f51d",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": {
        "apple_pay": null,
        "airwallex": null,
        "noon": {
            "order_category": "pay"
        }
    },
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_srQZ4vZCTrjK1XhWzA7t",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_UcS43Fo5dQL631cFT4V3",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-02-12T19:17:54.488Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "128.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": "pm_r8XyBKhMfwgSeu9RMRxt",
    "payment_method_status": "active",
    "updated": "2025-02-12T19:02:56.256Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": "test_ord",
    "order_tax_amount": null,
    "connector_mandate_id": null
}

RSync

curl --location 'http://localhost:8080/refunds/ref_SCNfNPs3TV8wEk1pVvoS' \
--header 'Accept: application/json' \
--header 'api-key: dev_6HkhcQvkti3OGp1PFsRSwRzKaPnitoH7k854sEOKfOkRypAq1PCNScAYw7VrDBcJ'

Response

{
    "refund_id": "ref_FXURRXerycqpduKOCtP2",
    "payment_id": "pay_qXgED4jGf5ncCz2EO3q8",
    "amount": 600,
    "currency": "USD",
    "status": "succeeded",
    "reason": "Customer returned product",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    },
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-02-12T19:02:59.241Z",
    "updated_at": "2025-02-12T19:03:02.765Z",
    "connector": "getnet",
    "profile_id": "pro_srQZ4vZCTrjK1XhWzA7t",
    "merchant_connector_id": "mca_UcS43Fo5dQL631cFT4V3",
    "split_refunds": 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

@Sweta-Kumari-Sharma Sweta-Kumari-Sharma added A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement labels Feb 12, 2025
@Sweta-Kumari-Sharma Sweta-Kumari-Sharma self-assigned this Feb 12, 2025
@Sweta-Kumari-Sharma Sweta-Kumari-Sharma requested review from a team as code owners February 12, 2025 19:48
Copy link

semanticdiff-com bot commented Feb 12, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/getnet.rs  10% smaller
  crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs  9% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  crates/api_models/src/enums.rs  0% smaller
  crates/common_enums/src/connector_enums.rs  0% smaller
  crates/connector_configs/src/connector.rs  0% smaller
  crates/connector_configs/toml/development.toml Unsupported file format
  crates/connector_configs/toml/production.toml Unsupported file format
  crates/connector_configs/toml/sandbox.toml Unsupported file format
  crates/hyperswitch_connectors/src/utils.rs  0% smaller
  crates/hyperswitch_domain_models/src/router_request_types.rs  0% smaller
  crates/hyperswitch_interfaces/src/api.rs  0% smaller
  crates/router/src/configs/defaults/payment_connector_required_fields.rs  0% smaller
  crates/router/src/core/admin.rs  0% smaller
  crates/router/src/core/payments/flows/authorize_flow.rs  0% smaller
  crates/router/src/core/payments/flows/complete_authorize_flow.rs  0% smaller
  crates/router/src/core/payments/transformers.rs  0% smaller
  crates/router/src/core/relay/utils.rs  0% smaller
  crates/router/src/core/utils.rs  0% smaller
  crates/router/src/types/api.rs  0% smaller
  crates/router/src/types/transformers.rs  0% smaller
  crates/router/tests/connectors/utils.rs  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Getnet.js  0% smaller
  cypress-tests/cypress/e2e/configs/Payment/Utils.js  0% smaller

@Sweta-Kumari-Sharma Sweta-Kumari-Sharma changed the title getnet cards added feat(connector): [GETNET] Add cards payment flow Feb 12, 2025
@Sweta-Kumari-Sharma Sweta-Kumari-Sharma linked an issue Feb 12, 2025 that may be closed by this pull request
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Feb 12, 2025
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Feb 13, 2025
@hyperswitch-bot hyperswitch-bot bot added M-api-contract-changes Metadata: This PR involves API contract changes and removed M-api-contract-changes Metadata: This PR involves API contract changes labels Feb 13, 2025
@Sweta-Kumari-Sharma Sweta-Kumari-Sharma force-pushed the getnet-cards branch 2 times, most recently from 2088440 to b00b6c1 Compare February 13, 2025 16:10
@deepanshu-iiitu
Copy link
Contributor

Please update the crates/connector_configs/toml files as well.

@@ -1248,8 +1248,7 @@ pub fn create_webhook_url(
merchant_connector_id_or_connector_name: &str,
) -> String {
format!(
"{}/webhooks/{}/{}",
router_base_url,
"https://3489-110-227-219-118.ngrok-free.app/webhooks/{}/{}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this.

Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
let auth = getnet::GetnetAuthType::try_from(&req.connector_auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let id = auth.merchant_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let id = auth.merchant_id;
let merchant_id = auth.merchant_id;

@@ -150,6 +166,22 @@ impl ConnectorCommon for Getnet {

impl ConnectorValidation for Getnet {
//TODO: implement functions when support enabled
fn validate_connector_against_payment_request(
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove TODO comment from the PR

Comment on lines 64 to 70
#[serde(rename = "first-name")]
pub first_name: Secret<String>,
#[serde(rename = "last-name")]
pub last_name: Secret<String>,
pub email: Email,
pub phone: Option<Secret<String>>,
pub address: Address,
Copy link
Contributor

Choose a reason for hiding this comment

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

Add these fields to crates/router/src/configs/defaults/payment_connector_required_fields.rs if they are mandatory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@Sweta-Kumari-Sharma Sweta-Kumari-Sharma force-pushed the getnet-cards branch 2 times, most recently from 0dcf5f7 to 7e93823 Compare February 16, 2025 18:49
Comment on lines +1615 to +1638
[getnet]
[[getnet.credit]]
payment_method_type = "Mastercard"
[[getnet.credit]]
payment_method_type = "Visa"
[[getnet.credit]]
payment_method_type = "Interac"
[[getnet.credit]]
payment_method_type = "AmericanExpress"
[[getnet.credit]]
payment_method_type = "JCB"
[[getnet.credit]]
payment_method_type = "DinersClub"
[[getnet.credit]]
payment_method_type = "Discover"
[[getnet.credit]]
payment_method_type = "CartesBancaires"
[[getnet.credit]]
payment_method_type = "UnionPay"
[[getnet.credit]]
payment_method_type = "Rupay"
[[getnet.credit]]
payment_method_type = "Maestro"

Copy link
Contributor

Choose a reason for hiding this comment

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

Why only credit is added? What about debit cards?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Getnet documentation lists only creditcard as payment method. Ref: https://docs.getneteurope.com/PaymentMethods.html

@@ -388,6 +388,7 @@ pub trait ConnectorActions: Connector {
payment_data: Option<types::RefundsData>,
payment_info: Option<PaymentInfo>,
) -> Result<types::RefundSyncRouterData, Report<ConnectorError>> {
println!("$$$ in rsync {:?} ", payment_data);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this

enums::CaptureMethod::Automatic
| enums::CaptureMethod::Manual
| enums::CaptureMethod::ManualMultiple => Ok(()),
enums::CaptureMethod::Scheduled | enums::CaptureMethod::SequentialAutomatic => Err(
Copy link
Contributor

Choose a reason for hiding this comment

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

Add SequentialAutomatic whenever Automatic is available and SequentialAutomatic is not implemented

match capture_method {
enums::CaptureMethod::Automatic
| enums::CaptureMethod::Manual
| enums::CaptureMethod::ManualMultiple => Ok(()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is manual multiple implemented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No sequentialAutomatic and ManualMultiple got interchanged here mistakenly, Corrected

common: HashMap::from(
[
(
"payment_method_data.card.card_number".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is email and first_name, last_name not added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These fields are optional for Getnet

};
let capture_method = &item.request.capture_method;
let transaction_type = match capture_method {
Some(CaptureMethod::Automatic) => GetnetTransactionType::VoidCapture,
Copy link
Contributor

Choose a reason for hiding this comment

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

You cannot void a auto capture request from hyperswitch as it has already been captured.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be VoidPurchase. Corrected.

let transaction_type = match capture_method {
Some(CaptureMethod::Automatic) => GetnetTransactionType::VoidCapture,
Some(CaptureMethod::Manual) => GetnetTransactionType::VoidAuthorization,
Some(CaptureMethod::ManualMultiple)
Copy link
Contributor

Choose a reason for hiding this comment

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

If ManualMultiple is supported as a capture method why is not supported in void?

#[serde(rename = "card-token")]
pub card_token: CardToken,
#[serde(rename = "ip-address")]
pub ip_address: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub ip_address: String,
pub ip_address: Secret<String>,

Comment on lines 935 to 964
#[derive(Serialize, Deserialize, Debug)]
pub struct GetnetWebhookNotificationResponse {
#[serde(rename = "response-signature-base64")]
pub response_signature_base64: String,
#[serde(rename = "response-signature-algorithm")]
pub response_signature_algorithm: String,
#[serde(rename = "response-base64")]
pub response_base64: String,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these fields contain any sensitive info? If yes, we should make them secret.

#[serde(rename = "card-token")]
pub card_token: CardToken,
#[serde(rename = "ip-address")]
pub ip_address: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub ip_address: String,
pub ip_address: Secret<String>,

@Sweta-Kumari-Sharma Sweta-Kumari-Sharma force-pushed the getnet-cards branch 3 times, most recently from 9954194 to 8a826ab Compare February 18, 2025 06:23
Comment on lines +359 to +362
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetnetPaymentsResponse {
status: GetnetPaymentStatus,
id: String,
payment: PaymentResponseData,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We also need to handle webhooks response in GetnetPaymentsResponse
REFER: AdyenPaymentResponse

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 M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] [GETNET] Implement Card Flows
2 participants