Module: AvaTax::Client::MultiDocument

Defined in:
lib/avatax/client/multidocument.rb

Instance Method Summary collapse

Instance Method Details

#adjust_multi_document_transaction(code, type, model, options = {}) ⇒ Object

Adjust a MultiDocument transaction

Adjusts the current MultiDocument transaction uniquely identified by this URL.

A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).

When you adjust a transaction, that transaction's status is recorded as Adjusted.

Both the revisions will be available for retrieval based on their code and ID numbers. Only transactions in Committed status can be reported on a tax filing by Avalara's Managed Returns Service.

Transactions that have been previously reported to a tax authority by Avalara Managed Returns are considered locked and are no longer available for adjustments.

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountOperator, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • code (String)

    The transaction code for this MultiDocument transaction

  • type (String)

    The transaction type for this MultiDocument transaction (See DocumentType::* for a list of allowable values)

  • include (String)

    Specifies objects to include in this fetch call

  • model (Object)

    The adjust request you wish to execute

Returns:

  • (Object)


37
38
# File 'lib/avatax/client/multidocument.rb', line 37

def adjust_multi_document_transaction(code, type, model, options={})        path = "/api/v2/transactions/multidocument/#{code}/type/#{type}/adjust"
post(path, model, options, AvaTax::VERSION)      end

#audit_multi_document_transaction(code, type) ⇒ Object

Get audit information about a MultiDocument transaction

Retrieve audit information about a MultiDocument transaction stored in AvaTax.

The audit API retrieves audit information related to a specific MultiDocument transaction. This audit information includes the following:

  • The code of the MultiDocument transaction
  • The type of the MultiDocument transaction
  • The server timestamp representing the exact server time when the transaction was created
  • The server duration - how long it took to process this transaction
  • Whether exact API call details were logged
  • A reconstructed API call showing what the original create call looked like

A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • code (String)

    The transaction code for this MultiDocument transaction

  • type (String)

    The transaction type for this MultiDocument transaction (See DocumentType::* for a list of allowable values)

Returns:

  • (Object)


73
74
# File 'lib/avatax/client/multidocument.rb', line 73

def audit_multi_document_transaction(code, type)        path = "/api/v2/transactions/multidocument/#{code}/type/#{type}/audit"
get(path, {}, AvaTax::VERSION)      end

#commit_multi_document_transaction(model) ⇒ Object

Commit a MultiDocument transaction

Marks a list of transactions by changing its status to Committed.

Transactions that are committed are available to be reported to a tax authority by Avalara Managed Returns.

A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).

Any changes made to a committed transaction will generate a transaction history.

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • model (Object)

    The commit request you wish to execute

Returns:

  • (Object)


102
103
# File 'lib/avatax/client/multidocument.rb', line 102

def commit_multi_document_transaction(model)        path = "/api/v2/transactions/multidocument/commit"
post(path, model, {}, AvaTax::VERSION)      end

#create_multi_document_transaction(model, options = {}) ⇒ Object

Create a new MultiDocument transaction

Records a new MultiDocument transaction in AvaTax.

A traditional transaction requires exactly two parties: a seller and a buyer. MultiDocument transactions can involve a marketplace of vendors, each of which contributes some portion of the final transaction. Within a MultiDocument transaction, each individual buyer and seller pair are matched up and converted to a separate document. This separation of documents allows each seller to file their taxes separately.

This API will report an error if you attempt to create a transaction when one already exists with the specified code. If you would like the API to automatically update the transaction when it already exists, please set the allowAdjust value to true.

To generate a refund for a transaction, use the RefundTransaction API.

The field type identifies the kind of transaction - for example, a sale, purchase, or refund. If you do not specify a type value, you will receive an estimate of type SalesOrder, which will not be recorded.

The origin and destination locations for a transaction must be identified by either address or geocode. For address-based transactions, please provide addresses in the fields line, city, region, country and postalCode. For geocode-based transactions, please provide the geocode information in the fields latitude and longitude. If either latitude or longitude or both are null, the transaction will be calculated using the best available address location information.

You may specify one or more of the following values in the $include parameter to fetch additional nested data, using commas to separate multiple values:

  • Lines
  • Details (implies lines)
  • Summary (implies details)
  • Addresses
  • SummaryOnly (omit lines and details - reduces API response size)
  • LinesOnly (omit details - reduces API response size)
  • ForceTimeout - Simulates a timeout. This adds a 30 second delay and error to your API call. This can be used to test your code to ensure it can respond correctly in the case of a dropped connection.

