X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=Cardcom.pm;h=20eff05cd8465d6ebf63a2678281cabf6a2345c8;hb=f1d2acf660099ccb14f472a54aea4659f4544c17;hp=68ba354a2a3441309280546fba229b122c24cc29;hpb=f615277ada6dbcb82a61e15e757e88c428662366;p=Business-OnlinePayment-Cardcom.git diff --git a/Cardcom.pm b/Cardcom.pm index 68ba354..20eff05 100644 --- a/Cardcom.pm +++ b/Cardcom.pm @@ -5,11 +5,11 @@ use Carp; use Tie::IxHash; use Business::OnlinePayment 3; use Business::OnlinePayment::HTTPS 0.03; -use Data::Dumper; +#use Data::Dumper; use vars qw($VERSION $DEBUG @ISA); @ISA = qw(Business::OnlinePayment::HTTPS); -$VERSION = '0.01'; +$VERSION = '0.02'; $DEBUG = 0; sub set_defaults { @@ -24,11 +24,10 @@ sub set_defaults { # -Identity number # -Configurable currency # -Configurable deal code -# -Refunds or whatever this thing calls them sub submit { my($self) = @_; - warn Dumper($self) if $DEBUG > 1; + #warn Dumper($self) if $DEBUG > 1; $self->remap_fields( card_number => 'cardnumber', @@ -38,8 +37,13 @@ sub submit { cvv2 => 'cvv', ); - die "invalid action" unless - $self->{_content}{'action'} =~ /^\s*normal\s*authorization\s*$/i; + my $action = $self->{_content}{'action'}; + if ( $action =~ /^\s*credit\s*$/i ) { + $self->{_content}{dealtype} = 51; + $self->{_content}{credittype} = 1; + } elsif ( $action !~ /^\s*normal\s*authorization\s*$/i ) { + die "invalid action"; + } $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/ or croak "unparsable expiration ". $self->{_content}{expiration}; @@ -111,6 +115,8 @@ sub fields { Username userpassword languages + dealtype + credittype cvv ); } @@ -121,12 +127,13 @@ sub _info { 'gateway_name' => 'Cardcom', 'gateway_url' => 'http://www.cardcom.co.il', 'module_version' => $VERSION, - 'support_types' => [ 'CC' ], + 'supported_types' => [ 'CC' ], 'token_support' => 0, # well technically the gateway supports it, but we haven't implemented it 'test_transaction' => 1, - 'supported_actions' => [ # XXX refunds + 'supported_actions' => [ 'Normal Authorization', - ], + 'Credit', + ], }; } @@ -146,12 +153,11 @@ Business::OnlinePayment::Cardcom - Cardcom backend module for Business::OnlinePa # One step transaction, the simple case. #### - my $tx = new Business::OnlinePayment("Cardcom"); + my $tx = new Business::OnlinePayment("Cardcom", 'TerminalNumber'=>1234 ); $tx->content( type => 'CC', login => 'Cardcom Username', password => 'Cardcom Password', - terminalnumber => 'Cardcom Terminal Number', action => 'Normal Authorization', amount => '49.95', card_number => '4005550000000019', @@ -170,7 +176,7 @@ Business::OnlinePayment::Cardcom - Cardcom backend module for Business::OnlinePa =head2 CC -Content required: type, login, password, action, amount, card_number, expiration, terminalnumber. +Content required: type, login, password, action, amount, card_number, expiration. =head1 PREREQUISITES @@ -182,10 +188,20 @@ For detailed information see L. =head1 AUTHOR -Erik Levinson +Original Author: Erik Levinson -=head1 SEE ALSO +Current Maintainer: Ivan Kohler C<< >> perl(1). L. +=head1 ADVERTISEMENT + +Need a complete, open-source back-office and customer self-service solution? +The Freeside software includes support for credit card and electronic check +processing, integrated trouble ticketing, and customer signup and self-service +web interfaces. + +http://freeside.biz/freeside/ + + =cut