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

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 2.007 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-2cc899e4a130 )