Skip to content

Conversation

@iemyashasvi
Copy link

@iemyashasvi iemyashasvi commented Nov 4, 2025

Description

CeleroCommerce Connector Integration
Flows implemented
Auth (Manual , Automatic) , Capture ,Psync ,Rsync , Void ,Refund

Motivation and Context

Additional Changes

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

How did you test it?

Tested using GRPCurls using the mockserver of CeleroCommerce in hyperswitch

Auth Request
grpcurl -plaintext \ 
          -H 'x-connector: celero' \
          -H 'x-auth: header-key' \
          -H 'x-api-key: '$CELERO_API_KEY \
          -H 'x-merchant-id: test_merchant' \
          -H 'x-tenant-id: tenant' \
          -d '{
            "request_ref_id": {"id": "test_celero_auth_001"},  
            "amount": 1299,                            
            "currency": "USD",                         
            "payment_method": {            
              "card": {       
                "credit": {                     
                  "card_number": {"value": "4111111111111111"},
                  "card_exp_month": {"value": "12"},
                  "card_exp_year": {"value": "30"},
                  "card_cvc": {"value": "123"},
                  "card_network": "VISA"
                }
              }
            },
            "connector_customer_id": "test_customer_celero_123",
            "return_url": "https://www.example.com/return",
            "capture_method": "MANUAL",   
            "address": {},
            "auth_type": "NO_THREE_DS",
            "enrolled_for_3ds": false,
            "request_incremental_authorization": false,
            "minor_amount": 1299,
            "browser_info": {
              "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
              "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
              "language": "en-US",
              "color_depth": 24,
              "screen_height": 1080,
              "screen_width": 1920,
              "java_enabled": false
            }
          }' localhost:8000 ucs.v2.PaymentService/Authorize

Response

{
  "transactionId": {
    "id": "txn_tansc9n7em"
  },
  "status": "AUTHORIZED",
  "rawConnectorResponse": {
    "value": "{\"status\":\"success\",\"msg\":\"Transaction processed\",\"data\":{\"id\":\"txn_tansc9n7em\",\"type\":\"authorize\",\"amount\":1299,\"currency\":\"USD\",\"response\":{\"card\":{\"status\":\"approved\",\"auth_code\":\"324642\",\"processor_response_code\":\"00\",\"avs_response_code\":\"Y\"}},\"created_at\":\"2025-11-04T11:05:34.154Z\",\"updated_at\":\"2025-11-04T11:05:34.154Z\"}}"
  },
  "statusCode": 200,
  "responseHeaders": {
    "access-control-allow-origin": "*",
    "connection": "keep-alive",
    "content-length": "329",
    "content-type": "application/json; charset=utf-8",
    "date": "Tue, 04 Nov 2025 11:05:34 GMT",
    "etag": "W/\"149-E0Jd6avuY5Xv7uC8c2CLhV/J+bk\"",
    "keep-alive": "timeout=5",
    "x-powered-by": "Express"
  },
  "state": {
    "connectorCustomerId": "test_customer_celero_123"
  },
  "rawConnectorRequest": {
    "value": "{\"body\":{\"amount\":1299,\"currency\":\"USD\",\"idempotency_key\":\"test_celero_auth_001_idempotency\",\"order_id\":\"test_celero_auth_001\",\"payment_method\":{\"card\":{\"cvc\":\"123\",\"expiration_date\":\"12/30\",\"number\":\"4111111111111111\"}},\"type\":\"authorize\"},\"headers\":{\"Authorization\":\"celero-test-api-key-123\",\"Content-Type\":\"application/json\",\"via\":\"HyperSwitch\"},\"method\":\"POST\",\"url\":\"http://localhost:3010/celero/api/transaction\"}"
  }
}

Capture Request
 grpcurl -plaintext \                                             
    -H "x-connector: celero" \      
    -H "x-auth: header-key" \      
    -H "x-api-key: $CELERO_API_KEY" \      
    -H "x-merchant-id: test_merchant" \      
    -H "x-tenant-id: tenant" \      
    -d '{      
      "transaction_id": { "id": "txn_jy6ty39qes" },      
      "request_ref_id": { "id": "celero_capture_001" },
      "amount_to_capture": 1299,                      
      "currency": "USD"                    
    }' \               
    localhost:8000 ucs.v2.PaymentService/Capture

Response

{
  "transactionId": {
    "id": "txn_jy6ty39qes"
  },
  "status": "CHARGED",
  "statusCode": 200,
  "responseHeaders": {
    "access-control-allow-origin": "*",
    "connection": "keep-alive",
    "content-length": "62",
    "content-type": "application/json; charset=utf-8",
    "date": "Tue, 04 Nov 2025 11:03:22 GMT",
    "etag": "W/\"3e-EQXO3ZRFwTPDpnxRbnIv0ZCPjPA\"",
    "keep-alive": "timeout=5",
    "x-powered-by": "Express"
  },
  "rawConnectorRequest": {
    "value": "{\"body\":{\"amount\":1299},\"headers\":{\"Authorization\":\"celero-test-api-key-123\",\"Content-Type\":\"application/json\",\"via\":\"HyperSwitch\"},\"method\":\"POST\",\"url\":\"http://localhost:3010/celero/api/transaction/txn_jy6ty39qes/capture\"}"
  }
}


Refund

Request

 grpcurl -plaintext \                                            
          -H 'x-connector: celero' \
          -H 'x-auth: header-key' \
          -H 'x-api-key: '$CELERO_API_KEY \
          -H 'x-merchant-id: test_merchant' \
          -H 'x-tenant-id: tenant' \
          -d '{
            "request_ref_id": {"id": "test_celero_refund_001"},
            "refund_id": "refund_celero_001",
            "transaction_id": {"id": "txn_glckku2w5a"},
            "payment_amount": 1299,
            "currency": "USD",
            "minor_payment_amount": 1299,
            "refund_amount": 650,
            "minor_refund_amount": 650,
            "reason": "Customer requested partial refund"
          }' localhost:8000 ucs.v2.PaymentService/Refund

Response

{
  "transactionId": {},
  "refundId": "refund_txn_glckku2w5a",
  "status": "REFUND_SUCCESS",
  "rawConnectorResponse": {
    "value": "{\"status\":\"success\",\"msg\":\"Transaction refunded successfully\",\"data\":null}"
  },
  "statusCode": 200,
  "responseHeaders": {
    "access-control-allow-origin": "*",
    "connection": "keep-alive",
    "content-length": "74",
    "content-type": "application/json; charset=utf-8",
    "date": "Tue, 04 Nov 2025 11:05:04 GMT",
    "etag": "W/\"4a-86cvwxLin3hcBWSdyF8RoY4gQ+Y\"",
    "keep-alive": "timeout=5",
    "x-powered-by": "Express"
  },
  "rawConnectorRequest": {
    "value": "{\"body\":{\"amount\":650},\"headers\":{\"Authorization\":\"celero-test-api-key-123\",\"Content-Type\":\"application/json\",\"via\":\"HyperSwitch\"},\"method\":\"POST\",\"url\":\"http://localhost:3010/celero/api/transaction/txn_glckku2w5a/refund\"}"
  }
}

Void Request
 grpcurl -plaintext \
      -H 'x-connector: celero' \
      -H 'x-auth: header-key' \
      -H 'x-api-key: '$CELERO_API_KEY \
      -H 'x-merchant-id: test_merchant' \
      -H 'x-tenant-id: tenant' \
      -d '{    
        "transaction_id": {"id": "txn_tansc9n7em"},          
        "request_ref_id": {"id": "test_celero_void_001"},              
        "cancellation_reason": "Customer requested cancellation",
        "currency":"USD"
      }' localhost:8000 ucs.v2.PaymentService/Void

Response

{
  "transactionId": {
    "id": "txn_tansc9n7em"
  },
  "status": "VOIDED",
  "statusCode": 200,
  "responseHeaders": {
    "access-control-allow-origin": "*",
    "connection": "keep-alive",
    "content-length": "60",
    "content-type": "application/json; charset=utf-8",
    "date": "Tue, 04 Nov 2025 11:05:59 GMT",
    "etag": "W/\"3c-2kf5R3+ZgFHjF6o4a8q7alLUVfA\"",
    "keep-alive": "timeout=5",
    "x-powered-by": "Express"
  },
  "rawConnectorRequest": {
    "value": "{\"body\":null,\"headers\":{\"Authorization\":\"celero-test-api-key-123\",\"Content-Type\":\"application/json\",\"via\":\"HyperSwitch\"},\"method\":\"POST\",\"url\":\"http://localhost:3010/celero/api/transaction/txn_tansc9n7em/void\"}"
  }
}

@iemyashasvi iemyashasvi self-assigned this Nov 4, 2025
@iemyashasvi iemyashasvi requested review from a team as code owners November 4, 2025 11:29
@iemyashasvi iemyashasvi added GRACE alpha This is an Alpha integration , code generated and tested by mock server , not on sandbox API's labels Nov 4, 2025
@iemyashasvi iemyashasvi force-pushed the celero-grace-implementation branch from 0938171 to 008d357 Compare November 11, 2025 11:02
#[serde(rename = "type")]
pub transaction_type: CeleroTransactionType,
pub amount: MinorUnit,
pub currency: String,

Choose a reason for hiding this comment

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

use enum currency

..item.router_data
});
}
CeleroCardStatus::Refunded => AttemptStatus::Charged,

Choose a reason for hiding this comment

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

Why is Refunded marked as charged?

Comment on lines +538 to +550
pub struct CeleroBillingAddressResponse {
pub first_name: Option<String>,
pub last_name: Option<String>,
pub company: Option<String>,
pub address_line_1: Option<String>,
pub address_line_2: Option<String>,
pub city: Option<String>,
pub state: Option<String>,
pub postal_code: Option<String>,
pub country: Option<String>,
pub phone: Option<String>,
pub fax: Option<String>,
pub email: Option<String>,

Choose a reason for hiding this comment

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

make pii fields secret and use struct Email for email

Comment on lines +597 to +608
impl TryFrom<&RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>>
for CeleroSyncRequest
{
type Error = error_stack::Report<errors::ConnectorError>;

fn try_from(
_item: &RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
// Empty request for GET-based sync - transaction ID is passed in URL
Ok(Self {})
}
}

Choose a reason for hiding this comment

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

this is not needed

// Capture response structure (uses same format as payment response)
#[derive(Debug, Deserialize, Serialize)]
pub struct CeleroCaptureResponse {
pub status: String,

Choose a reason for hiding this comment

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

Why is status string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alpha This is an Alpha integration , code generated and tested by mock server , not on sandbox API's GRACE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants