{
  "swagger": "2.0",
  "info": {
    "title": "Reactive Manager API - Balance Update Events",
    "version": "1.0"
  },
  "tags": [
    {
      "name": "BalanceUpdateEventController"
    }
  ],
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/rx-api/transactions/v1/balance-update": {
      "post": {
        "summary": "Balance Update Event",
        "description": "Reports the player's current balance after a transaction or account activity. Out-of-order and duplicate submissions are handled automatically — only the event with the most recent date is applied to the player's balance record.",
        "operationId": "BalanceUpdateEventController_ProcessBalanceUpdate",
        "responses": {
          "202": {
            "description": "Accepted",
            "schema": {}
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/ResponseHttpErrorResponse"
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {}
          },
          "500": {
            "description": "500 (Error) Internal server Error",
            "schema": {}
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/ReactiveBalanceEventsProcessBalanceUpdateRequest"
            }
          }
        ],
        "tags": [
          "BalanceUpdateEventController"
        ],
        "security": [
          {
            "OAuth2": []
          }
        ]
      }
    }
  },
  "definitions": {
    "ReactiveBalanceEventsProcessBalanceUpdateRequest": {
      "type": "object",
      "properties": {
        "requestId": {
          "type": "string",
          "description": "Unique request identifier used for idempotency. Duplicate requests with the same requestId will be discarded."
        },
        "playerId": {
          "type": "string",
          "description": "The Player unique identifier."
        },
        "date": {
          "type": "string",
          "description": "The date of transaction in RFC 3339 format, for example 2019-10-13T07:20:50.52Z."
        },
        "currency": {
          "type": "string",
          "description": "Player currency code in ISO 4217 format, for example CHF."
        },
        "exchangeRate": {
          "type": "number",
          "format": "double",
          "description": "The exchange rate at the date of base currency. For CHF use 1."
        },
        "transactionStatus": {
          "type": "string",
          "description": "The status of the transaction or balance update."
        },
        "reason": {
          "type": "string",
          "description": "The reason why the balance was updated."
        },
        "realMoneyBalance": {
          "type": "string",
          "description": "Current real money balance after the transaction or balance update, in the currency of the player. A value of '0' is valid and will overwrite the stored balance when this request is the most recent one by date. This field is represented as a string to guarantee exact precision over the network and avoid floating-point calculation errors. The value must be a valid numeric string using a dot ('.') strictly as the decimal separator. Thousands separators are not allowed (e.g., send '1500.50' instead of '1,500.50' or '1.500,50')."
        },
        "bonusMoneyBalance": {
          "type": "string",
          "description": "Current bonus money balance after the transaction or balance update, in the currency of the player. A value of '0' is valid and will overwrite the stored balance when this request is the most recent one by date. This field is represented as a string to guarantee exact precision over the network and avoid floating-point calculation errors. The value must be a valid numeric string using a dot ('.') strictly as the decimal separator. Thousands separators are not allowed (e.g., send '1500.50' instead of '1,500.50' or '1.500,50')."
        },
        "brandId": {
          "type": "string",
          "description": "Brand ID unique identifier."
        }
      },
      "required": [
        "requestId",
        "playerId",
        "date",
        "currency",
        "exchangeRate",
        "reason",
        "realMoneyBalance",
        "bonusMoneyBalance"
      ]
    },
    "ResponseDetails": {
      "type": "object",
      "properties": {
        "faultCode": {
          "type": "integer",
          "format": "int32"
        },
        "fields": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/ResponseField"
          }
        }
      }
    },
    "ResponseField": {
      "type": "object",
      "properties": {
        "field": {
          "type": "string"
        },
        "error": {
          "type": "string"
        }
      }
    },
    "ResponseHttpErrorResponse": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        },
        "request": {
          "$ref": "#/definitions/ResponseRequest"
        },
        "details": {
          "$ref": "#/definitions/ResponseDetails"
        },
        "timestamp": {
          "type": "string"
        }
      }
    },
    "ResponseRequest": {
      "type": "object",
      "properties": {
        "xRequestId": {
          "type": "string"
        },
        "sourceIp": {
          "type": "string"
        },
        "method": {
          "type": "string"
        },
        "uri": {
          "type": "string"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "protobufAny": {
      "type": "object",
      "properties": {
        "@type": {
          "type": "string"
        }
      },
      "additionalProperties": {}
    },
    "rpcStatus": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/protobufAny"
          }
        }
      }
    }
  },
  "securityDefinitions": {
    "OAuth2": {
      "type": "oauth2",
      "description": "The client needs to authenticate themselves for this request. The auth request return a valid JWT access token",
      "flow": "application",
      "tokenUrl": "https://platform-api-customer-instance-id.gamanzaengage.com/api/oauth/v1/token"
    }
  }
}
