8 use Business::OnlinePayment;
10 $Data::Dumper::Sortkeys = 1;
11 $Data::Dumper::Indent = 1;
13 my $merchant_id = $ENV{BAMBORA_MERCHANT_ID};
14 my $api_key = $ENV{BAMBORA_API_KEY};
17 skip 'Missing env vars BAMBORA_MERCHANT_ID and BAMBORA_API_KEY', 36
18 unless $merchant_id && $api_key;
23 login => $merchant_id,
30 # Create a payment profile with Tokenize
33 my ( $tr, $response ) = make_api_request( \%content );
39 message => 'Operation Successful',
41 [qw/ customer_code /],
45 $response->{customer_code} eq $tr->card_token,
46 '$tr->card_token eq $response->{customer_code}'
50 # Create a charge against the payment profile
51 # with the token set as 'card_number'
56 action => 'Normal Authorization',
57 card_number => $tr->card_token,
61 my ( $tr_ch1, $response_ch1 ) = make_api_request( \%content_ch1 );
64 # response_ch1 => $response_ch1,
70 amount => $content_ch1{amount},
73 authorizing_merchant_id => $content{login},
74 message => 'Approved',
75 payment_method => 'CC',
87 # Create a charge against the payment profile
88 # with the token set as 'card_token'
92 login => $content{login},
93 password => $content{password},
94 action => 'Normal Authorization',
95 #card_token => '9915559773829941',
96 card_token => $tr->card_token,
100 my ( $tr_ch2, $response_ch2 ) = make_api_request( \%content_ch2 );
103 # response_chs => $response_ch2
109 amount => $content_ch2{amount},
112 authorizing_merchant_id => $content{login},
113 message => 'Approved',
114 payment_method => 'CC',
125 # Attempt charge with a normal credit card number as card_token
131 card_token => '4242424242424242',
135 my ( $tr_fail, $response_fail ) = make_api_request( \%content_fail );
140 [qw/ error_message /],