From f615277ada6dbcb82a61e15e757e88c428662366 Mon Sep 17 00:00:00 2001 From: levinse Date: Tue, 7 Jun 2011 00:06:41 +0000 Subject: [PATCH] BOP Cardcom, RT13058 --- Cardcom.pm | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/Cardcom.pm b/Cardcom.pm index cd8b2a8..68ba354 100644 --- a/Cardcom.pm +++ b/Cardcom.pm @@ -28,10 +28,13 @@ sub set_defaults { sub submit { my($self) = @_; + warn Dumper($self) if $DEBUG > 1; + $self->remap_fields( card_number => 'cardnumber', amount => 'Sum', login => 'Username', + password => 'userpassword', cvv2 => 'cvv', ); @@ -51,6 +54,16 @@ sub submit { $self->terminalnumber =~ /^\d+$/ or die "invalid TerminalNumber"; $self->{_content}{TerminalNumber} = $self->terminalnumber; + $self->required_fields( + qw( login password TerminalNumber card_number amount ) + ); + + if($self->test_transaction) { + $self->{_content}{'Username'} = 'gali'; + $self->{_content}{'userpassword'} = '7654321'; + $self->{_content}{'TerminalNumber'} = '1000'; + } + tie my %fields, 'Tie::IxHash', $self->get_fields( $self->fields ); my $post_data = join('&', map "$_=$fields{$_}", keys %fields ); warn "POSTING: ".$post_data if $DEBUG > 1; @@ -76,9 +89,10 @@ sub submit { my $authorization = $2; my $message = $3; - $self->authorization($authorization); + $self->result_code($result); if ( $result == 0 ) { $self->is_success(1); + $self->authorization($authorization); } else { $self->is_success(0); $self->error_message($message); @@ -95,11 +109,27 @@ sub fields { cardvalidityyear cardvaliditymonth Username + userpassword languages cvv ); } +sub _info { + { + 'info_compat' => '0.01', + 'gateway_name' => 'Cardcom', + 'gateway_url' => 'http://www.cardcom.co.il', + 'module_version' => $VERSION, + 'support_types' => [ 'CC' ], + 'token_support' => 0, # well technically the gateway supports it, but we haven't implemented it + 'test_transaction' => 1, + 'supported_actions' => [ # XXX refunds + 'Normal Authorization', + ], + }; +} + 1; __END__ @@ -126,6 +156,7 @@ Business::OnlinePayment::Cardcom - Cardcom backend module for Business::OnlinePa amount => '49.95', card_number => '4005550000000019', expiration => '08/06', + cvv2 => '123', ); $tx->submit(); @@ -143,11 +174,8 @@ Content required: type, login, password, action, amount, card_number, expiration =head1 PREREQUISITES - URI::Escape Tie::IxHash - Net::SSLeay _or_ ( Crypt::SSLeay and LWP ) - =head1 DESCRIPTION For detailed information see L. -- 2.11.0