1 package Business::OnlinePayment::CardFortress;
3 use base qw( Business::OnlinePayment::HTTPS );
7 #use vars qw( $DEBUG $me );
13 'info_version' => '0.01',
14 'module_version' => $VERSION,
15 'supported_types' => [ 'CC' ],
16 'supported_actions' => { 'CC' => [
17 'Normal Authorization',
24 'token_support' => 'challenge/response',
25 #need to figure out how to pass through for gateways that do... an option?
26 #'CC_void_requires_card' => 1,
34 $self->server('gw.cardfortress.com') unless $self->server;
36 $self->port('443') unless $self->port;
37 $self->path('/bop/index.html') unless $self->path;
39 $self->build_subs(qw( order_number avs_code cvv2_response
40 response_page response_code response_headers
48 $self->server('test.cardfortress.com');
50 my ($page,$server_response,%headers) = $self->https_post($self->content);
52 die $server_response unless $server_response =~ /^200/;
55 #this encoding good enough? wfm... if something's easier for other
56 #languages they can always use a different URL
57 foreach my $line ( grep /^\w+=/, split(/\n/, $page) ) {
58 $line =~ /^(\w+)=(.*)$/ or next;
62 foreach (qw( is_success error_message failure_status
63 authorization order_number
64 fraud_score fraud_transaction_id
65 result_code avs_code cvv2_response
68 $self->$_($response{$_});
71 #map these to gateway_response_code, etc?
84 Business::OnlinePayment::CardFortress - CardFortress backend for Business::OnlinePayment
88 use Business::OnlinePayment;
90 my $tx = new Business::OnlinePayment( 'CardFortress',
91 'gateway' => 'ProcessingGateway',
92 'gateway_login' => 'gwlogin',
93 'gateway_password' => 'gwpass',
94 #private_key not necessary
99 login => 'cardfortress_login',
100 password => 'cardfortress_pass',
101 action => 'Normal Authorization',
102 description => 'Business::OnlinePayment test',
104 customer_id => 'tfb',
105 name => 'Tofu Beast',
106 address => '123 Anystreet',
110 card_number => '4007000000027',
111 expiration => '09/02',
112 cvv2 => '1234', #optional (not stored)
116 if($tx->is_success()) {
117 print "Card processed successfully: ".$tx->authorization."\n";
118 $token = $tx->card_token;
119 print "Card token is: $token\n";
121 print "Card was rejected: ".$tx->error_message."\n";
124 # ... time slips by ...
126 my $rx = new Business::OnlinePayment( 'CardFortress',
127 'gateway' => 'ProcessingGateway',
128 'gateway_login' => 'gwlogin',
129 'gateway_password' => 'gwpass',
130 'private_key' => '/path/to/keyfile',
135 login => 'cardfortress_login',
136 password => 'cardfortress_pass',
137 action => 'Normal Authorization',
138 description => 'Business::OnlinePayment test',
140 card_token => $card_token
141 cvv2 => '1234', #optional, typically not necessary w/followup tx
147 This is a Business::OnlinePayment backend module for the gateway-independent
148 CardFortress storage service (http://cardfortress.com/).
150 =head1 SUPPORTED TRANSACTION TYPES
152 =head2 CC, Visa, MasterCard, American Express, Discover
154 Content required: type, login, action, amount, card_number, expiration.
156 =head1 METHODS AND FUNCTIONS
158 See L<Business::OnlinePayment> for the complete list. The following methods either override the methods in L<Business::OnlinePayment> or provide additional functions.
162 Returns the card token for any transaction. The card token can be used in
163 a subsequent transaction as a replacement for the card number and expiration
164 (as well as customer/AVS data).
168 Returns the response error code.
172 Returns the response error description text.
174 =head2 server_response
176 Returns the complete response from the server.
180 Ivan Kohler C<< <ivan-bop-cardfortress at freeside.biz> >>
182 =head1 COPYRIGHT & LICENSE
184 Copyright 2008-2010 Freeside Internet Services, Inc. (http://freeside.biz/)
187 This program is free software; you can redistribute it and/or modify it
188 under the same terms as Perl itself.