1 package Business::OnlineThirdPartyPayment::eWayShared;
4 use Business::OnlineThirdPartyPayment 3;
5 use vars qw($VERSION @ISA $DEBUG);
7 @ISA = qw(Business::OnlineThirdPartyPayment);
15 $self->server('www.eway.com.au') unless $self->server;
16 $self->port('443') unless $self->port;
17 $self->path('/gateway/payment.asp') unless $self->path;
18 $self->build_subs(qw(authorization order_number result_code error_message));
23 $self->{'use_3dsecure'} = shift if ( @_ );
24 $self->path('/gateway_3d/payment.asp') if $self->{'use_3dsecure'};
25 return $self->{'use_3dsecure'};
29 # Situation: We've been POSTed back from the gateway's web site. The
30 # POST data is in the argument. We need to set the state of the object
31 # and then return the reference number.
32 my ($self, $data) = @_;
33 my $status = $data->{'ewayTrxnStatus'};
34 $self->order_number($data->{'ewayTrxnReference'});
35 if ( lc($status) eq 'true' ) {
37 $self->authorization($data->{'eWAYAuthCode'});
38 # not spelled like this in the spec
42 $self->result_code($data->{'eWAYresponsecode'});
43 $self->error_message($data->{'eWAYresponseText'});
45 return $data->{'ewayTrxnNumber'};
49 # One of two situations:
50 # "authorization only": We haven't sent anything yet and are just
51 # creating a pending transaction locally. Set popup_url and remap
52 # transaction fields into collectitems.
54 # "post authorization: We've already called reference() with the
57 my %content = $self->content;
59 my $action = lc($content{'action'});
60 die 'Third Party Payment supports "Authorization Only" and '.
61 '"Post Authorization" transactions'
62 if !($action eq 'authorization only' || $action eq 'post authorization');
63 die 'eWay only supports credit card transactions'
64 if $self->transaction_type() ne 'CC';
66 my @required = qw( amount reference );
67 $self->required_fields(@required);
69 if ( $action eq 'authorization only' ) {
72 "https://". $self->server().
73 ($self->port != 443 ? ':'. $self->port() : ''). $self->path();
74 $self->popup_url( $url );
77 'login' => 'ewayCustomerID',
78 'amount' => 'ewayTotalAmount',
79 'first_name' => 'ewayCustomerFirstName',
80 'last_name' => 'ewayCustomerLastName',
81 'email' => 'ewayCustomerEmail',
82 'address' => 'ewayCustomerAddress',
83 'zip' => 'ewayCustomerPostcode',
84 'description' => 'ewayCustomerInvoiceDescription',
85 'invoice_number' => 'ewayCustomerInvoiceRef',
86 'reference' => 'ewayTrxnNumber',
87 'callback_url' => 'eWAYURL',
89 $self->required_fields(qw(login amount first_name last_name));
90 $self->remap_fields(%fields);
91 my %content = $self->content;
92 $content{'ewayTotalAmount'} *= 100;
93 $self->collectitems([ map { $_ => $content{$_} } values(%fields) ]);
97 elsif ( $action eq 'post authorization' ) {
98 return; # everything has been set up already
107 Business::OnlineThirdPartyPayment::eWayShared - eWay backend for Business::OnlineThirdPartyPayment
111 For detailed information see L<Business::OnlineThirdPartyPayment>.
113 Call "$transaction->use_3dsecure(1)" (or pass "'use_3dsecure' => 1"
114 to I<new()>) to enable the 3D-Secure gateway.
120 eWay Shared Payments and 3D-Secure API, as of December 2010.
124 Mark Wells <mark@freeside.biz>
126 Based on Business::OnlineThirdPartyPayment::Interswitchng by
127 Jeff Finucane <interswitchng@weasellips.com>
131 perl(1). L<Business::OnlineThirdPartyPayment>.