Net-Simplify

 view release on metacpan or  search on metacpan

lib/Net/Simplify/Invoice.pm  view on Meta::CPAN

package Net::Simplify::Invoice;

=head1 NAME

Net::Simplify::Invoice - A Simplify Commerce Invoice object

=head1 SYNOPSIS

  use Net::Simplify;


  $Net::Simplify::public_key = 'YOUR PUBLIC KEY';
  $Net::Simplify::private_key = 'YOUR PRIVATE KEY';

  # Create a new Invoice.
  my $invoice = Net::Simplify::Invoice->create{ {...});

  # Retrieve a Invoice given its ID.
  my $invoice = Net::Simplify::Invoice->find('a7e41');

  # Update existing Invoice.
  my $invoice = Net::Simplify::Invoice->find('a7e41');
  $invoice->{PROPERTY} = "NEW VALUE";
  $invoice->update();

  # Delete
  my $invoice = Net::Simplify::Invoice->find('a7e41');
  $invoice->delete();

  # Retrieve a list of objects
  my $invoices = Net::Simplify::Invoice->list({max => 10});
  foreach my $v ($invoices->list) {
      # ...
  }

=head1 DESCRIPTION

=head2 METHODS

=head3 create(%params, $auth)

Creates a C<Net::Simplify::Invoice> object.  The parameters are:

=over 4

=item C<%params>

Hash map containing initial values for the object.  Valid keys are:

=over 4



=item billingAddress.city

Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2] 

=item billingAddress.country

Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2] 

=item billingAddress.line1

Billing address line 1 of the location where the goods or services were supplied. [max length: 255] 

=item billingAddress.line2

Billing address line 2 of the location where the goods or services were supplied. [max length: 255] 

=item billingAddress.name

Billing address name of the location where the goods or services were supplied. Will use the customer name if not provided. [max length: 255] 

lib/Net/Simplify/Invoice.pm  view on Meta::CPAN

=item name

The name of the customer we are invoicing.  This is optional if customer or invoiceToCopy is provided.  A new customer will be created using the the name and email. [max length: 50, min length: 2] 

=item note

This field can be used to store a note that is not displayed to the customer. [max length: 4000] 

=item reference

User defined reference field. [max length: 255] 



=item shippingAddress.city

Address city of the location where the goods or services were supplied. [max length: 255, min length: 2] 

=item shippingAddress.country

Address country of the location where the goods or services were supplied. [max length: 2, min length: 2] 

=item shippingAddress.line1

Address line 1 of the location where the goods or services were supplied. [max length: 255] 

=item shippingAddress.line2

Address line 2 of the location where the goods or services were supplied. [max length: 255] 

=item shippingAddress.name

Address name of the location where the goods or services were supplied. [max length: 255] 

=item shippingAddress.state

Address state of the location where the goods or services were supplied. [max length: 255] 

=item shippingAddress.zip

Address zip of the location where the goods or services were supplied. [max length: 32] 

=item suppliedDate

The date on which the goods or services were supplied. 

=item taxNo

The tax number or VAT id of the person who supplied the goods or services. [max length: 255] 

=item type

The type of invoice.  One of WEB or MOBILE. [valid values: WEB, MOBILE, default: WEB] 


=back

=item C<$auth>

Authentication object for accessing the API.  If no value is passed the global keys
C<$Net::Simplify::public_key> and C<$Net::Simplify::private_key> are used.

=back




=head3 delete()

Deletes the C<Net::Simplify::Invoice> object.  Authentication is done using the same credentials used when the AccessToken was created.



=head3 list(%criteria, $auth)

Retrieve a list of C<Net::Simplify::Invoice> objects.  The parameters are:

=over 4

=item C<%criteria>

Hash map representing the criteria to limit the results of the list operation.  Valid keys are:

=over 4

=item C<filter>

<table class="filter_list"><tr><td>filter.id</td><td>Filter by the invoice Id</td></tr><tr><td>filter.amount</td><td>Filter by the invoice amount (in the smallest unit of your currency)</td></tr><tr><td>filter.text</td><td>Filter by the name of the i...



=item C<max>

Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]



=item C<offset>

Used in paging of the list.  This is the start offset of the page. [min value: 0, default: 0]



=item C<sorting>

Allows for ascending or descending sorting of the list.
The value maps properties to the sort direction (either C<asc> for ascending or C<desc> for descending).  Sortable properties are:

=over 4

=item C<id>

=item C<invoiceDate>

=item C<dueDate>

=item C<datePaid>

=item C<customer>

=item C<status>

=item C<dateCreated>


=back




=back

=back



=head3 find($id, $auth)

Retrieve a C<Net::Simplify::Invoice> object from the API.  Parameters are:

=over 4

=item C<$id>

Identifier of the object to retrieve.

=item C<$auth>

Authentication object for accessing the API.  If no value is passed the global keys
C<$Net::Simplify::public_key> and C<$Net::Simplify::private_key> are used.

=back




=head3 update()

Update C<Net::Simplify::Invoice> object.
The properties that can be updated are:

=over 4


=item C<billingAddress.city>

Billing address city of the location where the goods or services were supplied. [max length: 255, min length: 2] 

=item C<billingAddress.country>

Billing address country of the location where the goods or services were supplied. [max length: 2, min length: 2] 

=item C<billingAddress.line1>

Billing address line 1 of the location where the goods or services were supplied. [max length: 255] 

=item C<billingAddress.line2>

Billing address line 2 of the location where the goods or services were supplied. [max length: 255] 

=item C<billingAddress.name>

Billing address name of the location where the goods or services were supplied. [max length: 255] 

=item C<billingAddress.state>

Billing address state of the location where the goods or services were supplied. [max length: 255] 

=item C<billingAddress.zip>

Billing address zip of the location where the goods or services were supplied. [max length: 32] 

=item C<businessAddress.city>

Business address city of the business that is sending the invoice. [max length: 255, min length: 2] 

=item C<businessAddress.country>

Business address country of the business that is sending the invoice. [max length: 2, min length: 2] 

=item C<businessAddress.line1>

Business address line 1 of the business that is sending the invoice. [max length: 255] 

=item C<businessAddress.line2>

Business address line 2 of the business that is sending the invoice. [max length: 255] 

=item C<businessAddress.name>



( run in 1.034 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )