{
  "openapi": "3.0.1",
  "info": {
    "title": "PciApi.Api",
    "version": "1.0"
  },
  "paths": {
    "/v1/paymentmethods": {
      "post": {
        "tags": [
          "PaymentMethods"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddPaymentMethod"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AddPaymentMethod"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AddPaymentMethod"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethodDetailsSingleResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethodDetailsSingleResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethodDetailsSingleResult"
                }
              }
            }
          }
        }
      }
    },
    "/v1/paymentmethods/{id}": {
      "put": {
        "tags": [
          "PaymentMethods"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditPaymentMethod"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/EditPaymentMethod"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/EditPaymentMethod"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethodDetailsSingleResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethodDetailsSingleResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentMethodDetailsSingleResult"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AccountOwnership": {
        "enum": [
          "Personal",
          "Company"
        ],
        "type": "string"
      },
      "AddPaymentMethod": {
        "required": [
          "accountOwnership",
          "cardName",
          "paymentMethodType",
          "user"
        ],
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/PaymentMethodUser"
          },
          "paymentMethodType": {
            "$ref": "#/components/schemas/PaymentMethodAccountType"
          },
          "accountOwnership": {
            "$ref": "#/components/schemas/AccountOwnership"
          },
          "accountNumber": {
            "type": "string",
            "nullable": true
          },
          "travellerId": {
            "type": "string",
            "nullable": true
          },
          "cardName": {
            "type": "string"
          },
          "encryptedCardNumber": {
            "type": "string",
            "format": "byte",
            "nullable": true
          },
          "isDefault": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          },
          "accountingPaymentMethod": {
            "$ref": "#/components/schemas/BankAccount"
          },
          "isAutoCreateExpenseEnabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "BankAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "externalId": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "fullName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EditPaymentMethod": {
        "required": [
          "accountOwnership",
          "cardName",
          "paymentMethodType",
          "user"
        ],
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/PaymentMethodUser"
          },
          "paymentMethodType": {
            "$ref": "#/components/schemas/PaymentMethodAccountType"
          },
          "accountOwnership": {
            "$ref": "#/components/schemas/AccountOwnership"
          },
          "accountNumber": {
            "type": "string",
            "nullable": true
          },
          "travellerId": {
            "type": "string",
            "nullable": true
          },
          "cardName": {
            "type": "string"
          },
          "encryptedCardNumber": {
            "type": "string",
            "format": "byte",
            "nullable": true
          },
          "isDefault": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          },
          "cardType": {
            "$ref": "#/components/schemas/PaymentMethodCardType"
          },
          "accountingPaymentMethod": {
            "$ref": "#/components/schemas/BankAccount"
          },
          "foreignPaymentExpenseIncreasePercentage": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "isAutoCreateExpenseEnabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ErrorMessage": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "property": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PaymentMethodAccountType": {
        "enum": [
          "Cash",
          "DebitCard",
          "CreditCard",
          "Transfer",
          "Paypal",
          "Prepaid",
          "Cheque",
          "AmericanExpress",
          "LodgeCard",
          "Kbc",
          "PurchaseCard",
          "Rydoo",
          "UbsVirtualCard"
        ],
        "type": "string"
      },
      "PaymentMethodCardType": {
        "enum": [
          "MasterCard",
          "Visa",
          "Amex",
          "Maestro",
          "Rydoo"
        ],
        "type": "string"
      },
      "PaymentMethodDetails": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "user": {
            "$ref": "#/components/schemas/PaymentMethodUser"
          },
          "paymentMethodType": {
            "$ref": "#/components/schemas/PaymentMethodAccountType"
          },
          "accountOwnership": {
            "$ref": "#/components/schemas/AccountOwnership"
          },
          "accountNumber": {
            "type": "string",
            "nullable": true
          },
          "travellerId": {
            "type": "string",
            "nullable": true
          },
          "cardName": {
            "type": "string",
            "nullable": true
          },
          "cardNumber": {
            "type": "string",
            "nullable": true
          },
          "isDefault": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          },
          "cardType": {
            "$ref": "#/components/schemas/PaymentMethodCardType"
          },
          "accountingPaymentMethod": {
            "$ref": "#/components/schemas/BankAccount"
          },
          "foreignPaymentExpenseIncreasePercentage": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "isAutoCreateExpenseEnabled": {
            "type": "boolean"
          },
          "lastSendCardValidationMailTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "validationStatus": {
            "$ref": "#/components/schemas/PaymentMethodValidationStatus"
          },
          "isReimbursable": {
            "type": "boolean"
          },
          "isCardNumberValid": {
            "type": "boolean"
          },
          "isCompanyCardEnforced": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "PaymentMethodDetailsSingleResult": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ErrorMessage"
            },
            "nullable": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResultMessage"
            },
            "nullable": true
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResultMessage"
            },
            "nullable": true
          },
          "data": {
            "$ref": "#/components/schemas/PaymentMethodDetails"
          }
        },
        "additionalProperties": false
      },
      "PaymentMethodUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "userName": {
            "type": "string",
            "nullable": true
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "avatarUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PaymentMethodValidationStatus": {
        "enum": [
          "None",
          "PendingValidation",
          "Validated",
          "Failed",
          "OptOut"
        ],
        "type": "string"
      },
      "ResultMessage": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    }
  }
}