Net-Simplify

 view release on metacpan or  search on metacpan

README.txt  view on Meta::CPAN

  Using the SDK
  --------------

  To run a payment though Simplify Commerce use the following
  script substituting your public and private API keys:

      use Net::Simplify;

      # Set global API keys
      $Net::Simplify::public_key = 'YOUR PUBLIC KEY';
      $Net::Simplify::private_key = 'YOUR PRIVATE KEY';

      # Create a payment
      my $payment = Net::Simplify::Payment->create({
          amount => 1200,
          currency => 'USD',
          description => 'test payment',
          card => {
              number => "5555555555554444",
              cvc => "123",
              expMonth => 12,

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

=head1 NAME

Net::Simplify - Simplify Commerce Payments API

=head1 SYNOPSIS

  use Net::Simplify;

  # Set global API keys
  $Net::Simplify::public_key = 'YOUR PUBLIC KEY';
  $Net::Simplify::private_key = 'YOUR PRIVATE KEY';

  # Create a payment
  my $payment = Net::Simplify::Payment->create({
          amount => 1200,
          currency => 'USD',
          description => 'test payment',
          card => {
             number => "5555555555554444",
             cvc => "123",
             expMonth => 12,

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

          reference => 'P100'
  });

  printf "Payment %s %s\n", $payment->{id}, $payment->{paymentStatus};



  # Use an Authentication object to hold credentials
  my $auth = Net::Simplify::Authentication->create({
        public_key => 'YOUR PUBLIC KEY',
        private_key => 'YOUR PRIVATE_KEY'
  };

  # Create a payment using the $auth object
  my $payment2 = Net::Simplify::Payment->create({
          amount => 2400,
          currency => 'USD',
          description => 'test payment',
          card => {
             number => "5555555555554444",
             cvc => "123",

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

The Simplify module provides a convenient way of accessing the Simplify API.  It allows global
authentication keys to be set and imports all of the Simplify packages.


=head2 GLOBAL VARIABLES

=head3 $Net::Simplify::public_key

The public key to be used for all API calls where an Authentication object is not passed.

=head3 $Net::Simplify::private_key

The private key to be used for all API calls where an Authentication object is not passed.

=head3 $Net::Simplify::user_agent

The user agent string to be sent with all requests.

=head1 SEE ALSO

L<Net::Simplify::AccessToken>,

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


=cut

use 5.006;
use strict;
use warnings FATAL => 'all';

use Net::Simplify::Constants;

$Net::Simplify::public_key = undef;
$Net::Simplify::private_key = undef;
$Net::Simplify::api_base_live_url = $Net::Simplify::Constants::API_BASE_LIVE_URL;
$Net::Simplify::api_base_sandbox_url = $Net::Simplify::Constants::API_BASE_SANDBOX_URL;
$Net::Simplify::oauth_base_url = $Net::Simplify::Constants::OAUTH_BASE_URL;
$Net::Simplify::user_agent = undef;

use Net::Simplify::Authentication;
use Net::Simplify::AccessToken;
use Net::Simplify::ApiException;
use Net::Simplify::IllegalArgumentException;
use Net::Simplify::AuthenticationException;

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


  my $auth_code = "YOUR AUTH CODE";
  my $redirect_uri = "YOUR REDIRECT URI";

  my $token = Net::Simplify::AccessToken->create($auth_code, $redirect_uri);
  printf "Access token %s\n", $token->access_token;

  # Create Authentication object using the access token
  my $auth = Net::Simplify::Authentication->create({
        public_key => 'YOUR PUBLIC_KEY',
        private_key => 'YOUR PRIVATE KEY',
        access_token => $token->access_token
  });

  # Create a payment using the OAuth credentials
  my $payment = Net::Simplify::Payment->create({...}, $auth);


=head1 DESCRIPTION

Access tokens provide a way of performing operations on behalf of another user.  To create

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


The authentication code obtained during the OAuth login process.

=item C<$redirect_uri>

The redirect URI for the OAuth login process.  This must match the registered value.

=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 refresh()

Refresh the token obtaining new access and refresh tokens.  Authentication is done
using the same credentials used when the AccessToken was created.

=head3 revoke()

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


=head1 NAME

Net::Simplify::ApiException - Simplify Commerce exception base class.

=head1 SYNOPSIS

  use Net::Simplify;

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

  eval {
      my $payment = Net::Simplify::Payment->create(...);
  };
  if ($@) {
      if ($@->isa('Net::Simplify::ApiException')) {
          my $message = $@->message;
          my $code = $@->code;
          printf "API Exception: %s %s\n", $@->message, $@->code;
      }

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

=head1 NAME

Net::Simplify::Authentication - Simplify Commerce authentication class

=head1 SYNOPSIS

  use Net::Simplify;

  my $auth = Net::Simplify::Authentication->create({
      public_key => 'YOUR PUBLIC KEY',
      private_key => 'YOUR PRIVATE KEY'
  });
  
  my $payment = Net::Simplify::Payment->create({...}, $auth);

=head1 DESCRIPTION

=head3 create(%params)

Creates an authentication object using values in the C<params> hash.  The authencation 
object contains three values: C<public_key>, C<private_key> and C<access_token>.  The
public and private keys are used for all API requests and the access token is required
for all OAuth API requests (see L<Net::Simplify::AccessToken>).

If C<%params> contains C<public_key> this value is used to set the object's public key otherwise 
the value is taken from the global C<$Net::Simplify::public_key>. 
If C<%params> contains C<private_key> this value is used to set the object's private key otherwise 
the value is taken from the global C<$Net::Simplify::private_key>. 

=head3 public_key()

Returns the value of this object's public_key.

=head3 private_key()

Returns the value of this object's private_key.

=head3 access_token()

Returns the value of this object's access token.

=head1 SEE ALSO

L<Net::Simplify>,
L<Net::Simplify::AccessToken>,
L<http://www.simplify.com>

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

use 5.006;
use strict;
use warnings FATAL => 'all';

sub create {

    my ($class, $params) = @_;
    
    my $self = {};
    $self->{public_key} = $params->{public_key} if defined $params->{public_key};
    $self->{private_key} = $params->{private_key} if defined $params->{private_key};
    $self->{access_token} = $params->{access_token} if defined $params->{access_token};

    $self->{public_key} = $Net::Simplify::public_key unless defined $self->{public_key};
    $self->{private_key} = $Net::Simplify::private_key unless defined $self->{private_key};

    bless $self, $class
}

sub public_key {
    my ($self, $v) = @_;

    $self->{public_key} = $v if defined $v;

    $self->{public_key};
}

sub private_key {
    my ($self, $v) = @_;

    $self->{private_key} = $v if defined $v;

    $self->{private_key};
}

sub access_token {
    my ($self, $v) = @_;

    $self->{access_token} = $v if defined $v;

    $self->{access_token};
}

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


=head1 NAME

Net::Simplify::AuthenticationException - Simplify Commerce exception for authentication errors

=head1 SYNOPSIS

  use Net::Simplify;

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

  eval {
      my $payment = Net::Simplify::Payment->create(....);
  };
  if ($@) {
      if ($@->isa('Net::Simplify::AuthenticationException')) {
          printf "Authentication exception: %s\n", $@->message;
      }
  }
 

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

=head1 NAME

Net::Simplify::Authorization - A Simplify Commerce Authorization object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item token

If specified, card associated with card token will be used. [max length: 255] 


=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::Authorization> object.  Authentication is done using the same credentials used when the AccessToken was created.

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


=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





=head1 SEE ALSO

L<Net::Simplify>,

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


=head1 NAME

Net::Simplify::BadRequestException - Simplify Commerce exception for bad request errors

=head1 SYNOPSIS

  use Net::Simplify;

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

  eval {
      my $payment = Net::Simplify::Payment->create(...);
  };
  if ($@) {
      if ($@->isa('Net::Simplify::BadRequestException')) {
          printf "API Exception: %s %s\n", $@->message, $@->code;
          if ($@->has_field_errors) {
              foreach my $e ($@->field_errors) {
                  printf "Field error: %s %s %s\n", $e->field, $e->code, $e->message;

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

=head1 NAME

Net::Simplify::CardToken - A Simplify Commerce CardToken object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item source

Card Token Source [default: API] 


=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 find($id, $auth)

Retrieve a C<Net::Simplify::CardToken> 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::CardToken> object.
The properties that can be updated are:

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

=head1 NAME

Net::Simplify::Coupon - A Simplify Commerce Coupon object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item startDate

First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone. (B<required>) 


=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::Coupon> object.  Authentication is done using the same credentials used when the AccessToken was created.

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


=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::Coupon> object.
The properties that can be updated are:

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

=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";

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

=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.

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


=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:

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


=head1 NAME

Net::Simplify::DomainList - Simplify Commerce class representing a list of domain objects

=head1 SYNOPSIS

  use Net::Simplify;

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

  my $ret = Net::Simplify::Payment->list({});

  printf "Total: %d\n", $ret->total;
  foreach my $o ($ret->list) {
      printf " %s\n", $o->{id};
  }

=head1 DESCRIPTION

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


=head1 NAME

Net::Simplify::Event - Simplify Commerce webhook event class

=head1 SYNOPSIS

  use Net::Simplify;

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

  my $payload = 'YOUR WEBHOOK EVENT PAYLOAD';
  my $event = Net::Simplify::Event->create({payload => $payload});
  printf "event name %s\n", $event->{name};

  my $data = $event->{data};

=head1 DESCRIPTION

=head2 METHODS

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


=item C<url>

The URL for the webhook (optional, if present it must match the URL registered for the webhook).

=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

=head1 SEE ALSO

L<Net::Simplify>,
L<Net::Simplify::Authentication>,
L<http://www.simplify.com>

=head1 VERSION

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


=head1 NAME

Net::Simplify::FieldError - Simplify Commerce field error class

=head1 SYNOPSIS

  use Net::Simplify;

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

  eval {
      my $payment = Net::Simplify::Payment->create(...);
  };
  if ($@) {
      if ($@->isa('Net::Simplify::BadRequestException')) {
          if ($@->has_field_errors) {
              foreach my $error ($@->field_errors) {
                  my $c = $error->code;
                  my $f = $error->field;

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

=head1 NAME

Net::Simplify::FraudCheck - A Simplify Commerce FraudCheck object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item token

Card token representing card details for the card to be checked. [max length: 255] 


=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 list(%criteria, $auth)

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

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


=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::FraudCheck> object.
The properties that can be updated are:

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


=head1 NAME

Net::Simplify::IllegalArgumentException - Simplify Commerce exception for illegal argument errors

=head1 SYNOPSIS

  use Net::Simplify;

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

  eval {
      my $payment = Net::Simplify::Payment->create(....);
  };
  if ($@) {
      if ($@->isa('Net::Simplify::IllegalArgumentException')) {
          printf "Illegal argument exception: %s\n", $@->message;
      }
  }
 

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

=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";

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

=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.

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


=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:

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

=head1 NAME

Net::Simplify::InvoiceItem - A Simplify Commerce InvoiceItem object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item tax

The tax ID of the tax charge in the invoice item. 


=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::InvoiceItem> object.  Authentication is done using the same credentials used when the AccessToken was created.

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


=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::InvoiceItem> object.
The properties that can be updated are:

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

    if (defined $token) {
        $$header{$JWS_HDR_TOKEN} = $token;
    }

    my $p1 = encode_base64url(encode_json $header);

    my $p2 = "";
    $p2 = encode_base64url($payload) if defined $payload;

    my $msg = "${p1}.${p2}";
    my $sig = _sign($msg, $auth->private_key);

    "${msg}.${sig}";
}

sub decode {
    my ($class, $message, $url, $auth) = @_;
 
    # Remove whitespace
    $message =~ s/\s*//g; 
    my @parts = split(/\./, $message);
    my $num_parts = @parts;
    
    if ($num_parts != 3) {
        croak(Net::Simplify::IllegalArgumentException->new("Invalid JWS message"));
    }

    my $header = decode_json(decode_base64url($parts[0]));

    _verify_header($header, $url, $auth->public_key);

    if (!_verify_sig($auth->private_key, @parts)) {
        croak(Net::Simplify::AuthenticationException->new("JWS signature does not match"));
    }

    decode_json(decode_base64url($parts[1]));
}


sub _verify_header {
    my ($header, $url, $public_key) = @_;

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

        _auth_error("Missing nonce");
    }
    
    $value = $header->{$JWS_HDR_UNAME};
    if (!defined $value) {
        _auth_error("Missing username header");
    }
}

sub _sign {
    my ($msg, $private_key) = @_;

    my $key = decode_base64($private_key);

    hmac_b64u('SHA256', $key, $msg);
}

sub _verify_sig {
    my ($private_key, @parts) = @_;

    $parts[2] eq _sign($parts[0] . '.' . $parts[1], $private_key);
}

sub _verify_timestamp {
    my ($timestamp) = @_;
    
    abs($timestamp - _now()) < $JWS_TIMESTAMP_MAX_DIFF;
}
    
sub _now {
    gettimeofday() * 1000

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


=head1 NAME

Net::Simplify::NotAllowedException - Simplify Commerce exception for forbidden request errors

=head1 SYNOPSIS

  use Net::Simplify;

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

  eval {
      my $payment = Net::Simplify::Payment->create(....);
  };
  if ($@) {
      if ($@->isa('Net::Simplify::NotAllowedException')) {
          printf "Not allowed exception: %s\n", $@->message;
      }
  }
 

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


=head1 NAME

Net::Simplify::ObjectNotFoundException - Simplify Commerce exception for object not found errors

=head1 SYNOPSIS

  use Net::Simplify;

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

  eval {
      my $payment = Net::Simplify::Payment->find('a67e3');
  };
  if ($@) {
      if ($@->isa('Net::Simplify::ObjectNotFoundException')) {
          printf "Object not found exception: %s\n", $@->message;
      }
  }
 

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

=head1 NAME

Net::Simplify::Payment - A Simplify Commerce Payment object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item token

If specified, card associated with card token will be used. [max length: 255] 


=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 list(%criteria, $auth)

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

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


=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::Payment> object.
The properties that can be updated are:

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

=head1 NAME

Net::Simplify::Plan - A Simplify Commerce Plan object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item trialPeriodQuantity

Quantity of the trial period.  Must be greater than 0 and a whole number. [min value: 1] 


=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::Plan> object.  Authentication is done using the same credentials used when the AccessToken was created.

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


=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::Plan> object.
The properties that can be updated are:

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

=head1 NAME

Net::Simplify::Refund - A Simplify Commerce Refund object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item statementDescription.phoneNumber

Merchant contact phone number. 


=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 list(%criteria, $auth)

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

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


=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





=head1 SEE ALSO

L<Net::Simplify>,

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

}


sub _check_auth {
    my ($auth) = @_;

    if (!defined $auth->{public_key}) {
        croak(Net::Simplify::IllegalArgumentException->new("No public key"));
    }

    if (!defined $auth->{private_key}) {
        croak(Net::Simplify::IllegalArgumentException->new("No private key"));
    }
}


sub _check_param {
    my ($params, $name) = @_;

    if (!defined($params->{$name})) {
        croak(Net::Simplify::IllegalArgumentException->new("Missing paramater '${name}'"));

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

=head1 NAME

Net::Simplify::Subscription - A Simplify Commerce Subscription object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item source

Source of where subscription was created 


=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::Subscription> object.  Authentication is done using the same credentials used when the AccessToken was created.

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


=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::Subscription> object.
The properties that can be updated are:

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


=head1 NAME

Net::Simplify::SystemException - Simplify Commerce exception for system errors

=head1 SYNOPSIS

  use Net::Simplify;

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

  eval {
      my $payment = Net::Simplify::Payment->create(....);
  };
  if ($@) {
      if ($@->isa('Net::Simplify::SystemException')) {
          printf "System exception: %s\n", $@->message;
      }
  }
 

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

=head1 NAME

Net::Simplify::Tax - A Simplify Commerce Tax object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item rate

The tax rate.  Decimal value up three decimal places.  e.g 12.501. [max length: 6] (B<required>) 


=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::Tax> object.  Authentication is done using the same credentials used when the AccessToken was created.

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


=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





=head1 SEE ALSO

L<Net::Simplify>,

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

=head1 NAME

Net::Simplify::TransactionReview - A Simplify Commerce TransactionReview object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

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

=over 4


=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::TransactionReview> object.  Authentication is done using the same credentials used when the AccessToken was created.

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


=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::TransactionReview> object.
The properties that can be updated are:

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

=head1 NAME

Net::Simplify::Webhook - A Simplify Commerce Webhook object

=head1 SYNOPSIS

  use Net::Simplify;


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

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

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

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

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

=item url

Endpoint URL (B<required>) 


=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::Webhook> object.  Authentication is done using the same credentials used when the AccessToken was created.

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


=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::Webhook> object.
The properties that can be updated are:



( run in 0.518 second using v1.01-cache-2.11-cpan-4d50c553e7e )