X-Git-Url: http://git.freeside.biz/gitweb/?p=Business-OnlinePayment-Bambora.git;a=blobdiff_plain;f=t%2F051-tokenize-fail.t;fp=t%2F051-tokenize-fail.t;h=61bafb407b0f495a557453fad2498ce379709e54;hp=0000000000000000000000000000000000000000;hb=ef8b468214d2917b90f0537130f14c217ea71224;hpb=24c86c6b9136ad878a118d57fc9b876eee3672f8 diff --git a/t/051-tokenize-fail.t b/t/051-tokenize-fail.t new file mode 100755 index 0000000..61bafb4 --- /dev/null +++ b/t/051-tokenize-fail.t @@ -0,0 +1,47 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use lib 't'; +use TestFixtures; +use Business::OnlinePayment; +use Data::Dumper; + $Data::Dumper::Sortkeys = 1; + $Data::Dumper::Indent = 1; + +my $merchant_id = $ENV{BAMBORA_MERCHANT_ID}; +my $api_key = $ENV{BAMBORA_API_KEY}; + +SKIP: { + skip 'Missing env vars BAMBORA_MERCHANT_ID and BAMBORA_API_KEY', 36 + unless $merchant_id && $api_key; + + # + # Attempt charge with a normal credit card number as card_token + # Expect fail + # + + my %content_fail = ( + login => $merchant_id, + password => $api_key, + + action => 'Normal Authorization', + card_token => '4242424242424242', + amount => '24.95', + ); + + my ( $tr_fail, $response_fail ) = make_api_request( \%content_fail ); + + inspect_transaction( + $tr_fail, + { is_success => 0 }, + [qw/ error_message /], + ); + + ok( $tr_fail->error_message =~ /invalid card_token/i, + 'Saw expected error_message' + ); +} + +done_testing; \ No newline at end of file