Net-Simplify
view release on metacpan or search on metacpan
lib/Net/Simplify/Customer.pm view on Meta::CPAN
package Net::Simplify::Customer;
=head1 NAME
Net::Simplify::Customer - A Simplify Commerce Customer object
=head1 SYNOPSIS
use Net::Simplify;
$Net::Simplify::public_key = 'YOUR PUBLIC KEY';
$Net::Simplify::private_key = 'YOUR PRIVATE KEY';
# Create a new Customer.
my $customer = Net::Simplify::Customer->create{ {...});
# Retrieve a Customer given its ID.
my $customer = Net::Simplify::Customer->find('a7e41');
# Update existing Customer.
my $customer = Net::Simplify::Customer->find('a7e41');
$customer->{PROPERTY} = "NEW VALUE";
$customer->update();
# Delete
my $customer = Net::Simplify::Customer->find('a7e41');
$customer->delete();
# Retrieve a list of objects
my $customers = Net::Simplify::Customer->list({max => 10});
foreach my $v ($customers->list) {
# ...
}
=head1 DESCRIPTION
=head2 METHODS
=head3 create(%params, $auth)
Creates a C<Net::Simplify::Customer> object. The parameters are:
=over 4
=item C<%params>
Hash map containing initial values for the object. Valid keys are:
=over 4
=item card.addressCity
City of the cardholder. (B<required>)
=item card.addressCountry
Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. (B<required>)
=item card.addressLine1
Address of the cardholder (B<required>)
=item card.addressLine2
Address of the cardholder if needed. (B<required>)
=item card.addressState
State of residence of the cardholder. State abbreviations should be used. (B<required>)
lib/Net/Simplify/Customer.pm view on Meta::CPAN
The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
=item subscriptions.coupon
Coupon associated with the subscription for the customer.
=item subscriptions.currency
Currency code (ISO-4217). Must match the currency associated with your account.
=item subscriptions.currentPeriodEnd
End date of subscription's current period
=item subscriptions.currentPeriodStart
Start date of subscription's current period
=item subscriptions.customer
The customer ID to create the subscription for. Do not supply this when creating a customer.
=item subscriptions.frequency
Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
=item subscriptions.frequencyPeriod
Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
=item subscriptions.name
Name describing subscription [max length: 50]
=item subscriptions.plan
The plan ID that the subscription should be created from.
=item subscriptions.quantity
Quantity of the plan for the subscription. [min value: 1]
=item subscriptions.renewalReminderLeadDays
If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
=item subscriptions.source
Source of where subscription was created
=item token
If specified, card associated with card token will be used
=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::Customer> 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::Customer> 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 customer Id</td></tr><tr><td>filter.text</td><td>Can use this to filter by the name, email or reference for the customer</td></tr><tr><td>filter.dateCreatedMin<sup>*</sup></td><td>Fil...
=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<dateCreated>
=item C<id>
=item C<name>
=item C<email>
=item C<reference>
=back
=back
=back
=head3 find($id, $auth)
Retrieve a C<Net::Simplify::Customer> 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::Customer> object.
The properties that can be updated are:
=over 4
=item C<card.addressCity>
City of the cardholder. (B<required>)
=item C<card.addressCountry>
Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. (B<required>)
=item C<card.addressLine1>
Address of the cardholder. (B<required>)
=item C<card.addressLine2>
Address of the cardholder if needed. (B<required>)
=item C<card.addressState>
State of residence of the cardholder. State abbreviations should be used. (B<required>)
=item C<card.addressZip>
Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. (B<required>)
=item C<card.cvc>
CVC security code of the card. This is the code on the back of the card. Example: 123 (B<required>)
=item C<card.expMonth>
Expiration month of the card. Format is MM. Example: January = 01 (B<required>)
=item C<card.expYear>
Expiration year of the card. Format is YY. Example: 2013 = 13 (B<required>)
=item C<card.id>
ID of card. If present, card details for the customer will not be updated. If not present, the customer will be updated with the supplied card details.
=item C<card.name>
Name as appears on the card. (B<required>)
=item C<card.number>
( run in 1.058 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )