- see footer for list info -<
Here is the code for all to have a giggle at, it's my hacked effort, but it
does work ;)
==============================================
<cfquery name="Register" datasource="dating">
SELECT dbo.Registered.RegisterID, dbo.Registered.SubPeriod,
dbo.Registered.SubAmount, dbo.Registered.SubPaidDate,
dbo.Registered.SubDateDue
FROM dbo.Registered
</cfquery>
<cfquery name="Paypal" datasource="dating">
SELECT *
FROM dbo.Paypal
</cfquery>
<!--- read post from PayPal system --->
<CFSET str="cmd=_notify-validate">
<CFLOOP INDEX="TheField" list="#Form.FieldNames#">
<CFSET str = str & "&#LCase(TheField)#=#URLEncodedFormat(Form[TheField])#">
</CFLOOP>
<CFIF IsDefined("FORM.payment_date")>
<CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
</CFIF>
<CFIF IsDefined("FORM.subscr_date")>
<CFSET str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#">
</CFIF>
<cffile action="write" addnewline="yes" file="#ExpandPath('.')#\myFile.txt"
output="#FORM.fieldnames#">
<!--- post back to PayPal system to validate --->
<CFHTTP URL="https://www.paypal.com/cgi-bin/webscr?#str#" METHOD="GET"
RESOLVEURL="Yes">
</CFHTTP>
<!--- check notification validation --->
<CFIF #CFHTTP.FileContent# is "INVALID">
<cfabort>
</CFIF>
<cfif isdefined("form.txn_type") is 1 and form.txn_type is "subscr_eot">
<cfabort>
</cfif>
<!--- Dupe transactions --->
<cfif isdefined("form.txn_id") is 1>
<cfquery name="Paypal" datasource="dating">
SELECT *
FROM dbo.Paypal
where dbo.paypal.txn_id = '#form.txn_id#'
</cfquery>
<cfif Paypal.recordcount gt 0>
Duplicate transaction
<cfabort>
</cfif>
</cfif>
<!--- check user exists --->
<cfquery dbtype="query" name = "qRegister">
select *
from Register
where registerid = #val(form.custom)#
</cfquery>
<cfif qRegister.recordcount is 0>
User not found
<cfabort>
</cfif>
<!--- check Subscription dupes --->
<cfif isdefined("form.txn_type") is 1 and isdefined("form.subscr_date") is
1>
<cfif form.txn_type is "subscr_signup" or form.txn_type is "subscr_cancel"
or form.txn_type is "subscr_modify">
<cfquery name="Paypal" datasource="dating">
SELECT *
FROM dbo.Paypal
where dbo.Paypal.txn_type = '#form.txn_type#' and dbo.Paypal.subscr_id =
'#form.subscr_id#' and dbo.Paypal.subscr_date = '#form.subscr_date#'
</cfquery>
<cfif Paypal.recordcount gt 0>
<cfabort>
</cfif>
</cfif>
</cfif>
<!--- Subscr Failed --->
<cfif isdefined("form.txn_type") is 1 and isdefined("form.retry_at") is 1>
<cfif form.txn_type is "subscr_failed">
<cfquery name="Paypal" datasource="dating">
SELECT *
FROM dbo.Paypal
where dbo.Paypal.txn_type = '#form.txn_type#' and dbo.Paypal.subscr_id =
'#form.subscr_id#' and dbo.Paypal.retry_at = '#form.retry_at#'
</cfquery>
<cfif Paypal.recordcount gt 0>
<cfabort>
</cfif>
</cfif>
</cfif>
<!-- Post into Paypal trans table -->
<cfquery datasource="dating">
INSERT INTO dbo.Paypal (txn_type, subscr_date, subscr_effective, period1,
period2, period3, amount1, amount2, amount3, mc_amount1, mc_amount2,
mc_amount3, mc_currency, recurring, reattempt, retry_at, recur_times,
username, password, subscr_id, business, receiver_email, receiver_id,
item_name, item_number, invoice, custom, option_name1, option_selection1,
option_name2, option_selection2, payment_status, pending_reason,
reason_code, payment_date, txn_id, parent_txn_id, mc_gross, mc_fee,
settle_amount, settle_currency, exchange_rate, payment_gross, payment_fee,
first_name, last_name, payer_business_name, address_name, address_street,
address_city, address_state, address_zip, address_country, address_status,
payer_email, payer_id, payer_status, payment_type, notify_version,
verify_sign) VALUES (
<cfif IsDefined("FORM.txn_type") AND #FORM.txn_type# NEQ "">
'#FORM.txn_type#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.subscr_date") AND #FORM.subscr_date# NEQ "">
'#FORM.subscr_date#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.subscr_effective") AND #FORM.subscr_effective# NEQ
"">
'#FORM.subscr_effective#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.period1") AND #FORM.period1# NEQ "">
'#FORM.period1#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.period2") AND #FORM.period2# NEQ "">
'#FORM.period2#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.period3") AND #FORM.period3# NEQ "">
'#FORM.period3#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.amount1") AND #FORM.amount1# NEQ "">
'#FORM.amount1#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.amount2") AND #FORM.amount2# NEQ "">
'#FORM.amount2#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.amount3") AND #FORM.amount3# NEQ "">
'#FORM.amount3#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.mc_amount1") AND #FORM.mc_amount1# NEQ "">
'#FORM.mc_amount1#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.mc_amount2") AND #FORM.mc_amount2# NEQ "">
'#FORM.mc_amount2#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.mc_amount3") AND #FORM.mc_amount3# NEQ "">
'#FORM.mc_amount3#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.mc_currency") AND #FORM.mc_currency# NEQ "">
'#FORM.mc_currency#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.recurring") AND #FORM.recurring# NEQ "">
'#FORM.recurring#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.reattempt") AND #FORM.reattempt# NEQ "">
'#FORM.reattempt#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.retry_at") AND #FORM.retry_at# NEQ "">
'#FORM.retry_at#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.recur_times") AND #FORM.recur_times# NEQ "">
'#FORM.recur_times#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.username") AND #FORM.username# NEQ "">
'#FORM.username#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.password") AND #FORM.password# NEQ "">
'#FORM.password#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.subscr_id") AND #FORM.subscr_id# NEQ "">
'#FORM.subscr_id#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.business") AND #FORM.business# NEQ "">
'#FORM.business#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.receiver_email") AND #FORM.receiver_email# NEQ "">
'#FORM.receiver_email#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.receiver_id") AND #FORM.receiver_id# NEQ "">
'#FORM.receiver_id#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.item_name") AND #FORM.item_name# NEQ "">
'#FORM.item_name#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.item_number") AND #FORM.item_number# NEQ "">
'#FORM.item_number#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.invoice") AND #FORM.invoice# NEQ "">
'#FORM.invoice#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.custom") AND #FORM.custom# NEQ "">
'#FORM.custom#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.option_name1") AND #FORM.option_name1# NEQ "">
'#FORM.option_name1#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.option_selection1") AND #FORM.option_selection1# NEQ
"">
'#FORM.option_selection1#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.option_name2") AND #FORM.option_name2# NEQ "">
'#FORM.option_name2#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.option_selection2") AND #FORM.option_selection2# NEQ
"">
'#FORM.option_selection2#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payment_status") AND #FORM.payment_status# NEQ "">
'#FORM.payment_status#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.pending_reason") AND #FORM.pending_reason# NEQ "">
'#FORM.pending_reason#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.reason_code") AND #FORM.reason_code# NEQ "">
'#FORM.reason_code#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payment_date") AND #FORM.payment_date# NEQ "">
'#FORM.payment_date#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.txn_id") AND #FORM.txn_id# NEQ "">
'#FORM.txn_id#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.parent_txn_id") AND #FORM.parent_txn_id# NEQ "">
'#FORM.parent_txn_id#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.mc_gross") AND #FORM.mc_gross# NEQ "">
'#FORM.mc_gross#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.mc_fee") AND #FORM.mc_fee# NEQ "">
'#FORM.mc_fee#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.settle_amount") AND #FORM.settle_amount# NEQ "">
'#FORM.settle_amount#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.settle_currency") AND #FORM.settle_currency# NEQ "">
'#FORM.settle_currency#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.exchange_rate") AND #FORM.exchange_rate# NEQ "">
'#FORM.exchange_rate#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payment_gross") AND #FORM.payment_gross# NEQ "">
'#FORM.payment_gross#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payment_fee") AND #FORM.payment_fee# NEQ "">
'#FORM.payment_fee#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.first_name") AND #FORM.first_name# NEQ "">
'#FORM.first_name#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.last_name") AND #FORM.last_name# NEQ "">
'#FORM.last_name#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payer_business_name") AND #FORM.payer_business_name#
NEQ "">
'#FORM.payer_business_name#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.address_name") AND #FORM.address_name# NEQ "">
'#FORM.address_name#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.address_street") AND #FORM.address_street# NEQ "">
'#FORM.address_street#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.address_city") AND #FORM.address_city# NEQ "">
'#FORM.address_city#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.address_state") AND #FORM.address_state# NEQ "">
'#FORM.address_state#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.address_zip") AND #FORM.address_zip# NEQ "">
'#FORM.address_zip#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.address_country") AND #FORM.address_country# NEQ "">
'#FORM.address_country#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.address_status") AND #FORM.address_status# NEQ "">
'#FORM.address_status#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payer_email") AND #FORM.payer_email# NEQ "">
'#FORM.payer_email#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payer_id") AND #FORM.payer_id# NEQ "">
'#FORM.payer_id#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payer_status") AND #FORM.payer_status# NEQ "">
'#FORM.payer_status#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.payment_type") AND #FORM.payment_type# NEQ "">
'#FORM.payment_type#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.notify_version") AND #FORM.notify_version# NEQ "">
'#FORM.notify_version#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.verify_sign") AND #FORM.verify_sign# NEQ "">
'#FORM.verify_sign#'
<cfelse>
NULL
</cfif>
)
</cfquery>
<!--- Payments and Refunds --->
<cfif isdefined("form.txn_type") is 1 and isdefined("form.custom") is 1 and
isdefined("form.payment_status")>
<cfif form.txn_type is "Subscr_payment" and form.payment_status is
"Completed">
<!--- set period from Item Name --->
<cfif #form.item_name# is "2MonthFor1">
<cfset subperiod1 = 2>
<cfset subamount = 5>
<cfelseif #form.item_name# is "YearlyPromotion">
<cfset subperiod1 = 12>
<cfset subamount = 10>
<cfelseif #form.item_name# is "monthly">
<cfset subperiod1 = 1>
<cfset subamount = 5>
<cfelseif #form.item_name# is "quarterly">
<cfset subperiod1 = 3>
<cfset subamount = 10>
<cfelseif #form.item_name# is "6months">
<cfset subperiod1 = 6>
<cfset subamount = 15>
<cfelseif #form.item_name# is "6MonthSpecial">
<cfset subperiod1 = 6>
<cfset subamount = 10>
<cfelseif #form.item_name# is "Year">
<cfset subperiod1 = 12>
<cfset subamount = 25>
</cfif>
<!--- Get payment date --->
<cfset qdate = "#form.payment_date#">
<cfset Fday = #ListGetAt(qdate, 3, " ")#>
<cfset Fmonth = #ListGetAt(qdate, 2, " ")#>
<cfset Fyear = #ListGetAt(qdate, 4, " ")#>
<cfset gmonth = mid(fmonth,1, 3)>
<cfset Fday = mid(Fday, 1, 2)>
<cfif #mid(gmonth,1,3)# is "Jan">
<cfset qmonth = 1>
<cfelseif #mid(gmonth,1,3)# is "Feb">
<cfset qmonth = 2>
<cfelseif #mid(gmonth,1,3)# is "Mar">
<cfset qmonth = 3>
<cfelseif #mid(gmonth,1,3)# is "Apr">
<cfset qmonth = 4>
<cfelseif #mid(gmonth,1,3)# is "May">
<cfset qmonth = 5>
<cfelseif mid(gmonth,1,3) is "Jun">
<cfset qmonth = 6>
<cfelseif mid(gmonth,1,3) is "Jul">
<cfset qmonth = 7>
<cfelseif mid(gmonth,1,3) is "Aug">
<cfset qmonth = 8>
<cfelseif mid(gmonth,1,3) is "Sep">
<cfset qmonth = 9>
<cfelseif mid(gmonth,1,3) is "Oct">
<cfset qmonth = 10>
<cfelseif mid(gmonth,1,3) is "Nov">
<cfset qmonth = 11>
<cfelseif mid(gmonth,1,3) is "Dec">
<cfset qmonth = 12>
</cfif>
<cfset qdate = #createdate(Fyear, qmonth, Fday)#>
<!--- End, get payment date --->
<!--- calculate next payduedate --->
<cfif qdate gte #Qregister.subdatedue#>
<cfset subdatedue1 = #dateadd("m", subperiod1, lsdateformat(qdate))#>
<cfelseif now() lt #register.subdatedue#>
<cfset subdatedue1 = #dateadd("m", subperiod1, Qregister.subdatedue)#>
</cfif>
<cfquery datasource="dating">
UPDATE REGISTERED
SET subperiod= #subperiod1#, subamount= #subamount#, subpaiddate=
'#lsdateformat(qdate)#', subdatedue= '#lsdateformat(dateadd("m", subperiod1,
qdate))#'
where registered.registerid = #Qregister.registerid#
</cfquery>
</cfif>
</cfif>
<!--- end of Subscr_Payment --->
<!--- Refunds --->
<cfif isdefined("form.txn_type") is 0 and isdefined("form.payment_status")
is 1>
<cfif form.payment_status is "Refunded">
Refund
</cfif>
</cfif>
==================================================
----- Original Message -----
From: "Gordon Burns" <[EMAIL PROTECTED]>
To: "Coldfusion Development" <[email protected]>
Sent: Wednesday, September 21, 2005 1:19 PM
Subject: RE: [CF-Dev] Paypal Tags?
>- see footer for list info -<
I have just talked to Jenny and we had a discussion re using PayPal for
subscription payments and she was giving me the benefit of her experience
working with Paypal in response to my mail.
I am sure she will be happy tp post same on the list her offer to go off
list was to enable me to get answers to general PayPal points.
The tag that was on easycfm is gone or at least the site that had it has
gone. Any other suggestions?
Is anyone using one?
Gordon
At 13:10 21/09/2005, you wrote:
- see footer for list info -<
I'm sure others would find the info useful. If you do it offlist, it wont
help anyone else or end up in the list archive.
Russ
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 21 September 2005 12:44
To: Coldfusion Development
Subject: Re: [CF-Dev] Paypal Tags?
- see footer for list info -<
Hi Gordon,
I have quite a bit of experience with Paypal, if i can be of any help
please
feel free to message me off the mail list.
Jenny
http://www.fasttrackonline.co.uk
----- Original Message -----
From: "Gordon Burns" <[EMAIL PROTECTED]>
To: "Coldfusion Development" <[email protected]>
Sent: Wednesday, September 21, 2005 11:56 AM
Subject: [CF-Dev] Paypal Tags?
>- see footer for list info -<
Sorry, I think this has come up before but any recommendations for a
PayPal tag?
This is one product with 4 prices sale operation ?
Anuy shared experiences and tips as this is the first time we have had a
client that wants to use Paypal.
Does anyone else find Macromedia Exchange hard work compared to old tag
gallery or is just me an an age thing..?
Thanks
Gordon
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your
help -<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your
help -<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your
help -<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<