If you omit the $include parameter, the API will assume you want Summary,Addresses.

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • include (String)

    Specifies objects to include in the response after transaction is created

  • model (Object)

    the multi document transaction model

Returns:

  • (Object)


156
157
# File 'lib/avatax/client/multidocument.rb', line 156

def create_multi_document_transaction(model, options={})        path = "/api/v2/transactions/multidocument"
post(path, model, options, AvaTax::VERSION)      end

#get_multi_document_transaction_by_code_and_type(code, type, options = {}) ⇒ Object

Retrieve a MultiDocument transaction

Get the current MultiDocument transaction identified by this URL.

If this transaction was adjusted, the return value of this API will be the current transaction with this code.

You may specify one or more of the following values in the $include parameter to fetch additional nested data, using commas to separate multiple values:

  • Lines
  • Details (implies lines)
  • Summary (implies details)
  • Addresses
  • SummaryOnly (omit lines and details - reduces API response size)
  • LinesOnly (omit details - reduces API response size)

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • code (String)

    The multidocument code to retrieve

  • type (String)

    The transaction type to retrieve (See DocumentType::* for a list of allowable values)

  • include (String)

    Specifies objects to include in the response after transaction is created

Returns:

  • (Object)


191
192
# File 'lib/avatax/client/multidocument.rb', line 191

def get_multi_document_transaction_by_code_and_type(code, type, options={})        path = "/api/v2/transactions/multidocument/#{code}/type/#{type}"
get(path, options, AvaTax::VERSION)      end

#get_multi_document_transaction_by_id(id, options = {}) ⇒ Object

Retrieve a MultiDocument transaction by ID

Get the unique MultiDocument transaction identified by this URL.

A traditional transaction requires exactly two parties: a seller and a buyer. MultiDocument transactions can involve a marketplace of vendors, each of which contributes some portion of the final transaction. Within a MultiDocument transaction, each individual buyer and seller pair are matched up and converted to a separate document. This separation of documents allows each seller to file their taxes separately.

This endpoint retrieves the exact transaction identified by this ID number even if that transaction was later adjusted by using the AdjustTransaction endpoint.

A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).

You may specify one or more of the following values in the $include parameter to fetch additional nested data, using commas to separate multiple values:

  • Lines
  • Details (implies lines)
  • Summary (implies details)
  • Addresses
  • SummaryOnly (omit lines and details - reduces API response size)
  • LinesOnly (omit details - reduces API response size)

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • id (Integer)

    The unique ID number of the MultiDocument transaction to retrieve

  • include (String)

    Specifies objects to include in the response after transaction is created

Returns:

  • (Object)


234
235
# File 'lib/avatax/client/multidocument.rb', line 234

def get_multi_document_transaction_by_id(id, options={})        path = "/api/v2/transactions/multidocument/#{id}"
get(path, options, AvaTax::VERSION)      end

#list_multi_document_transactions(options = {}) ⇒ FetchResult

Retrieve all MultiDocument transactions

List all MultiDocument transactions within this account.

This endpoint is limited to returning 1,000 MultiDocument transactions at a time. To retrieve more than 1,000 MultiDocument transactions, please use the pagination features of the API.

A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).

Search for specific objects using the criteria in the $filter parameter; full documentation is available on Filtering in REST . Paginate your results using the $top, $skip, and $orderby parameters.

You may specify one or more of the following values in the $include parameter to fetch additional nested data, using commas to separate multiple values:

  • Lines
  • Details (implies lines)
  • Summary (implies details)
  • Addresses
  • SummaryOnly (omit lines and details - reduces API response size)
  • LinesOnly (omit details - reduces API response size)

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • filter (String)

    A filter statement to identify specific records to retrieve. For more information on filtering, see Filtering in REST.
    Not filterable: documents

  • include (String)

    Specifies objects to include in the response after transaction is created

  • top (Integer)

    If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.

  • skip (Integer)

    If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.

  • orderBy (String)

    A comma separated list of sort statements in the format (fieldname) [ASC|DESC], for example id ASC.

Returns:

  • (FetchResult)


278
279
# File 'lib/avatax/client/multidocument.rb', line 278

def list_multi_document_transactions(options={})        path = "/api/v2/transactions/multidocument"
get(path, options, AvaTax::VERSION)      end

#refund_multi_document_transaction(code, type, model, options = {}) ⇒ Object

Create a refund for a MultiDocument transaction

Create a refund for a MultiDocument transaction.

