#!/usr/bin/perl
###############################################################################
#
#
# 4/04/2008 - Created for gotacres.com for auction check-out after winning
#
#
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
$cgi = new CGI;
use DBI;
$User_name = $cgi->param('User_name');
$User_email = $cgi->param('User_email');
$Auction_id = $cgi->param('Auction_id');
#$Auction_id='88';
$This_action = $cgi->param('This_action');
$APIcall = $cgi->param('call');
if ($APIcall ne ""){
&DOAPICALL;
exit;
}
if ($This_action eq "" && $User_name eq "" || $This_action eq "" && $Auction_id eq ""){
&DONOTENOUGHINFOERROR;
exit;
}
elsif ($This_action eq "") {
print "Content-type: text/html\n\n";
open (HEAD, "gothead.pp");
until (eof (HEAD)){
$Head =
;
chop $Head;
print "$Head\n";
}
close HEAD;
print "
\n";
print "
You've got land!
Enter your auction password to retrieve the details of your winning auction(s)!
\n";
print "
\n";
open (FOOT, "gotfoot.pp");
until (eof (FOOT)){
$Head = ;
chop $Head;
print "$Head\n";
}
close FOOT;
exit;
}
elsif ($This_action eq "Process_step_one"){
$woncount = $cgi->param('woncount');
my $Sql_cookie = $cgi->cookie('gotacres.compp');
my @cookied = split (/\:/ , $Sql_cookie);
$User_id = $cookied[0];
$Auction_id = $cookied[1];
if ($User_id eq "" || $Auction_id eq ""){
#
# Tell them paypal requires it for security
#
# &DONOCOOKIEERROR;
# exit;
}
#&GETEXPRESSCONFIG;
if ($woncount eq ""){
$Title_name[1] = $cgi->param('Title_name1');
$Addressa[1] = $cgi->param('Addressa1');
$Addressa[2] = $cgi->param('Addressb2');
$City[1] = $cgi->param('City1');
$State[1] = $cgi->param('State1');
$Zip_postal[1] = $cgi->param('Zip_postal1');
$Country[1] = $cgi->param('Country1');
$Contact_email[1] = $cgi->param('Contact_email1');
$Check_amount[1] = $cgi->param('Check_amount1');
$Auction_id[1] = $cgi->param('Auction_id1');
$Title[1] = $cgi->param('Title1');
$User_name = $cgi->param('username');
$Referred_by_other = $cgi->param('Referred_by_other');
$Referred_by = $cgi->param('Referred_by');
$Contact_phone[1] = $cgi->param('Contact_phone1');
require "../../got_data/gotacresql.pl";
&SQLVAR;
$dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host", $db_user, $db_pass, {'RaiseError' => 1});
$sth = $dbh->prepare("SELECT * FROM geodesic_auctions_logins WHERE username='$User_name'");
$sth->execute();
$ref = $sth->fetchrow_hashref;
$Onfile_pass = $ref->{'password'};
$User_id = $ref->{'id'};
$Auction_pass = $cgi->param('Auction_pass');
$User_id = $ref->{'id'};
$Payment_type = $cgi->param('Payment_type');
$ECAmt = "199.00";
if ($Payment_type eq "Both" || $Payment_type eq ""){
$sth = $dbh->prepare("SELECT * FROM geodesic_auctions_bids WHERE auction_id='$Auction_id[1]' AND bidder='$User_id' ORDER BY bid DESC");
$sth->execute();
$ref = $sth->fetchrow_hashref;
$Amount_bid_due = $ref->{'bid'};
$ECAmt = $ECAmt+$Amount_bid_due;
if ($ECAmt ne "199.00"){
$ECAmt .= ".00";
}
}
$replaceboth = $ECAmt;
if (uc($Onfile_pass) ne uc($Auction_pass)){
$Error = "
Password entered did not match auction password!";
$errcnt++;
}
if ($Title_name[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the legal name of the person to whom the title will be issued!";
$errcnt++;
}
if ($Addressa[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the address to which we will send the documents!";
$errcnt++;
}
if ($City[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the city to which we will send the documents!";
$errcnt++;
}
if ($Zip_postal[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the Zip or Postal Code to which we will send the documents! (If none, enter None)";
$errcnt++;
}
if ($Country[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the country to which we will send the documents!";
$errcnt++;
}
if ($Contact_email[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include an email address!";
$errcnt++;
}
if ($Contact_phone[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You didn't enter your phone number!";
$errcnt++;
}
if ($Referred_by eq "Click to select."){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You didn't select anything for how you found us!";
$errcnt++;
}
if ($Payment_type eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You didn't choose to pay either the document fee or the document fee and your winning bid!";
$errcnt++;
}
#$Error="";
if ($Error ne ""){
$Error .= "
";
&DOCHECKOUTERROR;
exit;
}
else {
# http://www.gotacres.com/NVP/nvp.cgi?UseSandbox=Y&call=SetExpressCheckout
# =======================
# SET EXPRESS CHECKOUT
# ========================
# example URL to call this API
# http://HOST/cgi-bin/poneal/NVP_perl/nvp.cgi?UseSandbox=Y&call=SetExpressCheckout
#$APIrequest = uri_escape("&METHOD=SetExpressCheckout&RETURNURL=".$ECRetUrl."&CANCELURL=".$ECCanclRetUrl."&AMT=".$ECAmt."&CURRENCYCODE=USD&PAYMENTACTION=Authorization");
$APIcall = "SetExpressCheckout";
&GETEXPRESSCONFIG;
#$ECAmt = "1.00";
$APIrequest = "&METHOD=SetExpressCheckout&RETURNURL=".$ECRetURL ."&CANCELURL=".$ECCanclRetUrl."&AMT=".$ECAmt."&CURRENCYCODE=USD&PAYMENTACTION=Authorization";
#$APIrequest = "&METHOD=SetExpressCheckout&RETURNURL=".$ECRetURL ."&CANCELURL=".$ECCanclRetUrl."&AMT=".$ECAmt."&CURRENCYCODE=USD&PAYMENTACTION=Authorization&DESC=$My_desc&HDRBORDERCOLOR=$headerborder&HDRIMG=$headerimage&HDRBACKCOLOR=$headerbackcolor";
#$APIrequest2 = "&METHOD=SetExpressCheckout&RETURNURL=".$ECRetURL ."&CANCELURL=".$ECCanclRetUrl."&AMT=".$ECAmt1."&CURRENCYCODE=USD&PAYMENTACTION=Authorization";
#$paypalbutton1 =
#die;
&GETAPIDETAILS;
$This_pp = " https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=".$ECToken."";
open (CHEC, "checkout_template1_newpp");
my $Thissession = "$User_id\:$Auction_id[1]";
push @cookies, $cgi->cookie(-name=>'gotacres.compp', -value=>($Thissession), -expires=>'+1h');
print $cgi->header(-cookie=>[@cookies]);
$ECAmt .= ".00";
if ($Payment_type eq "Both"){
$Replace_checkout_type = "both the document fee and the winning bid (\$$ECAmt).
\n";
}
else {
$Replace_checkout_type = "just the document fee (\$199.00) and will return a check or money order for your winning bid with your signed documents.
Password entered did not match auction password!";
$errcnt++;
}
if ($Referred_by eq "Click to select."){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You didn't select anything for how you found us!";
$errcnt++;
}
&CHEKONEFORERRORS;
if ($Payment_type eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You didn't choose to pay either the document fee or the document fee and your winning bid!";
$errcnt++;
}
if ($One_for_all eq "") {
&CHECKMULTIPLEFORERRORS;
}
else {
&GETMULTIPLEDATA;
}
$remvcnt=0;
until ($remvcnt >= $woncount){
$remvcnt++;
if ($Keep_parcel[$remvcnt] eq ""){
$One_kept = "Yes";
}
}
if ($One_kept ne "Yes"){
if ($Error eq ""){
$Error = "ol";
}
$Error .= "
You clicked \"No\" for all the parcels. You must purchase at least one property to continue.";
$errcnt++;
}
#$Error="";
if ($Error ne ""){
&DOMULTIPLEERROR;
exit;
}
else {
# http://www.gotacres.com/NVP/nvp.cgi?UseSandbox=Y&call=SetExpressCheckout
# =======================
# SET EXPRESS CHECKOUT
# ========================
# example URL to call this API
# http://HOST/cgi-bin/poneal/NVP_perl/nvp.cgi?UseSandbox=Y&call=SetExpressCheckout
#$APIrequest = uri_escape("&METHOD=SetExpressCheckout&RETURNURL=".$ECRetUrl."&CANCELURL=".$ECCanclRetUrl."&AMT=".$ECAmt."&CURRENCYCODE=USD&PAYMENTACTION=Authorization");
$APIcall = "SetExpressCheckout";
if ($Payment_type eq "Both"){
$ECAmt = $Multiple_amount_due;
}
else {
$ECAmt = $All_doc_fees;
}
&GETEXPRESSCONFIG;
$APIrequest = "&METHOD=SetExpressCheckout&RETURNURL=".$ECRetURL ."&CANCELURL=".$ECCanclRetUrl."&AMT=".$ECAmt."&CURRENCYCODE=USD&PAYMENTACTION=Authorization";
#$APIrequest2 = "&METHOD=SetExpressCheckout&RETURNURL=".$ECRetURL ."&CANCELURL=".$ECCanclRetUrl."&AMT=".$ECAmt1."&CURRENCYCODE=USD&PAYMENTACTION=Authorization";
#$paypalbutton1 =
&GETAPIDETAILS;
my $Thissession = "$User_id\:$Auction_id[1]";
push @cookies, $cgi->cookie(-name=>'gotacres.compp', -value=>($Thissession), -expires=>'+1h');
print $cgi->header(-cookie=>[@cookies]);
open (CHEC, "checkout_template_multiple1pp");
until (eof (CHEC)){
$Chec = ;
chop $Chec;
$Chec =~ s/REPLACEAUCTIONID/$Auction_id[1] $Amount_bid_due Bump/g;
$Chec =~ s/MIKEREPUSER/\/g;
$Chec =~ s/REPLACEAUCTIONTITLE/$Title[1]/g;
$Chec =~ s/REPLACETITLENAME/$Title_name[1]/g;
$Chec =~ s/REPLACEADDRESS1/$Addressa[1]/g;
$Chec =~ s/REPLACEADDRESS2/$Addressb[1]/g;
$Chec =~ s/REPLACECITY/$City[1]/g;
$Chec =~ s/REPLACESTATE/$State[1]/g;
$Chec =~ s/REPLACEZIP/$Zip_postal[1]/g;
$Chec =~ s/REPLACECOUNTRY/$Country[1]/g;
$Chec =~ s/REPLACEEMAIL/$Contact_email[1]/g;
$Chec =~ s/REPLACEPHONE/$Contact_phone[1]/g;
$Chec =~ s/REPLACECHECKAMOUNT/$Check_amount[1]/g;
$Chec =~ s/REPLACEREFERREDBYOTHER/$Referred_by_other/g;
$Chec =~ s/REPLACEREFERREDBY/$Referred_by/g;
$Chec =~ s/REPLACEWONCOUNT/$woncount/g;
#$Chec =~ s/auctioncheckout\.cgi/auctioncheckoutpp\.cgi/g;
if ($Chec =~ /REPLACEOTHERAUCTIONS/){
$slip = 1;
until ($slip >= $woncount){
$slip++;
print "Auction # $Auction_id[$slip] for $Title[$slip]
\n";
print "
Precise name or names you want on title to the land:*
/ , $Mike_hash_in);
$Legal = $descript[4];
$Legal =~ s/\//g;
$Legal =~ s/\<\/STRONG\>//g;
$Legal =~ s/\<\/P\>//g;
$Legal =~ s/Legal: //g;
$Legal =~ s/Legal://g;
$Legal =~ s/\//gi;
$Legal =~ s/\<\/u\>//gi;
$Legal[$leglcnt] = $Legal;
@sold1 = split (/Price:/ , $Mike_hash_in);
@sold2 = split (/\)/ , $sold1[1]);
$This_price = $sold2[0];
$This_price =~ s/\<\/u\>//ig;
$This_price =~ s/\<\/strong\>//ig;
$This_price .= ")";
$Sell_price[$leglcnt] = $This_price;
$updateset = "high_bidder='$User_id'";
$sth = $dbh->prepare("UPDATE geodesic_auctions SET $updateset WHERE id = \"$Auction_id[$leglcnt]\" AND live='0'");
$sth->execute();
$sth = $dbh->prepare("SELECT * FROM geodesic_auctions_userdata WHERE id='$This_seller[$leglcnt]'");
$sth->execute();
$ref = $sth->fetchrow_hashref;
$This_seller_name[$leglcnt] = "$ref->{'firstname'} $ref->{'lastname'}";
$This_seller_email[$leglcnt] = $ref->{'email'};
}
if ($woncount ==1){
open (MAIL,"|/usr/sbin/sendmail -f $This_seller_email[1] $Contact_email[1]");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com webmaster\@gotacres.com");
print MAIL "From: $This_seller_name[1] <$This_seller_email[1]>\n";
print MAIL "To: $Title_name[1] <$Contact_email[1]>\n";
print MAIL "Subject: Title details for $Legal[1]!\n\n";
print MAIL "Here are the title details for auction # $Auction_id[1] ($Title[1])\n\n";
print MAIL "The \"Legal\" for this auction was $Legal[1].\n\n";
print MAIL "Title documents will be made as follows:\n\n";
print MAIL "Name : $Title_name[1]\n";
print MAIL "Address 1 : $Addressa[1]\n";
if ($Addressb[1] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[1]\n";
print MAIL "State/Region : $State[1]\n";
print MAIL "Zip/Postal Code: $Zip_postal[1]\n";
print MAIL "Country : $Country[1]\n\n";
print MAIL "Amount due to be returned with documents (check or money order): \$$Check_amount[1]\n\n";
print MAIL "If you have not been to PayPal to process the document fee, you may click the link below (or copy & paste it into your broswer) to do so now:\n";
print MAIL "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=info%40gotacres%2ecom&item_name=Got%20Acres%20Processing%20Fee&amount=199\n\n";
if ($This_seller_name[1] =~ /doug/i){
print MAIL "If you have any questions please call me toll free at 800-421-7163 or outside the U.S. at 714-435-0324.\n\n";
}
elsif ($This_seller_name[1] =~ /arlene/i){
print MAIL "If you have any questions please call me at 916-687-8118.\n\n";
}
print MAIL "Yours sincerely,\n\n";
print MAIL "$This_seller_name[1]\n\n";
close MAIL;
#vtext.com
open (MAIL,"|/usr/sbin/sendmail -f dougcaffey\@gotacres.com klj929598\@aol.com");
print MAIL "From: Doug Caffey \n";
print MAIL "To: Dena Willmon \n";
print MAIL "Subject: Title details for completed auction!\n\n";
print MAIL "Here are the title details for auction # $Auction_id[1] ($Title[1])\n\n";
print MAIL "Seller was $This_seller_name[1].\n\n";
print MAIL "The \"Legal\" for this auction was $Legal[1].\n\n";
print MAIL "Title documents should be made as follows:\n\n";
print MAIL "Name : $Title_name[1]\n";
print MAIL "Address 1 : $Addressa[1]\n";
if ($Addressb[1] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[1]\n";
print MAIL "State/Region : $State[1]\n";
print MAIL "Zip/Postal Code: $Zip_postal[1]\n";
print MAIL "Country : $Country[1]\n";
print MAIL "Phone : $Contact_phone[1]\n\n";
print MAIL "Listed Price of Land : \$$Sell_price[1]\n";
print MAIL "Amount due upon receipt of documents: \$$Check_amount[1]\n\n";
print MAIL "Details at http://www.gotacres.com/doug/\n";
close MAIL;
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com 7147428374\@vtext.com");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com 7146056700\@mymetropcs.com");
print MAIL "From: GotAcres\n";
print MAIL "To: Doug\n";
print MAIL "Subject: Title Det. Rcvd!\n\n";
print MAIL "Title Det auc # $Auction_id[1] Dena told";
close MAIL;
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com $This_seller_email[1]");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com webmaster\@gotacres.com");
print MAIL "From: $Title_name[1] <$Contact_email[1]>\n";
print MAIL "To: $This_seller_name[1] <$This_seller_email[1]>\n";
print MAIL "Subject: Title details for completed auction!\n\n";
print MAIL "Here are the title details for auction # $Auction_id[1] ($Title[1])\n\n";
print MAIL "The \"Legal\" for this auction was $Legal[1].\n\n";
print MAIL "Title documents should be made as follows:\n\n";
print MAIL "Name : $Title_name[1]\n";
print MAIL "Address 1 : $Addressa[1]\n";
if ($Addressb[1] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[1]\n";
print MAIL "State/Region : $State[1]\n";
print MAIL "Zip/Postal Code: $Zip_postal[1]\n";
print MAIL "Country : $Country[1]\n";
print MAIL "Phone : $Contact_phone[1]\n\n";
print MAIL "Listed Price of Land : \$$Sell_price[1]\n";
print MAIL "Amount due upon receipt of documents: \$$Check_amount[1]\n\n";
print MAIL "Bonus information! This person came via ";
if ($Referred_by_other eq ""){
print MAIL "$Referred_by!\n";
}
else {
print MAIL "$Referred_by_other!\n";
}
close MAIL;
if ($This_seller_name !~ /doug/i){
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com dougcaffey\@gotacres.com");
print MAIL "From: Michael \n";
print MAIL "To: Doug Caffey \n";
print MAIL "Subject: Title details for completed auction (not one of yours!)\n\n";
print MAIL "Here are the title details for auction # $Auction_id[1] ($Title[1])\n\n";
print MAIL "This was one of $This_seller_name[1]\'s parcels. They were emailed the details before you.\n\n";
print MAIL "The \"Legal\" for this auction was $Legal[1].\n\n";
print MAIL "Title documents should be made as follows:\n\n";
print MAIL "Name : $Title_name[1]\n";
print MAIL "Address 1 : $Addressa[1]\n";
if ($Addressb[1] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[1]\n";
print MAIL "State/Region : $State[1]\n";
print MAIL "Zip/Postal Code: $Zip_postal[1]\n";
print MAIL "Country : $Country[1]\n";
print MAIL "Phone : $Contact_phone[1]\n\n";
print MAIL "Listed Price of Land : \$$Sell_price[1]\n";
print MAIL "Amount due upon receipt of documents: \$$Check_amount[1]\n\n";
print MAIL "Bonus information! This person came via ";
if ($Referred_by_other eq ""){
print MAIL "$Referred_by!\n";
}
else {
print MAIL "$Referred_by_other!\n";
}
close MAIL;
}
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com webmaster\@gotacres.com");
print MAIL "From: $Title_name[1] <$Contact_email[1]>\n";
print MAIL "To: Webmaster \n";
print MAIL "Subject: Title details for completed auction!\n\n";
print MAIL "Here are the title details for auction # $Auction_id[1] ($Title[1])\n\n";
print MAIL "Seller was $This_seller_name[1].\n\n";
print MAIL "The \"Legal\" for this auction was $Legal[1].\n\n";
print MAIL "Title documents should be made as follows:\n\n";
print MAIL "Name : $Title_name[1]\n";
print MAIL "Address 1 : $Addressa[1]\n";
if ($Addressb[1] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[1]\n";
print MAIL "State/Region : $State[1]\n";
print MAIL "Zip/Postal Code: $Zip_postal[1]\n";
print MAIL "Country : $Country[1]\n";
print MAIL "Phone : $Contact_phone[1]\n\n";
print MAIL "Listed Price of Land : \$$Sell_price[1]\n";
print MAIL "Amount due upon receipt of documents: \$$Check_amount[1]\n\n";
print MAIL "Bonus information! This person came via ";
if ($Referred_by_other eq ""){
print MAIL "$Referred_by!\n";
}
else {
print MAIL "$Referred_by_other!\n";
}
close MAIL;
}
else {
$mailed=0;
until ($mailed >= $woncount){
$mailed++;
if ($This_seller_name[$mailed] ne $lastsellername){
if ($lastsellername ne ""){
if ($This_seller_name[$mailed] =~ /doug/i){
print MAIL "If you have any questions please call me toll free at 800-421-7163 or outside the U.S. at 714-435-0324.\n\n";
}
elsif ($This_seller_name[$mailed] =~ /arlene/i){
print MAIL "If you have any questions please call me at 916-687-8118.\n\n";
}
print MAIL "Yours sincerely,\n\n";
print MAIL "$This_seller_name[$mailed]\n\n";
close MAIL;
}
$lastsellername = $This_seller_name[$mailed];
open (MAIL,"|/usr/sbin/sendmail -f $This_seller_email[$mailed] $Contact_email[$mailed]");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com webmaster\@gotacres.com");
print MAIL "From: $This_seller_name[$mailed] <$This_seller_email[$mailed]>\n";
print MAIL "To: $Title_name[1] <$Contact_email[1]>\n";
print MAIL "Subject: Title details for completed auction(s)!\n\n";
}
print MAIL "For auction # $Auction_id[$mailed] ($Title[$mailed])\n\n";
print MAIL "Title documents will be made as follows:\n\n";
print MAIL "Name : $Title_name[$mailed]\n";
print MAIL "Address 1 : $Addressa[$mailed]\n";
if ($Addressb[$mailed] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[$mailed]\n";
print MAIL "State/Region : $State[$mailed]\n";
print MAIL "Zip/Postal Code: $Zip_postal[$mailed]\n";
print MAIL "Country : $Country[$mailed]\n\n";
print MAIL "Amount due to be returned with documents (check or money order): \$$Check_amount[$mailed]\n\n";
print MAIL "If you have not been to PayPal to process the document fee, you may click the link below (or copy & paste it into your broswer) to do so now:\n";
print MAIL "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=info%40gotacres%2ecom&item_name=Got%20Acres%20Processing%20Fee&amount=199\n\n";
print MAIL "--------------------------------------------------------------------------------------------------------------------------------------------\n\n";
}
if ($This_seller_name[$mailed] =~ /doug/i){
print MAIL "If you have any questions please call me toll free at 800-421-7163 or outside the U.S. at 714-435-0324.\n\n";
}
elsif ($This_seller_name[$mailed] =~ /arlene/i){
print MAIL "If you have any questions please call me at 916-687-8118.\n\n";
}
print MAIL "Yours sincerely,\n\n";
print MAIL "$This_seller_name[$mailed]\n\n";
close MAIL;
$mailed=0;
until ($mailed >= $woncount){
$mailed++;
if ($This_seller_name[$mailed] ne $lastsellername){
if ($lastsellername ne ""){
if ($This_seller_name[$mailed] =~ /doug/i){
print MAIL "If you have any questions please call me toll free at 800-421-7163 or outside the U.S. at 714-435-0324.\n\n";
}
elsif ($This_seller_name[$mailed] =~ /arlene/i){
print MAIL "If you have any questions please call me at 916-687-8118.\n\n";
}
print MAIL "Yours sincerely,\n\n";
print MAIL "$This_seller_name[$mailed]\n\n";
close MAIL;
}
$lastsellername = $This_seller_name[$mailed];
open (MAIL,"|/usr/sbin/sendmail -f $This_seller_email[$mailed] $This_seller_email[$mailed]");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com webmaster\@gotacres.com");
print MAIL "From: $Title_name[1] <$Contact_email[1]>\n";
print MAIL "To: $This_seller_name[$mailed] <$This_seller_email[$mailed]>\n";
print MAIL "Subject: Title details for completed auction(s)!\n\n";
}
print MAIL "For auction # $Auction_id[$mailed] ($Title[$mailed])\n\n";
print MAIL "Title documents will be made as follows:\n\n";
print MAIL "Name : $Title_name[$mailed]\n";
print MAIL "Address 1 : $Addressa[$mailed]\n";
if ($Addressb[$mailed] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[$mailed]\n";
print MAIL "State/Region : $State[$mailed]\n";
print MAIL "Zip/Postal Code: $Zip_postal[$mailed]\n";
print MAIL "Country : $Country[$mailed]\n\n";
print MAIL "Listed Price of Land : \$$Sell_price[$mailed]\n";
print MAIL "Amount due to be returned with documents (check or money order): \$$Check_amount[$mailed]\n\n";
print MAIL "--------------------------------------------------------------------------------------------------------------------------------------------\n\n";
}
if ($This_seller_name[$mailed] =~ /doug/i){
print MAIL "If you have any questions please call me toll free at 800-421-7163 or outside the U.S. at 714-435-0324.\n\n";
}
elsif ($This_seller_name[$mailed] =~ /arlene/i){
print MAIL "If you have any questions please call me at 916-687-8118.\n\n";
}
print MAIL "Yours sincerely,\n\n";
print MAIL "$This_seller_name[$mailed]\n\n";
close MAIL;
$onenotdoug = "No";
$dug=0;
until ($dug >= $woncount){
$dug++;
if ($This_seller_name[$dug] !~ /doug/i){
$onenotdoug = "Yes";
}
}
if ($onenotdoug eq "Yes"){
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com dougcaffey\@gotacres.com");
print MAIL "From: Webmaster \n";
print MAIL "To: Doug Caffey \n";
print MAIL "Subject: Title details for completed auction(s) (not yours)!\n\n";
$mailed=0;
until ($mailed >= $woncount){
$mailed++;
if ($This_seller_name !~ /doug/){
print MAIL "For auction # $Auction_id[$mailed] ($Title[$mailed])\n\n";
print MAIL "Title documents will be made as follows:\n\n";
print MAIL "Name : $Title_name[$mailed]\n";
print MAIL "Address 1 : $Addressa[$mailed]\n";
if ($Addressb[$mailed] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[$mailed]\n";
print MAIL "State/Region : $State[$mailed]\n";
print MAIL "Zip/Postal Code: $Zip_postal[$mailed]\n";
print MAIL "Country : $Country[$mailed]\n\n";
print MAIL "Listed Price of Land : \$$Sell_price[$mailed]\n";
print MAIL "Amount due to be returned with documents (check or money order): \$$Check_amount[$mailed]\n";
print MAIL "Link to auction: http://www.gotacres.com/auction/index.php?a=2&b=$Auction_id[$mailed]\n\n";
print MAIL "--------------------------------------------------------------------------------------------------------------------------------------------\n\n";
}
}
print MAIL "Have a great day!\n\n";
close MAIL;
}
open (MAIL,"|/usr/sbin/sendmail -f dougcaffey\@gotacres.com klj929598\@aol.com");
print MAIL "From: Doug Caffey \n";
print MAIL "To: Dena Willmon\n";
print MAIL "Subject: Title details for completed auction(s)!\n\n";
$mailed=0;
until ($mailed >= $woncount){
$mailed++;
print MAIL "For auction # $Auction_id[$mailed] ($Title[$mailed])\n\n";
print MAIL "Title documents will be made as follows:\n\n";
print MAIL "Name : $Title_name[$mailed]\n";
print MAIL "Address 1 : $Addressa[$mailed]\n";
if ($Addressb[$mailed] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[$mailed]\n";
print MAIL "State/Region : $State[$mailed]\n";
print MAIL "Zip/Postal Code: $Zip_postal[$mailed]\n";
print MAIL "Country : $Country[$mailed]\n\n";
print MAIL "Listed Price of Land : \$$Sell_price[$mailed]\n";
print MAIL "Amount due to be returned with documents (check or money order): \$$Check_amount[$mailed]\n";
print MAIL "Link to auction: http://www.gotacres.com/auction/index.php?a=2&b=$Auction_id[$mailed]\n\n";
print MAIL "--------------------------------------------------------------------------------------------------------------------------------------------\n\n";
}
print MAIL "Details at http://www.gotacres.com/doug/\n\n";
print MAIL "Have a great day!\n\n";
close MAIL;
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com 7147428374\@vtext.com");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com 7146056700\@mymetropcs.com");
print MAIL "From: GotAcres\n";
print MAIL "To: Doug\n";
print MAIL "Subject: Title Det. Rcvd!\n\n";
print MAIL "Title Det 4 more than 1 Dena told";
close MAIL;
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com webmaster\@gotacres.com");
print MAIL "From: $Title_name[1] <$Contact_email[1]>\n";
print MAIL "To: Webmaster \n";
print MAIL "Subject: Title details for completed auction(s)!\n\n";
$mailed=0;
until ($mailed >= $woncount){
$mailed++;
print MAIL "For auction # $Auction_id[$mailed] ($Title[$mailed])\n\n";
print MAIL "Title documents will be made as follows:\n\n";
print MAIL "Name : $Title_name[$mailed]\n";
print MAIL "Address 1 : $Addressa[$mailed]\n";
if ($Addressb[$mailed] ne ""){
print MAIL "Address 2 : $Addressb[1]\n";
}
print MAIL "City : $City[$mailed]\n";
print MAIL "State/Region : $State[$mailed]\n";
print MAIL "Zip/Postal Code: $Zip_postal[$mailed]\n";
print MAIL "Country : $Country[$mailed]\n\n";
print MAIL "Listed Price of Land : \$$Sell_price[$mailed]\n";
print MAIL "Amount due to be returned with documents (check or money order): \$$Check_amount[$mailed]\n\n";
print MAIL "--------------------------------------------------------------------------------------------------------------------------------------------\n\n";
}
print MAIL "Have a great day!\n\n";
close MAIL;
}
print "Content-type: text/html\n\n";
if ($woncount == 1){
open (CHEC, "checkout_template3");
until (eof (CHEC)){
$Chec = ;
print "$Chec\n";
}
close CHEC;
exit;
}
else {
open (CHEC, "checkout_template3_multiple");
until (eof (CHEC)){
$Chec = ;
if ($Chec =~ /REPLACEPROPERTIES/){
print "";
$checd=0;
until ($checd >= $woncount){
print "
click here to pay document fee for Auction $Auction_id[$mailed] ($Legal[$mailed])\n";
}
print "
";
}
print "$Chec\n";
}
close CHEC;
exit;
}
}
elsif ($This_action eq "Winning_bidder"){
print "Content-type: text/html\n\n";
open (CHEC, "winning_bidder_template1");
until (eof (CHEC)){
$Chec = ;
chop $Chec;
$Chec =~ s/REPLACEAUCTIONID/$Auction_id/g;
$Chec =~ s/REPLACEUSERNAME/$User_name/g;
$Chec =~ s/REPLACEAUCTIONTITLE/$Title/g;
$Chec =~ s/REPLACEFIRSTNAME/$Title_name/g;
$Chec =~ s/REPLACECITY/$City/g;
$Chec =~ s/REPLACESTATE/$State/g;
$Chec =~ s/REPLACECOUNTRY/$Country/g;
$Chec =~ s/REPLACEEMAIL/$Contact_email/g;
$Chec =~ s/REPLACECHECKAMOUNT/$Check_amount/g;
#$Chec =~ s/auctioncheckout\.cgi/auctioncheckoutpp\.cgi/;
print "$Chec\n";
}
close CHEC;
}
elsif ($This_action eq "Get_winning_details"){
require "../../got_data/gotacresql.pl";
&SQLVAR;
$User_id = $cgi->param('User_id');
$User_pass = $cgi->param('User_pass');
$Where_this = "WHERE id = \"$Auction_id\" AND live='0'";
$dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host", $db_user, $db_pass, {'RaiseError' => 1});
$sth = $dbh->prepare("SELECT * FROM geodesic_auctions_userdata WHERE username LIKE \"%$User_id%\"");
$sth->execute();
$ref = $sth->fetchrow_hashref;
$User_id_num = $ref->{'id'};
$Contact_email = $ref->{'email'};
if ($User_id_num eq ""){
$Error = "We did not find a matching user! Click here to register or re-enter details below.
";
&DOBADUSERERROR;
exit;
}
$sth = $dbh->prepare("SELECT * FROM geodesic_auctions_logins WHERE username LIKE \"%$User_id%\"");
$sth->execute();
$ref = $sth->fetchrow_hashref;
$Onfile_pass = $ref->{'password'};
if ($Onfile_pass eq ""){
die;
}
if (uc($Onfile_pass) ne uc($User_pass)){
$Error = "The password entered did not match the password on file!
Click this box to use the above details for all properties shown. Or, fill in the complete details for one or more and the remaining will use the above.
\n";
until ($printedcount >= $woncount){
$printedcount++;
print "
Auction # $Auction_won[$printedcount] for $Title[$printedcount]
\n";
print "
Precise name or names you want on title to the land:*
\n";
print "
Address 1*
\n";
print "
Address 2
\n";
print "
City*
\n";
print "
State/Region*
\n";
print "
Zip/Postal Code*
\n";
print "
Country*
\n";
print "
Email*
\n";
print "
Phone*
\n";
print "
\n";
}
}
else {
if ($Chec =~ /CLICK HERE to review above information/){
$pmttyp=0;
$Total_fee = $All_winning_bids+$All_doc_fees;
if ($Total_fee !~ /\./){
$Total_fee .= ".00";
}
if ($All_doc_fees !~ /\./){
$All_doc_fees .= ".00";
}
if ($All_winning_bids !~ /\./){
$All_winning_bids .= ".00";
}
print "
Select payment type:
Your winning bids total \$$All_winning_bids. Your document fees total \$$All_doc_fees. Your payment options are for the total\n";
print "of your winning bids and document fees (\$$Total_fee) or to pay the document fees only (\$$All_doc_fees) if you wish to return a check or money order\n";
print "with your documents.
\n";
print "
The programmer of this software anticipated times when not all the parcels won would be taken and as such you may select \"No\" below for parcels\n";
print "you do not wish to purchase at this time. Your adjusted total for your payment choice below will show on the next screen. Additionally, you can still purchase any parcels not taken at this time up until they are relisted.
\n";
print "
Auction #
Description
Winning Bid
Document Fee
Keep Property?
\n";
until ($pmttype >= $woncount){
$pmttype++;
print "
$Auction_won[$pmttype]
$Title[$pmttype]
\$$Amount_due[$pmttype]
\$199.00
No
\n";
}
print "
\n";
print "Both (\$$Total_fee) Document fees only (\$$All_doc_fees)
\n";
}
#$Chec =~ s/auctioncheckout\.cgi/auctioncheckoutpp\.cgi/;
print "$Chec\n";
}
}
}
}
close CHEC;
}
###############################################################################################################################################################################
sub DONOTENOUGHINFOERROR {
open (CHEC, "checkout_template4");
print "Content-type: text/html\n\n";
until (eof (CHEC)){
$Chec = ;
chop $Chec;
print "$Chec\n";
}
close CHEC;
exit;
}
###############################################################################################################################################################################
sub DOCHECKOUTERROR {
open (CHEC, "checkout_template_errorpp");
if ($Payment_type eq "Both"){
$replaceboth = "checked";
}
elsif ($Payment_type eq "Documents"){
$replacedocuments = "checked";
}
print "Content-type: text/html\n\n";
until (eof (CHEC)){
$Chec = ;
chop $Chec;
$Chec =~ s/REPLACEUSERNAME/$User_name/g;
$Chec =~ s/REPLACEAUCTIONID/$Auction_id[1]/g;
$Chec =~ s/REPLACEERROR/$Error/g;
$Chec =~ s/REPLACEAUCTIONTITLE/$Title[1]/g;
$Chec =~ s/REPLACETITLENAME/$Title_name[1]/g;
$Chec =~ s/REPLACEADDRESS1/$Addressa[1]/g;
$Chec =~ s/REPLACEADDRESS2/$Addressb[1]/g;
$Chec =~ s/REPLACECITY/$City[1]/g;
$Chec =~ s/REPLACESTATE/$State[1]/g;
$Chec =~ s/REPLACEZIP/$Zip_postal[1]/g;
$Chec =~ s/REPLACECOUNTRY/$Country[1]/g;
$Chec =~ s/REPLACEEMAIL/$Contact_email[1]/g;
$Chec =~ s/REPLACEREFERREDBYOTHER/$Referred_by_other/g;
$Chec =~ s/REPLACEREFERREDBY/$Referred_by/g;
$Chec =~ s/REPLACEPHONE/$Contact_phone[1]/g;
$Chec =~ s/REPLACECHECKAMOUNT/$Check_amount[1]/g;
$Chec =~ s/REPLACEWINNINGBID/$Amount_bid_due/;
$Chec =~ s/REPLACETOTALDUE/$ECAmt/;
$Chec =~ s/REPLACEPAYMENTBOTH/$replaceboth/;
$Chec =~ s/REPLACEPAYMENTDOCUMENTS/$replacedocuments/;
#$Chec =~ s/auctioncheckout\.cgi/auctioncheckoutpp\.cgi/g;
print "$Chec\n";
}
close CHEC;
exit;
}
#############################################################################################################################################################################
sub DONOCURRENTWINNER {
open (CHEC, "no_winning_auctionr_template");
print "Content-type: text/html\n\n";
until (eof (CHEC)){
$Chec = ;
chop $Chec;
print "$Chec\n";
}
exit;
}
#############################################################################################################################################################################
sub DOBADUSERERROR {
print "Content-type: text/html\n\n";
open (CHEC, "user_not_found_template");
until (eof (CHEC)){
$Chec = ;
chop $Chec;
$Chec =~ s/REPLACEERROR/$Error/;
$Chec =~ s/REPLACEUSERID//;
print "$Chec\n";
}
close CHEC;
}
#############################################################################################################################################################################
sub DOBADPASSERROR {
print "Content-type: text/html\n\n";
open (CHEC, "user_not_found_template");
until (eof (CHEC)){
$Chec = ;
chop $Chec;
$Chec =~ s/REPLACEERROR/$Error/;
$Chec =~ s/REPLACEUSERID/$User_id/;
print "$Chec\n";
}
close CHEC;
}
#############################################################################################################################################################################
sub CHEKONEFORERRORS {
if ($Keep_parcel[1] eq ""){
if ($Title_name[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the legal name of the person to whom the title will be issued!";
$errcnt++;
}
if ($Addressa[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the address to which we will send the documents!";
$errcnt++;
}
if ($City[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the city to which we will send the documents!";
$errcnt++;
}
if ($Zip_postal[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the Zip or Postal Code to which we will send the documents! (If none, enter None)";
$errcnt++;
}
if ($Country[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the country to which we will send the documents!";
$errcnt++;
}
if ($Contact_email[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include an email address!";
$errcnt++;
}
if ($Contact_phone[1] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the legal name of the person to whom the title will be issued for $Title[$checkcnt]!";
$errcnt++;
}
if ($Addressa[$checkcnt] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the address to which we will send the documents for $Title[$checkcnt]!";
$errcnt++;
}
if ($City[$checkcnt] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the city to which we will send the documents for $Title[$checkcnt]!";
$errcnt++;
}
if ($Zip_postal[$checkcnt] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the Zip or Postal Code to which we will send the documents for $Title[$checkcnt]! (If none, enter None)";
$errcnt++;
}
if ($Country[$checkcnt] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include the country to which we will send the documents for $Title[$checkcnt]!";
$errcnt++;
}
if ($Contact_email[$checkcnt] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You must include an email address for $Title[$checkcnt]!";
$errcnt++;
}
if ($Contact_phone[$checkcnt] eq ""){
if ($Error eq ""){
$Error = "";
}
$Error .= "
You didn't enter a phone number for $Title[$checkcnt]!";
$errcnt++;
}
$Multiple_amount_due = $Multiple_amount_due+($Check_amount[$checkcnt]);
$All_winning_bids = $All_winning_bids+$Check_amount[$checkcnt];
}
}
}
#############################################################################################################################################################################
sub DOMULTIPLEERROR {
open (CHEC, "checkout_template_error1pp");
print "Content-type: text/html\n\n";
$Error .= "
Click this box to use the above details for all auctions won presented here. Or, fill in the complete details for one or more and the remaining will use the above.
\n";
until ($printedcount >= $woncount){
$printedcount++;
print "
Auction # $Auction_id[$printedcount] for $Title[$printedcount]
\n";
print "
Precise name or names you want on title to the land:*
\n";
print "
Address 1*
\n";
print "
Address 2
\n";
print "
City*
\n";
print "
State/Region*
\n";
print "
Zip/Postal Code*
\n";
print "
Country*
\n";
print "
Email*
\n";
print "
Phone*
\n";
print "
\n";
}
}
else {
if ($Chec =~ /CLICK HERE to review above information/){
$pmttyp=0;
$Total_fee = $All_winning_bids+$All_doc_fees;
if ($Total_fee !~ /\./){
$Total_fee .= ".00";
}
if ($All_doc_fees !~ /\./){
$All_doc_fees .= ".00";
}
$All_winning_bids = $Multiple_amount_due+$All_doc_fees;
if ($All_winning_bids !~ /\./){
$All_winning_bids .= ".00";
}
print "
Select payment type:
Your winning bids total \$$Multiple_amount_due. Your document fees total \$$All_doc_fees. Your payment options are for the total\n";
print "of your winning bids and document fees (\$$All_winning_bids) or to pay the document fees only (\$$All_doc_fees) if you wish to return a check or money order\n";
print "with your documents.
\n";
print "
The programmer of this software anticipated times when not all the parcels won would be taken and as such you may select \"No\" below for parcels you do not wish to purchase at this time. Additionally, you can still purchase any parcels not taken at this time up until they are relisted.
\n";
print "
Auction #
Description
Winning Bid
Document Fee
Keep Property?
\n";
until ($pmttype >= $woncount){
$pmttype++;
if ($Keep_parcel[$pmttype] ne ""){
$checkedp = "checked";
}
else {
$checkedp = "";
}
print "
$Auction_id[$pmttype]
$Title[$pmttype]
\$$Check_amount[$pmttype]
\$199.00
No
\n";
}
print "
\n";
print "Both (\$$All_winning_bids) Document fees only (\$$All_doc_fees)
\n";
}
#$Chec =~ s/auctioncheckout\.cgi/auctioncheckoutpp\.cgi/;
print "$Chec\n";
}
}
}
#############################################################################################################################################################################
sub DOTITLEDETAILSCOMPLETED {
print "Content-type: text/html\n\n";
open (TEMP, "step_one_done_template");
if ($Final_fee_step_one[1] ne ""){
$Replace_note = "We have received everything we need to process this sale. If your title documents are not already on their way via Fedex® they will be shortly! If it has been more than 5 business days since you completed step two please call us at 714-435-0324.";
}
else {
$Replace_note = "According to our records, you have won the following auction but we have not yet noted receipt of the \$149.00 document fee via PayPal®. If you have recently submitted it to PayPal® it may be in processing. Otherwise, please click the link below to do so at this time. If you have any questions please call us at 714-435-0324.";
}
until (eof (TEMP)){
$Temp = ;
chop $Temp;
$Temp =~ s/REPLACEFIRSTNAME/$User_id/g;
$Temp =~ s/REPLACENOTE/$Replace_note/g;
$Temp =~ s/REPLACEAUCTIONID/$Auction_step_one[1]/g;
$Temp =~ s/REPLACEAUCTIONTITLE/$Title_step_one[1]/g;
print "$Temp\n";
}
close TEMP;
}
#############################################################################################################################################################################
sub GETEXPRESSCONFIG {
use URI::Escape;
require "../../got_data/gotacresql.pl";
&GETGOTAPISTUFF;
#====CONFIGURATION SECTION=====
# set mode of script. if "DEBUG" then print the RAW request and response strings
#my $scriptMODE = "DEBUG";
#set root URL where nvp.cgi resides
my $rootURL = "http://www.gotacres.com/auction/";
# SET UP API CREDENTIALS
# -- PRODUCTION --
my $APIusername = "$API_username";
my $APIpassword = "$API_password";
my $APIsignature = "$API_signature";
#my $APISubject = "";
#$UseSB = "Y";
my $LiveURL = "https://api-3t.paypal.com/nvp";
# -- SANDBOX --
my $SBAPIusername = "webmas_1219854196_biz_api1.gotacres.com";
my $SBAPIpassword = "1219854201";
my $SBAPIsignature = "An5ns1Kso7MWUdW4ErQKJJJ4qi4-AdDqIYNQEUbHwOh0SOrRuiq.G55y";
my $SBAPISubject = "";
my $SandboxURL = "https://api-3t.sandbox.paypal.com/nvp";
# Other misc. needed vars for purposes of this example
$ECRetURL = uri_escape($rootURL."auctioncheckout.cgi?call=GetECDetails");
$ECRetURl = my $ECRetURL;
$ECCanclRetUrl = uri_escape($rootURL."auctioncheckout.cgi");
#my $ECAmt = "5.00";
# based on querystring, use Sandbox creds or not
# read in the GET parameters - all of these will NOT be present all the time, this is done strictly for this example
#$APIcall = param('call');
$refTxnId = $cgi->param('refTxnId');
$PayerID = $cgi->param('PayerID');
$ECToken = $cgi->param('token');
$pmtAction = $cgi->param('pmtAction');
# ===== SET CREDENTIAL STRING ======
if ($UseSB eq "Y"){
if ($SBAPISubject eq ""){
#$AuthString = uri_escape("USER=".$SBAPIusername."&PWD=".$SBAPIpassword."&SIGNATURE=".$SBAPIsignature."&VERSION=2.3");
$AuthString = "USER=".$SBAPIusername."&PWD=".$SBAPIpassword."&SIGNATURE=".$SBAPIsignature."&VERSION=2.3";
}
else {
#$AuthString = uri_escape("USER=".$SBAPIusername."&PWD=".$SBAPIpassword."&SIGNATURE=".$SBAPIsignature."&SUBJECT=".$SBAPISubject."&VERSION=2.3");
$AuthString = "USER=".$SBAPIusername."&PWD=".$SBAPIpassword."&SIGNATURE=".$SBAPIsignature."&SUBJECT=".$SBAPISubject."&VERSION=2.3";
}
# set endpoint URL
$URL = $SandboxURL
}
else {
# LIVE API CALL
if ($APISubject eq ""){
# $AuthString = uri_escape("USER=".$APIusername."&PWD=".$APIpassword."&SIGNATURE=".$APIsignature."&VERSION=2.3");
$AuthString = "USER=".$APIusername."&PWD=".$APIpassword."&SIGNATURE=".$APIsignature."&VERSION=2.3";
}
else {
# $AuthString = uri_escape("USER=".$APIusername."&PWD=".$APIpassword."&SIGNATURE=".$APIsignature."&SUBJECT=".$APISubject."&VERSION=2.3");
$AuthString = "USER=".$APIusername."&PWD=".$APIpassword."&SIGNATURE=".$APIsignature."&SUBJECT=".$APISubject."&VERSION=2.3";
}
# set endpoint URL
$URL = $LiveURL
}
}
##############################################################################################################################################################################
sub GETAPIDETAILS {
# once we have the reqeust string built, let's make the call by sending it to PayPal
# post to PayPal
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$req = new HTTP::Request POST => $URL;
# set header stuff
#$req->content_type('application/x-www-form-urlencoded');
$req->content($AuthString.$APIrequest);
# get response
$res = $ua->request($req);
# parse response into name/value pairs
@pairs = split(/&/, $res->content);
$count = 0;
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$variable{$name} = $value;
$count++;
}
# This line prints the ENTIRE response string - for DEBUG
if ($scriptMODE eq "DEBUG"){
print "the RESPONSE WAS:
".$res->content." ";
}
if ($res->is_success) {
# lets assign some API response vars to local vars
$Ack = $variable{'ACK'};
# if the HTTP request went through, then lets examine the response string - need to see if it is Success or Failure
if ($Ack eq "Success"){
if ($APIcall eq "Refund"){
&printRefundTxnResponse();
}
elsif ($APIcall eq "GetDetails"){
&printGetTxnDetailsResponse();
}
elsif ($APIcall eq "SetExpressCheckout"){
&printSetExpressCheckoutResponse();
}
elsif ($APIcall eq "GetECDetails"){
&printGetExpressCheckoutDetailsResponse();
}
elsif ($APIcall eq "DoECPmt"){
&printDoExpressCheckoutPaymentResponse();
}
elsif ($APIcall eq "Capture"){
&printDoCaptureResponse();
}
elsif ($APIcall eq "DirectPayment"){
&printDirectPayResponse();
}
else {
# default
print "API call was Successful - no specific parsing setup, yet :-)";
}
}
else {
&printErrors($res->content);
}
}
else {
print "there was some problem with the HTTP request! Mbr>";
print $res->content;
}
}
##############################################################################################################################################################################
sub printErrors {
$CorrelationID = $variable{'CORRELATIONID'};
$LongErrorMsg1 = $variable{'L_LONGMESSAGE0'};
$ShortErrorMsg1 = $variable{'L_SHORTMESSAGE0'};
$ResTimestamp = $variable{'TIMESTAMP'};
$ErrorCode1 = $variable{'L_ERRORCODE0'};
# output the response
print "Content-type: text/html\n\n";
print "
";
}
#############################################################################################################################################################################
sub printSetExpressCheckoutResponse {
if ($Auction_id eq ""){
$Auction_id = $Auction_id[1];
}
$tempfile = "$User_id"."$Auction_id"."temp.txt";
open (TEMP, ">temp/$tempfile");
#die;
$kept=0;
$ECAmt = 0;
if ($woncount <1){
$woncount = 1;
}
until ($kept >= $woncount){
$kept++;
if ($Keep_parcel[$kept] eq ""){
if ($Payment_type eq "Both"){
$Item_amount_due = $Check_amount[$kept]+199;
}
else {
$Item_amount_due = 199;
}
print TEMP "$Title_name[$kept]\\$Addressa[$kept]\\$Addressb[$kept]\\$City[$kept]\\$State[$kept]\\$Zip_postal[$kept]\\$Country[$kept]\\$Contact_email[$kept]\\$Check_amount[$kept]\\$Auction_id[$kept]\\$Title[$kept]\\$Item_amount_due\\$Referred_by\\$Referred_by_other\n";
$new_woncount++;
$Title_name[$new_woncount] = $Title_name[$kept];
$Addressa[$new_woncount] = $Addressa[$kept];
$Addressb[$new_woncount] = $Addressb[$kept];
$City[$new_woncount] = $City[$kept];
$State[$new_woncount] = $State[$kept];
$Zip_postal[$new_woncount] = $Zip_postal[$kept];
$Country[$new_woncount] = $Country[$kept];
$Contact_email[$new_woncount] = $Contact_email[$kept];
$Check_amount[$new_woncount] = $Check_amount[$kept];
$Auction_id[$new_woncount] = $Auction_id[$kept];
$Title[$new_woncount] = $Title[$kept];
$ECAmt = $ECAmt+$Item_amount_due;
}
}
close TEMP;
$ECToken= $variable{'TOKEN'};
$This_pp = " https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=".$ECToken."";
open (CHEC, "checkout_template1_newpp");
my $Thissession = "$User_id\:$Auction_id[1]";
push @cookies, $cgi->cookie(-name=>'gotacres.compp', -value=>($Thissession), -expires=>'+1h');
print $cgi->header(-cookie=>[@cookies]);
$ECAmt .= ".00";
if ($Payment_type eq "Both"){
$Replace_checkout_type = "both the document fee and the winning bid (\$$ECAmt).
\n";
}
else {
$Replace_checkout_type = "just the document fee (\$199.00) and will return a check or money order for your winning bid with your signed documents.
PayPal® has verified your details. Click the button below to authorize your payment of \$$Payment_due.
\n";
print "
";
#print "
$thisbutton Bob
\n";
open (FOOT, "gotfoot.pp");
until (eof (FOOT)){
$Foot = ;
chop $Foot;
print "$Foot\n";
}
}
###############################################################################################################################################################################
sub printDoExpressCheckoutPaymentResponse {
my $Sql_cookie = $cgi->cookie('gotacres.compp');
my @cookied = split (/\:/ , $Sql_cookie);
$User_id = $cookied[0];
$Auction_id = $cookied[1];
$tempfile = "$User_id"."$Auction_id"."temp.txt";
open (TEMP, "temp/$tempfile") || die;
until (eof (TEMP)){
$Temp = ;
chop $Temp;
@temp1 = split (/\\/ , $Temp);
}
$updated = 0;
require "../../got_data/gotacresql.pl";
&SQLVAR;
$dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host", $db_user, $db_pass, {'RaiseError' => 1});
until ($updated >= $tempcount){
$updated++;
$updateset = "high_bidder='$User_id'";
$sth = $dbh->prepare("UPDATE geodesic_auctions SET $updateset WHERE id='$Auction_id[$updated]'");
$sth->execute();
}
$leglcnt = 0;
until ($leglcnt >= $tempcount){
$leglcnt++;
$Where_this = "WHERE id = \"$Auction_id[$leglcnt]\" AND live='0'";
$sth = $dbh->prepare("SELECT * FROM geodesic_auctions $Where_this");
$sth->execute();
$ref = $sth->fetchrow_hashref;
$This_seller[$leglcnt] = $ref->{'seller'};
$Mikes = $ref->{'description'};
$Mike_hash_in = $Mikes;
&GETMIKEHASH;
@descript = split (/\
/ , $Mike_hash_in);
$Legal = $descript[4];
$Legal =~ s/\//g;
$Legal =~ s/\<\/STRONG\>//g;
$Legal =~ s/\<\/P\>//g;
$Legal =~ s/Legal: //g;
$Legal =~ s/Legal://g;
$Legal =~ s/\//gi;
$Legal =~ s/\<\/u\>//gi;
$Legal[$leglcnt] = $Legal;
@sold1 = split (/Price:/ , $Mike_hash_in);
@sold2 = split (/\)/ , $sold1[1]);
$This_price = $sold2[0];
$This_price =~ s/\<\/u\>//ig;
$This_price =~ s/\<\/strong\>//ig;
$This_price .= ")";
$Sell_price[$leglcnt] = $This_price;
$updateset = "high_bidder='$User_id'";
$sth = $dbh->prepare("UPDATE geodesic_auctions SET $updateset WHERE id = \"$Auction_id[$leglcnt]\" AND live='0'");
$sth->execute();
$sth = $dbh->prepare("SELECT * FROM geodesic_auctions_userdata WHERE id='$This_seller[$leglcnt]'");
$sth->execute();
$ref = $sth->fetchrow_hashref;
$This_seller_name[$leglcnt] = "$ref->{'firstname'} $ref->{'lastname'}";
$This_seller_email[$leglcnt] = $ref->{'email'};
}
&SENDCUSTOMEREMAIL;
$notdoug=0;
until ($notdoug >= $tempcount){
$notdoug++;
if ($This_seller_name ne "Doug Caffey"){
&TELLTHISSELLERTHISAUCTION;
}
}
$Tell_who = "Doug Caffey";
$Tell_who_email = "dougcaffey\@gotacres.com";
&SENDGOTACRESEMAIL;
$Tell_who = "Dena Willmon";
$Tell_who_email = "klj929598\@aol.com";
&SENDGOTACRESEMAIL;
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com 7147428374\@vtext.com");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com 7146056700\@mymetropcs.com");
print MAIL "From: GotAcres\n";
print MAIL "To: Doug\n";
if ($Payment_type eq "Both"){
print MAIL "Subject: Doc fee & win bid rcvd!\n\n";
}
else {
print MAIL "Subject: Doc fee recvd!\n\n";
}
if ($tempcount >1){
print MAIL "Title Det 4 more than 1 Dena told\n";
}
else {
print MAIL "Title Det 4 $Parcel_number[1] Dena told\n";
}
close MAIL;
$Tell_who = "Michael Diatalevi";
$Tell_who_email = "webmaster\@gotacres.com";
&SENDGOTACRESEMAIL;
close TEMP;
system "rm temp/$tempfile";
push @cookies, $cgi->cookie(-name=>'gotacres.compp', -value=>(), -expires=>'+1');
print $cgi->header(-cookie=>[@cookies]);
open (HEAD, "gothead.pp");
until (eof (HEAD)){
$Head = ;
chop $Head;
if ($Head =~ /\GotAcres.com&\#174\;/){
print "GotAcres.com® - Successfull Checkout!\n";
}
print "$Head\n";
}
close HEAD;
print "
Success!
\n";
print "Congratulations! You have successfully completed the checkout process and your details have been received. Your documents will be sent via Fedex®,\n";
print "usually within 72 hours. We have also sent a confirmation email to the address provided during checkout which includes the complete details.
\n";
print "
Thank You!
\n";
open (FOOT, "gotfoot.pp");
until (eof (FOOT)){
$Foot = ;
chop $Foot;
print "$Foot\n";
}
}
###############################################################################################################################################################################
sub SENDCUSTOMEREMAIL {
open (MAIL,"|/usr/sbin/sendmail -f dougcaffey\@gotacres.com $Contact_email[1]");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com webmaster\@gotacres.com");
print MAIL "From: Doug Caffey \n";
print MAIL "To: $Title_name[1] <$Contact_email[1]>\n";
if ($tempcount ==1){
print MAIL "Subject: Title details for $Parcel_number[1]!\n\n";
print MAIL "Here are the title details for auction # $Auction_id[1] ($Title[1])\n\n";
}
else {
print MAIL "Subject: Title details for completed auctions!\n\n";
}
$mailed1=0;
$Check_amount=0;
until ($mailed1 >= $tempcount){
$mailed1++;
if ($tempcount >1){
print MAIL "Here are the title details for auction # $Auction_id[$mailed1] ($Title[$mailed1])\n\n";
}
print MAIL "The parcel number for this auction was $Parcel_number[$mailed1].\n\n";
print MAIL "Title documents will be made as follows:\n\n";
print MAIL "Name : $Title_name[$mailed1]\n";
print MAIL "Address 1 : $Addressa[$mailed1]\n";
if ($Addressb[$mailed1] ne ""){
print MAIL "Address 2 : $Addressb[$mailed1]\n";
}
print MAIL "City : $City[$mailed1]\n";
print MAIL "State/Region : $State[$mailed1]\n";
print MAIL "Zip/Postal Code: $Zip_postal[$mailed1]\n";
print MAIL "Country : $Country[$mailed1]\n\n";
if ($Amount[$mailed1] == 199){
$Check_amount = $Check_amount+$Winning_bid[$mailed1];
}
print MAIL "------------------------------------------------------------------------------------\n";
}
print MAIL "\n";
if ($Check_amount >0){
print MAIL "Amount due to be returned with documents (check or money order): \$$Check_amount\n\n";
}
print MAIL "Please allow up to 72 hours for your documents to be sent.\n\n";
print MAIL "If you have any questions please call me toll free at 800-421-7163 or outside the U.S. at 714-435-0324.\n\n";
print MAIL "Yours sincerely,\n\n";
print MAIL "Doug Caffey\n\n";
close MAIL;
}
###############################################################################################################################################################################
sub SENDGOTACRESEMAIL {
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com $Tell_who_email");
#open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com webmaster\@gotacres.com");
print MAIL "From: Webmaster \n";
print MAIL "To: $Tell_who_name <$Tell_who_email>\n";
if ($tempcount ==1){
print MAIL "Subject: Title details for $Parcel_number[1]!\n\n";
print MAIL "Here are the title details for auction # $Auction_id[1] ($Title[1])\n\n";
}
else {
print MAIL "Subject: Title details for completed auctions!\n\n";
}
$mailed1=0;
until ($mailed1 >= $tempcount){
$mailed1++;
if ($tempcount >1){
print MAIL "Here are the title details for auction # $Auction_id[$mailed1] ($Title[$mailed1])\n";
print MAIL "Link to auction: http://www.gotacres.com/auction/index.php?a=2&b=$Auction_id[$mailed]\n\n";
}
print MAIL "The parcel number for this auction was $Parcel_number[$mailed1].\n\n";
print MAIL "The price of this parcel was $Sell_price[$mailed1].\n\n";
print MAIL "Title documents should be made as follows:\n\n";
print MAIL "Name : $Title_name[$mailed1]\n";
print MAIL "Address 1 : $Addressa[$mailed1]\n";
if ($Addressb[$mailed1] ne ""){
print MAIL "Address 2 : $Addressb[$mailed1]\n";
}
print MAIL "City : $City[$mailed1]\n";
print MAIL "State/Region : $State[$mailed1]\n";
print MAIL "Zip/Postal Code: $Zip_postal[$mailed1]\n";
print MAIL "Country : $Country[$mailed1]\n\n";
print MAIL "------------------------------------------------------------------------------------\n";
}
print MAIL "\n";
if ($Check_amount >0){
print MAIL "Amount due to be returned with documents (check or money order): \$$Check_amount. Only the document fee has been paid.\n\n";
}
else {
print MAIL "They paid \$$Payment_due at PayPal, which included their winning bid";
if ($mailed1 >1){
print MAIL "s";
}
else {
print MAIL " (\$$Winning_bid[$mailed1]) ";
}
print MAIL " and document fee";
if ($mailed1 >1){
print MAIL "s";
}
else {
print MAIL " (\$199.00)";
}
print MAIL ".\n";
}
$mailed1=0;
if ($Check_amount ==0 && $tempcount >1){
print MAIL "\n";
print MAIL "Payment breakdown:\n\n";
until ($mailed1 >= $tempcount){
$mailed1++;
print MAIL "Parcel # $Parcel_number[$mailed1]: Winning bid: \$$Winning_bid[$mailed1] Document Fee: \$199.00\n";
}
}
print MAIL "Bonus information: This person came via $Bonus_information";
if ($Bonus_other ne ""){
print MAIL " ($Bonus_other)";
}
print MAIL ".\n";
close MAIL;
}
###############################################################################################################################################################################
sub TELLTHISSELLERTHISAUCTION {
open (MAIL,"|/usr/sbin/sendmail -f webmaster\@gotacres.com $This_seller_email[$notdoug]");
print MAIL "From: Michael Diatalevi \n";
print MAIL "To: $This_seller_name[$notdoug] <$This_seller_email[$notdoug]>\n";
print MAIL "Subject: Title details for $Parcel_number[$notdoug]!\n\n";
print MAIL "Here are the title details for auction # $Auction_id[$notdoug] ($Title[$notdoug])\n\n";
print MAIL "The parcel number for this auction was $Parcel_number[$notdoug].\n\n";
print MAIL "Title documents should be made as follows:\n\n";
print MAIL "Name : $Title_name[$notdoug]\n";
print MAIL "Address 1 : $Addressa[$notdoug]\n";
if ($Addressb[$notdoug] ne ""){
print MAIL "Address 2 : $Addressb[$notdoug]\n";
}
print MAIL "City : $City[$notdoug]\n";
print MAIL "State/Region : $State[$notdoug]\n";
print MAIL "Zip/Postal Code: $Zip_postal[$notdoug]\n";
print MAIL "Country : $Country[$notdoug]\n\n";
if ($Check_amount==0){
print MAIL "Amount due to be returned with documents (check or money order): \$$Winning_bid[$notdoug]. Only the document fee has been paid.\n\n";
}
else {
$This_payment = $Winning_bid[$notdoug]+199;
print MAIL "They paid \$$This_payment at PayPal, which included their winning bid";
print MAIL " (\$$Winning_bid[$mailed1]) ";
print MAIL " and document fee";
print MAIL " (\$199.00)";
print MAIL ".\n\n";
}
print MAIL "Listed price of land: $Sell_price[$notdoug]\n\n";
print MAIL "Bonus information: $Bonus_information";
if ($Bonus_other ne ""){
print MAIL " ($Bonus_other)";
}
print MAIL ".\n";
close MAIL;
}
###############################################################################################################################################################################
#my $SBAPIusername = "webmas_1219854196_biz_api1.gotacres.com";
#my $SBAPIpassword = "1219854201";
#my $SBAPIsignature = "An5ns1Kso7MWUdW4ErQKJJJ4qi4-AdDqIYNQEUbHwOh0SOrRuiq.G55y";
#my $SBAPISubject = "";
#my $SandboxURL = "https://api-3t.sandbox.paypal.com/nvp";
#219937601
#webmas_1219875637_per@gotacres.com