swagger: "2.0"
host: "vendor-gw.fabric.tnxs.net:8080"
securityDefinitions:
  ApiKeyAuth:
    type: apiKey
    in: header
    name: X-API-Key
security:
  - ApiKeyAuth: []
basePath: "/v1"
schemes:
  - "http"
info:
  version: 1.2.7
  title: "vendor-gw"
  contact:
    email: "noc@taxnexus.net"
  license:
    name: "Proprietary - Copyright (c) 2018-2021 by Taxnexus, Inc."
  termsOfService: "https://www.taxnexus.com/terms/"
  description: |
    # Taxnexus Vendor Gateway
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  itemNumberPath:
    description: The Item Number
    in: path
    name: item
    required: true
    type: string
  itemNumberQuery:
    description: The Item Number
    in: query
    name: item
    required: false
    type: string
  lastModifiedEndQuery:
    description: The last modified end timestamp
    in: query
    name: endDate
    required: false
    type: string
  lastModifiedStartQuery:
    description: The last modified start timestamp
    in: query
    name: startDate
    required: false
    type: string
  licenseNumberQuery:
    description: The Licnese Number for the query
    in: query
    name: license
    required: false
    type: string
  limitQuery:
    description: "How many objects to return at one time"
    format: int64
    in: query
    name: limit
    required: false
    type: integer
  nameQuery:
    description: The Name of the Object
    in: query
    name: name
    required: false
    type: string
  offsetQuery:
    description: How many objects to skip
    format: int64
    in: query
    name: offset
    required: false
    type: integer
  partnerKeyQuery:
    description: The Partner Key
    in: query
    name: partner
    required: false
    type: string
  poIdQuery:
    description: The ID Purchase Order to be retrieved
    in: query
    name: poId
    required: false
    type: string
  stateCodeQuery:
    description: The 2-character State Code
    in: query
    name: state
    required: true
    type: string
  taxnexusUserQuery:
    description: Taxnexus User Account Number (T0000001)
    in: query
    name: user
    required: true
    type: string
  userKeyQuery:
    description: The Taxnexus User's Key on the Vendor API
    in: query
    name: user
    required: true
    type: string
  vendorQuery:
    description: The name of the Vendor Gateway to be used
    enum:
      - blaze
      - metrc
    in: query
    name: vendor
    required: false
    type: string
responses:
  AccessForbidden:
    description: Access forbidden, account lacks access
    schema:
      $ref: "#/definitions/Error"
  Conflict:
    description: Conflict
    schema:
      $ref: "#/definitions/Error"
  InvalidDataError:
    description: Invalid data was sent
    schema:
      $ref: "#/definitions/InvalidError"
  InvoiceResponse:
    description: An array of Invoice (full) objects
    schema:
      $ref: "#/definitions/InvoiceResponse"
  AccountResponse:
    description: An array of AccountBasic objects
    schema:
      $ref: "#/definitions/AccountResponse"
  NotFound:
    description: Resource was not found
    schema:
      $ref: "#/definitions/Error"
  PurchaseOrderResponse:
    description: An array of Purchase Order objects
    schema:
      $ref: "#/definitions/PurchaseOrderResponse"
  ServerError:
    description: Server Internal Error
    schema:
      $ref: "#/definitions/Error"
  Unauthorized:
    description: Access unauthorized, invalid API-KEY was used
    schema:
      $ref: "#/definitions/Error"
  UnprocessableEntity:
    description: Unprocessable Entity, likely a bad parameter
    schema:
      $ref: "#/definitions/Error"
paths:
  /accounts:
    get:
      tags:
        - Accounts
      operationId: getAccounts
      description:
        Get the Stores, Accounts or other entities that correspond to
        locations
      parameters:
        - $ref: "#/parameters/licenseNumberQuery"
        - $ref: "#/parameters/partnerKeyQuery"
        - $ref: "#/parameters/stateCodeQuery"
        - $ref: "#/parameters/userKeyQuery"
        - $ref: "#/parameters/vendorQuery"
      responses:
        "200":
          $ref: "#/responses/AccountResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      summary: Get Accounts for this User
  /invoices:
    get:
      summary: Get a list of Invoices
      operationId: getInvoices
      description: Return a list of available Taxnexus Invoices
      tags:
        - Invoices
      parameters:
        - $ref: "#/parameters/itemNumberQuery"
        - $ref: "#/parameters/lastModifiedEndQuery"
        - $ref: "#/parameters/lastModifiedStartQuery"
        - $ref: "#/parameters/licenseNumberQuery"
        - $ref: "#/parameters/limitQuery"
        - $ref: "#/parameters/offsetQuery"
        - $ref: "#/parameters/partnerKeyQuery"
        - $ref: "#/parameters/stateCodeQuery"
        - $ref: "#/parameters/userKeyQuery"
        - $ref: "#/parameters/vendorQuery"
      responses:
        "200":
          description:
            A list of Invoices for this User was retrieved successfully
          schema:
            $ref: "#/definitions/InvoiceResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
  /pos:
    get:
      summary: Get a list of Purchase Orders
      operationId: getPos
      description: Return a list of available Purchase Orders
      tags:
        - PurchaseOrders
      parameters:
        - $ref: "#/parameters/lastModifiedEndQuery"
        - $ref: "#/parameters/lastModifiedStartQuery"
        - $ref: "#/parameters/licenseNumberQuery"
        - $ref: "#/parameters/limitQuery"
        - $ref: "#/parameters/offsetQuery"
        - $ref: "#/parameters/partnerKeyQuery"
        - $ref: "#/parameters/poIdQuery"
        - $ref: "#/parameters/stateCodeQuery"
        - $ref: "#/parameters/userKeyQuery"
        - $ref: "#/parameters/vendorQuery"
      responses:
        "200":
          $ref: "#/responses/PurchaseOrderResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
