Avalara · Arazzo Workflow

Avalara Void and Recreate a Transaction

Version 1.0.0

Look up an existing transaction, void it, then recreate a corrected version.

1 workflow 1 source API 1 provider
View Spec View on GitHub TaxesArazzoWorkflows

Provider

avalara

Workflows

void-and-recreate-transaction
Void an existing transaction and create a corrected replacement.
Retrieves a transaction by code, voids it with a documented reason code, then creates a corrected SalesInvoice transaction to replace it.
3 steps inputs: amount, city, companyCode, country, customerCode, date, line1, postalCode, region, taxCode, transactionCode, voidReason outputs: newTransactionCode, totalTax, voidedStatus
1
getOriginal
getTransactionByCode
Retrieve the existing transaction by code to confirm it exists before voiding it.
2
voidOriginal
voidTransaction
Void the existing transaction with the supplied reason code so it is removed from tax reporting.
3
recreate
createTransaction
Create a corrected SalesInvoice transaction to replace the voided one.

Source API Descriptions

Arazzo Workflow Specification

avalara-void-and-recreate-transaction-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Avalara Void and Recreate a Transaction
  summary: Look up an existing transaction, void it, then recreate a corrected version.
  description: >-
    Corrects a mistaken transaction by voiding it and issuing a fresh one. The
    workflow first retrieves the existing transaction by code to confirm it
    exists, voids it with a documented reason so it drops out of tax reporting,
    and then creates a new corrected sales invoice in its place. Every step
    spells out its request inline so the flow can be read and executed without
    opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: avataxApi
  url: ../openapi/avalara-avatax-rest-openapi.yml
  type: openapi
workflows:
- workflowId: void-and-recreate-transaction
  summary: Void an existing transaction and create a corrected replacement.
  description: >-
    Retrieves a transaction by code, voids it with a documented reason code,
    then creates a corrected SalesInvoice transaction to replace it.
  inputs:
    type: object
    required:
    - companyCode
    - transactionCode
    - customerCode
    - date
    - line1
    - city
    - region
    - postalCode
    - country
    - amount
    properties:
      companyCode:
        type: string
        description: Company code that owns the transaction.
      transactionCode:
        type: string
        description: Code of the existing transaction to void.
      voidReason:
        type: string
        description: Reason code for voiding (e.g. DocVoided, AdjustmentCancelled).
      customerCode:
        type: string
        description: Unique code identifying the customer for the corrected transaction.
      date:
        type: string
        description: Date of the corrected transaction (YYYY-MM-DD).
      line1:
        type: string
        description: Ship-to street address line 1.
      city:
        type: string
        description: Ship-to city.
      region:
        type: string
        description: Ship-to state or province code.
      postalCode:
        type: string
        description: Ship-to postal code.
      country:
        type: string
        description: Ship-to two-character ISO 3166 country code.
      amount:
        type: number
        description: Corrected total amount for the line item.
      taxCode:
        type: string
        description: Avalara tax code for the line item.
  steps:
  - stepId: getOriginal
    description: >-
      Retrieve the existing transaction by code to confirm it exists before
      voiding it.
    operationId: getTransactionByCode
    parameters:
    - name: companyCode
      in: path
      value: $inputs.companyCode
    - name: transactionCode
      in: path
      value: $inputs.transactionCode
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      originalStatus: $response.body#/status
  - stepId: voidOriginal
    description: >-
      Void the existing transaction with the supplied reason code so it is
      removed from tax reporting.
    operationId: voidTransaction
    parameters:
    - name: companyCode
      in: path
      value: $inputs.companyCode
    - name: transactionCode
      in: path
      value: $inputs.transactionCode
    requestBody:
      contentType: application/json
      payload:
        code: $inputs.voidReason
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      voidedStatus: $response.body#/status
  - stepId: recreate
    description: >-
      Create a corrected SalesInvoice transaction to replace the voided one.
    operationId: createTransaction
    requestBody:
      contentType: application/json
      payload:
        type: SalesInvoice
        companyCode: $inputs.companyCode
        date: $inputs.date
        customerCode: $inputs.customerCode
        commit: true
        addresses:
          shipTo:
            line1: $inputs.line1
            city: $inputs.city
            region: $inputs.region
            postalCode: $inputs.postalCode
            country: $inputs.country
        lines:
        - amount: $inputs.amount
          taxCode: $inputs.taxCode
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      newTransactionCode: $response.body#/code
      totalTax: $response.body#/totalTax
  outputs:
    voidedStatus: $steps.voidOriginal.outputs.voidedStatus
    newTransactionCode: $steps.recreate.outputs.newTransactionCode
    totalTax: $steps.recreate.outputs.totalTax