summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngel Abad <angel@debian.org>2014-05-09 09:08:03 +0200
committerAngel Abad <angel@debian.org>2014-05-09 09:08:03 +0200
commitc78393be4a247887344ed866822e008c9fb064a1 (patch)
tree251daa6e1c637b93a14d0880a44d7e479c06e1ed
parent97b16ca76ef3f6ab8156799c1e196f7b93e6495b (diff)
parent833fd63d7013e1350c790c8fbbc50d6836832a40 (diff)
Merge tag 'upstream/3.03'
Upstream version 3.03 # gpg: Firmado el vie 09 may 2014 09:07:58 CEST usando clave DSA ID EE3BC279 # gpg: comprobando base de datos de confianza # gpg: 3 dudosa(s) necesarias, 1 completa(s) necesarias, # modelo de confianza classic # gpg: nivel: 0 validez: 5 firmada: 15 confianza: 0-, 0q, 0n, 0m, 0f, 5u # gpg: nivel: 1 validez: 15 firmada: 90 confianza: 9-, 0q, 0n, 2m, 4f, 0u # gpg: nivel: 2 validez: 12 firmada: 72 confianza: 12-, 0q, 0n, 0m, 0f, 0u # gpg: siguiente comprobaciĆ³n de base de datos de confianza el: 2015-02-04 # gpg: Firma correcta de "Angel Abad <angelabad@gmail.com>" # gpg: alias "Angel Abad (Indio) <angel@sindominio.net>" # gpg: alias "Angel Abad <angelabad@ubuntu.com>" # gpg: alias "Angel Abad <angel@debian.org>"
-rw-r--r--Changes8
-rw-r--r--MANIFEST2
-rw-r--r--META.json42
-rw-r--r--META.yml40
-rw-r--r--OnlinePayment.pm63
-rw-r--r--README2
-rw-r--r--notes_for_module_writers_v33
-rw-r--r--t/override.t24
8 files changed, 138 insertions, 46 deletions
diff --git a/Changes b/Changes
index f2d1a19..ebdfdc9 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,13 @@
Revision history for Perl extension Business::OnlinePayment.
+3.03 Tue Apr 29 11:14:25 PDT 2014
+ - Document Reverse Authorization action
+ - Document expiration is MM/YY and fix the example
+ - Document repository moved from CVS to git
+ - Add avs_code and cvv2_response to build_subs, they're standard fields
+ - Document best-practice eval of the submit() method in example
+ - Rework build_subs(), thanks to Michal Schwern, closes: CPAN#22073
+
3.02 Fri Aug 19 16:20:04 PDT 2011
- Fix fatal error calling ->info('supported_actions') on a gateway that
does not yet support introspection (e.g. AuthorizeNet)
diff --git a/MANIFEST b/MANIFEST
index 9063c11..9383160 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -12,7 +12,9 @@ t/bop.t
t/fd_precharge.t
t/pod.t
t/introspection.t
+t/override.t
notes_for_module_writers
notes_for_module_writers_v3
META.yml Module meta-data (added by MakeMaker)
TODO
+META.json Module JSON meta-data (added by MakeMaker)
diff --git a/META.json b/META.json
new file mode 100644
index 0000000..f60bd67
--- /dev/null
+++ b/META.json
@@ -0,0 +1,42 @@
+{
+ "abstract" : "unknown",
+ "author" : [
+ "Ivan Kohler <ivan-business-onlinepayment@420.am>"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921",
+ "license" : [
+ "unknown"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Business-OnlinePayment",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Net::HTTPS::Any" : "0",
+ "Tie::IxHash" : "0"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "version" : "3.03"
+}
diff --git a/META.yml b/META.yml
index 5c77615..1bebe06 100644
--- a/META.yml
+++ b/META.yml
@@ -1,23 +1,23 @@
---- #YAML:1.0
-name: Business-OnlinePayment
-version: 3.02
-abstract: ~
+---
+abstract: unknown
author:
- - Ivan Kohler <ivan-business-onlinepayment@420.am>
-license: unknown
-distribution_type: module
-configure_requires:
- ExtUtils::MakeMaker: 0
+ - 'Ivan Kohler <ivan-business-onlinepayment@420.am>'
build_requires:
- ExtUtils::MakeMaker: 0
-requires:
- Net::HTTPS::Any: 0
- Tie::IxHash: 0
-no_index:
- directory:
- - t
- - inc
-generated_by: ExtUtils::MakeMaker version 6.56
+ ExtUtils::MakeMaker: 0
+configure_requires:
+ ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921'
+license: unknown
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: Business-OnlinePayment
+no_index:
+ directory:
+ - t
+ - inc
+requires:
+ Net::HTTPS::Any: 0
+ Tie::IxHash: 0
+version: 3.03
diff --git a/OnlinePayment.pm b/OnlinePayment.pm
index 63093fa..f3d221c 100644
--- a/OnlinePayment.pm
+++ b/OnlinePayment.pm
@@ -6,7 +6,7 @@ use Carp;
require 5.005;
-$VERSION = '3.02';
+$VERSION = '3.03';
$VERSION = eval $VERSION; # modperlstyle: convert the string into a number
# Remember subclasses we have "wrapped" submit() with _pre_submit()
@@ -33,8 +33,12 @@ my @methods = qw(
response_code
response_header
response_page
+ avs_code
+ cvv2_response
);
+__PACKAGE__->build_subs(@methods);
+
#fallback
sub _info {
my $class = shift;
@@ -86,7 +90,6 @@ sub new {
croak("unknown processor $processor ($@)") if $@;
my $self = bless {processor => $processor}, $subclass;
- $self->build_subs(@methods);
if($self->can("set_defaults")) {
$self->set_defaults(%data);
@@ -157,7 +160,6 @@ sub _pre_submit {
unless ( $@ =~ m/^Can\'t locate/ );
} else {
my $risk_tx = bless( { processor => $fraud_detection }, $subclass );
- $risk_tx->build_subs(@methods);
if ($risk_tx->can('set_defaults')) {
$risk_tx->set_defaults();
}
@@ -270,15 +272,24 @@ Business::OnlinePayment - Perl extension for online payment processing
type => 'Visa',
amount => '49.95',
card_number => '1234123412341238',
- expiration => '0100',
+ expiration => '06/15',
name => 'John Q Doe',
);
- $transaction->submit();
-
- if($transaction->is_success()) {
- print "Card processed successfully: ", $transaction->authorization(), "\n";
+
+ eval { $transaction->submit(); };
+
+ if ( $@ ) {
+
+ print "$processor error: $@\n";
+
} else {
- print "Card was rejected: ", $transaction->error_message(), "\n";
+
+ if ( $transaction->is_success() ) {
+ print "Card processed successfully: ". $transaction->authorization()."\n";
+ } else {
+ print "Card was rejected: ". $transaction->error_message(). "\n";
+ }
+
}
=head1 DESCRIPTION
@@ -345,6 +356,8 @@ What action being taken by this transaction. Currently available are:
=item Post Authorization
+=item Reverse Authorization
+
=item Void
=item Credit
@@ -499,7 +512,7 @@ Credit card number.
=item expiration
-Credit card expiration.
+Credit card expiration, MM/YY.
=item cvv2
@@ -627,14 +640,19 @@ verification (if the processor supports it).
=head2 submit()
-Submit the transaction to the processor for completion
+Submit the transaction to the processor for completion.
+
+If there is a gateway communication error or other "meta" , the submit method
+will throw a fatal exception. You can catch this with eval {} if you would
+like to treat gateway co
=head1 TRANSACTION RESULT METHODS
=head2 is_success()
-Returns true if the transaction was submitted successfully, false if
-it failed (or undef if it has not been submitted yet).
+Returns true if the transaction was approved by the gateway, false if
+it was submitted but not approved, or undef if it has not been
+submitted yet.
=head2 error_message()
@@ -650,10 +668,8 @@ are: "expired", "nsf" (non-sufficient funds), "stolen", "pickup",
"blacklisted" and "declined" (card/transaction declines only, not
other errors).
-Note that (as of Aug 2006) this is only supported by some of the
-newest processor modules, and that, even if supported, a failure
-status is an entirely optional field that is only set for specific
-kinds of failures.
+Note that not all processor modules support this, and that if supported,
+it may not be set for all declines.
=head2 authorization()
@@ -774,7 +790,7 @@ Phil Lobbes E<lt>phil at perkpartners dot comE<gt>
Copyright (c) 1999-2004 Jason Kohles
Copyright (c) 2004 Ivan Kohler
-Copyright (c) 2007-2011 Freeside Internet Services, Inc.
+Copyright (c) 2007-2014 Freeside Internet Services, Inc.
All rights reserved.
@@ -794,21 +810,18 @@ http://420.am/cgi-bin/mailman/listinfo/bop-devel/
=head1 REPOSITORY
-The code is available from our public CVS repository:
+The code is available from our public git repository:
- export CVSROOT=":pserver:anonymous@cvs.freeside.biz:/home/cvs/cvsroot"
- cvs login
- # The password for the user `anonymous' is `anonymous'.
- cvs checkout Business-OnlinePayment
+ git clone git://git.freeside.biz/Business-OnlinePayment.git
Or on the web:
- http://freeside.biz/cgi-bin/viewvc.cgi/Business-OnlinePayment/
+ http://freeside.biz/gitweb/?p=Business-OnlinePayment.git
Many (but by no means all!) processor plugins are also available in the same
repository, see:
- http://freeside.biz/cgi-bin/viewvc.cgi/
+ http://freeside.biz/gitweb/
=head1 DISCLAIMER
diff --git a/README b/README
index a6e2be3..7566d31 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
Copyright (c) 1999-2004 Jason Kohles
Copyright (c) 2004 Ivan Kohler
-Copyright (c) 2007-2010 Freeside Internet Services, Inc.
+Copyright (c) 2007-2012 Freeside Internet Services, Inc.
All rights reserved. This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
diff --git a/notes_for_module_writers_v3 b/notes_for_module_writers_v3
index e7f0501..1d848f5 100644
--- a/notes_for_module_writers_v3
+++ b/notes_for_module_writers_v3
@@ -4,6 +4,9 @@ These are the module writer's notes for v3. See the regular
- If your gateway is HTTPS-based, use (or convert to)
Business::OnlinePayment::HTTPS !!
+ Note: The correct thing for modern B:OP: gateway modules that need to
+ speak HTTPS to do is to use Business::OnlinePayment::HTTPS and depend on
+ "Net::HTTPS::Any" (since B:OP itself doesn't).
- Handling failures:
diff --git a/t/override.t b/t/override.t
new file mode 100644
index 0000000..d35c4fd
--- /dev/null
+++ b/t/override.t
@@ -0,0 +1,24 @@
+#!/usr/bin/perl -w
+
+use Test::More tests => 2;
+
+{ # fake test driver (with submit method)
+
+ package Business::OnlinePayment::MOCK;
+ use strict;
+ use warnings;
+ use base qw(Business::OnlinePayment);
+ sub test_transaction {
+ my $self = shift;
+ return $self->SUPER::test_transaction(@_);
+ }
+}
+
+$INC{"Business/OnlinePayment/MOCK.pm"} = "testing";
+
+my $tx = Business::OnlinePayment->new("MOCK");
+is eval {
+ $tx->test_transaction(1);
+ $tx->test_transaction;
+}, 1;
+is $@, '';