Skip to content

Conversation

Anurag-05-prog
Copy link
Contributor

@Anurag-05-prog Anurag-05-prog commented May 19, 2025

Type of Change

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

Closes this issue

Description

Added Authorize, Capture, Void, Refund, PSync and RSync flow for cards payment method for Barclaycard. Also added connector specifications for the same connector.

Additional Changes

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

Motivation and Context

How did you test it?

Postman Tests

  1. Payment Connector - Create

Request:

curl --location 'http://localhost:8080/account/merchant_1747726068/connectors' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: ••••••' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_account_details": {
        "auth_type": auth_type,
        "api_secret": api_secret,
        "api_key": api_key,
        "key1": key1
    },
    "test_mode": false,
    "disabled": false,
    "business_country": "US",
    "business_label": "default",
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ]
}'

Response:

{
    "connector_type": "payment_processor",
    "connector_name": "barclaycard",
    "connector_label": "barclaycard_US_default",
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "connector_account_details": {
        "auth_type": auth_type,
        "api_key": "************************************",
        "key1": "*****************",
        "api_secret": "********************************************"
    },
    "payment_methods_enabled": [
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "credit",
                    "payment_experience": null,
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        },
        {
            "payment_method": "card",
            "payment_method_types": [
                {
                    "payment_method_type": "debit",
                    "payment_experience": null,
                    "card_networks": null,
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": 1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "connector_webhook_details": null,
    "metadata": null,
    "test_mode": false,
    "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. Payments - Create

Request:

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "automatic",
    "customer_id": "customer_123",
    "email": "[email protected]",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "card_number": "4347699988887777",
            "card_exp_month": "1",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "card_cvc": "555"
        }
    },
    "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"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country":"US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "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"
    }
}'

Response:

{
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "merchant_id": "merchant_1747726068",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "barclaycard",
    "client_secret": "pay_U1YF8Oy30dykRHfSzRLz_secret_9BQZ2PGg3e7ZIeIT6BAq",
    "created": "2025-05-20T07:31:28.562Z",
    "currency": "USD",
    "customer_id": "customer_123",
    "customer": {
        "id": "customer_123",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7777",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "434769",
            "card_extended_bin": null,
            "card_exp_month": "1",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "eci": null,
                "cavv": null,
                "eci_raw": null,
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "approval_code": "831000",
                "card_verification": {
                    "resultCode": "M",
                    "resultCodeRaw": "M"
                },
                "consumer_authentication_response": {
                    "code": "2",
                    "codeRaw": "2"
                }
            },
            "authentication_data": {
                "acs_transaction_id": null,
                "system_trace_audit_number": "149277",
                "retrieval_reference_number": "514007149277"
            }
        },
        "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": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "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": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "phone": null,
    "return_url": "https://duck.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": null,
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "customer_123",
        "created_at": 1747726288,
        "expires": 1747729888,
        "secret": "epk_8d2cca87e0544416b980cee5bb5a1ab3"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7477262936786891604805",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_U1YF8Oy30dykRHfSzRLz_1",
    "payment_link": null,
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-05-20T07:46:28.562Z",
    "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-05-20T07:31:34.524Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
  1. Payments - Retrieve

Request:

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

Response:

{
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "merchant_id": "merchant_1747726068",
    "status": "succeeded",
    "amount": 6540,
    "net_amount": 6540,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 6540,
    "connector": "barclaycard",
    "client_secret": "pay_U1YF8Oy30dykRHfSzRLz_secret_9BQZ2PGg3e7ZIeIT6BAq",
    "created": "2025-05-20T07:31:28.562Z",
    "currency": "USD",
    "customer_id": "customer_123",
    "customer": {
        "id": "customer_123",
        "name": null,
        "email": "[email protected]",
        "phone": null,
        "phone_country_code": null
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "attempts": [
        {
            "attempt_id": "pay_U1YF8Oy30dykRHfSzRLz_1",
            "status": "charged",
            "amount": 6540,
            "order_tax_amount": null,
            "currency": "USD",
            "connector": "barclaycard",
            "error_message": null,
            "payment_method": "card",
            "connector_transaction_id": "7477262936786891604805",
            "capture_method": "automatic",
            "authentication_type": "no_three_ds",
            "created_at": "2025-05-20T07:31:28.562Z",
            "modified_at": "2025-05-20T07:31:34.524Z",
            "cancellation_reason": null,
            "mandate_id": null,
            "error_code": null,
            "payment_token": null,
            "connector_metadata": null,
            "payment_experience": null,
            "payment_method_type": null,
            "reference_id": "pay_U1YF8Oy30dykRHfSzRLz_1",
            "unified_code": null,
            "unified_message": null,
            "client_source": null,
            "client_version": null
        }
    ],
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "7777",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "434769",
            "card_extended_bin": null,
            "card_exp_month": "1",
            "card_exp_year": "26",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "eci": null,
                "cavv": null,
                "eci_raw": null,
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "approval_code": "831000",
                "card_verification": {
                    "resultCode": "M",
                    "resultCodeRaw": "M"
                },
                "consumer_authentication_response": {
                    "code": "2",
                    "codeRaw": "2"
                }
            },
            "authentication_data": {
                "acs_transaction_id": null,
                "system_trace_audit_number": "149277",
                "retrieval_reference_number": "514007149277"
            }
        },
        "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": "PiX",
            "last_name": null
        },
        "phone": null,
        "email": null
    },
    "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": null,
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": null,
    "phone": null,
    "return_url": "https://duck.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": null,
    "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": "7477262936786891604805",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2019-09-10T10:11:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_U1YF8Oy30dykRHfSzRLz_1",
    "payment_link": null,
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-05-20T07:46:28.562Z",
    "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-05-20T07:33:57.427Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": "{\"id\":\"7477262936786891604805\",\"rootId\":\"7477262936786891604805\",\"reconciliationId\":\"7477262936786891604805\",\"submitTimeUTC\":\"2025-05-20T07:31:33Z\",\"merchantId\":\"juspay_us_sandbox\",\"applicationInformation\":{\"status\":\"PENDING\",\"reasonCode\":100,\"applications\":[{\"name\":\"ics_auth\",\"reasonCode\":\"100\",\"rCode\":\"1\",\"rFlag\":\"SOK\",\"reconciliationId\":\"7477262936786891604805\",\"rMessage\":\"Request was processed successfully.\",\"returnCode\":1010000},{\"name\":\"ics_bill\",\"status\":\"PENDING\",\"reasonCode\":\"100\",\"rCode\":\"1\",\"rFlag\":\"SOK\",\"reconciliationId\":\"7477262936786891604805\",\"rMessage\":\"Request was processed successfully.\",\"returnCode\":1260000},{\"name\":\"ics_decision\",\"reasonCode\":\"100\",\"rCode\":\"1\",\"rFlag\":\"SOK\",\"rMessage\":\"Service processed successfully\",\"returnCode\":1320000},{\"name\":\"ics_decision_early\",\"reasonCode\":\"100\",\"rCode\":\"1\",\"returnCode\":9999999}]},\"buyerInformation\":{},\"clientReferenceInformation\":{\"code\":\"pay_U1YF8Oy30dykRHfSzRLz_1\",\"applicationName\":\"REST API\",\"applicationVersion\":\"1.0\",\"partner\":{}},\"consumerAuthenticationInformation\":{\"eciRaw\":\"7\",\"strongAuthentication\":{}},\"deviceInformation\":{},\"errorInformation\":{\"message\":\"Request was processed successfully.\"},\"installmentInformation\":{},\"fraudMarkingInformation\":{},\"merchantDefinedInformation\":[{\"key\":\"1\",\"value\":\"login_date=\\\"2019-09-10T10:11:12Z\\\"\"},{\"key\":\"2\",\"value\":\"new_customer=\\\"true\\\"\"},{\"key\":\"3\",\"value\":\"udf1=\\\"value1\\\"\"}],\"merchantInformation\":{\"merchantDescriptor\":{\"name\":\"juspay_us_sandbox\"}},\"orderInformation\":{\"billTo\":{\"firstName\":\"JOSEPH\",\"lastName\":\"DOE\",\"address1\":\"1467\",\"locality\":\"San Fransico\",\"administrativeArea\":\"CA\",\"postalCode\":\"94122\",\"email\":\"[email protected]\",\"country\":\"US\"},\"shipTo\":{},\"amountDetails\":{\"totalAmount\":\"65.4\",\"currency\":\"USD\",\"taxAmount\":\"0\",\"authorizedAmount\":\"65.4\"},\"shippingDetails\":{},\"invoiceDetails\":{},\"lineItems\":[{\"productCode\":\"default\",\"taxAmount\":0,\"quantity\":1,\"unitPrice\":65.4}]},\"paymentInformation\":{\"customer\":{},\"paymentInstrument\":{},\"instrumentIdentifier\":{},\"shippingAddress\":{},\"paymentType\":{\"name\":\"vdcvantiv\",\"type\":\"credit card\",\"method\":\"VI\"},\"card\":{\"suffix\":\"7777\",\"prefix\":\"434769\",\"expirationMonth\":\"1 \",\"expirationYear\":\"26  \",\"type\":\"001\"},\"invoice\":{},\"accountFeatures\":{},\"fluidData\":{},\"issuerInformation\":{\"country\":\"US\"},\"paymentAccountInformation\":{\"card\":{},\"features\":{},\"network\":{}}},\"paymentInsightsInformation\":{\"responseInsights\":{},\"ruleResults\":{}},\"payoutInformation\":{\"pushFunds\":{},\"pullFunds\":{}},\"payoutOptions\":{},\"processingInformation\":{\"paymentSolution\":\"Visa\",\"commerceIndicator\":\"7\",\"commerceIndicatorLabel\":\"internet\",\"authorizationOptions\":{\"authType\":\"O\",\"initiator\":{\"merchantInitiatedTransaction\":{}},\"cardVerificationIndicator\":false},\"bankTransferOptions\":{},\"japanPaymentOptions\":{},\"fundingOptions\":{\"firstRecurringPayment\":false},\"ecommerceIndicator\":\"7\",\"reconciliationId\":\"7477262936786891604805\",\"captureOptions\":{}},\"processorInformation\":{\"processor\":{\"name\":\"vdcvantiv\"},\"networkTransactionId\":\"016153570198200\",\"approvalCode\":\"831000\",\"responseCode\":\"00\",\"avs\":{\"code\":\"Y\",\"codeRaw\":\"Y\"},\"cardVerification\":{\"resultCode\":\"M\"},\"achVerification\":{\"resultCodeRaw\":\"00\"},\"electronicVerificationResults\":{},\"systemTraceAuditNumber\":\"149277\",\"eventStatus\":\"Pending\",\"retrievalReferenceNumber\":\"514007149277\"},\"pointOfSaleInformation\":{},\"riskInformation\":{\"profile\":{\"name\":\"Standard mid-market profile\",\"decision\":\"ACCEPT\"},\"rules\":[{\"name\":\"Fraud Score - Monitor\",\"decision\":\"IGNORE\"},{\"name\":\"Fraud Score - Reject\",\"decision\":\"IGNORE\"},{\"name\":\"Fraud Score - Review\",\"decision\":\"IGNORE\"},{\"name\":\"Invalid Address\",\"decision\":\"IGNORE\"}],\"score\":{\"factorCodes\":[\"H\",\"P\"],\"result\":3}},\"recipientInformation\":{},\"senderInformation\":{\"account\":{},\"paymentInformation\":{\"customer\":{},\"paymentType\":{\"name\":\"vdcvantiv\",\"type\":\"credit card\",\"method\":\"VI\"},\"card\":{\"suffix\":\"7777\",\"expirationMonth\":\"1 \",\"expirationYear\":\"26  \",\"type\":\"001\"},\"invoice\":{},\"accountFeatures\":{},\"fluidData\":{},\"issuerInformation\":{},\"paymentAccountInformation\":{}}},\"tokenInformation\":{},\"_links\":{\"self\":{\"href\":\"https://api.smartpayfuse-test.barclaycard/tss/v2/transactions/7477262936786891604805\",\"method\":\"GET\"}},\"recurringPaymentInformation\":{},\"unscheduledPaymentInformation\":{}}"
}
  1. Refunds - Create

Request:

curl --location 'http://localhost:8080/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data '{
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "amount": 6540,
    "reason": "Customer returned product",
    "refund_type": "instant"  
}'

Response:

{
    "refund_id": "ref_9KXjMEdZ4PZDcFWAwNmC",
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "amount": 6540,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": null,
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-05-20T07:35:51.909Z",
    "updated_at": "2025-05-20T07:35:53.786Z",
    "connector": "barclaycard",
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
  1. Refunds - Retrieve

Request:

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

Response:

{
    "refund_id": "ref_9KXjMEdZ4PZDcFWAwNmC",
    "payment_id": "pay_U1YF8Oy30dykRHfSzRLz",
    "amount": 6540,
    "currency": "USD",
    "status": "pending",
    "reason": "Customer returned product",
    "metadata": null,
    "error_message": null,
    "error_code": null,
    "unified_code": null,
    "unified_message": null,
    "created_at": "2025-05-20T07:35:51.909Z",
    "updated_at": "2025-05-20T07:37:20.756Z",
    "connector": "barclaycard",
    "profile_id": "pro_pehtYfNAEJUejck1GkP6",
    "merchant_connector_id": "mca_BSrgu17zDqS7EXYvqz9O",
    "split_refunds": null,
    "issuer_error_code": null,
    "issuer_error_message": null
}
  1. Feature Matrix

Request:

curl --location 'http://localhost:8080/feature_matrix' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key'

Response:

{
    "connector_count": 1,
    "connectors": [
        {
            "name": "BARCLAYCARD",
            "display_name": "BarclayCard SmartPay Fuse",
            "description": "Barclaycard, part of Barclays Bank UK PLC, is a leading global payment business that helps consumers, retailers and businesses to make and take payments flexibly, and to access short-term credit and point of sale finance.",
            "category": "bank_acquirer",
            "supported_payment_methods": [
                {
                    "payment_method": "card",
                    "payment_method_type": "credit",
                    "payment_method_type_display_name": "Credit Card",
                    "mandates": "not_supported",
                    "refunds": "supported",
                    "supported_capture_methods": [
                        "automatic",
                        "manual",
                        "sequential_automatic"
                    ],
                    "three_ds": "not_supported",
                    "no_three_ds": "supported",
                    "supported_card_networks": [
                        "Mastercard",
                        "Visa",
                        "AmericanExpress",
                        "JCB",
                        "Discover",
                        "Maestro",
                        "Interac",
                        "DinersClub",
                        "CartesBancaires",
                        "UnionPay"
                    ],
                    "supported_countries": null,
                    "supported_currencies": null,
                },
                {
                    "payment_method": "card",
                    "payment_method_type": "debit",
                    "payment_method_type_display_name": "Debit Card",
                    "mandates": "not_supported",
                    "refunds": "supported",
                    "supported_capture_methods": [
                        "automatic",
                        "manual",
                        "sequential_automatic"
                    ],
                    "three_ds": "not_supported",
                    "no_three_ds": "supported",
                    "supported_card_networks": [
                        "Mastercard",
                        "Visa",
                        "AmericanExpress",
                        "JCB",
                        "Discover",
                        "Maestro",
                        "Interac",
                        "DinersClub",
                        "CartesBancaires",
                        "UnionPay"
                    ],
                    "supported_countries": null,
                    "supported_currencies": null,
                }
            ],
            "supported_webhook_flows": []
        }
    ]
}

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

@Anurag-05-prog Anurag-05-prog self-assigned this May 19, 2025
@Anurag-05-prog Anurag-05-prog requested review from a team as code owners May 19, 2025 04:39
Copy link

semanticdiff-com bot commented May 19, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/tests/connectors/barclaycard.rs  75% smaller
  crates/hyperswitch_connectors/src/connectors/barclaycard.rs  9% smaller
  crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs  8% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  api-reference/openapi_spec.json  0% smaller
  config/config.example.toml Unsupported file format
  config/deployments/integration_test.toml Unsupported file format
  config/deployments/production.toml Unsupported file format
  config/deployments/sandbox.toml Unsupported file format
  config/development.toml Unsupported file format
  config/docker_compose.toml Unsupported file format
  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/router/src/core/admin.rs  0% smaller
  crates/router/src/types/api.rs  0% smaller
  crates/router/src/types/transformers.rs  0% smaller
  loadtest/config/development.toml Unsupported file format

@Anurag-05-prog Anurag-05-prog linked an issue May 19, 2025 that may be closed by this pull request
2 tasks
@Anurag-05-prog Anurag-05-prog changed the title Barclaycard cards flow feat(connector): Barclaycard cards flow May 19, 2025
@deepanshu-iiitu deepanshu-iiitu changed the base branch from main to barclays-template May 20, 2025 09:09
@deepanshu-iiitu deepanshu-iiitu requested review from a team as code owners May 20, 2025 09:09
@deepanshu-iiitu deepanshu-iiitu changed the base branch from barclays-template to main May 20, 2025 09:09
@deepanshu-iiitu deepanshu-iiitu removed request for a team May 21, 2025 08:14
Comment on lines 789 to 808
let connector_payment_id = req.request.connector_transaction_id.clone();
match req.request.capture_method {
Some(enums::CaptureMethod::Automatic)
| Some(enums::CaptureMethod::SequentialAutomatic) => Ok(format!(
"{}pts/v2/payments/{connector_payment_id}/refunds",
self.base_url(connectors)
)),
Some(enums::CaptureMethod::Manual) => Ok(format!(
"{}pts/v2/captures/{connector_payment_id}/refunds",
self.base_url(connectors)
)),
Some(enums::CaptureMethod::ManualMultiple)
| Some(enums::CaptureMethod::Scheduled)
| None => Err(utils::construct_not_implemented_error_report(
req.request
.capture_method
.unwrap_or(enums::CaptureMethod::ManualMultiple),
self.id(),
)),
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Test that if /payments works for both, if yes remove /captures

@Anurag-05-prog Anurag-05-prog changed the title feat(connector): Barclaycard cards flow feat(connector): [Barclaycard] Implemented Cards - Non3DS flow May 21, 2025
@Anurag-05-prog Anurag-05-prog changed the title feat(connector): [Barclaycard] Implemented Cards - Non3DS flow feat(connector): [Barclaycard] Implement Cards - Non 3DS flow May 21, 2025
Chethan-rao
Chethan-rao previously approved these changes May 22, 2025
@hyperswitch-bot hyperswitch-bot bot dismissed stale reviews from Chethan-rao and deepanshu-iiitu via dd96851 May 23, 2025 07:30
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label May 23, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue May 26, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 26, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue May 27, 2025
Merged via the queue into main with commit 01af474 May 27, 2025
14 of 20 checks passed
@likhinbopanna likhinbopanna deleted the barclaycard-cards-flow branch May 27, 2025 10:28
pixincreate added a commit that referenced this pull request May 30, 2025
…ordea-sepa

* 'main' of github.com:juspay/hyperswitch: (30 commits)
  chore(version): 2025.05.30.0
  chore(ci): update postman ci credentials (#8172)
  chore(docs): remove old add_connector.md file (#8143)
  refactor: Payment Attempt as mandatory field in PaymentStatusData (#8126)
  fix(payment_link): sanitize embedded payment link data (#7736)
  chore(version): 2025.05.29.0
  feat(analytics): Add ckh columns for 3ds intelligence analytics (#8136)
  refactor(debit_routing): Handle missing merchant_business_country by defaulting to US (#8141)
  chore(version): 2025.05.28.0
  refactor(success_based): add support for exploration (#8158)
  feat(dynamic_routing): add get api for dynamic routing volume split (#8114)
  fix: incorrect payout_method_id in payouts table (#8107)
  feat(router): Enable client_secret auth for payments_get_intent [v2] (#8119)
  chore: address Rust 1.87.0 clippy lints (#8130)
  feat: list for dynamic routing (#8111)
  ci(cypress): fix mandates unsupported connectors (#8086)
  feat(connector): [Barclaycard] Implement Cards - Non 3DS flow (#8068)
  fix(authentication): add Organization context validation in `Merchant Create` and `Merchant List` APIs (#8103)
  feat(connector): [Worldpayxml] add card payment (#8076)
  feat(connector): Stripe revolut pay wallet integration (#8066)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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] [Barclaycard] Implement Card Flows
4 participants