3.02 unreleased
- Fix fatal error calling ->info('supported_actions') on a gateway that
does not yet support introspection (e.g. AuthorizeNet)
+ - Fix introspection with a complicated supported_actions
- Documentation fix for recurring_billing flag
- Add optional transaction field to documentation: currency
- Fix spelling mistake in preCharge.pm POD, thanks to gregor herrmann,
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More tests => 13;
{ # fake test driver 1 (no _info hash)
}
}
+{ # fake test driver 3 (with _info hash)
+
+ package Business::OnlinePayment::MOCK3;
+ use base qw(Business::OnlinePayment::MOCK1);
+ sub _info {
+ {
+ 'info_compat' => '0.01', # always 0.01 for now,
+ # 0.02 will have requirements
+ 'gateway_name' => 'Example Gateway',
+ 'gateway_url' => 'http://www.example.com/',
+ 'module_version' => '0.01', #$VERSION,
+ 'supported_types' => [ qw( CC ECHECK ) ],
+ 'token_support' => 1,
+ 'test_transaction' => 1,
+ 'supported_actions' => { 'CC' => [
+ 'Normal Authorization',
+ 'Authorization Only',
+ 'Post Authorization',
+ 'Void',
+ 'Credit',
+ 'Recurring Authorization',
+ 'Modify Recurring Authorization',
+ 'Cancel Recurring Authorization',
+ ],
+ 'ECHECK' => [
+ 'Normal Authorization',
+ 'Void',
+ 'Credit',
+ ],
+ },
+ };
+ }
+}
+
my $package = "Business::OnlinePayment";
-my @drivers = qw(MOCK1 MOCK2);
+my @drivers = qw(MOCK1 MOCK2 MOCK3);
my $driver = $drivers[0];
# trick to make use() happy (called in Business::OnlinePayment->new)
'CC_void_requires_card introspection');
ok(!$obj->info('ECHECK_void_requires_account'),
'ECHECK_void_requires_account introspection');
+
+
+$driver = 'MOCK3';
+$obj = $package->new($driver);
+isa_ok( $obj, $package );
+isa_ok( $obj, $package . "::" . $driver );
+
+%actions = eval { $obj->info('supported_actions') };
+ok( grep { $_ eq 'Authorization Only' } @{ $actions{CC} },
+ "->info('supported_actions') w/hashref supported_actions");
+ok( ! grep { $_ eq 'Authorization Only' } @{ $actions{ECHECK} },
+ "->info('supported_actions') w/hashref supported_actions");
+