garbage= [!] ************************************************************************* Copyright 2009, Euca Deisign Center, PayFlow Pro (PayPal) NameValue API v4.3x Note: You need to be running Java 5 or higher to run these templates. You can use the 'javaversion.tpl' file to determine what you are running. DISCLAIMER: This code is provided as-is and the source is open for your improvement and editing. EDC is not liable for support of this code, but may be contacted for development. ***************************************************************************[/!] [!] ** Set some general vars ** [/!] [text]ErrorLog=[lookup db=WebMerchantPrefs.db&lookInField=preference&value=ErrorLog&returnField=value][/text] [text]mode=[lookup db=WebMerchantPrefs.db&lookInField=preference&value=PayFlow_Pro_Mode&returnField=value][/text] [text]classPath=[lookup db=WebMerchantPrefs.db&lookInField=preference&value=PayFlowProClassPath&returnField=value][/text] [!] ** Build Params ** [/!] [text]paramList=[/text] [text]paramList=[paramList]USER=[lookup db=WebMerchantPrefs.db&lookInField=preference&value=PayFlow_Pro_User&returnField=value]&[/text] [text]paramList=[paramList]VENDOR=[lookup db=WebMerchantPrefs.db&lookInField=preference&value=PayFlow_Pro_Vendor&returnField=value]&[/text] [text]paramList=[paramList]PARTNER=[lookup db=WebMerchantPrefs.db&lookInField=preference&value=PayFlow_Pro_Partner&returnField=value]&[/text] [text]paramList=[paramList]PWD=[lookup db=WebMerchantPrefs.db&lookInField=preference&value=PayFlow_Pro_Pass&returnField=value]&[/text] [switch value=[payMethod]] [case value=CC] [text]paramList=[paramList]TRXTYPE=S&[/text] [/case] [case value=BK] [text]paramList=[paramList]TRXTYPE=A&[/text] [/case] [case value=SH] [text]paramList=[paramList]TRXTYPE=D&ORIGID=[referenceNumber]&[/text] [/case] [case value=VO] [text]paramList=[paramList]TRXTYPE=V&ORIGID=[referenceNumber]&[/text] [/case] [case value=CR] [text]paramList=[paramList]TRXTYPE=C&[hideif [url][referencenumber][/url]=]ORIGID=[referenceNumber]&[/hideif][/text] [/case] [/switch] [text]paramList=[paramList]TENDER=C[hideif _SH_VO_^_[payMethod]_]&[/hideif][/text] [!] ** not all fields are needed to be passed for certain transaction types ** [/!] [hideif _SH_VO_^_[payMethod]_] [text]paramList=[paramList]ACCT=[accountNum]&[/text] [text]cleanYear=[expYear][/text] [ShowIf [expYear]>99][text]cleanYear=[math][expYear]-1900[/math][/text][/ShowIf]
[text]cleanYear=[format .2d][GetChars start=1&end=2&from=end][cleanYear][/GetChars][/format][/text]
[text]paramList=[paramList]EXPDATE=[format .2d][expMonth][/format][cleanYear]&[/text] [text]paramList=[paramList]AMT=[grandTotal]&[/text] [hideif [paymethod]=CR] [text]paramList=[paramList]COMMENT1=[cart]&[/text] [!] ** adding cart here for ease of reference in paypal manager ** [/!] [text]paramList=[paramList]COMMENT2=&[/text] [text]paramList=[paramList]INVNUM=&[/text] [text]paramList=[paramList]STREET=[address1]&[/text] [text]paramList=[paramList]ZIP=[zip]&[/text] [hideif [CCID]=] [text]paramList=[paramList]CVV2=[CCID]&[/text] [/hideif] [/hideif] [!] paymethdod = CR [/!] [/hideif] [!] *_SH_VO_CR_^_[paymethod]_*[/!] [!]clear out old values[/!] [text multi=T]result=&authcode=&respmsg=&MErrMsg=&pnref=&avsaddr=&avszip=[/text]
[text]po0=[hideif [mode]=connect]pilot-[/hideif]payflowpro.paypal.com[/text] [!] ** stripping last "&" character from param list ** [/!] [!] [Text]tlastchar=[getchars start=1&end=1&from=end][paramList][/getchars][/Text] [showif [url][tlastchar][/url]=[url]&[/url]] [/showif] [/!] [Text]po1=[paramList][/Text] [ShowIf [ErrorLog]!] [AppendFile file=[ErrorLog]&secure=t][today] [now] OHS:Sending PayFlow Pro Account:************[GetChars start=1&end=4&from=end][ConvertChars db=^WebMerchant/NumbersOnly.db][accountnum][/ConvertChars][/GetChars], Expiredate: [format .2d][expMonth][/format]/[format .2d][cleanYear][/format], Amount: [grandTotal][UnURL]%0D%0A[/UnURL][/AppendFile] [/ShowIf] [!] Testing [writefile file=LastPayFlow_ProHit1.txt]Debug: ClassPath: [classPath] URL:[po0] paramlist:[po1] mode: [mode] errorlog: [ErrorLog] [/writefile] [/!] [!] ** The actual call to the Java Class is platform dependent noting bugs in object in WebDNA 6.2 ** [/!] [showif [platform]=windows] [!] [Text]returnString=[OBJECT objname=NVP_Trans&type=1&classpath=[classpath]&call=ConnectToPayFlowPro[!] [/!]¶m1=[po0]¶m1type=Text[!] Address [/!]¶m2=[po1]¶m2type=text[!] ParamList [/!]][/OBJECT][/Text] [/!] [Text]returnString=[dos]java -classpath "classes;[classPath]" NVP_Trans [po0] "[po1]"[/dos][/Text] [/showif] [hideif [platform]=windows] [Text]returnString=[shell]java -classpath [classPath] NVP_Trans [po0] '[po1]'[/shell][/Text] [/hideif] [!] ** need to strip some headers ** [/!] [!] ref:Transaction Response :-------------------- RESULT=0[/!] [text]returnstring=RESULT[middle startafter=RESULT&endbefore=][returnstring][/middle][/text] [text multi=t][returnString][/text] &m_status=[ShowIf [url][returnstring][/url]^[url]RESULT=0[/url]]Approved[text]result=0[/text][/ShowIf][HideIf [result]=0][result][/HideIf]&m_AuthNum=[authcode]&m_Response=[url][respmsg][/url]&m_BatchNum=&m_RefNum=[pnref]&m_SequenceNum=&m_ItemNum=&m_AddressResponse=[avsaddr][avszip]&garbage=