YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

What are the last two function names? Options
krh5150
#1 Posted : Tuesday, December 17, 2002 1:03:34 PM
Rank: Starting Member

Groups: Registered

Joined: 12/17/2002
Posts: 1
Location: ,
The new updated code below was created to have more than one normal subscription without any trials. I went through the code to add it to the current paypal.pl script, but noticed that the last two functions at the bottom of the code do not have the proper function header with no function name. Please let me know what the name of these two functions are so I can place a function header on them. # User Constants - customize these to YOUR installation (see manual) # ------------------------------------------------------------------- # Set this to the path of your .htpassword file my $PASSWORD_FILE = ''; # Set this to the path of your processed_txns file my $TRANSACTION_FILE = ''; # You only need to change this if you are running with https # see the manual for details my $PAYPAL_URL = 'http://www.paypal.com/cgi-bin/webscr'; # The script matches the subscription terms specified by your 'join' # button to the terms specified below. This script supports up to # 3 different join buttons. If you have a trial period, fill in # the '1' fields. If not, leave empty. For 'PERIOD' specify like # '1 M' for one month. For 'AMOUNT' specify like '12.95'. # Join button a my $PERIOD1a = ''; my $AMOUNT1a = ''; my $PERIOD3a = ''; my $AMOUNT3a = ''; # Join button b my $PERIOD1b = ''; my $AMOUNT1b = ''; my $PERIOD3b = ''; my $AMOUNT3b = ''; # Join button c my $PERIOD1c = ''; my $AMOUNT1c = ''; my $PERIOD3c = ''; my $AMOUNT3c = ''; my $AMOUNT2 = ''; my $PERIOD2 = ''; # Set this to the path of sendmail. On Linux and FreeBSD systems this # is typically '/usr/sbin/sendmail', on Solaris systems it is usually # found at '/usr/lib/sendmail' my $SENDMAIL_PATH = ''; # Set this to the email address you'd like to have error notification # messages sent to my $ADMIN_EMAIL = ''; # Set this to your primary PayPal email address my @PAYMENT_EMAILS = (''); # ------------------------------------------------------------------- main(); sub main { # acknowlege the ipn from PayPal if (ack_ipn()) { # decide what to do with msg received handle_ipn(); } # IPN was successfully processed respond(1); } sub ack_ipn { # ack the ipn my $ua = new LWP::UserAgent; # build the request my $req = new HTTP::Request("POST", $PAYPAL_URL); $req->content_type("application/x-www-form-urlencoded"); $req->content(query_string() . "&cmd=_notify-validate"); # get the response my $resp = $ua->request($req); if (($resp->is_success) && ($resp->content eq "VERIFIED")) { return 1; } else { # attempt to identify error if (($resp->is_success) && ($resp->content eq "INVALID")) { error_notify("Notification received was NOT from PayPal - Message was ignored.", "acknowledge IPN", 0, 0); } else { error_notify("Notification could not be acknowledged due to a network or PayPal issue. " ."PayPal will retry until it succeeds.", "acknowledge IPN", 1, 0); } return undef; } } sub handle_ipn { # handle the msg received if ((param("txn_type") eq "subscr_signup") && (validate_signup())) { # make sure a username was sent if (!param("username")) { error_notify("No username found. Check your subscription button or link.", "add user", 0, 1); return; } # add subscriber to password file add_user(param("username"), param("password"), param("subscr_id")); } elsif (param("txn_type") eq "subscr_eot") { # make sure a username was sent if (!param("username")) { error_notify("No username found. Check your subscription button or link.", "remove user", 0, 1); return; } # remove subscriber from password file remove_user(param("username")); } else { # ignore message } } sub match_terms { # validate the terms and amounts my $p1 = shift; my $a1 = shift; my $p3 = shift; my $a3 = shift; if (($PERIOD2 eq param("period2") && $AMOUNT2 eq param("amount2"))&& ($p1 eq param("period1") && $a1 eq param("amount1")) && ($p3 eq param("period3") && $a3 eq param("amount3"))) { return 1; } else { return undef; } } sub validate_signup { # validate the terms and amounts if (match_terms($PERIOD1a, $AMOUNT1a, $PERIOD3a, $AMOUNT3a) || match_terms($PERIOD1b, $AMOUNT1b, $PERIOD3b, $AMOUNT3b) || match_terms($PERIOD1c, $AMOUNT1c, $PERIOD3c, $AMOUNT3c)) { } else { error_notify("Although payment was accepted the account was not activated.", "validate subscription terms", 0, 1); return undef; } # validate the receiver email my $valid = undef; foreach (@PAYMENT_EMAILS) { if (param("receiver_email") eq $_) { $valid = 1; } } if (!$valid) { error_notify("An IPN was received that did not match your primary email " . "address - Message was ignored.", "validate receiver email ", 0, 0); return undef; } file_open($TRANSACTION_FILE, "+<"); # validate transaction id if (find_txn(param("subscr_id"))) { # transaction was previously processed file_close($TRANSACTION_FILE); error_notify("An IPN was received that was already processed " . "- Message was ignored.", "validate subscription id", 0, 0); return undef; } else { file_close($TRANSACTION_FILE); } return 1; } Patrick Breitenbach PayPal, Inc. Dev Net: https://www.paypal.com/pdn Kevin
Sponsor  
 
paypal_pb
#2 Posted : Tuesday, December 17, 2002 5:47:47 PM
Rank: Starting Member

Groups: Registered

Joined: 9/16/2002
Posts: 2,960
Location: ,
This code replaces a one whole block of code from the original paypal.pl. Replace the origial paypal.pl code from:

# User Constants - customize these to YOUR installation (see manual)
...
...
file_close($TRANSACTION_FILE);
}

return 1;
}

with this code block.

Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF | YAF © 2003-2009, Yet Another Forum.NET
This page was generated in 0.206 seconds.