{
  "description": "Test vectors for the X-Cashela-Signature check of Cashela Pay-In notifications. signature = lower-case hex HMAC-SHA256 of '{timestamp}.{nonce}.{body}' with the secret. expect_valid is what a correct verifier answers; 'stale-timestamp' must be rejected because its timestamp is outside tolerance_seconds of the current time.",
  "cases": [
    {
      "name": "valid",
      "secret": "whsec_test_0123456789abcdef",
      "timestamp": "1759838400",
      "nonce": "8f14e45f-ceea-467d-9a0b-000000000001",
      "body": "{\"ref\":\"PI-TEST-0001\",\"external_identifier\":\"partner-order-0001\",\"status\":\"COMPLETED\",\"date\":\"2025-10-07T12:00:00.000000Z\",\"amount\":4750.5,\"currency\":\"CLP\",\"settlement_currency\":\"USD\",\"net_amount\":5,\"processing_fee_amount\":0.25,\"fx_spread_amount\":0,\"tax_amount\":0,\"card\":null}",
      "expected_signature": "b2e80494a3da3d33cfb2c38b1c6c334efb46ed098b4f29f24760da6831de0f6c",
      "expect_valid": true
    },
    {
      "name": "tampered-body",
      "secret": "whsec_test_0123456789abcdef",
      "timestamp": "1759838400",
      "nonce": "8f14e45f-ceea-467d-9a0b-000000000001",
      "body": "{\"ref\":\"PI-TEST-0001\",\"external_identifier\":\"partner-order-0001\",\"status\":\"CANCELLED\",\"date\":\"2025-10-07T12:00:00.000000Z\",\"amount\":4750.5,\"currency\":\"CLP\",\"settlement_currency\":\"USD\",\"net_amount\":5,\"processing_fee_amount\":0.25,\"fx_spread_amount\":0,\"tax_amount\":0,\"card\":null}",
      "expected_signature": "b2e80494a3da3d33cfb2c38b1c6c334efb46ed098b4f29f24760da6831de0f6c",
      "expect_valid": false
    },
    {
      "name": "reserialized-body",
      "secret": "whsec_test_0123456789abcdef",
      "timestamp": "1759838400",
      "nonce": "8f14e45f-ceea-467d-9a0b-000000000001",
      "body": "{\n    \"ref\": \"PI-TEST-0001\",\n    \"external_identifier\": \"partner-order-0001\",\n    \"status\": \"COMPLETED\",\n    \"date\": \"2025-10-07T12:00:00.000000Z\",\n    \"amount\": 4750.5,\n    \"currency\": \"CLP\",\n    \"settlement_currency\": \"USD\",\n    \"net_amount\": 5,\n    \"processing_fee_amount\": 0.25,\n    \"fx_spread_amount\": 0,\n    \"tax_amount\": 0,\n    \"card\": null\n}",
      "expected_signature": "b2e80494a3da3d33cfb2c38b1c6c334efb46ed098b4f29f24760da6831de0f6c",
      "expect_valid": false
    },
    {
      "name": "wrong-secret",
      "secret": "whsec_test_wrong",
      "timestamp": "1759838400",
      "nonce": "8f14e45f-ceea-467d-9a0b-000000000001",
      "body": "{\"ref\":\"PI-TEST-0001\",\"external_identifier\":\"partner-order-0001\",\"status\":\"COMPLETED\",\"date\":\"2025-10-07T12:00:00.000000Z\",\"amount\":4750.5,\"currency\":\"CLP\",\"settlement_currency\":\"USD\",\"net_amount\":5,\"processing_fee_amount\":0.25,\"fx_spread_amount\":0,\"tax_amount\":0,\"card\":null}",
      "expected_signature": "b2e80494a3da3d33cfb2c38b1c6c334efb46ed098b4f29f24760da6831de0f6c",
      "expect_valid": false
    },
    {
      "name": "stale-timestamp",
      "secret": "whsec_test_0123456789abcdef",
      "timestamp": "100",
      "nonce": "8f14e45f-ceea-467d-9a0b-000000000001",
      "body": "{\"ref\":\"PI-TEST-0001\",\"external_identifier\":\"partner-order-0001\",\"status\":\"COMPLETED\",\"date\":\"2025-10-07T12:00:00.000000Z\",\"amount\":4750.5,\"currency\":\"CLP\",\"settlement_currency\":\"USD\",\"net_amount\":5,\"processing_fee_amount\":0.25,\"fx_spread_amount\":0,\"tax_amount\":0,\"card\":null}",
      "expected_signature": "b6723175ec84f4bfe6e9066a03f235517f4d0168d355f1bfab99606e7339a4bb",
      "expect_valid": false,
      "tolerance_seconds": 300
    }
  ]
}
