1 package Business::OnlinePayment::Exact;
7 use Business::OnlinePayment;
9 our @ISA = qw(Business::OnlinePayment);
13 our $VERSION = '0.02';
17 $self->build_subs(qw(proxy on_action uri tns types process encodingstyle
19 $self->proxy('https://secure2.e-xact.com/vpos/process/vpos.asmx');
20 $self->on_action('http://secure2.e-xact.com/vpos/process/Process');
21 $self->uri('http://secure2.e-xact.com/vpos/process/');
22 $self->tns('http://secure2.e-xact.com/vpos/process/');
23 $self->types('http://secure2.e-xact.com/vpos/process/encodedTypes');
24 $self->process('http://secure2.e-xact.com/vpos/process/Request');
25 $self->encodingstyle('http://schemas.xmlsoap.org/soap/encoding/');
30 my %content = $self->content();
31 my %actions = ('normal authorization' => '00',
32 'authorization only' => '01',
34 'post authorization' => '02',
37 $content{'action'} = $actions{lc($content{'action'})};
38 $content{'name'} = $content{'first_name'}.' '.$content{'last_name'} ||
39 $content{'name'} if $content{'first_name'} and $content{'last_name'};
40 $content{'expiration'} =~ /(\d\d)\D*(\d\d)/ if $content{'expiration'};
41 $content{'expiration_month'} = $1 || $content{'expiration_month'};
42 $content{'expiration_year'} = $2 || $content{'expiration_year'};
43 $content{'expiration'} = $content{'expiration_month'}.
44 $content{'expiration_year'} || $content{'expiration'};
45 $self->content(%content);
51 my %content = $self->content();
53 $content{$map{$_}} = $content{$_};
55 $self->content(%content);
58 sub test_transaction {
59 my( $self, $enabled ) = @_;
68 password => 'Password',
69 action => 'Transaction_Type',
70 amount => 'DollarAmount',
71 customer_ip => 'Client_IP',
72 order_number => 'Reference_No',
73 name => 'CardHoldersName',
74 address => 'VerificationStr1',
75 email => 'Client_Email',
76 card_number => 'Card_Number',
77 expiration => 'Expiry_Date',
78 referer => 'Customer_Ref',
80 my %content = $self->content();
83 foreach (keys %content) {
84 push @data, SOAP::Data->name($_ => $content{$_})->type('string');
88 SOAP::Data->attr({'xsi:type' => 'types:Transaction'})
89 ->name('Transaction')->value(\SOAP::Data->value(@data));
95 ->on_action(sub{return $self->on_action})
99 $s->serializer->register_ns($self->tns => 'tns');
100 $s->serializer->register_ns($self->types => 'types');
102 my $m = SOAP::Data->name('q1:Process')
103 ->attr({'xmlns:q1' => $self->process,
104 'soap:encodingStyle' => $self->encodingstyle});
106 my $result = $s->call($m => $data);
108 if ($result->fault) {
109 $self->is_success(0);
110 $self->error_message($result->faultstring);
113 if ($result->valueof('//TransactionResult/Transaction_Approved')
114 eq '1' and $result->valueof('//TransactionResult/EXact_Resp_Code')
115 eq '00' and $result->valueof('//TransactionResult/Transaction_Error')
117 $self->is_success(1);
118 $self->error_message(
119 $result->valueof('//TransactionResult/EXact_Message'));
120 $self->authorization(
121 $result->valueof('//TransactionResult/Authorization_Num'));
123 $result->valueof('//TransactionResult/SequenceNo'));
126 $self->is_success(0);
127 $self->error_message(
128 $result->valueof('//TransactionResult/EXact_Message'));
139 Business::OnlinePayment::Exact - Perl extension for doing credit card
140 processing through the E-xact v7 Web Services API payment gateway.
144 use Business::OnlinePayment;
145 my $tx = new Business::OnlinePayment('Exact');
148 card_number => '4200000000000000',
149 expiration => '0110',
151 action => 'authorization only',
153 password => 'password'
156 if ($tx->is_success()) {
157 my $ordernum = $tx->order_number;
158 print "Got the cash";
161 print $tx->error_message;
166 This is a Business::OnlinePayment module for E-xact loosely based on
167 Business::OnlinePayment::AuthorizeNet. I've only used it for normal
168 authorization so it may require some work to do pre auth, etc.
173 See synopsis. It works like any other Business::OnlinePayment module.
174 The following content keys are usefull:
188 The following content keys are also available (but not really usefull):
189 'first_name' and 'last_name' will combine to override 'name'
190 'expiration_month' and 'expiration_year' will combine to override
193 The 'authorization' method will return the bank authorization code, and the
194 'order_number' method will contain the sequence number from E-xact.
195 The content key 'referer' can be used to store any string data (20 bytes)
196 and used to search for those transactions from the web interface.
204 Business::OnlinePayment
206 "Exact Payment WebService Plug-In Programming Reference Guide v7"
207 (which can be found on www.e-xact.com with enough digging)
211 mock, E<lt>mock@obscurity.orgE<gt>
213 =head1 COPYRIGHT AND LICENSE
215 Copyright (C) 2005 by mock
217 This library is free software; you can redistribute it and/or modify
218 it under the same terms as Perl itself, either Perl version 5.8.1 or,
219 at your option, any later version of Perl 5 you may have available.