{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "DynamoTransactionSns",
  "title": "DynamoTransactionSns",
  "properties": {
    "url": {
      "type": "string",
      "pattern": "(https?://(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*))"
    },
    "transaction": {
      "type": "object",
      "properties": {
        "bankId": {
          "type": "string",
          "pattern": "^[0-9]{4,}$"
        },
        "amount": {
          "type": "object",
          "properties": {
            "subtotalIva": {
              "type": "integer",
              "minimum": 0
            },
            "subtotalIva0": {
              "type": "integer",
              "minimum": 0
            },
            "iva": {
              "type": "integer",
              "minimum": 0
            },
            "extraTaxes": {
              "type": "object",
              "properties": {
                "propina": {
                  "type": "integer",
                  "minimum": 0
                },
                "tasaAeroportuaria": {
                  "type": "integer",
                  "minimum": 0
                },
                "agenciaDeViajes": {
                  "type": "integer",
                  "minimum": 0
                },
                "iac": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "required": ["subtotalIva", "subtotalIva0", "iva"]
        },
        "callbackUrl": {
          "type": "string"
        },
        "userType": {
          "type": "string",
          "enum": ["0", "1"]
        },
        "documentType": {
          "type": "string",
          "enum": ["CC", "NIT", "CE", "TI", "PP"]
        },
        "documentNumber": {
          "type": "string",
          "pattern": "^[0-9]{6,}$"
        },
        "paymentDescription": {
          "type": "string"
        },
        "created": {
          "type": "number"
        },
        "status": {
          "type": "string"
        },
        "token": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9]{32}$"
        },
        "publicMerchantId": {
          "type": "string",
          "pattern": "^[0-9]{22,32}$"
        },
        "userIp": {
          "type": "string"
        },
        "trazabilityCode": {
          "type": "string",
          "pattern": "^[0-9]+"
        },
        "returnCode": {
          "type": "string",
          "enum": [
            "SUCCESS",
            "FAIL_ENTITYNOTEXISTSORDISABLED",
            "FAIL_BANKNOTEXISTSORDISABLED",
            "FAIL_SERVICENOTEXISTS",
            "FAIL_INVALIDAMOUNT",
            "FAIL_INVALIDSOLICITDATE",
            "FAIL_BANKUNREACHEABLE",
            "FAIL_NOTCONFIRMEDBYBANK",
            "FAIL_CANNOTGETCURRENTCYCLE",
            "FAIL_ACCESSDENIED",
            "FAIL_TIMEOUT",
            "FAIL_DESCRIPTIONNOTFOUND",
            "FAIL_EXCEEDEDLIMIT",
            "FAIL_TRANSACTIONNOTALLOWED"
          ]
        },
        "bankurl": {
          "type": "string"
        },
        "transactionCycle": {
          "type": "string"
        },
        "ticketNumber": {
          "type": "string",
          "pattern": "^[0-9]{6,}$"
        }
      },
      "required": [
        "bankId",
        "amount",
        "callbackUrl",
        "userType",
        "documentType",
        "documentNumber",
        "created",
        "status",
        "token",
        "publicMerchantId",
        "userIp"
      ]
    }
  },
  "required": ["transaction", "url"],
  "type": "object"
}
