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',
66 ok( $response = $tr->response_decoded, 'response_decoded' );
68 for my $k ( keys %expect ) {
70 $response->{$k} eq $expect{$k},
71 sprintf '$tr->%s == %s', $k, $expect{$k}
75 for my $k ( @expect ) {
77 defined $response->{$k},
78 sprintf '$r->%s (%s)',
85 action => 'Post Authorization',
86 order_number => $tr->order_number,
87 amount => '8.99', # $1 Less than pre-auth
91 ok( $tr_pa = Business::OnlinePayment->new('Bambora'), 'Instantiate $tr_pa' );
92 ok( $tr_pa->content( %content ), 'Set transaction content onto $tr_pa' );
95 eval { $tr_pa->submit };
96 ok( !$@, "Submit post-auth" );
97 warn "Error: $@" if $@;
103 message => 'Approved',
108 authorizing_merchant_id
116 ok( $response_pa = $tr_pa->response_decoded, 'response_decoded' );
118 for my $k ( keys %expect ) {
120 $response_pa->{$k} eq $expect{$k},
121 sprintf '$tr->%s == %s', $k, $expect{$k}
125 for my $k ( @expect ) {
127 defined $response_pa->{$k},
128 sprintf '$r->%s (%s)',
129 $k, $response_pa->{$k}
139 login => $content{login},
140 password => $content{password},
141 order_number => $tr_pa->order_number,
146 ok( $tr_void = Business::OnlinePayment->new('Bambora'), 'Instantiate $tr_void' );
147 ok( $tr_void->content( %content_void ), 'Set transaction content onto $tr_void' );
150 eval { $tr_void->submit };
151 ok( !$@, "Submit void" );
152 warn "Error: $@" if $@;
158 message => 'Approved',
163 authorizing_merchant_id