Business-PinPayment

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

--- #YAML:1.0
name: Business-PinPayment
version: 0.03
author:
  - Xufeng (Danny) Liang <danny.glue@gmail.com>
abstract: Interface to Pin Payment API
license: perl
requires:
  Test::More: 0
  HTTP::Request: 0
  LWP::UserAgent: 0
  Net::SSL: 0
  JSON: 0

Makefile.PL  view on Meta::CPAN

    NAME                => 'Business::PinPayment',
    AUTHOR              => q{Xufeng (Danny) Liang <danny.glue@gmail.com>},
    VERSION_FROM        => 'lib/Business/PinPayment.pm',
    ABSTRACT_FROM       => 'lib/Business/PinPayment.pm',
    ($ExtUtils::MakeMaker::VERSION >= 6.3002
      ? ('LICENSE'=> 'perl')
      : ()),
    PL_FILES            => {},
    PREREQ_PM => {
        'Test::More' => 0,
        'HTTP::Request' => 0,
        'LWP::UserAgent' => 0,
        'Net::SSL' => 0,
        'JSON' => 0
    },
    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
    clean               => { FILES => 'Business-PinPayment-*' },
);

lib/Business/PinPayment.pm  view on Meta::CPAN

package Business::PinPayment;
use strict;
use warnings;
use Net::SSL;
use HTTP::Request;
use LWP::UserAgent;
use JSON;

our $VERSION = '0.04';

# build 4.1

sub new {
  my ($class, %args) = (@_);
  my $self = bless {}, $class;

lib/Business/PinPayment.pm  view on Meta::CPAN

  }

  if ($api eq 'refunds' && $self->{config}->{charge_token}) {
    $url .= '/charges/' . $self->{config}->{charge_token} .'/' .$api;
  }
  else {
    $url .= '/' . $api;
  }

  my $ua = LWP::UserAgent->new();
  my $p = HTTP::Request->new(POST => $url);
  $p->content_type('application/json');
  $p->authorization_basic($api_key);

  my $json_request = to_json( $self->{config}, {utf8 => 1} );
  $p->content($json_request) unless $api eq 'refunds';
  $self->{response} = $ua->request($p);
  
  my $json_response;
  
  if ($self->{response}->content) {

lib/Business/PinPayment.pm  view on Meta::CPAN

=head2 C<successful>

Returns true if the transaction is successful.

=head2 C<error>

Returns the error message.

=head2 C<response>

Returns the response of the L<HTTP::Request> object.

=head2 C<json_response>

Returns a hashref of the JSON response content.

=head2 C<id>

Returns the transaction 'token'.

=head2 C<status>

Returns the successful 'status_message', error message or code.

=head2 C<card_token>

Returns the 'card_token'.

=head1 SEE ALSO

L<HTTP::Request>, L<LWP::UserAgent>, L<https://pin.net.au>

=head1 AUTHOR

Xufeng (Danny) Liang (danny.glue@gmail.com)

=head1 COPYRIGHT & LICENSE

Copyright 2013 Xufeng (Danny) Liang, All Rights Reserved.

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



( run in 0.574 second using v1.01-cache-2.11-cpan-de7293f3b23 )