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

2 Pages <12
#form.fieldnames# Options
MAGSGQ
#21 Posted : Thursday, May 08, 2003 10:16:04 AM
Rank: Starting Member

Groups: Registered

Joined: 5/7/2003
Posts: 13
Location: ,
Good morning.

Patricks test code exists in this thread posted a while ago. As for what is happening and what's not working, I'll try to explain as best I can.

I have(had since I made a change this morning) one file....success.cfm which includes my IPN code.

I have created two files now: ipn.cfm and success.cfm

ipn.cfm is my URL for PayPal setup and it is my notify_url.
success.cfm is my 'return' url

Anyways, what I did was output the CFHTTP.FileContent and the FORM.Vars sent by PP and basically wrote the URL to see what VARS were being passed. Of course, not matter what I did for testing; IE: Patricks code contained in this thread and Eliteweaver, it always came back as invalid.

I finally convinced someone to test it out live for me. PayPal recorded the transaction but for some reason I was getting those CFusion errors.

Where do I stand now? Not sure! I have ipn.cfm and success.cfm and I really do not know where to go from here now.

Thanks in advance.

PS...how would I write using CFFILE again? I'm going to include the IPN code.





&lt;!-- read post from PayPal system and add 'cmd' --&gt;
&lt;CFSET str="cmd=_notify-validate"&gt;
&lt;CFLOOP INDEX="TheField" list="#Form.FieldNames#"&gt;
&lt;CFSET str = str & "#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#"&gt;
&lt;/CFLOOP&gt;
&lt;CFIF IsDefined("FORM.payment_date")&gt;
&lt;CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#"&gt;
&lt;/CFIF&gt;
&lt;CFIF IsDefined("FORM.subscr_date")&gt;
&lt;CFSET str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#"&gt;
&lt;/CFIF&gt;




&lt;!-- post back to PayPal system to validate --&gt;
&lt;CFHTTP URL="https://www.paypal.com/cgi-bin/webscr?#str#" METHOD="GET" RESOLVEURL="false"&gt;
&lt;/CFHTTP&gt;


&lt;!-- check notification validation --&gt;

&lt;CFIF #CFHTTP.FileContent# is "VERIFIED"&gt;
&lt;!-- check that payment_status=Completed --&gt;
&lt;cfif FORM.payment_status eq "Completed"&gt;
&lt;!-- check that receiver_email is your email address --&gt;
&lt;cfif #FORM.RECEIVER_EMAIL# eq "tmergl@pacmsolutions.com"&gt;

&lt;!-- process payment --&gt;
&lt;cftry&gt;

&lt;cfquery name="AddOrder" datasource="COTTAGE"&gt;
INSERT INTO InsertOrder(
business,
receiver_email,
item_name,
item_number,
invoice,
payment_status,
payment_date,
txn_id,
txn_type,
payment_type,
payer_id,
first_name,
last_name
)
VALUES(
'#FORM.BUSINESS#',
'#FORM.RECEIVER_EMAIL#',
'#FORM.ITEM_NAME#',
'#FORM.ITEM_NUMBER#',
'#FORM.INVOICE#',
'#FORM.PAYMENT_STATUS#',
#CreateODBCDateTime(Now())#,
'#FORM.TXN_ID#',
'#FORM.TXN_TYPE#',
'#FORM.PAYMENT_TYPE#',
'#FORM.PAYER_ID#',
'#FORM.FIRST_NAME#',
'#FORM.LAST_NAME#'
)
&lt;/cfquery&gt;
&lt;cfcatch&gt;
&lt;!--- let's log all errors ---&gt;
&lt;cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error order info"&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;
&lt;cfset password = #Evaluate("#RandRange(1,10000)# * #RandRange(1,10000)#")#&gt;
&lt;cfset serial_number = "#RandRange(1,10000)#-0-#Left(first_name,1)#"&gt;
&lt;cftry&gt;

