Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    10 minute script modification - simple - make quick $25.00

    I have a program that I use that takes in paypal funds for a service. The programmer and website that made this software has gone poof on me or I would offer him the quick $25.00.

    Below you will see a paypal passback script for a cgi program. What I need is a monitary conversion in this script.

    I need the paypal deposit qty converted to a different rate. The rate is 1656.

    So I would need the totaldeposit=paypaldeposit x 1656

    Any thaughts or suggestions? Email me at michael@bourg.us if you are interested in making the quick $25.00

    -------------------------------
    #!/usr/bin/perl

    use strict;

    my $lib_path;BEGIN{my $path=sub{my $file=(caller)[1];my $idx=rindex($file,'/');$idx=rindex($file,'\\') if($idx==-1);return substr($file,0,$idx+1);};$lib_path=&$path;}

    use CGI;

    use lib "${lib_path}lib";

    use dblib;

    use mylib;

    use payment;

    my $ext_file=$dblib::ext_file;

    main();

    sub main

    {

    my $q=new CGI;

    my $dbh=$dblib::dbh;

    my($ok,$info,$found_total,$custid,$order_number)=notify_paypal($q,$dbh);

    print "Status: 302 Moved\nPragma: no-cache\nLocation: client.$ext_file?act=balance&ok=$ok&info=$info\n\n";

    }

    sub notify_paypal

    {

    my($q,$dbh)=@_;

    my($order_number,$cid)=split(/\-/,$ENV{'QUERY_STRING'});

    my($found_id,$found_total)=payment::check_order($dbh,$order_number);

    if(!$found_id){return(0,"%MSG451%");}

    my $custid=payment::update_order($dbh,$found_id,$order_number,$order_number,1);

    payment:rder_done($dbh,$found_total,$custid);

    mylib::send_admin_letter($dbh,"Client, <name> made deposit!","Client, <name> made deposit ($found_total)!",$custid,1);

    return(1,"%MSG450%",$found_total,$custid,$order_number);

    }

    1;
    Last edited by joblo; 05-20-2004 at 05:14 AM.

  • #2
    New to the CF scene
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Extra Info

    Might have to do it in this file.. This is a "payment.pm" file:

    If you want a zip copy of both files.. Go to http://www.onlinegameaddicts.com/payment.zip

    Also.. If you are able to convert it for the 2checkout option as well, I'll make it $35.00... I know someone out there could do this for me in about 10 minutes flat.. lol

    ------------------------
    package payment;

    use strict;

    sub add_order
    {
    my($dbh,$total,$cart_order_id,$deposit_type,$time,$status,$custid)=@_;

    my $sth=$dbh->prepare("INSERT INTO ad_order(total,cart_order_id,deposit_type,time,status,custid,date_added) VALUES(?,?,?,?,?,?,NOW())");
    $sth->execute($total,$cart_order_id,$deposit_type,$time,$status,$custid);
    my $id=$sth->{'mysql_insertid'};

    return $id;
    }

    sub update_order
    {
    my($dbh,$id,$order_number,$cart_order_id,$status)=@_;

    my $sth=$dbh->prepare("UPDATE ad_order SET order_number=?,status=? WHERE cart_order_id=? AND id=?");
    $sth->execute($order_number,$status,$cart_order_id,$id);

    $sth=$dbh->prepare("SELECT custid FROM ad_order WHERE order_number=? AND cart_order_id=?");$sth->execute($order_number,$cart_order_id);
    my($custid)=$sth->fetchrow_array;

    return $custid;
    }

    sub check_order
    {
    my($dbh,$cart_order_id)=@_;

    my $sth=$dbh->prepare("SELECT id,total FROM ad_order WHERE cart_order_id=? AND status<>1");$sth->execute($cart_order_id);
    my($id,$total)=$sth->fetchrow_array;

    return($id,$total);
    }

    sub order_done
    {
    my($dbh,$total,$custid)=@_;

    my $sth=$dbh->prepare("UPDATE ad_client SET balance=balance+? WHERE id=?");
    $sth->execute($total,$custid);

    return 1;
    }

    sub transaction
    {
    my($dbh,$total,$custid,$deposit_type,$script_url)=@_;

    my $ext_file=$dblib::ext_file;
    my $server_url=$dblib::server_url;

    my $payment_url=$server_url."/".$script_url."/";
    $payment_url=~s/\/\//\//g;
    $payment_url=~s/http:\//http:\/\//;

    if(($total<=0) || !($deposit_type==1 || $deposit_type==2 || $deposit_type==3 || $deposit_type==4 || $deposit_type==5 || $deposit_type==6 || $deposit_type==7)){return(0,"Incomplete Information");}

    my $time=time();

    my $sth=$dbh->prepare("SELECT account,active,links FROM ad_deposit_type WHERE id=?");$sth->execute($deposit_type);my($account,$active,$links)=$sth->fetchrow_array;

    if($active && $deposit_type==3)
    {
    add_order($dbh,$total,$time,$deposit_type,$time,0,$custid);
    print "Location: https://www.2checkout.com/cgi-bin/sbuyers/cartpurchase.2c?demo=N&sid=$account&total=$total&cart_order_id=$time\n\n";
    exit;
    }
    elsif($active && $deposit_type==1)
    {
    add_order($dbh,$total,$time,$deposit_type,$time,0,$custid);

    my $return=$payment_url."ret_paypal.$ext_file";
    $return=~s/\:/\%3A/g;
    $return=~s/\./\%2E/g;
    $return=~s/\//\%2F/g;
    print "Location: https://www.paypal.com/cgi-bin/webscr?business=$account&cmd=_xclick&cancel_return=http%3A%2F%2Fwww%2Epaypal%2Ecom&return=$return%3F $time-$custid&item_name=Deposit&item_number=1&invoice=PP$time&amount=$total&no_shipping=1\n\n";
    exit;
    }
    elsif($active && $deposit_type==4)
    {
    add_order($dbh,$total,$time,$deposit_type,$time,0,$custid);

    my $hpage=$payment_url."client.$ext_file";$hpage=~s/\:/\%3A/g;$hpage=~s/\./\%2E/g;$hpage=~s/\//\%2F/g;
    my $return=$payment_url."ret_itransact.$ext_file?1_order_number=$time";$return=~s/\:/\%3A/g;$return=~s/\./\%2E/g;$return=~s/\//\%2F/g;


    print "Location: https://secure.itransact.com/cgi-bin/buynow/buynow.cgi?showaddr=1&1-desc=Deposit&1-cost=$total&1-qty=1&vendor_id=$account&home_page=$hpage&ret_addr=$return&mername=Advertise+With+Pleasure&showcvv=1 &acceptcards=1&1_order_number=$time\n\n";
    exit;
    }
    elsif($active && $deposit_type==5)
    {
    $links=~s/\r//gi;

    my @links=split(/\n/g,$links);
    my @amount_sel=();
    foreach (@links)
    {
    my($sum,$url)=split(/\|/s,$_);
    if($sum==$total)
    {
    add_order($dbh,$total,$time,$deposit_type,$time,0,$custid);
    $url=$url."&s=".$time."&total=".$total;

    print "Location: $url\n\n";
    exit;
    }
    }
    }
    elsif($active && $deposit_type==6)
    {
    add_order($dbh,$total,$time,$deposit_type,$time,0,$custid);

    my $return=$payment_url."ret_egold.$ext_file";
    $return=~s/\/\//\//g;$return=~s/http:\//http:\/\//;
    $return=~s/\:/\%3A/g;$return=~s/\./\%2E/g;$return=~s/\//\%2F/g;

    my $return_bad=$payment_url."client.$ext_file";
    $return_bad=~s/\/\//\//g;$return_bad=~s/http:\//http:\/\//;
    $return_bad=~s/\:/\%3A/g;$return_bad=~s/\./\%2E/g;$return_bad=~s/\//\%2F/g;

    print "Location: https://www.e-gold.com/sci_asp/payments.asp?PAYEE_ACCOUNT=$account&PAYMENT_AMOUNT=$total&PAYMENT_ID=$time&PAYMENT_URL=$return&NOPAY MENT_URL=$return_bad&PAYEE_NAME=Fillup%20Balane&PAYMENT_UNITS=1&PAYMENT_METAL_ID=1&PAYMENT_URL_METHO D=POST&SUGGESTED_MEMO=Fillup%20personal%20balance&NOPAYMENT_URL_METHOD=POST&BAGGAGE_FIELDS=op_key&op _key=$custid\n\n";
    exit;
    }
    elsif($active && $deposit_type==7)
    {
    add_order($dbh,$total,$time,$deposit_type,$time,0,$custid);

    my $return=$payment_url."ret_paysystems.$ext_file?o=$time";
    $return=~s/\/\//\//g;$return=~s/http:\//http:\/\//;
    $return=~s/\:/\%3A/g;$return=~s/\./\%2E/g;$return=~s/\//\%2F/g;

    my $return_bad=$payment_url."client.$ext_file";
    $return_bad=~s/\/\//\//g;$return_bad=~s/http:\//http:\/\//;
    $return_bad=~s/\:/\%3A/g;$return_bad=~s/\./\%2E/g;$return_bad=~s/\//\%2F/g;

    print "Location: https://secure.paysystems1.com/cgi-v310/payment/onlinesale-tpppro.asp?companyid=$account&product1=Deposit&total=$total&formget=N&redirect=$return&redirectfail= $return_bad&\n\n";
    exit;
    }

    return(1,"");
    }

    sub Process_AuthroizeNet
    {
    my($authorize_net_login,$amount,%Customer)=@_;

    my($Fields,$Domain,$Sub_Domain);
    my(@Response,$Response);
    my(%AVS)=("A"=>"Address (Street) matches, ZIP does not","B"=>"Address Information Not Provided for AVS Check","E"=>"AVS error","G"=>"Non U.S. Card Issuing Bank","N"=>"No Match on Address (Street) or ZIP","P"=>"AVS not applicable for this transaction","R"=>"Retry – System unavailable or timed out","S"=>"Service not supported by issuer","U"=>"Address information is unavailable","W"=>"9 digit ZIP matches, Address (Street) does not","X"=>"Address (Street) and 9 digit ZIP match","Y"=>"Address (Street) and 5 digit ZIP match","Z"=>"5 digit ZIP matches, Address (Street) does not");

    $Fields ="x_ADC_URL=FALSE&";
    $Fields.="x_Version=3.10&";
    $Fields.="x_ADC_Delim_Data=TRUE&";
    $Fields.="x_Card_Num=$Customer{'Card_Num'}&";
    $Fields.="x_Exp_Date=$Customer{'Card_Expires'}&";
    $Fields.="x_Card_Code=$Customer{'Card_Code'}&";
    $Fields.="x_Login=$authorize_net_login&";
    $Fields.="x_Amount=$amount&";
    $Fields.="x_Method=CC&";
    $Fields.="x_Type=auth_capture&";

    $Fields.="x_First_Name=$Customer{'First_Name'}&" if ($Customer{'First_Name'});
    $Fields.="x_Last_Name=$Customer{'Last_Name'}&" if ($Customer{'Last_Name'});
    $Fields.="x_Address=$Customer{'Street_Address'}&" if ($Customer{'Street_Address'});
    $Fields.="x_City=$Customer{'City'}&" if ($Customer{'City'});
    $Fields.="x_State=$Customer{'State'}&" if ($Customer{'State'});
    $Fields.="x_Zip=$Customer{'Zip'}&" if ($Customer{'Zip'});
    $Fields.="x_Country=$Customer{'Country'}&" if ($Customer{'Country'});
    $Fields.="x_Company=$Customer{'Company'}&" if ($Customer{'Company'});

    $Fields.="x_Ship_To_First_Name=$Customer{'s_First_Name'}&" if ($Customer{'s_First_Name'});
    $Fields.="x_Ship_To_Last_Name=$Customer{'s_Last_Name'}&" if ($Customer{'s_Last_Name'});
    $Fields.="x_Ship_To_Address=$Customer{'s_Street_Address'}&" if ($Customer{'s_Street_Address'});
    $Fields.="x_Ship_To_City=$Customer{'s_City'}&" if ($Customer{'s_City'});
    $Fields.="x_Ship_To_State=$Customer{'s_State'}&" if ($Customer{'s_State'});
    $Fields.="x_Ship_To_Zip=$Customer{'s_Zip'}&" if ($Customer{'s_Zip'});
    $Fields.="x_Ship_To_Country=$Customer{'s_Country'}&" if ($Customer{'s_Country'});
    $Fields.="x_Ship_To_Company=$Customer{'s_Company'}&" if ($Customer{'s_Company'});

    $Fields.="x_Phone=$Customer{'Phone'}&" if ($Customer{'Phone'});
    $Fields.="x_Fax=$Customer{'Fax'}&" if ($Customer{'Fax'});
    $Fields.="x_Email=$Customer{'Email'}&" if ($Customer{'Email'});
    $Fields.="x_Invoice_Num=$Customer{'Invoice_Num'}&" if ($Customer{'Invoice_Num'});
    $Fields.="x_Test_Request=FALSE";
    $Fields=~s/ /%20/g;

    $Domain="secure.authorize.net";
    $Sub_Domain="/gateway/transact.dll";

    $Response=&Web_Server($Domain,$Sub_Domain,$Fields);

    @Response=split(",",$Response);
    if($Response[0]==1)
    {
    return(1,$Response[3],$AVS{$Response[5]},$Response[4],$Response[6]);
    }
    else
    {
    return(0,$Response[3],"@Response", "", "");
    }
    }

    sub SSL_Post
    {
    my($Domain,$URL,$Form_Param,$type)=@_;
    my($buf);

    my $testresult=eval("use Net::SSL");
    if($@){warn "couldn't load Net::SSL: $@";}

    my $remote=Net::SSL->new(PeerAddr=>$Domain,PeerPort=>443) or print "Can't connect";
    print "ERROR" if !$remote;
    $remote->autoflush(1);

    if($type){$remote->print("POST $URL HTTP/1.0\nHost: $Domain\n\n");}
    else{$remote->print("GET $URL HTTP/1.0\nHost: $Domain\n\n");}
    my $reply='';
    while($remote->read($buf,1024)){$reply.=$buf;}
    close $remote;
    my($Header,$Response)=split("\r\n\r\n",$reply);
    return $Response;
    }

    sub Web_Server
    {
    my($Domain,$URL,$Form_Param)=@_;
    my($Full_URL,$Response,$Code,$Status,$Header);

    if(!$Form_Param){$Full_URL=$Domain.$URL;}
    else{$Full_URL=$URL."?".$Form_Param;}

    $Response=&SSL_Post($Domain,$Full_URL,$Form_Param);

    return $Response;
    }

    1;

  • #3
    New Coder
    Join Date
    May 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hey. Ok, in your script, where like the total is, it is like (item1, item2, item3, 0, item4) ok, you should be able to just do a declaration where you make that a item. Like add_order($dbh,$total,$time,$deposit_type,$time, 0,$custid) = $total , or something like that. And then have the add_order be $total x 1656. That should work. If anyone sees a glitch in that, please let him know. If that doesnt, and you still need help, i could give it a better shot, like sit down and go over it. Or i could code you a custom script, for the same price. Tell me what ya think. If that works for you, my paypal is puckettdb@fuse.net
    Thanks,
    Josh

  • #4
    New to the CF scene
    Join Date
    May 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'll give that a try in just a bit and see what happens..

  • #5
    New Coder
    Join Date
    May 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok. I am pretty sure that it should work. Like maybe declare that all of those itesm = $totalprice , and then have the add card be like ($totalprice x 6566) or whatever number.

  • #6
    New to the CF scene
    Join Date
    May 2004
    Location
    A bubble gum pyramid
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's a tip on selecting a Perl programmer. Take a look at some of his code. You don't have to understand it. If there are no plain english comments in it, stay away from that programmer. A comment in Perl is preceded by a #. For example:

    # print something
    print "Something";

    # execute send-to-paypal routine
    &paypal("data");

    Sometimes scripts don't need comments that badly, but many such scripts have them anyway and as a non-programmer, you should make sure a script you're paying for has comments incase someone other than the author needs to maintain it.

    Oh, I just noticed there's no indention either! Hopefully, it lost its indention because you didn't use code tags in your post. Make sure any script you pay for has some indented lines.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •