swagger: "2.0"
info:
  version: 1.3.0
  title: "plex"
  description: "System Operations Microservice"
  termsOfService: "http://taxnexus.net/terms/"
  contact:
    email: "noc@taxnexus.net"
  license:
    name: "Proprietary - Copyright (c) 2018-2021 by Taxnexus, Inc."
securityDefinitions:
  ApiKeyAuth:
    type: "apiKey"
    in: "header"
    name: "X-API-Key"
security:
  - ApiKeyAuth: []
schemes:
  - "http"
basePath: "/v1"
host: "plex.fabric.tnxs.net:8080"
consumes:
  - "application/json"
produces:
  - "application/json"
parameters:
  accountIdQuery:
    description: Taxnexus Record Id of an Account
    in: query
    name: accountId
    required: false
    type: string
  accountIdQueryRequired:
    description: Taxnexus Record Id of an Account
    in: query
    name: accountId
    required: true
    type: string
  monthQuery:
    description: "The Month Number (1,2, ..., 12) of the report"
    format: int64
    in: query
    name: month
    required: false
    type: number
  quarterQuery:
    description: "The Quarter Number (1,2,3,4) of the report"
    format: int64
    in: query
    name: quarter
    required: false
    type: number
  semiannualQuery:
    description: The Semiannual Number (1,2) of the report
    format: int64
    in: query
    name: semiannual
    required: false
    type: number
  yearQuery:
    description: The year of the report
    format: int64
    in: query
    name: year
    required: false
    type: number
responses:
  AccessForbidden:
    description: "Access forbidden, account lacks access"
    schema:
      $ref: "#/definitions/Error"
  NotFound:
    description: Resource was not found
    schema:
      $ref: "#/definitions/Error"
  ServerError:
    description: Server Internal Error
    schema:
      $ref: "#/definitions/Error"
  TaxSummaryResponse:
    description: Taxnexus Response with TaxSummaryResponse Objects
    schema:
      $ref: "#/definitions/TaxSummaryResponse"
  InvoiceSummaryResponse:
    description: Taxnexus Response with TaxSummaryResponse Objects
    schema:
      $ref: "#/definitions/InvoiceSummaryResponse"
  InvoiceItemSummaryResponse:
    description: Taxnexus Response with TaxSummaryResponse Objects
    schema:
      $ref: "#/definitions/InvoiceItemSummaryResponse"
  TaxReturnResponse:
    description: The California CDTFA Sales and Use Tax Return
    schema:
      $ref: "#/definitions/TaxReturnResponse"
  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"
  UseTaxResponse:
    description: Taxnexus Response with TaxSummaryResponse Objects
    schema:
      $ref: "#/definitions/UseTaxResponse"
paths:
  /taxreturns/salesanduse:
    get:
      description: Return CDTFA Sales & Use Tax Return
      operationId: getSalesAndUseTaxReturn
      parameters:
        - $ref: "#/parameters/accountIdQuery"
        - $ref: "#/parameters/yearQuery"
        - $ref: "#/parameters/quarterQuery"
        - $ref: "#/parameters/monthQuery"
        - $ref: "#/parameters/semiannualQuery"
      responses:
        "200":
          $ref: "#/responses/TaxReturnResponse"
        "401":
          $ref: "#/responses/Unauthorized"
        "403":
          $ref: "#/responses/AccessForbidden"
        "404":
          $ref: "#/responses/NotFound"
        "422":
          $ref: "#/responses/UnprocessableEntity"
        "500":
          $ref: "#/responses/ServerError"
      summary: TaxReturn use tax summaries for an Account
      tags:
        - Tax