definitions:
  AccountBasic:
    properties:
      AccountNumber:
        description: Account Number
        type: string
      BillingAddress:
        $ref: "#/definitions/Address"
      BillingContact:
        $ref: "#/definitions/ContactBasic"
      ID:
        description: Taxnexus Record Id Only; not used in POST
        type: string
      License:
        $ref: "#/definitions/LicenseBasic"
      Name:
        description: Account Name
        type: string
      ParentFK:
        description:
          UUID Reference the master record that owns this item
        type: string
      Phone:
        description: Phone number
        type: string
      Ref:
        description: "Source System identifier for this record, if any"
        type: string
      ShippingAddress:
        $ref: "#/definitions/Address"
      ShippingContact:
        $ref: "#/definitions/ContactBasic"
      Type:
        description: Account Type
        type: string
      UUID:
        description: Unique Taxnexus ID
        type: string
      Website:
        description: Account Website
        type: string
    type: object
  AccountResponse:
    properties:
      data:
        items:
          $ref: "#/definitions/AccountBasic"
        type: array
      meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  Address:
    properties:
      City:
        description: City
        type: string
      Country:
        description: Country full name
        type: string
      CountryCode:
        description: Country Code
        type: string
      Postalcode:
        description: Postal Code
        type: string
      State:
        description: State full name
        type: string
      StateCode:
        description: State Code
        type: string
      Street:
        description: Street number and name
        type: string
    type: object
  ContactBasic:
    properties:
      AccountID:
        description: Contact Account Id
        type: string
      Email:
        description: Email
        type: string
      ID:
        description: Taxnexus Record Id Only; not used in POST
        type: string
      MailingAddress:
        $ref: "#/definitions/Address"
      MobilePhone:
        description: Mobile
        type: string
      Name:
        description: Name
        type: string
      ParentFK:
        description:
          UUID Reference the master record that owns this item
        type: string
      Ref:
        description: Source System identifier for this record, if any
        type: string
      UUID:
        description: Unique Taxnexus ID
        type: string
    type: object
  Error:
    properties:
      error:
        type: string
      status:
        maximum: 600
        minimum: 100
        type: integer
    type: object
  InvalidError:
    allOf:
      - $ref: "#/definitions/Error"
      - properties:
          details:
            items:
              type: string
            type: array
        type: object
  InvoiceBasic:
    properties:
      AccountID:
        description:
          Account Identifier from Source System; copied to the Tax
          Transaction result records
        type: string
      AccountName:
        description:
          Account Name from source system (not used in tax calculations)
        type: string
      Amount:
        description: Invoice Amount; ignored in tax calculation
        format: double
        type: number
      AmountDue:
        description: Amount Due; ignored in tax calculations
        format: double
        type: number
      BusinessAddress:
        $ref: "#/definitions/Address"
      CustomerID:
        description:
          The Customer ID linked to this invoice from the source system
        type: string
      EstimatedAmount:
        description: Invoice Total from source system
        format: double
        type: number
      EstimatedCannabisTax:
        description: Cannabis Tax from source system
        format: double
        type: number
      EstimatedCOGS:
        description: Cost of Goods Sold from source system
        type: number
        format: double
      EstimatedDiscount:
        description:
          An amount the Invoice is discounted in source Invoice
        format: double
        type: number
      EstimatedBusinessTax:
        description: Business Tax from source system
        format: double
        type: number
      EstimatedSalesTax:
        description: Sales Tax from source system
        format: double
        type: number
      EstimatedSubtotal:
        description: Subtotal from source system
        format: double
        type: number
      JobID:
        description: Taxnexus Job ID
        type: string
      ID:
        description: Taxnexus Record Id Only; not used in POST
        type: string
      InvoiceDate:
        description:
          Invoice Date; should be date only or correct time zone if in
          time notation
        type: string
      InvoiceNumber:
        description:
          Source System Customer-Facing Invoice Number; ignored in tax
          calculation
        type: string
      Items:
        description: The items associated with this Invoice
        items:
          $ref: "#/definitions/ItemBasic"
        type: array
      ParentFK:
        description:
          UUID Reference to a master record that owns this item
        type: string
      Ref:
        description:
          Source System identifier for this record, if any; copied to
          invoiceid in Tax Transaction result records
        type: string
      SalesRegulation:
        description:
          Sales Regulation Type; must be one of the listed values
        type: string
      ShippingHandling:
        description:
          The total amount of shipping and delivery charges on this
          invoice from the source system
        format: double
        type: number
      Status:
        description:
          Status used by for Billing Balances; ignored in tax
          calculation
        type: string
      Subtotal:
        description: Subtotal (not used in tax calculation)
        format: double
        type: number
      Type:
        description: Invoice Type (not used in tax calculation)
        type: string
      UUID:
        description: Unique Taxnexus Id assigned during ingest
        type: string
    type: object
  InvoiceResponse:
    properties:
      data:
        items:
          $ref: "#/definitions/InvoiceBasic"
        type: array
      meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  ItemBasic:
    properties:
      COGS:
        description: Cost of Goods Sold for this Item
        example: 0
        type: number
      Description:
        description: Line Item Description (not used in tax calculation)
        example: string
        type: string
      ID:
        description: Taxnexus Record Id Only; not used in POST
        example: string
        type: string
      InvoiceID:
        description: Source System Parent Foreign Key to Invoice
        example: string
        type: string
      ListPrice:
        description: The pre-discount price of the item
        example: 0
        type: number
      MRCInterval:
        description: The pre-discount price of the item
        example: 0
        format: int64
        type: number
      ParentFK:
        description:
          UUID Reference the master record that owns this item
        example: string
        type: string
      ProductCode:
        description: Product Code (not used in tax calculation)
        example: string
        type: string
      Quantity:
        description: Quantity
        example: 0
        type: number
      Ref:
        description:
          "Source System identifier for this record, if any; copied to
          invoiceitemid in Tax Transaction result records"
        example: string
        type: string
      SalesRegulation:
        description: Sales Regulation Type
        example: string
        type: string
      ShippingHandling:
        description: Shipping & Handling and Delivery Fees for this Item
        example: 0
        type: number
      Subtotal:
        description: Subtotal (not used in tax calculation)
        example: 0
        type: number
      TaxnexusCode:
        description: Taxnexus Code
        example: string
        type: string
      UnitPrice:
        description: Unit Price
        example: 0
        type: number
      Units:
        description: The Unit of Measure for this item
        type: string
      UUID:
        description: Unique Taxnexus ID
        example: string
        type: string
    type: object
  LicenseBasic:
    properties:
      DateIssued:
        description: Date Issued
        type: string
      ExpirationDate:
        description: Expiration Date
        type: string
      ID:
        description: Taxnexus Record Id
        type: string
      IsCanceled:
        description: Is Canceled?
        type: boolean
      IsRevoked:
        description: Is Revoked?
        type: boolean
      LicenseType:
        description: License State and Type
        type: string
      Name:
        description: License Number
        type: string
      ParentFK:
        description:
          UUID Reference the master record that owns this item
        type: string
      Ref:
        description: Source System identifier for this record, if any
        type: string
      Status:
        description: License Status
        type: string
      UUID:
        description: Unique Taxnexus ID
        type: string
    type: object
  Pagination:
    properties:
      next_link:
        type: string
      p_limit:
        format: int64
        type: integer
      p_offset:
        format: int64
        type: integer
      page_size:
        format: int64
        type: integer
      set_size:
        format: int64
        type: integer
    type: object
  PurchaseOrderBasic:
    properties:
      AccountID:
        description: Account ID
        type: string
      Amount:
        description: Purchase Order Amount
        format: float64
        type: number
      AmountDue:
        description: Amount Due
        type: number
      BusinessAddress:
        $ref: "#/definitions/Address"
      ID:
        description: Order Id
        type: string
      Items:
        items:
          $ref: "#/definitions/ItemBasic"
        type: array
      ParentFK:
        description:
          UUID Reference the master record that owns this item
        type: string
      PODate:
        description: Purcahse Order Date
        type: string
      PONumber:
        description: Purchase Order Number
        type: string
      Ref:
        description: Source System identifier for this record, if any
        type: string
      SalesRegulation:
        description: Sales Regulation Type
        type: string
      Status:
        description: Status
        type: string
      Subtotal:
        description: Subtotal
        format: float64
        type: number
      Type:
        description: Type
        type: string
      UUID:
        description: Unique Taxnexus ID
        type: string
    type: object
  PurchaseOrderResponse:
    properties:
      data:
        items:
          $ref: "#/definitions/PurchaseOrderBasic"
        type: array
      meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  ResponseMeta:
    properties:
      Contact:
        description: Microservice Contact Info
        type: string
      Copyright:
        description: Copyright Info
        type: string
      License:
        description: License Information and Restrictions
        type: string
      OperationID:
        description: Operation ID
        type: string
      Pagination:
        $ref: "#/definitions/Pagination"
      RequestIP:
        description: Request IP Address
        type: string
      RequestType:
        description: Request Type
        type: string
      RequestURL:
        description: Request URL
        type: string
      ServerInfo:
        description: Data Server Info
        type: string
      ServerResponseTime:
        description: Data Server Response Time (ms)
        type: string
      ServerTimeStamp:
        description: Backend Server Timestamp
        type: string
      TaxnexusAccount:
        description:
          Taxnexus Account Number used for recording transactions
        type: string
    type: object