A traditional transaction requires exactly two parties: a seller and a buyer. MultiDocument transactions can involve a marketplace of vendors, each of which contributes some portion of the final transaction. Within a MultiDocument transaction, each individual buyer and seller pair are matched up and converted to a separate document. This separation of documents allows each seller to file their taxes separately.

The RefundTransaction API allows you to quickly and easily create a ReturnInvoice representing a refund for a previously created SalesInvoice transaction. You can choose to create a full or partial refund, and specify individual line items from the original sale for refund.

The RefundTransaction API ensures that the tax amount you refund to the customer exactly matches the tax that was calculated during the original transaction, regardless of any changes to your company's configuration, rules, nexus, or any other setting.

This API is intended to be a shortcut to allow you to quickly and accurately generate a refund for the following common refund scenarios:

  • A full refund of a previous sale
  • Refunding the tax that was charged on a previous sale, when the customer provides an exemption certificate after the purchase
  • Refunding one or more items (lines) from a previous sale
  • Granting a customer a percentage refund of a previous sale

For more complex scenarios than the ones above, please use CreateTransaction with document type ReturnInvoice to create a custom refund transaction.

You may specify one or more of the following values in the $include parameter to fetch additional nested data, using commas to separate multiple values:

  • Lines
  • Details (implies lines)
  • Summary (implies details)
  • Addresses
  • SummaryOnly (omit lines and details - reduces API response size)
  • LinesOnly (omit details - reduces API response size)

If you omit the $include parameter, the API will assume you want Summary,Addresses.

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • code (String)

    The code of this MultiDocument transaction

  • type (String)

    The type of this MultiDocument transaction (See DocumentType::* for a list of allowable values)

  • include (String)

    Specifies objects to include in the response after transaction is created

  • model (Object)

    Information about the refund to create

Returns:

  • (Object)


338
339
# File 'lib/avatax/client/multidocument.rb', line 338

def refund_multi_document_transaction(code, type, model, options={})        path = "/api/v2/transactions/multidocument/#{code}/type/#{type}/refund"
post(path, model, options, AvaTax::VERSION)      end

#verify_multi_document_transaction(model) ⇒ Object

Verify a MultiDocument transaction

Verifies that the MultiDocument transaction uniquely identified by this URL matches certain expected values.

If the transaction does not match these expected values, this API will return an error code indicating which value did not match.

A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • model (Object)

    Information from your accounting system to verify against this MultiDocument transaction as it is stored in AvaTax

Returns:

  • (Object)


365
366
# File 'lib/avatax/client/multidocument.rb', line 365

def verify_multi_document_transaction(model)        path = "/api/v2/transactions/multidocument/verify"
post(path, model, {}, AvaTax::VERSION)      end

#void_multi_document_transaction(code, type, model) ⇒ Object

Void a MultiDocument transaction

Voids the current transaction uniquely identified by this URL.

A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like sales, purchases, inventory transfer, and returns (also called refunds).

When you void a transaction, that transaction's status is recorded as DocVoided.

Transactions that have been previously reported to a tax authority by Avalara Managed Returns Service are considered locked, and they are no longer available to be voided.

NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:

  • Replace '/' with '_-ava2f-_' For example: document/Code becomes document_-ava2f-_Code
  • Replace '+' with '_-ava2b-_' For example: document+Code becomes document_-ava2b-_Code
  • Replace '?' with '_-ava3f-_' For example: document?Code becomes document_-ava3f-_Code
  • Replace '%' with '_-ava25-_' For example: document%Code becomes document_-ava25-_Code
  • Replace '#' with '_-ava23-_' For example: document#Code becomes document_-ava23-_Code
  • Replace ' ' with '%20' For example: document Code becomes document%20Code

Security Policies

  • This API requires one of the following user roles: AccountAdmin, AccountOperator, BatchServiceAdmin, CompanyAdmin, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
  • This API depends on the following active services:Required (all): AvaTaxPro. Swagger Name: AvaTaxClient

Parameters:

  • code (String)

    The transaction code for this MultiDocument transaction

  • type (String)

    The transaction type for this MultiDocument transaction (See DocumentType::* for a list of allowable values)

  • model (Object)

    The void request you wish to execute

Returns:

  • (Object)


397
398
# File 'lib/avatax/client/multidocument.rb', line 397

def void_multi_document_transaction(code, type, model)        path = "/api/v2/transactions/multidocument/#{code}/type/#{type}/void"
post(path, model, {}, AvaTax::VERSION)      end