1 package Business::OnlinePayment::Cardcom;
6 use Business::OnlinePayment 3;
7 use Business::OnlinePayment::HTTPS 0.03;
9 use vars qw($VERSION $DEBUG @ISA);
11 @ISA = qw(Business::OnlinePayment::HTTPS);
18 $self->server('secure.cardcom.co.il');
19 $self->path('/BillGoldPost.aspx');
25 # -Configurable currency
26 # -Configurable deal code
27 # -Refunds or whatever this thing calls them
32 card_number => 'cardnumber',
38 die "invalid action" unless
39 $self->{_content}{'action'} =~ /^\s*normal\s*authorization\s*$/i;
41 $self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
42 or croak "unparsable expiration ". $self->{_content}{expiration};
43 my( $month, $year ) = ( $1, $2 );
44 $month = '0'. $month if $month =~ /^\d$/;
45 $self->{_content}{cardvalidityyear} = $year;
46 $self->{_content}{cardvaliditymonth} = $month;
48 $self->{_content}{amount} = sprintf('%.2f', $self->{_content}{amount} );
49 $self->{_content}{languages} = 'en';
51 $self->terminalnumber =~ /^\d+$/ or die "invalid TerminalNumber";
52 $self->{_content}{TerminalNumber} = $self->terminalnumber;
54 tie my %fields, 'Tie::IxHash', $self->get_fields( $self->fields );
55 my $post_data = join('&', map "$_=$fields{$_}", keys %fields );
56 warn "POSTING: ".$post_data if $DEBUG > 1;
58 my( $page, $response, @reply_headers) = $self->https_post( $post_data );
60 if ($response !~ /^200/) {
62 $response =~ s/[\r\n]+/ /g; # ensure single line
64 my $diag_message = $response || "connection error";
68 $self->server_response($page);
70 unless ( $page =~ /^(\d+);(\d+);(.*?)$/ ) {
71 die "unparsable response received from gateway" .
72 ( $DEBUG ? ": $page" : '' );
76 my $authorization = $2;
79 $self->authorization($authorization);
84 $self->error_message($message);
109 Business::OnlinePayment::Cardcom - Cardcom backend module for Business::OnlinePayment
113 use Business::OnlinePayment::Cardcom;
116 # One step transaction, the simple case.
119 my $tx = new Business::OnlinePayment("Cardcom");
122 login => 'Cardcom Username',
123 password => 'Cardcom Password',
124 terminalnumber => 'Cardcom Terminal Number',
125 action => 'Normal Authorization',
127 card_number => '4005550000000019',
128 expiration => '08/06',
132 if($tx->is_success()) {
133 print "Card processed successfully: ".$tx->authorization."\n";
135 print "Card was rejected: ".$tx->error_message."\n";
138 =head1 SUPPORTED TRANSACTION TYPES
142 Content required: type, login, password, action, amount, card_number, expiration, terminalnumber.
149 Net::SSLeay _or_ ( Crypt::SSLeay and LWP )
153 For detailed information see L<Business::OnlinePayment>.
157 Erik Levinson <levinse@freeside.biz>
161 perl(1). L<Business::OnlinePayment>.