definitions:
  AdditionalDeductions:
    properties:
      Amount:
        type: number
      Description:
        type: string
      NonTaxableAmount:
        type: number
    type: object
  DistrictTaxes:
    properties:
      Adjustments:
        type: number
        format: double
      County:
        type: string
      District:
        type: string
      DistrictTaxDue:
        type: number
        format: double
      NetTaxableAmount:
        type: number
      Rate:
        type: number
        format: double
      TaxableAmount:
        type: number
        format: double
    type: object
  Error:
    properties:
      Code:
        format: int64
        type: number
      Fields:
        type: string
      Message:
        type: string
    type: object
  InvoiceItemSummary:
    properties:
      COGS:
        format: double
        type: number
      PeriodName:
        description: The Period Name of the summary line
        type: string
      PlaceGeocode:
        description: Taxnexus Geocode for this group of item summaries
        type: string
      ShippingHandling:
        format: double
        type: number
      Subtotal:
        format: double
        type: number
      TaxnexusCode:
        type: string
    type: object
  InvoiceItemSummaryResponse:
    description: An array of Invoice Item Summary Reporting Objects
    properties:
      Data:
        items:
          $ref: "#/definitions/InvoiceItemSummary"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  InvoiceSummary:
    properties:
      Amount:
        format: double
        type: number
      BusinessTax:
        format: double
        type: number
      CannabisTax:
        format: double
        type: number
      EstimatedAmount:
        format: double
        type: number
      EstimatedBusinessTax:
        format: double
        type: number
      EstimatedCOGS:
        format: double
        type: number
      EstimatedCannabisTax:
        format: double
        type: number
      EstimatedDiscount:
        format: double
        type: number
      EstimatedSalesTax:
        format: double
        type: number
      EstimatedSubtotal:
        format: double
        type: number
      PeriodName:
        description: The Period Name of the summary line
        type: string
      PlaceGeocode:
        description: Taxnexus Geocode for this group of item summaries
        format: string
      SalesRegulation:
        type: string
      SalesTax:
        format: double
        type: number
      Subtotal:
        format: double
        type: number
    type: object
  InvoiceSummaryResponse:
    description: An array of Invoice Summary Reporting Objects
    properties:
      Data:
        items:
          $ref: "#/definitions/InvoiceSummary"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  Pagination:
    properties:
      Limit:
        format: int64
        type: integer
      Offset:
        format: int64
        type: integer
      PageSize:
        format: int64
        type: integer
      SetSize:
        format: int64
        type: integer
    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
  TaxReturn:
    properties:
      AdditionalDeductions:
        items:
          $ref: "#/definitions/AdditionalDeductions"
        type: array
      AdditionalDeductionsAmount:
        format: double
        type: number
      AssetSales:
        type: number
        format: double
      SummaryReport:
        $ref: "#/definitions/TaxReturnPanel"
      CountyReports:
        items:
          $ref: "#/definitions/TaxReturnPanel"
        type: array
      DistrictReports:
        items:
          $ref: "#/definitions/TaxReturnPanel"
        type: array
      DistrictTaxes:
        items:
          $ref: "#/definitions/DistrictTaxes"
        type: array
      ExcessTaxCollected:
        type: number
        format: double
      FixturesAndEquipment:
        type: number
        format: double
      FoodSales:
        type: number
        format: double
      GovSales:
        type: number
        format: double
      Interest:
        type: number
        format: double
      InterstateSales:
        type: number
        format: double
      Name:
        type: string
      Code:
        type: string
      Month:
        type: number
        format: int64
      Year:
        type: number
        format: int64
      Quarter:
        type: number
        format: int64
      PeriodHeaders:
        type: array
        items:
          type: string
      NetTaxableAmountToBeReported:
        type: number
        format: double
      NonTaxableLabor:
        type: number
        format: double
      Penalty:
        type: number
        format: double
      RemainingTax:
        type: number
        format: double
      ResaleSales:
        type: number
        format: double
      SalesTaxIncluded:
        type: number
        format: double
      TaxDue:
        type: number
        format: double
      TotalSales:
        format: double
        type: number
      TotalSalesAndPurchases:
        type: number
        format: double
      TotalTax:
        type: number
        format: double
      TotalTaxDueBeforeCredits:
        type: number
        format: double
      TotalTaxPrepayments:
        type: number
        format: double
      UseTaxSales:
        format: double
        type: number
    type: object
  TaxReturnPanel:
    properties:
      BusinessTaxes:
        items:
          type: number
        type: array
      BusinessTaxesTotal:
        format: double
        type: number
      CannabisCOGS:
        items:
          format: double
          type: number
        type: array
      CannabisCOGSTotal:
        format: double
        type: number
      CannabisGrossMargin:
        items:
          format: double
          type: number
        type: array
      CannabisGrossMarginPercentageAverage:
        format: double
        type: number
      CannabisGrossMarginPerentage:
        items:
          format: double
          type: number
        type: array
      CannabisGrossMarginTotal:
        format: double
        type: number
      CannabisRevenue:
        items:
          format: double
          type: number
        type: array
      CannabisRevenueTotal:
        format: double
        type: number
      ColumnHeaders:
        items:
          type: string
        type: array
      CountyName:
        type: string
      CountySalesTaxRate:
        format: double
        type: number
      CountySalesTaxes:
        items:
          format: double
          type: number
        type: array
      CountySalesTaxesTotal:
        format: double
        type: number
      DistrictCannabisBusinessTaxes:
        items:
          format: double
          type: number
        type: array
      DistrictCannabisBusinessTaxesTotal:
        format: double
        type: number
      DistrictCannabisDeliveryTaxes:
        items:
          format: double
          type: number
        type: array
      DistrictCannabisDeliveryTaxesTotal:
        format: double
        type: number
      DistrictCombinedRate:
        format: double
        type: number
      DistrictName:
        type: string
      DistrictSalesTaxRate:
        format: double
        type: number
      DistrictSalesTaxes:
        items:
          format: double
          type: number
        type: array
      DistrictSalesTaxesTotal:
        format: double
        type: number
      DistrictType:
        type: string
      EstimatedBusinessTaxes:
        items:
          format: double
          type: number
        type: array
      EstimatedBusinessTaxesTotal:
        format: double
        type: number
      EstimatedCOGS:
        items:
          format: double
          type: number
        type: array
      EstimatedCOGSTotal:
        format: double
        type: number
      EstimatedCannabisTaxes:
        items:
          format: double
          type: number
        type: array
      EstimatedCannabisTaxesTotal:
        format: double
        type: number
      EstimatedDiscounts:
        items:
          format: double
          type: number
        type: array
      EstimatedDiscountsTotal:
        format: double
        type: number
      EstimatedGrossMargin:
        items:
          format: double
          type: number
        type: array
      EstimatedGrossMarginPercentageAverage:
        format: double
        type: number
      EstimatedGrossMarginPerentage:
        items:
          format: double
          type: number
        type: array
      EstimatedGrossMarginTotal:
        format: double
        type: number
      EstimatedSalesTaxes:
        items:
          format: double
          type: number
        type: array
      EstimatedSalesTaxesTotal:
        format: double
        type: number
      EstimatedSubtotals:
        items:
          format: double
          type: number
        type: array
      EstimatedSubtotalsTotal:
        format: double
        type: number
      EstimatedTotals:
        items:
          format: double
          type: number
        type: array
      EstimatedTotalsTotal:
        format: double
        type: number
      ExciseTaxes:
        items:
          format: double
          type: number
        type: array
      ExciseTaxesTotal:
        format: double
        type: number
      Geocode:
        type: string
      HasDistrictTaxes:
        type: boolean
      MerchCOGS:
        items:
          format: double
          type: number
        type: array
      MerchCOGSTotal:
        format: double
        type: number
      MerchGrossMargin:
        items:
          format: double
          type: number
        type: array
      MerchGrossMarginPercentage:
        items:
          format: double
          type: number
        type: array
      MerchGrossMarginPercentageAverage:
        format: double
        type: number
      MerchGrossMarginTotal:
        format: double
        type: number
      MerchRevenue:
        items:
          format: double
          type: number
        type: array
      MerchRevenueTotal:
        format: double
        type: number
      PreTaxRevenue:
        items:
          format: double
          type: number
        type: array
      PreTaxRevenueTotal:
        format: double
        type: number
      SalesTaxBasis:
        items:
          format: double
          type: number
        type: array
      SalesTaxBasisTotal:
        format: double
        type: number
      SalesTaxes:
        items:
          format: double
          type: number
        type: array
      SalesTaxesTotal:
        format: double
        type: number
      StateCannabisTaxes:
        items:
          format: double
          type: number
        type: array
      StateCannabisTaxesTotal:
        format: double
        type: number
      StateSalesTaxRate:
        format: double
        type: number
      StateSalesTaxes:
        items:
          format: double
          type: number
        type: array
      StateSalesTaxesTotal:
        format: double
        type: number
      TaxExemptRevenue:
        items:
          format: double
          type: number
        type: array
      TaxExemptRevenueTotal:
        format: double
        type: number
      Title:
        type: string
      TotalTaxes:
        items:
          format: double
          type: number
        type: array
      TotalTaxesTotal:
        format: double
        type: number
      UseTaxRevenue:
        items:
          format: double
          type: number
        type: array
      UseTaxesRevenueTotal:
        format: double
        type: number
    type: object
  TaxReturnResponse:
    description: An array of Tax Return Objects
    properties:
      Data:
        items:
          $ref: "#/definitions/TaxReturn"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  TaxSummary:
    properties:
      Amount:
        format: double
        type: number
      Category:
        description: Tax Type Category
        type: string
      EffectiveRate:
        format: double
        type: number
      Month:
        description: Month Number
        format: int64
        type: number
      PeriodName:
        description: The Period Name of the summary line
        type: string
      PlaceGeocode:
        description: The Taxnexus Geocode of the summary line
        type: string
      Quarter:
        description: Quarter Number
        format: int64
        type: number
      RevenueBase:
        format: double
        type: number
      RevenueNet:
        format: double
        type: number
      RevenueNotTaxable:
        format: double
        type: number
      TaxExemptRevenue:
        format: double
        type: number
      TaxOnTax:
        format: double
        type: number
      TaxRate:
        format: double
        type: number
      TaxTypeID:
        description:
          Taxnexus ID of the TaxType for which this transaction is made
        type: string
      TaxTypeName:
        description: Tax or Fee Name
        type: string
      Year:
        description: Year Number
        format: int64
        type: number
    type: object
  TaxSummaryResponse:
    description: An array of Tax Summary Reporting Objects
    properties:
      Data:
        items:
          $ref: "#/definitions/TaxSummary"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
  UseTax:
    properties:
      Amount:
        format: double
        type: number
      RevenueBase:
        format: double
        type: number
      RevenueNet:
        format: double
        type: number
      RevenueNotTaxable:
        format: double
        type: number
      TaxExemptRevenue:
        format: double
        type: number
      TaxOnTax:
        format: double
        type: number
      TaxRate:
        format: double
        type: number
    type: object
  UseTaxResponse:
    description: An array of Use Tax Reporting Objects
    properties:
      Data:
        items:
          $ref: "#/definitions/UseTax"
        type: array
      Meta:
        $ref: "#/definitions/ResponseMeta"
    type: object
