7 require 'TestFixtures.pm';
8 use Business::OnlinePayment;
10 my $merchant_id = $ENV{BAMBORA_MERCHANT_ID};
11 my $api_key = $ENV{BAMBORA_API_KEY};
14 skip 'Missing env vars BAMBORA_MERCHANT_ID and BAMBORA_API_KEY', 3
15 unless $merchant_id && $api_key;
18 login => $merchant_id,
20 action => 'Authorization Only',
23 owner => 'Freeside Internet Services',
24 name => 'Mitch Jackson',
25 address => '1407 Graymalkin Lane',
31 invoice_number => time(),
32 card_number => '4030000010001234',
35 phone => '251-300-1300',
36 email => 'mitch@freeside.biz',
40 ok( $tr = Business::OnlinePayment->new('Bambora'), 'Instantiatiate $tr' );
41 ok( $tr->content( %content ), 'Set transaction content onto $tr' );
45 ok( !$@, "Submit pre-auth (expect approve)" );
53 message => 'Approved',
55 payment_method => 'CC',
65 ok( $response = $tr->response_decoded, 'response_decoded' );
67 for my $k ( keys %expect ) {
69 $response->{$k} eq $expect{$k},
70 sprintf '$tr->%s == %s', $k, $expect{$k}
74 for my $k ( @expect ) {
76 defined $response->{$k},
77 sprintf '$r->%s (%s)',
84 action => 'post authorization',
85 order_number => $tr->order_number,
89 ok( $tr_pa = Business::OnlinePayment->new('Bambora'), 'Instantiate $tr_pa' );
90 ok( $tr->content( %content ), 'Set transaction content onto $tr_pa' );
93 eval { $tr_pa->submit };
94 ok( !$@, "Submit post-auth" );
95 warn "Error: $@" if $@;
101 ok( $response_pa = $tr_pa->response_decoded, 'response_decoded' );
112 # defined $tr->$attr(),
113 # sprintf '%s $tr->%s() = %s',