[ic] Custom Payment (credit Card) Options
Desjardins, Ray
Desjardins.Ray@Con-Way.com
Mon, 6 Nov 2000 04:46:12 -0800
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C047EF.9087274A
Content-Type: text/plain;
charset="windows-1252"
Here are some instructions I put together some time ago for Authorize.Net.
Some of this may already be done if your using version 4.6.
Hope this helps,
Ray Desjardins
mailto:webmaster@dfwmicrotech.com
Authorize.Net 3.X installation instructions:
1. Place the below global sub routine file in
/your_minivend_root/globalsub/.
Example Path: /usr/local/minivend/globalsub/authorizenet
2. Edit your minivend.cfg and add the autorizenet include.
#include /globalsub/authorizenet
My Example:
#### Now including individual usertag files
#include usertag/*
#include compat/*
#include globalsub/authorizenet
3. Using your knar editor add the following variables to your catalog
variables database. I did this to allow me to change the authorize net
variables much easier. You can also add these to your catalog.cfg file if
you would like.
Variable Value
Group
MV_PAYMENT_ID your_authorize.net_login
Payment
MV_PAYMENT_MODE custom authorizenet
Payment
MV_PAYMENT_SECRET your_authorize.net_password
Payment
MV_PAYMENT_REFERER http://www.yourdomain.com/authorize.html
Payment
4. I changed the /usr/local/minivend/lib/Vend/Order.pm module to allow a
few more arguments to authrorize.net at purchase time.
Here is an example of my map_actual sub routine in the Order.pm module.
(This is change is optional but recommended)
sub map_actual {
# Allow remapping of payment variables
my %map = qw(
mv_credit_card_number mv_credit_card_number
name name
fname fname
lname lname
b_name b_name
b_fname b_fname
b_lname b_lname
address address
address1 address1
address2 address2
b_address b_address
b_address1 b_address1
b_address2 b_address2
city city
b_city b_city
state state
b_state b_state
zip zip
b_zip b_zip
country country
b_country b_country
mv_credit_card_exp_month mv_credit_card_exp_month
mv_credit_card_exp_year mv_credit_card_exp_year
cyber_mode mv_cyber_mode
amount amount
mv_order_number mv_order_number
);
5. Make sure your authorize.net account is configured to accept the
http://www.yourdomain.com/authorize.html as a referrer. Put your account in
test mode and have fun.
-----Original Message-----
From: Ted Sindzinski [mailto:admin@extremefactor.com]
Sent: Sunday, November 05, 2000 3:15 PM
To: interchange-users@minivend.com
Subject: [ic] Custom Payment (credit Card) Options
Hello,
I am currently trying to setup Interchange to work with
Authorize.net which authenticates via http requests. I currently have a
little lwp script that I used with my old shopping cart to send the
transactions. Although I have read a great deal of documentaiton, all I
can find about setting up payment schemes in Interchange is to use
'&charge=custom MY_PAYMENT_FUCNTION_NAME'. With this line added, what
must I do to define the function name and get it running? where must
errors return to to be seen? and lastly, where does this line go (file
wise)?
Thank you for any assistance
--
Ted Sindzinski
CTO Extreme Factor
*********************
www.extremefactor.com
_______________________________________________
Interchange-users mailing list
Interchange-users@www.minivend.com
http://www.minivend.com/mailman/listinfo/interchange-users
------_=_NextPart_000_01C047EF.9087274A
Content-Type: application/octet-stream;
name="authorizenet"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="authorizenet"
# Connection routine for AuthorizeNet version 3 using the 'ADC Direct =
Response' method.=20
# by mark@summersault.com with code reused and inspired by =20
# Mike Heins <mike@minivend.com>=20
# webmaster@nameastar.net=20
# Jeff Nappi <brage@cyberhighway.net>=20
# Paul Delys <paul@gi.alaska.edu>=20
# Edited by Ray Desjardins <ray@dfwmicrotech.com>
=20
Variable AUTHORIZENET_HELP <<EOV
=20
1. Modify minivend.cfg to use this file.=20
=20
#include globalsub/authorizenet=20
=20
2. Modify catalog.cfg to set the server and your Authorize.Net account =
info=20
=20
=20
# Username and password=20
Variable MV_PAYMENT_ID YourAuthorizeNetID=20
Variable MV_PAYMENT_SECRET YourAuthorizeNetPassword=20
Variable MV_PAYMENT_MODE custom authorizenet=20
Variable MV_PAYMENT_REFERER A valid referering url (match this with =
your setting on secure.authorize.net=20
=20
3. Make sure CreditCardAuto is off (default in MV4)=20
=20
4. Restart Minivend.=20
=20
EOV
GlobalSub <<EOS
sub authorizenet {=20
my ($user, $secret, $amount) =3D @_;=20
=20
my (%actual) =3D Vend::Order::map_actual();=20
=20
if (! $user ) {=20
$user =3D $::Variable->{MV_PAYMENT_ID} ||=20
$::Variable->{CYBER_ID}=20
or return undef;=20
}=20
=20
if(! $secret) {=20
$secret =3D $::Variable->{MV_PAYMENT_SECRET} ||=20
$::Variable->{CYBER_SECRET}=20
or return undef;=20
}=20
=20
my $server =3D $::Variable->{MV_PAYMENT_SERVER} ||=20
$::Variable->{CYBER_SERVER} ||=20
'secure.authorize.net';=20
=20
my $script =3D $::Variable->{MV_PAYMENT_SCRIPT} ||=20
$::Variable->{CYBER_SCRIPT} ||=20
'/gateway/transact.dll';=20
=20
my $port =3D $::Variable->{MV_PAYMENT_PORT} ||=20
$::Variable->{CYBER_PORT} ||=20
443;=20
=20
my $precision =3D $::Variable->{MV_PAYMENT_PRECISION} ||=20
$::Variable->{CYBER_PRECISION} ||=20
2;=20
my $referer =3D $::Variable->{MV_PAYMENT_REFERER}; =
=20
=20
$actual{mv_credit_card_exp_month} =3D~ s/\D//g;=20
$actual{mv_credit_card_exp_month} =3D~ s/^0+//;=20
$actual{mv_credit_card_exp_year} =3D~ s/\D//g;=20
$actual{mv_credit_card_exp_year} =3D~ s/\d\d(\d\d)/$1/;=20
=20
$actual{mv_credit_card_number} =3D~ s/\D//g;=20
=20
my $exp =3D sprintf '%02d%02d',=20
$actual{mv_credit_card_exp_month},=20
$actual{mv_credit_card_exp_year}; =
=20
=20
$actual{cyber_mode} =3D 'AUTH_CAPTURE'=20
unless $actual{cyber_mode};=20
=20
my %type_map =3D (=20
mauth_capture =3D> 'AUTH_CAPTURE',=20
mauthonly =3D> 'AUTH_ONLY',=20
CAPTURE_ONLY =3D> 'CAPTURE_ONLY',=20
CREDIT =3D> 'CREDIT',=20
VOID =3D> 'VOID',=20
PRIOR_AUTH_CAPTURE =3D> 'PRIOR_AUTH_CAPTURE',=20
=20
); =20
=20
if (defined $type_map{$actual{cyber_mode}}) {=20
$actual{cyber_mode} =3D $type_map{$actual{cyber_mode}};=20
}=20
else {=20
$actual{cyber_mode} =3D 'AUTH_CAPTURE';=20
}=20
=20
if(! $amount) {=20
$amount =3D Vend::Interpolate::total_cost();=20
$amount =3D sprintf("%.${precision}f", $amount);=20
} =20
=20
my($orderID);=20
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =3D =
gmtime(time());=20
=20
# We'll make an order ID based on date, time, and MiniVend session=20
=20
# $mon is the month index where Jan=3D0 and Dec=3D11, so we use=20
# $mon+1 to get the more familiar Jan=3D1 and Dec=3D12=20
$orderID =3D sprintf("%02d%02d%02d%02d%02d%05d%s",=20
$year + 1900,$mon + 1,$mday,$hour,$min,$Vend::SessionName); =
=20
my %query =3D (=20
x_Card_Num =3D> $actual{mv_credit_card_number},=20
x_First_Name =3D> $actual{b_fname},=20
x_Last_Name =3D> $actual{b_lname},
x_Address =3D> $actual{address},=20
x_City =3D> $actual{b_city},=20
x_State =3D> $actual{b_state},=20
x_Zip =3D> $actual{zip},
x_Type =3D> $actual{mv_payment_mode},=20
x_Amount =3D> $amount,=20
x_Exp_Date =3D> $exp,
x_Method =3D> 'CC',
x_Invoice_Num =3D> $actual{mv_order_number},
# x_Company =3D> $actual{company},
# x_Phone =3D> $actaul{day_phone}, =20
x_Password =3D> $secret,=20
x_Login =3D> $user,=20
x_Version =3D> '3.0',=20
x_ADC_URL =3D> 'FALSE',=20
x_ADC_Delim_Data =3D> 'TRUE',=20
=20
=20
);=20
=20
my @query;=20
=20
for (keys %query) {=20
my $key =3D $_;=20
my $val =3D $query{$key};=20
$val =3D~ s/["\$\n\r]//g;=20
$val =3D~ s/\$//g;=20
my $len =3D length($val);=20
if($val =3D~ /[&=3D]/) {=20
$key .=3D "[$len]";=20
}=20
push @query, "$key=3D$val";=20
}=20
my $string =3D join '&', @query;=20
=20
use Net::SSLeay qw(post_https make_form make_headers);=20
=20
my ($page, $response, %reply_headers)=20
=3D post_https($server, $port, $script, =20
make_headers( Referer =3D> $referer), =20
make_form(=20
%query=20
));=20
=20
# Minivend names are on the left, Authorize.Net on the right=20
my %result_map =3D ( qw/=20
MStatus x_response_code=20
pop.status x_response_code=20
MErrMsg x_response_reason_text=20
pop.error-message x_response_reason_text=20
order-id x_trans_id=20
pop.order-id x_trans_id=20
pop.auth-code x_auth_code=20
pop.avs_code x_avs_code=20
pop.avs_zip x_zip=20
pop.avs_addr x_address=20
/=20
); =20
=20
=20
#::logError(qq{\nauthorizenet page: $page response: $response\n}); =20
=20
my ($response_code,=20
$response_subcode,=20
$response_reason_code,=20
$response_reason_text,=20
$auth_code,=20
$avs_code,=20
$trans_id) =3D split (/,/,$page);=20
=20
#::logError(qq{authorizenet =
response_reason_text=3D$response_reason_text response_code: =
$response_code}); =20
=20
my %result;=20
if ($response_code =3D=3D 1) {=20
$result{MStatus} =3D 'success';=20
$result{'order-id'} =3D 1; # ? Why this this set to 1? -mark=20
} else {=20
$result{MStatus} =3D 'failure';=20
=20
# NOTE: A lot more AVS codes could be checked for here. =20
if ($avs_code eq 'N') {=20
$result{MErrMsg} =3D "You must enter the correct billing address =
of your credit card. The bank returned the following error: " . =
$response_reason_text;=20
} else {=20
$result{MErrMsg} =3D "$response_reason_text"=20
}=20
}=20
=20
return (%result);=20
=20
}=20
EOS
------_=_NextPart_000_01C047EF.9087274A--