&lt;cfquery name="AddCustomer" datasource="COTTAGE"&gt;
INSERT INTO InsertCustomer(
first_name,
last_name,
email,
address,
city,
state,
zip,
payer_id,
password
)
VALUES(
'#FORM.first_name#',
'#FORM.last_name#',
'#FORM.payer_email#',
'#FORM.address_street#',
'#FORM.address_city#',
'#FORM.address_state#',
'#FORM.address_zip#',
'#FORM.payer_id#',
'#password#'
)
&lt;/cfquery&gt;
&lt;cfcatch&gt;
&lt;!--- log any errors when inserting this customer ---&gt;
&lt;cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error inserting customer"&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;

&lt;!--- send user an email ---&gt;
&lt;cftry&gt;
&lt;cfmail from="terry.mergl@coastcottages.com"
to="#FORM.payer_email#"
bcc="tmergl@pacmsolutions.com"
server="smtp.coastcottages.com"
subject="CoastCottages.com Registration"&gt;
Thank you for subscribing #item_name# with CoastCottages.com

You may login and add your listing(s) at the following URL:
http://www.coastcottages.com/

Your username is: #payer_email#
Your password is: #password#

If you have questions or need help, please go to:
http://www.coastcottages.com/support/

Thanks again for your subscription!
CoastCottages.com
PACM Solutions LLC
http://www.coastcottages.com
&lt;/cfmail&gt;
&lt;!--- Now send yourself an email alerting that there was a sale done ---&gt;
&lt;cfmail server="smtp.coastcottages.com" from="registered@coastcottages.com" to="tmergl@pacmsolutions.com" subject="There was a new REGISTRATION on CoastCottages.com!"&gt;
An order was placed by: #FORM.first_name#' #FORM.last_name#

Item Purchased:
Item Name: #FORM.ITEM_NAME#
Item Number: #FORM.ITEM_NUMBER#
Purchase Price: #DOLLARFORMAT(FORM.PAYMENT_GROSS)#
PayPal Fee: #DollarFORMAT(FORM.PAYMENT_FEE)#
==========================
Profit Fee: #DollarFormat(Evaluate("#FORM.PAYMENT_GROSS# - #FORM.PAYMENT_FEE#"))#

A Reminder Email:
http://www.coastcottages.com
&lt;/cfmail&gt;
&lt;cfcatch&gt;
&lt;!--- Log Any Errors Sending Emails ---&gt;
&lt;cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error sending email"&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;
&lt;/cfif&gt;
&lt;/cfif&gt;


&lt;CFELSEIF #CFHTTP.FileContent# is "INVALID"&gt;
&lt;!-- log for investigation --&gt;
&lt;cftry&gt;
&lt;cfcatch&gt;
&lt;!--- let's log all errors ---&gt;
&lt;cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error order info"&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;
&lt;CFELSE&gt;
&lt;!-- error --&gt;
&lt;cftry&gt;
&lt;cfcatch&gt;
&lt;!--- let's log all errors ---&gt;
&lt;cffile action="append"
file="D:\webserver\coastcottages.com\www\paypal_log.txt"
output="Error order info"&gt;
&lt;/cfcatch&gt;
&lt;/cftry&gt;

&lt;/CFIF&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;CoastCottages.com - Membership Transaction In Process&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;link rel="stylesheet" href="/cottages.css" type="text/css"&gt;
&lt;/head&gt;

&lt;body bgcolor="#8D8950" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"&gt;
&lt;cfoutput&gt;#CFHTTP.FileContent#&lt;/cfoutput&gt;
&lt;/body&gt;
&lt;/html&gt;


I suck at CFusion!
RobertD
#22 Posted : Thursday, May 08, 2003 10:29:52 AM
Rank: Starting Member

Groups: Registered

Joined: 3/16/2003
Posts: 10
Location: ,
Your sentence:"Anyways, what I did was output the CFHTTP.FileContent and the FORM.Vars sent by PP and basically wrote the URL to see what VARS were being passed. Of course, not matter what I did for testing; IE: Patricks code contained in this thread and Eliteweaver, it always came back as invalid." Forget about the passed form vars for now. Concentrate on the passed data stream if you are unable to get form vars. Dump the stream using CFFILE. Look up CFFILE's parameters in Studio (assuming you're using CF tools for your code). I also do not understand what invalid means. What's invalid?

R




Robert Dew
Web Agency, Inc.
Schaumburg, IL

Lead programmer
5 years plus:
- Cold Fusion
- SQL Server
- Javascript
- Windows
25 years coding non Web apps.
MAGSGQ
#23 Posted : Thursday, May 08, 2003 10:49:55 AM
Rank: Starting Member

Groups: Registered

Joined: 5/7/2003
Posts: 13
Location: ,
CFHTTP.FileContent will either be VERIFIED or INVALID.

That's what I meant by invalid.

I suck at CFusion!
joel@perpetualmedia.com
#24 Posted : Tuesday, May 13, 2003 11:27:12 AM
Rank: Starting Member

Groups: Registered

Joined: 5/1/2003
Posts: 6
Location: ,
What happened? This was working and I tested it thoroughly just a few days ago and now this.....

&lt;!-- read post from PayPal system and add 'cmd' --&gt;
&lt;CFSET str="cmd=_notify-validate"&gt;

&lt;cfoutput&gt;
&lt;CFLOOP INDEX="TheField" list="#Form.FieldNames#"&gt;
&lt;CFSET str = str & "#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#"&gt;
&lt;/CFLOOP&gt;
&lt;/cfoutput&gt;

Gives Me This!!!

An error occurred while evaluating the expression:


"#Form.FieldNames#"


I'm an experienced Cold Fusion Developer and the problem is that PP is NOT sending the form variables necessary to process a completion. What gives?

MAGSGQ
#25 Posted : Tuesday, May 13, 2003 1:09:43 PM
Rank: Starting Member

Groups: Registered

Joined: 5/7/2003
Posts: 13
Location: ,
I gave up. I did it another way.

I suck at CFusion!
paypal_pb
#26 Posted : Wednesday, May 14, 2003 5:46:34 PM
Rank: Starting Member

Groups: Registered

Joined: 9/16/2002
Posts: 2,960
Location: ,
This code:

&lt;!-- read post from PayPal system and add 'cmd' --&gt;
&lt;CFSET str="cmd=_notify-validate"&gt;
&lt;CFLOOP INDEX="TheField" list="#Form.FieldNames#"&gt;
&lt;CFSET str = str & "#LCase(TheField)#=#URLEncodedFormat(Evaluate(TheField))#"&gt;
&lt;/CFLOOP&gt;
&lt;CFIF IsDefined("FORM.payment_date")&gt;
&lt;CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#"&gt;
&lt;/CFIF&gt;
&lt;CFIF IsDefined("FORM.subscr_date")&gt;
&lt;CFSET str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#"&gt;
&lt;/CFIF&gt;

&lt;!-- post back to PayPal system to validate --&gt;
&lt;CFHTTP URL="https://www.paypal.com/cgi-bin/webscr?#str#" METHOD="GET" RESOLVEURL="false"&gt;
&lt;/CFHTTP&gt;

&lt;!-- check notification validation --&gt;

&lt;CFIF #CFHTTP.FileContent# is "VERIFIED"&gt;

Is a way for you to confirm that the IPN came from PayPal and not a hacker.

The only thing I can think of is that the &lt;cfhttp&gt; tag may not be available if you are on an older version of ColdFusion. I believe the tag was introduced in CF 4.5.


Patrick Breitenbach
PayPal, Inc.
Dev Net: https://www.paypal.com/pdn
Users browsing this topic
Guest
2 Pages <12
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.350 seconds.