{
  "openapi": "3.0.3",
  "info": {
    "title": "Internal JOD Payment API",
    "version": "1.0.0"
  },
  "paths": {
    "/api/v1/payments": {
      "post": {
        "description": "Requires payments:write, authorized source debit and destination receive. First completion 201, identical replay 200. Rejections are durable. All responses after transaction commit.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "400": {
            "description": "MALFORMED_MESSAGE, VALIDATION_FAILED, TLS_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "FORBIDDEN",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "ACCOUNT_NOT_FOUND / NOT_FOUND (non-disclosure)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "406": {
            "description": "NOT_ACCEPTABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "description": "ACCOUNT_NOT_ACTIVE, INSUFFICIENT_FUNDS, IDEMPOTENCY_CONFLICT, PAYMENT_LIMIT_EXCEEDED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "description": "MALFORMED_MESSAGE (body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "415": {
            "description": "UNSUPPORTED_MEDIA_TYPE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            },
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "200": {
            "description": "Original stored completed receipt, identical replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Receipt"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Payment"
              },
              "example": {
                "paymentId": "d92192df-f79a-4553-8120-5660d2eb1294",
                "fromAccount": "ACC-1001",
                "toAccount": "ACC-2002",
                "amount": "125.750",
                "date": "2026-10-28T13:30:00+03:00",
                "purpose": "Invoice INV-2048",
                "notes": "October services"
              }
            },
            "application/xml": {
              "schema": {
                "$ref": "#/components/schemas/Payment"
              },
              "example": "<payment><paymentId>d92192df-f79a-4553-8120-5660d2eb1294</paymentId><fromAccount>ACC-1001</fromAccount><toAccount>ACC-2002</toAccount><amount>125.750</amount><date>2026-10-28T13:30:00+03:00</date><purpose>Invoice INV-2048</purpose><notes>October services</notes></payment>"
            }
          }
        }
      }
    },
    "/api/v1/payments/{paymentId}": {
      "get": {
        "description": "Requires payments:read. Only submitting principal may retrieve. Unknown or unrelated payment returns 404. Durable rejected outcome returned with 200.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "400": {
            "description": "MALFORMED_MESSAGE, VALIDATION_FAILED, TLS_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "FORBIDDEN",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "ACCOUNT_NOT_FOUND / NOT_FOUND (non-disclosure)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "406": {
            "description": "NOT_ACCEPTABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "description": "ACCOUNT_NOT_ACTIVE, INSUFFICIENT_FUNDS, IDEMPOTENCY_CONFLICT, PAYMENT_LIMIT_EXCEEDED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "description": "MALFORMED_MESSAGE (body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "415": {
            "description": "UNSUPPORTED_MEDIA_TYPE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Receipt"
                    },
                    {
                      "$ref": "#/components/schemas/Error"
                    }
                  ]
                }
              },
              "application/xml": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Receipt"
                    },
                    {
                      "$ref": "#/components/schemas/Error"
                    }
                  ]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "paymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ]
      }
    },
    "/api/v1/accounts/{accountId}/balance": {
      "get": {
        "description": "Requires payments:read and account ownership or debit grant.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "400": {
            "description": "MALFORMED_MESSAGE, VALIDATION_FAILED, TLS_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "FORBIDDEN",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "ACCOUNT_NOT_FOUND / NOT_FOUND (non-disclosure)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "406": {
            "description": "NOT_ACCEPTABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "description": "ACCOUNT_NOT_ACTIVE, INSUFFICIENT_FUNDS, IDEMPOTENCY_CONFLICT, PAYMENT_LIMIT_EXCEEDED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "description": "MALFORMED_MESSAGE (body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "415": {
            "description": "UNSUPPORTED_MEDIA_TYPE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accountId": {
                      "type": "string"
                    },
                    "availableBalance": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "JOD"
                      ]
                    }
                  }
                }
              },
              "application/xml": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accountId": {
                      "type": "string"
                    },
                    "availableBalance": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "enum": [
                        "JOD"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/v1/admin/reconciliation": {
      "get": {
        "description": "Requires payments:admin. Reports ledger count/balance and opening balance reconciliation.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "400": {
            "description": "MALFORMED_MESSAGE, VALIDATION_FAILED, TLS_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "UNAUTHENTICATED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "description": "FORBIDDEN",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "ACCOUNT_NOT_FOUND / NOT_FOUND (non-disclosure)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "406": {
            "description": "NOT_ACCEPTABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "description": "ACCOUNT_NOT_ACTIVE, INSUFFICIENT_FUNDS, IDEMPOTENCY_CONFLICT, PAYMENT_LIMIT_EXCEEDED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "413": {
            "description": "MALFORMED_MESSAGE (body too large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "415": {
            "description": "UNSUPPORTED_MEDIA_TYPE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "RATE_LIMITED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "TEMPORARILY_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Correlation-ID": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "healthy": {
                      "type": "boolean"
                    },
                    "unbalancedPayments": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "inconsistentAccounts": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "application/xml": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "healthy": {
                      "type": "boolean"
                    },
                    "unbalancedPayments": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "inconsistentAccounts": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "Payment": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "paymentId",
          "fromAccount",
          "toAccount",
          "amount",
          "date",
          "purpose"
        ],
        "properties": {
          "paymentId": {
            "type": "string",
            "format": "uuid"
          },
          "fromAccount": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "toAccount": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "amount": {
            "oneOf": [
              {
                "type": "number",
                "minimum": 0.001,
                "maximum": 10000,
                "multipleOf": 0.001
              },
              {
                "type": "string",
                "pattern": "^[0-9]+(\\.[0-9]{1,3})?$"
              }
            ]
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "purpose": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "notes": {
            "type": "string",
            "maxLength": 1000
          }
        },
        "xml": {
          "name": "payment"
        }
      },
      "Receipt": {
        "type": "object",
        "properties": {
          "paymentId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "COMPLETED",
              "REJECTED"
            ]
          },
          "fromAccount": {
            "type": "string"
          },
          "toAccount": {
            "type": "string"
          },
          "amount": {
            "type": "string",
            "pattern": "^\\d+\\.\\d{3}$"
          },
          "currency": {
            "type": "string",
            "enum": [
              "JOD"
            ]
          },
          "processedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "status",
          "code",
          "message",
          "issues",
          "correlationId",
          "timestamp"
        ],
        "properties": {
          "paymentId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "ERROR",
              "REJECTED"
            ]
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          },
          "correlationId": {
            "type": "string",
            "format": "uuid"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}