{
  "x-generator": "NSwag v14.7.1.0 (NJsonSchema v11.6.1.0 (Newtonsoft.Json v13.0.0.0))",
  "openapi": "3.0.0",
  "info": {
    "title": "Integration API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api-sandbox.n1co.shop/api/v1",
      "description": "Sandbox"
    },
    {
      "url": "https://api.n1co.com/api/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/Charges": {
      "post": {
        "tags": [
          "Charges"
        ],
        "operationId": "Charges_Charge",
        "requestBody": {
          "x-name": "command",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChargeInputPayload"
              }
            }
          },
          "required": true,
          "x-position": 1
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EPayCheckoutResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": [
              "EPay.ReadWrite.OwnedBy"
            ]
          }
        ]
      }
    },
    "/PaymentMethods": {
      "post": {
        "tags": [
          "PaymentMethods"
        ],
        "operationId": "PaymentMethods_CreateExternalBuyerPaymentMethod",
        "requestBody": {
          "x-name": "command",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateExternalBuyerPaymentMethodCommand"
              }
            }
          },
          "required": true,
          "x-position": 1
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalPaymentMethodResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": [
              "EPay.ReadWrite.OwnedBy"
            ]
          }
        ]
      },
      "put": {
        "tags": [
          "PaymentMethods"
        ],
        "operationId": "PaymentMethods_UpdateExternalBuyerPaymentMethod",
        "requestBody": {
          "x-name": "command",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateExternalBuyerPaymentMethodCommand"
              }
            }
          },
          "required": true,
          "x-position": 1
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExternalPaymentMethodResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": [
              "EPay.ReadWrite.OwnedBy"
            ]
          }
        ]
      }
    },
    "/Refunds": {
      "post": {
        "tags": [
          "Refunds"
        ],
        "operationId": "Refunds_RefundOrder",
        "requestBody": {
          "x-name": "command",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EPayCancelOrderCommand"
              }
            }
          },
          "required": true,
          "x-position": 1
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefundResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": [
              "EPay.ReadWrite.OwnedBy"
            ]
          }
        ]
      }
    },
    "/Setup3ds": {
      "post": {
        "tags": [
          "Setup3ds"
        ],
        "operationId": "Setup3ds_Setup3ds",
        "requestBody": {
          "x-name": "command",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Setup3dsCommand"
              }
            }
          },
          "required": true,
          "x-position": 1
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Setup3dsResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": [
              "Epay.3ds.Auth"
            ]
          }
        ]
      }
    },
    "/Token": {
      "post": {
        "tags": [
          "Token"
        ],
        "operationId": "Token_Get",
        "requestBody": {
          "x-name": "query",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetMicrosoftIdentityTokenQuery"
              }
            }
          },
          "required": true,
          "x-position": 1
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MicrosoftIdentityTokenDto"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "EPayCheckoutResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EPayResponse"
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "chargeId": {
                "type": "string",
                "nullable": true
              },
              "orderId": {
                "type": "string",
                "nullable": true
              },
              "paymentId": {
                "type": "string",
                "nullable": true
              },
              "amount": {
                "type": "number",
                "format": "decimal"
              },
              "captureAmount": {
                "type": "number",
                "format": "decimal",
                "nullable": true
              },
              "currency": {
                "type": "string",
                "nullable": true
              },
              "paid": {
                "type": "boolean"
              },
              "captured": {
                "type": "boolean"
              },
              "capturedAt": {
                "type": "string",
                "format": "date-time"
              },
              "status": {
                "type": "string",
                "nullable": true
              },
              "authorizationCode": {
                "type": "string",
                "nullable": true
              },
              "error": {
                "nullable": true,
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/EPayCheckoutError"
                  }
                ]
              }
            }
          }
        ]
      },
      "EPayCheckoutError": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "EPayResponse": {
        "type": "object",
        "x-abstract": true,
        "additionalProperties": false,
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "ChargeInputPayload": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "order": {
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/ChargeOrderPayload"
              }
            ]
          },
          "customerId": {
            "type": "string",
            "nullable": true
          },
          "cardId": {
            "type": "string",
            "nullable": true
          },
          "authenticationId": {
            "type": "string",
            "nullable": true
          },
          "cvv": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "ChargeOrderPayload": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "ExternalPaymentMethodResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EPayResponse"
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "nullable": true
              },
              "type": {
                "type": "string",
                "nullable": true
              },
              "bin": {
                "nullable": true,
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/BinDto"
                  }
                ]
              }
            }
          }
        ]
      },
      "BinDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "brand": {
            "type": "string",
            "nullable": true
          },
          "issuerName": {
            "type": "string",
            "nullable": true
          },
          "countryCode": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "CreateExternalBuyerPaymentMethodCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "customer": {
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/EPayBuyerDto"
              }
            ]
          },
          "card": {
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/ExternalBuyerPaymentMethodInfoDto"
              }
            ]
          }
        }
      },
      "EPayBuyerDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "ExternalBuyerPaymentMethodInfoDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "number": {
            "type": "string",
            "nullable": true
          },
          "expirationMonth": {
            "type": "string",
            "nullable": true
          },
          "expirationYear": {
            "type": "string",
            "nullable": true
          },
          "cvv": {
            "type": "string",
            "nullable": true
          },
          "cardHolder": {
            "type": "string",
            "nullable": true
          },
          "singleUse": {
            "type": "boolean"
          }
        }
      },
      "UpdateExternalBuyerPaymentMethodCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "customerId": {
            "type": "string",
            "nullable": true
          },
          "cardId": {
            "type": "string",
            "nullable": true
          },
          "card": {
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/UpdateExternalBuyerPaymentMethodInfoDto"
              }
            ]
          }
        }
      },
      "UpdateExternalBuyerPaymentMethodInfoDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "cardHolder": {
            "type": "string",
            "nullable": true
          },
          "expirationMonth": {
            "type": "string",
            "nullable": true
          },
          "expirationYear": {
            "type": "string",
            "nullable": true
          },
          "cvv": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "RefundResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "orderId": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "currency": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "EPayCancelOrderCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "orderId": {
            "type": "string",
            "nullable": true
          },
          "cancellationReason": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "Setup3dsResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "status": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "authenticationUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          }
        }
      },
      "Setup3dsCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "orderInformation": {
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrderInformationDto"
              }
            ]
          },
          "clientInformation": {
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/ClientInformationDto"
              }
            ]
          },
          "card": {
            "nullable": true,
            "oneOf": [
              {
                "$ref": "#/components/schemas/CardInformationDto"
              }
            ]
          },
          "returnUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          }
        }
      },
      "OrderInformationDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "totalAmount": {
            "type": "number",
            "format": "decimal"
          }
        }
      },
      "ClientInformationDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "address": {
            "type": "string",
            "nullable": true
          },
          "locality": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "billState": {
            "type": "string",
            "nullable": true
          },
          "billZip": {
            "type": "string",
            "nullable": true
          },
          "shipToZip": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "CardInformationDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "cardId": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "MicrosoftIdentityTokenDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "tokenType": {
            "type": "string",
            "nullable": true
          },
          "accessToken": {
            "type": "string",
            "nullable": true
          },
          "expiresIn": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "GetMicrosoftIdentityTokenQuery": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "clientId": {
            "type": "string",
            "nullable": true
          },
          "clientSecret": {
            "type": "string",
            "nullable": true
          }
        }
      }
    },
    "securitySchemes": {
      "JWT": {
        "type": "http",
        "description": "JWT access token returned by POST /Token.",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}