<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME

    WebService::Avalara::AvaTax - Avalara SOAP interface as compiled Perl
    methods

VERSION

    version 0.014

SYNOPSIS

        use WebService::Avalara::AvaTax;
        my $avatax = WebService::Avalara::AvaTax-&gt;new(
            username =&gt; 'avalara@example.com',
            password =&gt; 'sekrit',
        );
        my $answer_ref = $avatax-&gt;ping;

DESCRIPTION

    This class provides a Perl method API for Avalara AvaTax
    &lt;http://developer.avalara.com/api-docs/soap&gt; web services. The first
    call to any AvaTax SOAP operation uses XML::Compile::WSDL11 to compile
    and execute against the specified Avalara AvaTax service; subsequent
    calls can vary the parameters but will use the same compiled code.

METHODS

    Aside from the "new" method, "services" attribute and other attributes
    and methods consumed from
    WebService::Avalara::AvaTax::Role::Connection, available method names
    are dynamically loaded from each "services"' wsdl attribute and can be
    passed either a hash or reference to a hash with the necessary
    parameters. In scalar context they return a reference to a hash
    containing the results of the SOAP call; in list context they return
    the results hashref and an XML::Compile::SOAP::Trace object suitable
    for debugging and exception handling.

    If there is no result then you should check the trace object for why.

    Please consult the Avalara SOAP API reference
    &lt;http://developer.avalara.com/api-reference&gt; for semantic details on
    the methods, parameters and results available for each of the methods
    listed below. Note that in order to make this interface easier and more
    Perl-ish, the following changes have been made:

      * SOAP operation names have been transformed from CamelCase to
      lowercase_with_underscores. For example, GetTax is now "get_tax". If
      you do not like this behavior then use "orthodox" =&gt; 1 when calling
      "new".

      * Parameters do not need to be enclosed in {parameters}{FooRequest}{
      ... } hashes of hashes. These will be automatically added for you,
      along with all necessary SOAP headers. The examples below reflect
      this.

      * Similarly, results are not enclosed in {parameters}{FooResult}{ ...
      } hashes of hashes. They are, however, returned as a hash reference,
      not a simple hash. If you want access to other aspects of the SOAP
      response, make the call in list context and the second value in the
      list will be an XML::Compile::SOAP::Trace instance with methods for
      retrieving the full request and response as HTTP::Request and
      HTTP::Response objects, along with other methods for doing things
      like retrieving the parsed XML::LibXML::Document DOM node of the
      response.

 new

    Builds a new AvaTax web service client. Since this class consumes the
    WebService::Avalara::AvaTax::Role::Connection role, please consult that
    module's documentation for a full list of attributes that can be set at
    construction.

 get_tax

    (SOAP operation: GetTax)

    As a convenience to Business::Tax::Avalara users (and others), the
    DocDate element below will default to today's date in the UTC time
    zone.

    Constructing and making an example request:

        my %get_tax_request = (
            CompanyCode         =&gt; 'APITrialCompany',
            DocType             =&gt; 'SalesInvoice',
            DocCode             =&gt; 'INV001',
            DocDate             =&gt; '2014-01-01',
            CustomerCode        =&gt; 'ABC4335',
            Discount            =&gt; 0,
            OriginCode          =&gt; 0,
            DestinationCode     =&gt; 1,
            DetailLevel         =&gt; 'Tax',
            HashCode            =&gt; 0,
            Commit              =&gt; 'false',
            ServiceMode         =&gt; 'Automatic',
            PaymentDate         =&gt; '1900-01-01',
            ExchangeRate        =&gt; 1,
            ExchangeRateEffDate =&gt; '1900-01-01',
        );
    
        my @addresses = (
            {   Line1       =&gt; '45 Fremont Street',
                City        =&gt; 'San Francisco',
                Region      =&gt; 'CA',
                PostalCode  =&gt; '94105-2204',
                Country     =&gt; 'US',
                TaxRegionId =&gt; 0,
            },
            {   Line1       =&gt; '118 N Clark St',
                Line2       =&gt; 'ATTN Accounts Payable',
                City        =&gt; 'Chicago',
                Region      =&gt; 'IL',
                PostalCode  =&gt; '60602-1304',
                Country     =&gt; 'US',
                TaxRegionId =&gt; 0,
            },
            {   Line1       =&gt; '100 Ravine Lane',
                City        =&gt; 'Bainbridge Island',
                Region      =&gt; 'WA',
                PostalCode  =&gt; '98110',
                Country     =&gt; 'US',
                TaxRegionId =&gt; 0,
            },
        );
        for my $address_code (0 .. $#addresses) {
            push @{$get_tax_request{Addresses}{BaseAddress}} =&gt; {
                AddressCode =&gt; $address_code,
                %{ $addresses[$address_code] },
            };
        }
    
        my @lines = (
            {   OriginCode      =&gt; 0,
                DestinationCode =&gt; 1,
                ItemCode        =&gt; 'N543',
                TaxCode         =&gt; 'NT',
                Qty             =&gt; 1,
                Amount          =&gt; 10,
                Discounted      =&gt; 'false',
                Description     =&gt; 'Red Size 7 Widget',
            },
            {   OriginCode      =&gt; 0,
                DestinationCode =&gt; 2,
                ItemCode        =&gt; 'T345',
                TaxCode         =&gt; 'PC030147',
                Qty             =&gt; 3,
                Amount          =&gt; 150,
                Discounted      =&gt; 'false',
                Description     =&gt; 'Size 10 Green Running Shoe',
            },
            {   OriginCode      =&gt; 0,
                DestinationCode =&gt; 2,
                ItemCode        =&gt; 'FREIGHT',
                TaxCode         =&gt; 'FR',
                Qty             =&gt; 1,
                Amount          =&gt; 15,
                Discounted      =&gt; 'false',
                Description     =&gt; 'Shipping Charge',
            },
        );
        for my $line_no (1 .. @lines) {
            push @{$get_tax_request{Lines}{Line}} =&gt; {
                No =&gt; $line_no,
                %{ $lines[$line_no - 1] },
            };
        }
    
        my ( $answer_ref, $trace ) = $avatax-&gt;get_tax(%get_tax_request);

 post_tax

    (SOAP operation: PostTax)

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;post_tax(
            CompanyCode =&gt; 'APITrialCompany',
            DocType     =&gt; 'SalesInvoice',
            DocCode     =&gt; 'INV001',
            Commit      =&gt; 0,
            DocDate     =&gt; '2014-01-01',
            TotalTax    =&gt; '14.27',
            TotalAmount =&gt; 175,
            NewDocCode  =&gt; 'INV001-1',
        );

 commit_tax

    (SOAP operation: CommitTax)

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;commit_tax(
            DocCode     =&gt; 'INV001',
            DocType     =&gt; 'SalesInvoice',
            CompanyCode =&gt; 'APITrialCompany',
            NewDocCode  =&gt; 'INV001-1',
        );

 cancel_tax

    (SOAP operation: CommitTax)

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;cancel_tax(
            CompanyCode =&gt; 'APITrialCompany',
            DocType     =&gt; 'SalesInvoice',
            DocCode     =&gt; 'INV001',
            CancelCode  =&gt; 'DocVoided',
        );

 adjust_tax

    (SOAP operation: AdjustTax)

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;adjust_tax(
            AdjustmentReason      =&gt; 4,
            AdjustmentDescription =&gt; 'Transaction Adjusted for Testing',
            GetTaxRequest =&gt; {
                CustomerCode =&gt; 'ABC4335',
                DocDate      =&gt; '2014-01-01',
                CompanyCode  =&gt; 'APITrialCompany',
                DocCode      =&gt; 'INV001',
                DetailLevel  =&gt; 'Tax',
                Commit       =&gt; 0,
                DocType      =&gt; 'SalesInvoice',
                # BusinessIdentificationNo =&gt; '234243',
                # CustomerUsageType        =&gt; 'G',
                # ExemptionNo              =&gt; '12345',
                # Discount                 =&gt; 50,
                # LocationCode             =&gt; '01',
                # TaxOverride =&gt; [
                #    {   TaxOverrideType =&gt; 'TaxDate',
                #        Reason          =&gt; 'Adjustment for return',
                #        TaxDate         =&gt; '2013-07-01',
                #        TaxAmount       =&gt; 0,
                #    },
                # ],
                # ServiceMode =&gt; 'Automatic',
                PurchaseOrderNo     =&gt; 'PO123456',
                ReferenceCode       =&gt; 'ref123456',
                PosLaneCode         =&gt; '09',
                CurrencyCode        =&gt; 'USD',
                ExchangeRate        =&gt; '1.0',
                ExchangeRateEffDate =&gt; '2013-01-01',
                SalespersonCode     =&gt; 'Bill Sales',
                Addresses =&gt; { BaseAddress =&gt; [
                    {   AddressCode =&gt; '01',
                        Line1       =&gt; '45 Fremont Street',
                        City        =&gt; 'San Francisco',
                        Region      =&gt; 'CA',
                    },
                    {   AddressCode =&gt; '02',
                        Line1       =&gt; '118 N Clark St',
                        Line2       =&gt; 'Suite 100',
                        Line3       =&gt; 'ATTN Accounts Payable',
                        City        =&gt; 'Chicago',
                        Region      =&gt; 'IL',
                        Country     =&gt; 'US',
                        PostalCode  =&gt; '60602',
                    },
                    {   AddressCode =&gt; '03',
                        Latitude    =&gt; '47.627935',
                        Longitude   =&gt; '-122.51702',
                    },
                ] },
                Lines =&gt; { Line =&gt; [
                    {   No              =&gt; '01',
                        ItemCode        =&gt; 'N543',
                        Qty             =&gt; 1,
                        Amount          =&gt; 10,
                        TaxCode         =&gt; 'NT',
                        Description     =&gt; 'Red Size 7 Widget',
                        OriginCode      =&gt; '01',
                        DestinationCode =&gt; '02',
                        # CustomerUsageType =&gt; 'L',
                        # ExemptionNo       =&gt; '12345',
                        # Discounted        =&gt; 1,
                        # TaxIncluded       =&gt; 1,
                        # TaxOverride =&gt; {
                        #     TaxOverrideType =&gt; 'TaxDate',
                        #     Reason          =&gt; 'Adjustment for return',
                        #     TaxDate         =&gt; '2013-07-01',
                        #     TaxAmount       =&gt; 0,
                        # },
                        Ref1 =&gt; 'ref123',
                        Ref2 =&gt; 'ref456',
                    },
                    {   No              =&gt; '02',
                        ItemCode        =&gt; 'T345',
                        Qty             =&gt; 3,
                        Amount          =&gt; 150,
                        OriginCode      =&gt; '01',
                        DestinationCode =&gt; '03',
                        Description     =&gt; 'Size 10 Green Running Shoe',
                        TaxCode         =&gt; 'PC30147',
                    },
                    {   No              =&gt; '02-FR',
                        ItemCode        =&gt; 'FREIGHT',
                        Qty             =&gt; 1,
                        Amount          =&gt; 15,
                        OriginCode      =&gt; '01',
                        DestinationCode =&gt; '03',
                        Description     =&gt; 'Shipping Charge',
                        TaxCode         =&gt; 'FR',
                    },
                ] },
            },
        );

 get_tax_history

    (SOAP operation: GetTaxHistory)

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;get_tax_history(
            CompanyCode =&gt; 'APITrialCompany',
            DocType     =&gt; 'SalesInvoice',
            DocCode     =&gt; 'INV001',
            DetailLevel =&gt; 'Tax',
        );

 validate

    (SOAP operation: Validate)

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;validate(
            Address =&gt; {
                Line1      =&gt; '118 N Clark St',
                Line2      =&gt; 'Suite 100',
                Line3      =&gt; 'ATTN Accounts Payable',
                City       =&gt; 'Chicago',
                Region     =&gt; 'IL',
                PostalCode =&gt; '60602',
            },
            Coordinates =&gt; 1,
            Taxability  =&gt; 1,
            TextCase    =&gt; 'Upper',
        );

 is_authorized

    (SOAP operation: IsAuthorized)

    Both WebService::Avalara::AvaTax::Service::Address and
    WebService::Avalara::AvaTax::Service::Tax provide IsAuthorized
    operations. However, since the latter is loaded last, only its version
    is called when you call this method. If you need to specifically call a
    particular service's IsAuthorized, use the call method on its wsdl
    attribute.

    Note that the parameter passed to this call is a comma-delimited list
    of SOAP operation names in CamelCase, not lowercase_with_underscores.

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;is_authorized(
            join ', ' =&gt; qw(
                Ping
                IsAuthorized
                GetTax
                PostTax
                GetTaxHistory
                CommitTax
                CancelTax
                AdjustTax
            ),
        );

 ping

    (SOAP operation: Ping)

    Both WebService::Avalara::AvaTax::Service::Address and
    WebService::Avalara::AvaTax::Service::Tax provide Ping operations.
    However, since the latter is loaded last, only its version is called
    when you call this method. If you need to specifically call a
    particular service's Ping, use the call method on its wsdl attribute.

    Note that this method does support a single string as a message
    parameter; this is effectively ignored though.

    Example:

        use List::Util 1.33 'any';
        my ( $answer_ref, $trace ) = $avatax-&gt;ping;
        for my $code ( $answer_ref-&gt;{ResultCode} ) {
            if ( $code eq 'Success' ) { say $code;                    last }
            if ( $code eq 'Warning' ) { warn $answer_ref-&gt;{Messages}; last }
    
            die $answer_ref-&gt;{Messages} if any {$code eq $_} qw(Error Exception);
        }

 tax_summary_fetch

    (SOAP operation: TaxSummaryFetch)

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;tax_summary_fetch(
            MerchantCode =&gt; 'example',
            StartDate    =&gt; '2014-01-01',
            EndDate      =&gt; '2014-01-31',
        );

 apply_payment (DEPRECATED)

    (SOAP operation: ApplyPayment)

    From Avalara API documentation
    &lt;http://developer.avalara.com/api-docs/soap/applypayment&gt;:

      The ApplyPayment method of the TaxSvc was originally designed to
      update an existing document record with a PaymentDate value. This
      function (and cash-basis accounting in general) is no longer
      supported, and will not work on new or existing accounts, but remains
      in the TaxSvc WSDL and some automatically built adaptors for
      backwards compatibility.

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;apply_payment(
            DocId       =&gt; 'example',
            CompanyCode =&gt; 'APITrialCompany',
            DocType     =&gt; 'SalesInvoice',
            DocCode     =&gt; 'INV001',
            PaymentDate =&gt; '2014-01-01',
        );

 reconcile_tax_history (LEGACY API)

    (SOAP operation: ReconcileTaxHistory)

    From Avalara API documentation
    &lt;http://developer.avalara.com/api-docs/soap/reconciletaxhistory&gt;:

      The ReconcileTaxHistory method of the TaxSvc was designed to allow
      users to pull a range of documents for reconciliation against a
      document of record (i.e. in the ERP), and then flag the reconciled
      documents as completed. Those flagged documents would then be omitted
      from subsequent ReconcileTaxHistory calls. This method no longer
      changes the "reconciled" document flag, but can be used to retrieve
      ranges of document data (much like the AccountSvc DocumentFetch
      &lt;http://developer.avalara.com/api-docs/soap/accountsvc/document-elements&gt;),
      and remains in the TaxSvc WSDL and some automatically built adaptors
      for backwards compatibility.

    Example:

        my ( $answer_ref, $trace ) = $avatax-&gt;reconcile_tax_history(
            CompanyCode =&gt; 'APITrialCompany',
            LastDocId   =&gt; 'example',
            Reconciled  =&gt; 1,
            StartDate   =&gt; '2014-01-01',
            EndDate     =&gt; '2014-01-31',
            DocStatus   =&gt; 'Temporary',
            DocType     =&gt; 'SalesOrder',
            LastDocCode =&gt; 'example',
            PageSize    =&gt; 10,
        );

ATTRIBUTES

 services

    This module is really just a convenience wrapper around instances of
    WebService::Avalara::AvaTax::Service::Address and
    WebService::Avalara::AvaTax::Service::Tax modules. As such this
    attribute is used to keep an array reference to instances of both
    classes, with the following attributes from "new" passed to both:

    username

    password

    is_production

    user_agent

    debug

 orthodox

    When set to true at construction, the generated methods will exactly
    match their CamelCase SOAP operation names.

WORKAROUNDS FOR INCORRECT AVALARA RESPONSES

    As of this writing the Avalara SOAP API returns responses that are
    inconsistent with the WSDL document provided. Specifically, the
    TaxIncluded and GeocodeType fields in the GetTaxResponse are wrongly
    placed in their sequences of fields. This module adds preprocessing
    hooks that attempt to work around these problems so that the responses
    may be successfully parsed.

SEE ALSO

    Avalara Developer Network &lt;http://developer.avalara.com/&gt;

      Official source for Avalara developer information, including API
      references, technical articles and more.

    Business::Tax::Avalara

      An alternative that uses Avalara's REST API.

    XML::Compile::SOAP and XML::Compile::WSDL11

      Part of the XML::Compile suite and the basis for this distribution.
      It's helpful to understand these in order to debug or extend this
      module.

SUPPORT

 Perldoc

    You can find documentation for this module with the perldoc command.

      perldoc WebService::Avalara::AvaTax

 Websites

    The following websites have more information about this module, and may
    be of help to you. As always, in addition to those websites please use
    your favorite search engine to discover more resources.

      * MetaCPAN

      A modern, open-source CPAN search engine, useful to view POD in HTML
      format.

      http://metacpan.org/release/WebService-Avalara-AvaTax

      * Search CPAN

      The default CPAN search engine, useful to view POD in HTML format.

      http://search.cpan.org/dist/WebService-Avalara-AvaTax

      * AnnoCPAN

      The AnnoCPAN is a website that allows community annotations of Perl
      module documentation.

      http://annocpan.org/dist/WebService-Avalara-AvaTax

      * CPAN Ratings

      The CPAN Ratings is a website that allows community ratings and
      reviews of Perl modules.

      http://cpanratings.perl.org/d/WebService-Avalara-AvaTax

      * CPAN Forum

      The CPAN Forum is a web forum for discussing Perl modules.

      http://cpanforum.com/dist/WebService-Avalara-AvaTax

      * CPANTS

      The CPANTS is a website that analyzes the Kwalitee ( code metrics )
      of a distribution.

      http://cpants.cpanauthors.org/dist/WebService-Avalara-AvaTax

      * CPAN Testers

      The CPAN Testers is a network of smokers who run automated tests on
      uploaded CPAN distributions.

      http://www.cpantesters.org/distro/W/WebService-Avalara-AvaTax

      * CPAN Testers Matrix

      The CPAN Testers Matrix is a website that provides a visual overview
      of the test results for a distribution on various Perls/platforms.

      http://matrix.cpantesters.org/?dist=WebService-Avalara-AvaTax

      * CPAN Testers Dependencies

      The CPAN Testers Dependencies is a website that shows a chart of the
      test results of all dependencies for a distribution.

      http://deps.cpantesters.org/?module=WebService::Avalara::AvaTax

 Bugs / Feature Requests

    Please report any bugs or feature requests through the web interface at
    https://github.com/mjgardner/WebService-Avalara-AvaTax/issues. You will
    be automatically notified of any progress on the request by the system.

 Source Code

    The code is open to the world, and available for you to hack on. Please
    feel free to browse it and play with it, or whatever. If you want to
    contribute patches, please send me a diff or prod me to pull from your
    repository :)

    https://github.com/mjgardner/WebService-Avalara-AvaTax

      git clone git://github.com/mjgardner/WebService-Avalara-AvaTax.git

AUTHOR

    Mark Gardner &lt;mjgardner@cpan.org&gt;

COPYRIGHT AND LICENSE

    This software is copyright (c) 2015 by ZipRecruiter.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

</pre></body></html>