From f9bed43f823c2f684ef73ce3616441178b23691b Mon Sep 17 00:00:00 2001 From: Novalnet-Technic Date: Wed, 10 Nov 2021 17:01:54 +0530 Subject: [PATCH] first commit --- css/uc_novalnet.css | 104 ++ img/novalnet.png | Bin 0 -> 5470 bytes img/novalnet_cashpayment.png | Bin 0 -> 2418 bytes img/novalnet_cc.png | Bin 0 -> 2144 bytes img/novalnet_cc_amex.png | Bin 0 -> 1221 bytes img/novalnet_cc_maestro.png | Bin 0 -> 1204 bytes img/novalnet_cc_master.png | Bin 0 -> 1300 bytes img/novalnet_eps.png | Bin 0 -> 1064 bytes img/novalnet_giropay.png | Bin 0 -> 1223 bytes img/novalnet_ideal.png | Bin 0 -> 1481 bytes img/novalnet_instantbank.png | Bin 0 -> 952 bytes img/novalnet_invoice.png | Bin 0 -> 636 bytes img/novalnet_loader.gif | Bin 0 -> 7356 bytes img/novalnet_paypal.png | Bin 0 -> 1976 bytes img/novalnet_prepayment.png | Bin 0 -> 978 bytes img/novalnet_przelewy24.png | Bin 0 -> 2180 bytes img/novalnet_sepa.png | Bin 0 -> 1152 bytes includes/uc_novalnet.inc | 1595 ++++++++++++++++++++++++ includes/uc_novalnet_admin.inc | 568 +++++++++ includes/uc_novalnet_form.inc | 1266 +++++++++++++++++++ includes/uc_novalnet_page.inc | 554 ++++++++ js/uc_novalnet.js | 447 +++++++ translations/payment-uc_novalnet.de.po | 814 ++++++++++++ uc_novalnet.info | 13 + uc_novalnet.install | 164 +++ uc_novalnet.module | 218 ++++ uc_novalnet_version.txt | 6 + views/uc_novalnet.views_default.inc | 279 +++++ 28 files changed, 6028 insertions(+) create mode 100644 css/uc_novalnet.css create mode 100644 img/novalnet.png create mode 100644 img/novalnet_cashpayment.png create mode 100644 img/novalnet_cc.png create mode 100644 img/novalnet_cc_amex.png create mode 100644 img/novalnet_cc_maestro.png create mode 100644 img/novalnet_cc_master.png create mode 100644 img/novalnet_eps.png create mode 100644 img/novalnet_giropay.png create mode 100644 img/novalnet_ideal.png create mode 100644 img/novalnet_instantbank.png create mode 100644 img/novalnet_invoice.png create mode 100644 img/novalnet_loader.gif create mode 100644 img/novalnet_paypal.png create mode 100644 img/novalnet_prepayment.png create mode 100644 img/novalnet_przelewy24.png create mode 100644 img/novalnet_sepa.png create mode 100644 includes/uc_novalnet.inc create mode 100644 includes/uc_novalnet_admin.inc create mode 100644 includes/uc_novalnet_form.inc create mode 100644 includes/uc_novalnet_page.inc create mode 100644 js/uc_novalnet.js create mode 100644 translations/payment-uc_novalnet.de.po create mode 100644 uc_novalnet.info create mode 100644 uc_novalnet.install create mode 100644 uc_novalnet.module create mode 100644 uc_novalnet_version.txt create mode 100644 views/uc_novalnet.views_default.inc diff --git a/css/uc_novalnet.css b/css/uc_novalnet.css new file mode 100644 index 0000000..c71421e --- /dev/null +++ b/css/uc_novalnet.css @@ -0,0 +1,104 @@ +/** + * @file + * Styles for uc_novalnet module. + */ + +.payment-details-novalnet_sepa label{ + clear: left; + float: left; + margin: 2px 0; + padding-top: 5px; + width: 15em; +} + +.payment-details-novalnet_sepa input, +.payment-details-novalnet_sepa select +{ + float: left; + margin: 2px; + width:28%; +} + +#nnsepa_country { + float: left; + margin: 2px; + width: 29.3%; +} + +#nnsepa_ibanconf, #edit-panes-payment-details-novalnet-sepa-forget-pin{ + width:4%; +} +.form-item-panes-payment-details-nnsepa-ibanconf, .form-item-panes-payment-details-novalnet-sepa-forget-pin { + clear:both; +} +.form-item-panes-payment-details-nnsepa-ibanconf { + margin-left: 29%; +} +.account_details tbody,.account_details tr td,.account_details tr th{ + border:none; + background-color:#fff; +} +.form-item-panes-payment-details-nnsepa-ibanconf label, +#nnsepa_iban_div, #loading-img{ + display:none ; +} +#nnsepa_iban_div{ + float:left; +} +#nnsepa_iban_div label{ + width:50px; + float:left; +} +#frm_iban{ + clear:none; + width:198px !important ; +} +.account_details { + clear: both; + left: 30%; + max-height: 85%; + overflow-y:scroll; + position: fixed; + top: 10%; + width: 45%; + z-index: 1000; + background-color:#fff; + padding:2px; + display:none; +} +.account_details .header{ + font-size: 14px; + font-weight: bold; + color:#00669d; + border-bottom:1px solid #878787; +} +.account_details img{ + float:right; +} +#loading-img{ + background: none repeat scroll 0 0 #000; + height: 100%; + left: 0; + opacity: 0.5; + position: fixed; + top: 0; + width: 100%; + z-index:900; + display:none; +} +#loading-img img{ + left: 50%; + position: absolute; + top: 50%; +} +.form-item-panes-payment-details-novalnet-sepa-forget-pin label{ + float:none !important; +} +.paypal_enter_new, .cc_enter_new, .sepa_enter_new { cursor : pointer;color: blue;} +.none, .form-item-nn-amount-book-textfield {display: none;} +#nn_global_loading {margin: 45%;position: absolute;} +/* Admin side payment form display */ +#uc-novalnet-getform .form-item {width: 50%;} +#uc-novalnet-getform #nnsepa_ibanconf {float: left; margin: 6px;} +#uc-novalnet-getform #nnsepa_ibanconf {float: left; margin: 6px;} + diff --git a/img/novalnet.png b/img/novalnet.png new file mode 100644 index 0000000000000000000000000000000000000000..6e9b8b9963c813c8d0d336aa123e80b8886d5b91 GIT binary patch literal 5470 zcmV-k6`|^hP)Ze$=mX?-MMeswRSlgxqXcCAdgyuDQhh&n;W8Rtf+dN^cF3nvouC=x{Rfmsf?+FDaBL?O5u7Xj`F*l zsg!93QxfNLjN{%Ylg(7YWNF{pB-h4ptsnJ{;QAo0_2JkHx`1nP z?7{gk$ek)?T~?$fSu6k`44=tV%T&iy&s5D+1prGx7C>{sslQ)&@<05(WA%^$#(1F?Hf7ZEs^b1(Nf2 z^ez4W4SdnK8UQ()X%>L31A|-uI;LraFyWAf?$haG=UF| zOmn~oInK=^Akz2KOz$%7W7-2cVpych27UqnH-PH!JCObnNOwCLejc3~oNh2<%s(q@ z#YNq1?U&qlv$kKJbnwf!?VfgbQpEv{!s-+flqx8MfPV#33uqCP#)9yqaQzldC`2H3 zGHqh|F4N&D2j6GjghrRcRM%_ctP7Lc4XNw|xQ?YUI*iE)#(z8{K1dn$b<&=5R1JEI zq)t~oYma+h>WlO9U95zod?rA8ilakp%QIO}JNUl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;+(KMD;_hkzeU zca|8TRYn7%Ov}s#<%jSy{+#@M0L_qYy$u6M{%keOpiQ~|Yg1?<$w6Nn!~G4ig(*!- z3hmk~ftC2pkb4gRq^FoZ6Ou8#8|}U?B&X7g?+cL+fQL;?I{Ml}C(NbT_7N zKMidtGNviJLckh8oo1$SL`y#D?>vQi{{|X8Tmbwr8o$ekj0~gLQEt0XhxWl3z#N3u zj!Pc3#+^u`8RVXPzZm+zLAOGrE3h)Vdb=W;r|2}0FZC! U=MKb0M*si-07*qoM6N<$f@U$uY5)KL literal 0 HcmV?d00001 diff --git a/img/novalnet_cashpayment.png b/img/novalnet_cashpayment.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb4d4b2f03b009aaa48ef27f761f0d339341b0b GIT binary patch literal 2418 zcmZ`*X*ksD8~)8+vK&NXIA~~WVF)qS%D!a6WMu677RlJ1OgbnNoj4W7Q7MH;hU|EJxa|u{u`Eb9ets{+B}6Z&bZNACxF28`p#8p1X(Dsd&hr_dt4j6 zx<6+SzE?3RGB0C4v_Hi)9MD^gYZ>6y)2w6c6-*8}Q9>yB6twKlZ1Ty7W0h8ZA-e^8 zqwIyBL6$N00dHoNuanfe)lI>O^HPE|2&j#irp>I+r_qf?G=xoT*TTH_zxx<%-kF-3 z$}0C%yPqK~Fm<>_4-N9XfJpq;<+I_}kt6;#A1;Qz!YRq#z)=1IzMLeuq9uGoH7yZ> z35MMRP9XhlCqySDHTS@~)k2Zmiaf9qTwYyna=N2RaJH)UAOHUK&Bj9Ay#=Y^Sc6sA|UOEv>chF?n(#YrP%s6=?>JQvOcGjTE-JA0#E0IK~fiR`~ zst4E|v3;#W4@`uFifinIJrqD(z1^2fJbh{4X#?I$8+-GCH{(jNX0bh``)myDo* z9v+JoAp)V0^Y3dEzyaWtVBh;cwm5w{5 ztVM1lnBz9{8Y?cRySQw83HdoM%{d#Zgc=Sb9sHT#(&!7xYTmUmKZ3A?D$UW3_@n)F zDh6ZY&js!1R{r+!;gYl1K@RGtx*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~v%R#tYvN8pE}{0*qRF~9t`%j56z$5=U~!B3c=@2=cR5?<+QMSLyHR|v z*gPk)yQkloDJds+eb1Wcd3xbKyds*Hw)9;uJ-n(^W^ZJ1Wk^x6*`w*<%Q;z(++V zFB?mXM8mZeA6^TVzTQ!s+g{y2FZbQeEo+ze2UJb?R{wZ@anS z$>-bEKd!_kd2~t$Pi^3DWRl2E+?f?%X{;-<-tT%2KaU|x)ax0%-f`D?Hy5^kTB~|{ z+Lfq3S!cy2?rl6|rhDDJZD*Ty>w~D%+r&0~Uo(4}7pG=LQIEvQJ8@?U&TZap`si1U zm(R?-H(6TCWxaE_*RsBjFcrHWmF5<4Et~KD8i@%3nnl^^XB-ZGbC{g`$oK99=alS# z4+rnfna}UPV(s%!*E)Xp&rjr#6%D+*!hE%9wA&4N@jqoX$EKcAaOmh{he!1^9|DzN^>f&@7*}Ze539B zds8g3bK5(oD9kN({C7m5C@o5K2H)O=iyv8@sS+yVJ$JLH(RyY2MYf#!#=ESq_AWli zY84l7!BK60?C<_GvmoR8>74o8`yZG5&-iO+JfG+8)3+1FC;l(rQonJEvGrxedIrNe zxomaX8gGH+f@+CtL`h0wNvc(HQ7VvPFfuSS*EKNKH8Kh@Ft9SRv@$T%H88a@FyMK7 gLkLAfZhlH;S|x4`wfhp*0W~mqy85}Sb4q9e06!cOMF0Q* literal 0 HcmV?d00001 diff --git a/img/novalnet_cc_maestro.png b/img/novalnet_cc_maestro.png new file mode 100644 index 0000000000000000000000000000000000000000..834af799c72b51d843814b1d76a5716660dea579 GIT binary patch literal 1204 zcmV;l1WWsgP)9&g}hp*n67kjXmpWXYak%`hWkmzW-X03vBm_=IrA_Y`}UfM*}S!!fyPG zV+iY?`4OsEg&VOJi}N@q@H=+mPjtW&E6>YYz65{~JcRr5fCGr<_@p?4KjM&lcyPgr z_r;|VY4Qke#}f2haK33A#W#2hpL%0|Yc8N@4v2D|{CQkI`|WZTh16tYIBZ|{*w~vJ zxAgC6_VuU#>2c1^VjEt>-d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upQeFq9tPpYS0bH^r1c}kAaj&L#B`S$=DqMIbP-JB-6|R-fE;=EKVe^1MX8g5IxzB zjPI1Q6k@54f=r#ABgab}tz^^?H{E0BsWi4{8ogR+%w!rz7z$uju|=`lwNvS3D%*hr zdXEl-()d;dG{u@AOeJ|~filq2aGAIpY|EEgZ83$6@0z_zTUKe$S=n;DOz5`f3pK3G zIv~AywoLA8dV-`+F=e#a)&*%+iF9g#h1L$2qrrq0ckD;Dd*1k^6MR%@3S{E=-6*4V7cOSnTS zw0Fq0rU9tUibgnsL;JA~Oy3ksCiYT8yV8(8XlbRvONWnpiyXnt3Ve(Z`rs;{&Do+~ zbYKRYAdhkucSn|t-5Jz{_+_9(Y#ys}@#764s8Sb17{yElvniALfF`L7VbcAx0^g0_ zLRGry3?Wj4_<#_b%Eu#^f18C>>P-aE16Q@l;>=vmbmmWRno@kfwgcjZ2Dp*l>PTdy zT-?CHt5rr`r-Sd$A1)V{vmKU7;-kxh@T~c;@I68Xfo8Qq98R*TBvtr2kVRXb==$_1%p@e0aqSqw#Lb-+sTH`^T+e|2NkK@b$F;tffpU z3oDhe^hN(l_xQ8@dB&~;48Q<7wvB$wYV3(^HL-2mW}Pe`i_9&aHxPd3+}{i=y1?mx zi=5^oA0iIB5VQUa7daC%b{cJC5YHDvdBJ2rFB80=mQkw7VuF9nv&~29>ER>26j8`9 zzo=(~O7iIM( zQbh`(e5Qzak|?BtF$S0;g?ZZf%RK*Cp)cYyH|e91RA%UBk~&_J#R!|k5y};AaUDYK zC%ofvzU literal 0 HcmV?d00001 diff --git a/img/novalnet_eps.png b/img/novalnet_eps.png new file mode 100644 index 0000000000000000000000000000000000000000..02875aeefb8558e1cf37ef1a49ce28ef8042c188 GIT binary patch literal 1064 zcmV+@1lRkCP)Ezkb*tTukwmtK(wr$(CZQEnpw(tJ+>U7oJ4%g|bFFFr@+R9$Ow(@PI za4{BO7koY-7H)yYL5VyIFW?9?E`~zFL|4LUXk3qE zD5T*&X#9p?B1N~xejG%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ap4<%H3Nn3J^GjkAg!K-{-QB@d zQn%t6`@_bL>&ur&P2^|vE;d>4#Kr{}MXDvP5hW>!C8<`)MX5lF!N|bSLf61l*U&7) w(7?*b(#q6G+rYrez~FqJ)gu%Qx%nxXX_dG&?7Q3)2h_me>FVdQ&MBb@0E0pY1^@s6 literal 0 HcmV?d00001 diff --git a/img/novalnet_loader.gif b/img/novalnet_loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..cf70c2efd0887795d64bfc0d6573733589eca929 GIT binary patch literal 7356 zcmeI0X;c&Wn#TWCm3<@Zi-Jj5WH%t7xL^gs<{A-^MKK^C?g5v^wL=m#>^mYVmdGwB zB4SXq6GV**8W0g|Thl0r?XEP9UYnk@x98q(Gks>}+?jjko>TR)>eM;)`@R3?c>{w3 zW_rhP0T+w`@Y`>{frO*)#y$fCzK7RQj2I~-?y|cUNc1Bx|a^U%r;)@sh zhE|oUWal*I+iRxF&Xg!0EGWFt+&ze0`@ZZ-KXub_%WrDuX0!z6DZJ%p`-b0E-gq>1 zZ-ZRXy{_u2_3rv3oda8HuTPVl_Rl@9x8;QHlm00#_9q;f0svr7SokH!$83v_V|}x3 zTOuoFeN4*6EirMf>ozBB0qozXi~U2F`SAq)?yg(}(mmj;yLG>i3jlFK3?x!n+WrIb z^o-1`?3`>vXWW$B;sXSZQ4w%;Dwj@iMoMxmt*sp;RQ(32Q8}kFokWsY*(lCA8MjNA z4f>wV2gpW7=3t8HEeE2*EmMhIyRjOOX;;8^4HgpHTPDC!BVpY#lhCMC2JwnP?<8QS zAy^D?G)@3{g=e%ZY6A2Qa-z#mE{GC}+)w+*QFe4Hpyli3VtiY}yxV7KxX-BdafeA*xkMbMBU?}R*@et`tq z@pJ1!@%Yx4CEJ48!j%T65PYE_-R$B)}q)v(9A=PYE8S!mWdzWIx4 zTS!wCzjRm7>a4Q(`3FzR?hqYkul4D%MCZPaU^VCFgf2KVug&4siNY7NNXHwKA%i z(IVN?h^$Ha)A;?nNh*Jy-e7S&vv8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x}ROqk>6*m5`?cQIq)^Z+)ys^Zha(O98oN8D^7wK^fZ z#aclqiWzK4I8AApCUbgDG&9)1l$KQ~G$I4+%wZ(CS(WtbBp<~+T(^z;!>O+N40sgg z-iJGk$>4WbPvUl>6*e8H%C(8vY=}*VBCzVCP(CZ3uZLA1heBA@jzx%UUq+N7py1@} z0M-ogdqB~d{rqT0-<5E}G%Y*wcsJ8G86}@n0W#R6xXuH!D?bw&o+0LgNcJ1?38Es{ z(0sVrNEWPJWz2gKcQg7ZlmKRycMpjm$!i7xB&j@4P$8;gF=OT0GsH}QzTiZnq5Q%a z0e#8YE`cjP3dX<5Ld@}qYUXPi-D273h^C%ahS;&J>7n>{+n)f1E?@*Nc%};g0000< KMNUMnLSTaOw&x@O literal 0 HcmV?d00001 diff --git a/img/novalnet_prepayment.png b/img/novalnet_prepayment.png new file mode 100644 index 0000000000000000000000000000000000000000..91042816085bcabe2412d107656e19acc7cf54d5 GIT binary patch literal 978 zcmV;@11qZ-HR}qw6}< z{HsUKZu@?<^km)OSoW0dy^ox;K)Exck+Tp+g52&ml7L$~{A1#Y5;H&Fb5St&DLXuW&v>pd)AXVe^2)^+wgmjXLy8 z&)eQ-zW9&7T z7scNl35W)w9$A-UVYt5lXQ9#bSF=WREIAPl`{_0HN>4GS- zpg46)XX}-_1@GVIh1wSVp}oL4Y>gYt&NL4tfsGJ#ZiHjD38Sn(iHH9g!Dvp$shdz- zxtTV&qh)jjl!w`DHn`nxh@ug|%)yiZ32H+lf;eKU2wMKn;J!bH5Xq@;>-cJkq&L)Qaj z3r3<*WHK478phQbV-N%ZGtF>P!57U5Y~{BgkydcWuRZ9GXK=>$KHPuE`dG&yqBlV? z-jZd@7rrdZNTpJkZt|-EpLHlG=uW~SP&`*Khz==*leY2VzC+f-`c4r5ChQ_N&VyA{ zRFtEor3IAIX*3wHcmnt_xeVTsUH5JAyU=ilSgymUnOBR`ZjKi;L0I)6MNMX><)HcL3>x9T!GqY>IZc z+cgxm0qU{|#6JXq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x#5N(*VGvbLhsD~OThHOx(WrQN6|4W9FBxDeY%lw)%^55y&*RJ5e(7(Kt{wtv@kQo15e*EM_%JTzQBG$iX7V8VPtA( z#a%y~E&j*~`tEFr#7|C?+x_Xuvis~9Zu>&Kn{FgTx%T!gV}$raY3Z;YVlxnTA=(}& zY=LMuk<(nYI^l1K6P`+mYrlmvdS45wddCX6>|5{LtTiJ>E#5F_jKk861IG|BMY)TI z{(Lj!4pQ+UKE-{A%`AvbJt*|YV~D;UXogtaP!?S<4vXP$AD2wns5+C@^m`hW?SM3)up#@StH~no@fuX zJNOdi@d5&8ZXll{qzS}kG-{$28sTGz#if^Df~xpk7D5yuD$1{RG80~sLn|froHx66 zd_WDwZm#z2>7>pbX`l!xzj<5F*{aRu(#EQlh@lvcep(xNpabN8x`P&ukgO1!$M_k) z;HI$voP-M$ORl8`6a7ak=I=`dZW3~ikhz3RBjng07Ylv&*{QNgs^p(VjgSDScQ^sj zZeg4)wl`)QXKW^19By$%1RRFf&oTL*Zy+!y6n zD?H4%&P8_h^=bPascb#(-sfmh{W*z9##$(tYU3)d<7143E0kdsQjm-Y array( + 'name' => t('Credit Card'), + 'key' => '6', + 'link' => t('https://www.novalnet.com/credit-card'), + 'desc' => t('The amount will be debited from your credit card once the order is submitted')), + 'novalnet_ideal' => array( + 'name' => 'iDEAL', + 'key' => '49', + 'link' => t('https://www.novalnet.com/ideal'), + 'desc' => sprintf(t('After the successful verification, you will be redirected to Novalnet secure order page to proceed with the payment %s Please don’t close the browser after successful payment, until you have been redirected back to the Shop'), '
')), + 'novalnet_sepa' => array( + 'name' => t('Direct Debit SEPA'), + 'key' => '37', + 'link' => t('https://www.novalnet.com/sepa-direct-debit'), + 'desc' => t('Your account will be debited upon the order submission'), + 'guarantee_key' => '40' + ), + 'novalnet_invoice' => array( + 'name' => t('Invoice'), + 'key' => '27', + 'link' => t('https://www.novalnet.com/invoice'), + 'desc' => t("Once you've submitted the order, you will receive an e-mail with account details to make payment"), + 'guarantee_key' => '41'), + 'novalnet_paypal' => array( + 'name' => 'PayPal', + 'key' => '34', + 'link' => t('https://www.novalnet.com/paypal'), + 'desc' => sprintf(t('After the successful verification, you will be redirected to Novalnet secure order page to proceed with the payment %s Please don’t close the browser after successful payment, until you have been redirected back to the Shop'), '
')), + 'novalnet_eps' => array( + 'name' => 'eps', + 'key' => '50', + 'link' => t('https://www.novalnet.com/eps-online-payment'), + 'desc' => sprintf(t('After the successful verification, you will be redirected to Novalnet secure order page to proceed with the payment %s Please don’t close the browser after successful payment, until you have been redirected back to the Shop'), '
')), + 'novalnet_instantbank' => array( + 'name' => t('Instant Bank Transfer'), + 'key' => '33', + 'link' => t('https://www.novalnet.com/online-instant-transfer'), + 'desc' => sprintf(t('After the successful verification, you will be redirected to Novalnet secure order page to proceed with the payment %s Please don’t close the browser after successful payment, until you have been redirected back to the Shop'), '
')), + 'novalnet_prepayment' => array( + 'name' => t('Prepayment'), + 'key' => '27', + 'link' => t('https://www.novalnet.com/prepayment'), + 'desc' => t("Once you've submitted the order, you will receive an e-mail with account details to make payment")), + 'novalnet_giropay' => array( + 'name' => t('giropay'), + 'key' => '69', + 'link' => t('https://www.novalnet.com/giropay'), + 'desc' => sprintf(t('After the successful verification, you will be redirected to Novalnet secure order page to proceed with the payment %s Please don’t close the browser after successful payment, until you have been redirected back to the Shop'), '
')), + 'novalnet_cashpayment' => array( + 'name' => t('Barzahlen'), + 'key' => '59', + 'link' => t('https://www.novalnet.com/barzahlen'), + 'desc' => sprintf(t('After completing your order you get a payment slip from Barzahlen that you can easily print out or have it sent via SMS to your mobile phone. With the help of that payment slip you can pay your online purchase at one of our retail partners (e.g. supermarket).'), '
')), + 'novalnet_przelewy24' => array( + 'name' => t('Przelewy24'), + 'key' => '78', + 'link' => t('https://www.novalnet.com/przelewy24'), + 'desc' => sprintf(t('After the successful verification, you will be redirected to Novalnet secure order page to proceed with the payment %s Please don’t close the browser after successful payment, until you have been redirected back to the Shop'), '
')), + ); + /* if payment name passed as empty, it will returns entire payment array otherwise returns the individual payment array */ + return (!empty($nn_payment)) ? $payment_methods[$nn_payment] : $payment_methods; +} + +function uc_novalnet_logo_url($key) { + switch ($key) { + case 'novalnet_cc': + return t('https://www.novalnet.com/credit-card'); + case 'novalnet_sepa': + return t('https://www.novalnet.com/sepa-direct-debit'); + case 'novalnet_invoice': + return t('https://www.novalnet.com/invoice'); + case 'novalnet_prepayment': + return t('https://www.novalnet.com/prepayment'); + case 'novalnet_cashpayment': + return t('https://www.novalnet.com/barzahlen'); + case 'novalnet_ideal': + return t('https://www.novalnet.com/ideal'); + case 'novalnet_instantbank': + return t('https://www.novalnet.com/online-instant-transfer'); + case 'novalnet_paypal': + return t('https://www.novalnet.com/paypal'); + case 'novalnet_eps': + return t('https://www.novalnet.com/eps-online-payment'); + case 'novalnet_giropay': + return t('https://www.novalnet.com/giropay'); + case 'novalnet_przelewy24': + return t('https://www.novalnet.com/przelewy24'); + } +} + +/** + * + * Payment method callback function: To get the payport url for relevant requests + * + * $request_type - based on that request type, process url is retrived for the payment process. + * + * @param string $request_type + * @return string + */ +function uc_novalnet_get_url($request_type) { + switch ($request_type) { + + /* Get the payment url for cURL process */ + case 'nncurl_request': + return 'https://payport.novalnet.de/paygate.jsp'; + /* Get the payment url for xml process */ + case 'nnxml_request': + return 'https://payport.novalnet.de/nn_infoport.xml'; + /* Request for auto api configuration call */ + case 'novalnet_auto_config': + return 'https://payport.novalnet.de/autoconfig'; + /* Get the payment url for redirection payments */ + case 'novalnet_ideal': + case 'novalnet_instantbank': + return 'https://payport.novalnet.de/online_transfer_payport'; + case 'novalnet_paypal': + return 'https://payport.novalnet.de/paypal_payport'; + case 'novalnet_eps': + case 'novalnet_giropay': + return 'https://payport.novalnet.de/giropay'; + case 'novalnet_cc_pci': + return 'https://payport.novalnet.de/pci_payport'; + case 'novalnet_przelewy24': + return 'https://payport.novalnet.de/globalbank_transfer'; + } +} + +/** + * + * menu callback : Display the admin portal inside the shop + * + * Merchant login into admin portal in shop itself to activate the payment methods + * + * @param none + * @return none + */ +function uc_novalnet_merchant_admin() { + $support = t('Login here with Novalnet merchant credentials. For the activation of new payment methods please contact %ssupport@novalnet.de%s'); + echo '
' . sprintf($support, "", "") . '
'; + exit; +} + +/** + * + * Payment method sanitize function: sanitize the refer id parameters + * + * Remove the unwanted tags and spaces from the referer id + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_sanitize_referid($element, &$form_state) { + $form_state['values'] = array_map('strip_tags', $form_state['values']); + $form_state['values'] = array_map('trim', $form_state['values']); +} + +/** + * + * Payment method validate function for number validation. + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_element_validate_number($element, &$form_state) { + $element_value = trim($element['#value']); + if ( $element_value != '') { + /* Numeric validation - Throws a message, if it is not contains numeric values */ + if (!preg_match("/^[0-9]+$/", $element_value)) { + /* Varibale that contains the error message with field name(E.g: Telephone number is not valid) */ + $errormsg = $element['#title'] . ' ' . t('is invalid'); + form_error($element, check_plain($errormsg)); + } + } +} + +/** + * + * Payment method validate function: to validate the mobile number. + * + * $payment - To get the current payment name + * + * $payment_details - array that contains the form values for the current payment + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_element_validate_fraud_pin($element, &$form_state) { + $payment = $form_state['values']['panes']['payment']['payment_method']; + $payment_details = $form_state['values']['panes']['payment']['details']; + + /* Variable that contains the error message with field name(E.g: Telephone number is not valid) */ + $errormsg = str_replace('*', '', $element['#title'] . ' ' . t('is invalid')); + + /* Quit the form validation while using payment_ref in CC payment */ + if (!empty($payment_details['one_shop_cc_enabled'])) + return TRUE; + + /* Quit the form validation while using payment_ref in SEPA payment */ + if (!empty($payment_details['one_shop_sepa_enabled']) && empty($payment_details['sepa_given_details'])) + return TRUE; + + /* Sanitize the pin element */ + if (empty($payment_details[$payment . '_pinkey'])) + form_error($element, check_plain(strip_tags($errormsg))); + /* Validation for numbers and mail */ + if (trim($element['#value']) != '') { + if (($element['#attributes']['id'] == 'fraud_number' && !preg_match("/^[0-9]+$/", trim($element['#value'])))) { + form_error($element, check_plain(strip_tags($errormsg))); + } else { + /* stores the pin value in novalnet payment session */ + uc_novalnet_setsession($payment, array($payment . '_pinkey' => trim($element['#value']))); + } + } +} + +/** + * + * Payment method callback function: to complete the order purchase for redirection payment + * + * Function is used to complete the order and save the resposne log + * + * $parsed - variable that contains the server response + * + * @param none + * @return none + */ +function uc_novalnet_nnpayment_complete() { + $parsed = $_REQUEST; unset($_POST); + $parsed['order_no'] = !empty($parsed['order_no']) ? $parsed['order_no'] : $parsed['inputval3'] ; + /* To save the payment response in Novalnet transaction logs */ + uc_novalnet_save_log($parsed['order_no'], $parsed, 'response'); + /* To complete the payment transaction */ + uc_novalnet_completeorder($parsed); +} + +/** + * + * Payment method validate function: to validate the pin number + * + * $payment - To get the current payment name + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_element_validate_pin($element, &$form_state) { + /* Fetch the Payment method name from the form_state values */ + $payment = $form_state['values']['panes']['payment']['payment_method']; + $errormsg = t('Pin number is not valid'); + $pin_value = trim($element['#value']); + /* Quit the pin validation if it contains the empty value */ + if (!$form_state['values']['panes']['payment']['details'][$payment . '_forget_pin']) { + /* Pin validation - if it contains special characters or spaces */ + if (preg_match('/[\'\/~`\!@#\$%\^&\*\(\)_\-\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/', $pin_value)) { + $errormsg = t('The PIN you entered is incorrect'); + form_error($element, check_plain($errormsg)); + } + elseif (empty($pin_value)) { + $errormsg = t('Enter your PIN'); + form_error($element, check_plain($errormsg)); + } + /* Stores the pin value in session and forget pin flag set as empty (0) */ + uc_novalnet_setsession($payment, array('pin' => trim($element['#value']), 'forget_pin' => 0)); + } + else { + /* store the forget pin flag as 1, when end-user hits the forget pin */ + uc_novalnet_setsession($payment, array('forget_pin' => trim($form_state['values']['panes']['payment']['details'][$payment . '_forget_pin']))); + } +} + +/** + * + * Function to validate the basic and customer related parameters for payment process from admin create order + * + * @param object $order + * @return none + */ +function uc_validate_novalnet_getparams($order) { + $is_error = FALSE; + /* Validating customer details for order process */ + foreach (array('First name' => 'first_name', 'Last name' => 'last_name', 'Street' => 'street1', 'City' => 'city', 'Zone' => 'zone', 'Postal code' => 'postal_code', 'Country' => 'country') as $params => $values) { + $parameters = 'billing_' . $values; + if (empty($order->$parameters)) { + $is_error = TRUE; + drupal_set_message('Basic parameter ' . $params . ' is invalid', 'error'); + } + } + + /* Validating customer e-mail address*/ + if (empty($order->primary_email)) { + $is_error = TRUE; + drupal_set_message(t('Basic parameter email is invalid'), 'error'); + } + if ($is_error) + /* checking whether admin placed re-order */ + if (isset($_SESSION['cart_order'])) + drupal_goto('cart/checkout'); + else + drupal_goto('admin/store/orders/' . $order->order_id . ''); +} +/** + * + * Payment method callback function: To form the basic and customer related parameters for payment process + * + * @param array $data + * @param object $order + * @return none + */ +function uc_novalnet_getparams(&$data, $order) { + global $language; + $config_data = basic_params(); + $billing_country = uc_get_country_data(array('country_id' => $order->billing_country)); + $ipaddr = ip_address(); + /* Fetching the ubercart version details */ + $ubercart_info = system_get_info('module', 'uc_payment'); + $info_version = explode('-', $ubercart_info['version']); + /* Fetching the payment details */ + $payment_details = uc_novalnet_payment_methods($order->payment_method); + /* Form the payment call parameters */ + $data = array( + 'vendor' => $config_data['vendor_id'], + 'product' => $config_data['product_id'], + 'tariff' => $config_data['tariff_id'], + 'auth_code' => $config_data['auth_code'], + 'test_mode' => variable_get($order->payment_method . '_test_mode', 0), + 'currency' => variable_get('uc_currency_code', 'USD'), + 'first_name' => trim($order->billing_first_name), + 'last_name' => trim($order->billing_last_name), + 'gender' => 'u', + 'email' => trim($order->primary_email), + 'street' => $order->billing_street1, + 'search_in_street' => 1, + 'city' => $order->billing_city, + 'zip' => $order->billing_postal_code, + 'tel' => trim($order->billing_phone), + 'lang' => strtoupper($language->language), + 'language' => strtoupper($language->language), + 'country_code' => $billing_country[0]['country_iso_code_2'], + 'country' => $billing_country[0]['country_iso_code_2'], + 'session' => session_id(), + 'customer_no' => ($order->uid > 0 ) ? $order->uid : 'guest', + 'remote_ip' => ( filter_var($ipaddr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) || $ipaddr == '::1' ) ? '127.0.0.1' : $ipaddr, + 'order_no' => $order->order_id, + 'payment_method' => $order->payment_method, + 'system_name' => 'drupal-ubercart', + 'system_version' => VERSION . '-' . $info_version['1'] . '-NN11.2.0', + 'system_ip' => ( filter_var($_SERVER['SERVER_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) || $_SERVER['SERVER_ADDR'] == '::1' ) ? '127.0.0.1' : $_SERVER['SERVER_ADDR'], + 'system_url' => url('', array('absolute' => TRUE)), + 'amount' => round($order->order_total, 2) * 100, + 'key' => $payment_details['key'], + ); + /* Company parameter added for payment call */ + if (!empty($order->billing_company)) { + $data['company'] = $order->billing_company; + } + /* Checking the possibilities for guarantee payments */ + if (variable_get($order->payment_method . '_payment_guarantee_check', 0)) { + uc_novalnet_check_guarantee_payments($data, $order); + } + /* Checking for reference payment payment_ref = TID */ + + if ((!empty($_SESSION['novalnet_session'][$order->payment_method]['ref']) && variable_get($order->payment_method . '_enable_one_shop_clicking') == 1)) { + $transaction_id = nn_variable_get(array('customer_id' => $order->uid), 'uc_novalnet_transaction', array('tid'), array('is_ref_order' => '1'), array('paymentkey' => $data['key'])); + $data['payment_ref'] = $transaction_id['tid']; + if($order->payment_method == 'novalnet_cc' && !empty($_SESSION['novalnet_session'][$order->payment_method][$order->payment_method . '_uniqueid']) && !empty($_SESSION['novalnet_session'][$order->payment_method]['nn_cc_hash'])) + unset($data['payment_ref']); + } + + /* Manual check limit for allowed payments */ + if (in_array($order->payment_method, array('novalnet_cc', 'novalnet_invoice', 'novalnet_sepa', 'novalnet_paypal')) && variable_get($order->payment_method . '_enable_one_shop_clicking') != 2) + uc_novalnet_checklimit($data, $order); + if ($data['key'] != '40') { + /* checking the possibilities for zero amount booking */ + uc_novalnet_zero_amount_booking($data, $order->payment_method, $config_data); + } + + /* Load the individual payment params */ + if (!isset($_SESSION['novalnet_session'][$order->payment_method]['tid'])) + uc_novalnet_additional_params($data, $order, $config_data['payment_access_key']); + if ($order->payment_method == 'novalnet_cc') { + $_SESSION['novalnet_session'][$order->payment_method]['cc_request'] = $data; + $data['nn_it'] = 'iframe'; + if (!empty($_SESSION['novalnet_session'][$order->payment_method][$order->payment_method . '_uniqueid'])) + $data['unique_id'] = $_SESSION['novalnet_session'][$order->payment_method][$order->payment_method . '_uniqueid']; + if (!empty($_SESSION['novalnet_session'][$order->payment_method]['nn_cc_hash'])) + $data['pan_hash'] = $_SESSION['novalnet_session'][$order->payment_method]['nn_cc_hash']; + } + /* Send the notify url on payment call, which is not empty */ + if (!empty($config_data['notify_url'])) + $data['notify_url'] = $config_data['notify_url']; + + if ( in_array($order->payment_method, array('novalnet_paypal', 'novalnet_cc', 'novalnet_sepa')) && (variable_get($order->payment_method . '_enable_one_shop_clicking', 0) != 0 && empty($data['payment_ref'])) && arg(0) != 'admin' && empty($_SESSION['novalnet_session'][$order->payment_method]['gurantee']) && ($order->uid != 0 || $order->uid == 0 && variable_get($order->payment_method . '_enable_one_shop_clicking') == 2)) { + $data['create_payment_ref'] = 1; + } + if ($order->payment_method == 'novalnet_cc') { + $enable_one_shop = variable_get($order->payment_method . '_enable_one_shop_clicking') == 1 ? TRUE : FALSE; + if ($order->uid != 0) { + $card_details = nn_variable_get(array('customer_id' => $order->uid), 'uc_novalnet_transaction', array('masked_acc_details'), array('is_ref_order' => '1'), array('paymentkey' => 6)); + if (!empty($card_details)) + $card_details = unserialize($card_details['masked_acc_details']); + } + $one_shop_cc_enabled = !empty($enable_one_shop) && !empty($card_details) ? 1 : 0; + if ($one_shop_cc_enabled && variable_get('novalnet_cc_cc3d') && variable_get('novalnet_cc_force_cc3d')) unset($data['create_payment_ref']); + } + /* Send the second street name on payment call, which is not empty */ + if (!empty($order->billing_street2)) + $data['street'] .= ' ' . $order->billing_street2; + /* Send the referer id on payment call, which is not empty */ + if (!empty($config_data['referrer_id'])) + $data['referer_id'] = $config_data['referrer_id']; +} + +/** + * + * Payment method callback function: zero amount booking params for server call + * + * @param array $data + * @param array $payment + * @param array $config_data + * @return boolean + */ +function uc_novalnet_zero_amount_booking(&$data, $payment, $config_data) { + if (isset($_SESSION['novalnet_session'][$payment]['zero_amount'])) + { + unset($_SESSION['novalnet_session'][$payment]['zero_amount']); + } + if (variable_get($payment . '_enable_one_shop_clicking') == 2 && in_array($payment, array('novalnet_cc', 'novalnet_sepa', 'novalnet_paypal'))) + { + $_SESSION['novalnet_session'][$payment]['zero_amount'] = $data['amount'] = 0; + } # add allowed payments + + return isset($_SESSION['novalnet_session'][$payment]['zero_amount']); + +} + +/** + * + * Payment method callback function: to complete Novalnet order purchase in shop + * + * @param array $parsed + * @param array $order + * @return none + */ +function uc_novalnet_completeorder($parsed = array(), $order = array()) { + global $language; + $config_data = basic_params(); + /* Supported payments for redirection payments */ + $redirection_array = array('novalnet_paypal', 'novalnet_ideal', 'novalnet_instantbank', 'novalnet_eps', 'novalnet_giropay', 'novalnet_przelewy24'); + $parsed['order_no'] = !empty($parsed['order_no']) ? $parsed['order_no'] : $parsed['inputval3'] ; + /* To check the payment status from the server reposnse */ + $status_message = uc_novalnet_check_status($parsed); + /* If order object is empty - load the order from order-number */ + if (empty($order)) $order = uc_order_load($parsed['order_no']); + $parsed['payment_method'] = $order->payment_method; + $redirect_test = $redirection_array; + if ($order->payment_method == 'novalnet_cc' && variable_get($order->payment_method . '_cc3d') == 1) { + $redirect_test[7] = 'novalnet_cc'; + } + if ($status_message != 'success') { + drupal_set_message(check_plain($status_message), 'error'); + watchdog('uc_novalnet', '
Payment Error: @error', array('@error' => $status_message), WATCHDOG_ERROR); + /* checking whether admin placed re-order */ + if (isset($_SESSION['cart_order'])) + drupal_goto('cart/checkout'); + else + drupal_goto('admin/store/orders/' . $parsed['order_no']); + } + + if ($parsed['payment_method'] == 'novalnet_cc' && isset($_SESSION['novalnet_session'][$order->payment_method])) unset($_SESSION['novalnet_session'][$order->payment_method]['nn_cc_hash'], $_SESSION['novalnet_session'][$order->payment_method][$order->payment_method . '_uniqueid']); + if (variable_get('novalnet_paypal_enable_one_shop_clicking') == 1 && isset($_SESSION['novalnet_session']['novalnet_paypal']['paypal_given_details']) && $_SESSION['novalnet_session']['novalnet_paypal']['paypal_given_details'] == 1) + unset($redirect_test[0]); + /* Checks the payment is redirection, if it is redirection payment which is allowed for check hash process and decoding the params from response */ + if (in_array($parsed['payment_method'], $redirect_test)) { + /* Check hash process - Using payment response and payment access key from the shop back-end */ + uc_novalnet_checkHash($parsed, $config_data['payment_access_key']); + /* Decoding process - Using payment response and payment access key from the shop back-end */ + uc_novalnet_decode_param($parsed); + } + /* form the payment comments to display in the order success page as well as for emails and invoices */ + $parsed['nn_comments'] = uc_novalnet_get_comments($parsed); + + if (isset($parsed['product_id'])) $parsed['product'] = $parsed['product_id']; + // Function to complete the order in shop + /* Set before order status for the Invoice, prepayment and paypal 90 */ + if (((in_array($parsed['payment_method'], array('novalnet_invoice', 'novalnet_prepayment', 'novalnet_cashpayment'))) && (!in_array($parsed['key'], array(40,41)) && ($parsed['tid_status'] == 100 ))) || ($parsed['tid_status'] == 90 && $parsed['payment_method'] == 'novalnet_paypal') || ($parsed['tid_status'] == 86 && $parsed['payment_method'] == 'novalnet_przelewy24')) { + $order->order_total = 0; + $order_status = variable_get($parsed['payment_method'] . '_before_status', 'Pending'); + + } else { + $order_status = variable_get($parsed['payment_method'] . '_after_status', 'completed'); + } + if (in_array($parsed['tid_status'], array('85', '91', '98', '99'))) { + $order_status = $config_data['onhold_transaction_status']; + } + /* Set order completion status */ + if(in_array($parsed['key'], array(40,41)) && ($parsed['tid_status'] == 75 )) $order_status = variable_get($parsed['payment_method'] . '_guarantee_before_status', 'completed'); + + + /* Updating the order comments */ + uc_order_comment_save($order->order_id, 0, $parsed['nn_comments'] , 'order', $order_status , 'TRUE'); + + /* Adding the line items in order history */ + uc_payment_enter($order->order_id, $parsed['payment_method'], $order->order_total, $order->uid, NULL, $parsed['nn_comments']); + + /* Updatig the order status */ + uc_order_update_status($order->order_id, $order_status); + + /* Cashpayment UI page generation*/ + if ($parsed['payment_method'] == 'novalnet_cashpayment' && $parsed['cp_checkout_token']) { + if ($parsed['test_mode'] == '1') { + $url = 'https://cdn.barzahlen.de/js/v2/checkout-sandbox.js'; + } else { + $url = 'https://cdn.barzahlen.de/js/v2/checkout.js'; + } + $checkout_token = $parsed['cp_checkout_token']; + $parsed['nn_comments'] .= ""; + } + + drupal_set_message($parsed['nn_comments']); + + /* To update the transaction in Novalnet transaction table */ + uc_novalnet_update_status($parsed); + + $_SESSION['do_complete'] = TRUE; + uc_novalnet_setsession(); + /* checking whether admin placed re-order or end-user - based on that return url differs */ + if (isset($_SESSION['cart_order'])) { + $_SESSION['uc_checkout'][$_SESSION['cart_order']]['do_complete'] = TRUE; + drupal_goto('cart/checkout/complete'); + } else + drupal_goto('admin/store/orders/' . $parsed['order_no']); +} + +/** + * + * Payment method callback function: For onhold product + * + * @param array $data + * @param int $order + * @return none + */ +function uc_novalnet_checklimit(&$data, $order) { + if(variable_get($order->payment_method. '_paymentoption') == 'capture') { + return TRUE; + } + // If the merchant have configure the manual check amount and the amount is lesser than order amount then add on_hold param. + if (variable_get($order->payment_method. '_paymentoption') == 'authorize' && $data['amount'] >= variable_get($order->payment_method . '_manualamount')) { + $data['on_hold'] = 1; + } +} + +/** + * + * Payment method callback function: To form the payment parameters + * + * Use this function to add specific params(Like implemetation, due_date etc.) for individual payments. + * + * @param array $data + * @param object $order + * @param int $key + * @return none + */ +function uc_novalnet_additional_params(&$data, $order, $key) { + global $base_url, $user; + $data['input3'] = 'order_id'; + $data['inputval3'] = $order->order_id; + switch ($order->payment_method) { + /* Adding payment params(hash, user_variable, unique id and encoded values) for redirect payments */ + case 'novalnet_cc': + /* CC 3d flas is enabled */ + if (variable_get('novalnet_cc_cc3d')) { + $data['cc_3d'] = 1; + $data['uniqid'] = randomStringHash(); + $data['implementation'] = 'ENC'; + uc_novalnet_encode_data($data); + $data['hash'] = uc_novalnet_create_hash($data); + $data['user_variable_0'] = $base_url; + } + if (empty($_SESSION['novalnet_session']['novalnet_cc']['ref'])) { + unset($data['payment_ref']); + } + break; + case 'novalnet_ideal': + case 'novalnet_eps': + case 'novalnet_giropay': + case 'novalnet_instantbank': + case 'novalnet_paypal': + case 'novalnet_przelewy24': + if (variable_get($order->payment_method . '_enable_one_shop_clicking') == 2) + $_SESSION['novalnet_session'][$order->payment_method]['request'] = serialize($data); + + $data['uniqid'] = randomStringHash(); + /* Formation of encoded params for redirect payments */ + uc_novalnet_encode_data($data); + $data['hash'] = uc_novalnet_create_hash($data); + $data['user_variable_0'] = $base_url; + $data['implementation'] = 'ENC'; + break; + /* Adding specific(iban, bank_account_holder) params for SEPA */ + case 'novalnet_sepa': + /* Fetch the sepa due date from the shop back-end */ + if (variable_get($order->payment_method . '_due_date') != '' && variable_get($order->payment_method . '_due_date') >= 2 && variable_get($order->payment_method . '_due_date') <= 14) { + $due_date = variable_get($order->payment_method . '_due_date'); + $data['sepa_due_date'] = date('Y-m-d', strtotime("+ $due_date day")); + } + if (empty($data['payment_ref'])) { + $data['bank_account_holder'] = isset($_SESSION['novalnet_session']['novalnet_sepa']['nnsepa_owner']) ? $_SESSION['novalnet_session']['novalnet_sepa']['nnsepa_owner'] : ''; + $data['iban'] = isset($_SESSION['novalnet_session']['novalnet_sepa']['nnsepa_iban']) ? $_SESSION['novalnet_session']['novalnet_sepa']['nnsepa_iban'] : ''; + } + break; + /* Adding specific(invoice_ref, invoice_type and due_date) params for Invoice */ + case 'novalnet_invoice': + $data['invoice_ref'] = "BNR-" . $data['product'] . "-" . $data['order_no']; + $data['invoice_type'] = 'INVOICE'; + $due_date = (variable_get($order->payment_method . '_due_date')=='')? 14 : variable_get($order->payment_method . '_due_date'); + $data['due_date'] = date('Y-m-d', strtotime("+ $due_date day")); + break; + /* Adding specific(invoice_ref, invoice_type) params for prepayment */ + case 'novalnet_prepayment': + $data['invoice_ref'] = "BNR-" . $data['product'] . "-" . $data['order_no']; + $data['invoice_type'] = 'PREPAYMENT'; + break; + case 'novalnet_cashpayment': + $due_date = (variable_get($order->payment_method . '_due_date')=='')? 14 : variable_get($order->payment_method . '_due_date'); + $data['cp_due_date'] = date('Y-m-d', strtotime("+ $due_date day")); + break; + } +} + +/** + * + * Payment method callback function: unique-id generation function + * + * @param none + * @return string + */ +function randomStringHash($length = 16) +{ + $randomArray = ['8','7','6','5','4','3','2','1','9','0','9','7','6','1','2','3','4','5','6','7','8','9','0']; + shuffle($randomArray); + return substr(implode($randomArray, ''), 0, $length); +} + +/** + * + * Payment method callback function: set encoded params for relevant payments + * + * @param array $data + * @param int $key + * @return none + */ +function uc_novalnet_encode_data(&$data) { + $encode_data = array(); + $encode_data = array('auth_code','product','tariff','amount','test_mode'); + foreach ($encode_data as $value) { + if (isset($data[$value])) { + $data[$value] = encrypt($data[$value], $data['uniqid']); + } + } +} + +/** + * @param array $input + * @param array $salt + * + * @return string + */ +function encrypt($input, $salt) +{ + $config_data = basic_params(); + // Return Encrypted Data. + return htmlentities(base64_encode(openssl_encrypt($input, "aes-256-cbc", $config_data['payment_access_key'], true, $salt))); +} + +/** + * + * Payment method callback function: Set decode params + * + * @param array $data + * @return none + */ +function uc_novalnet_decode_param(&$data) { + $params = array('auth_code','product','tariff','amount','test_mode'); + foreach ($params as $value) { + if (isset($data[$value])) { + $data[$value] = decrypt($data[$value], $data['uniqid']); + } + } +} + +/** + * @param array $input + * @param array $salt + * + * @return string + */ +function decrypt($input, $salt) +{ + $config_data = basic_params(); + // Return decrypted Data. + return openssl_decrypt(base64_decode($input), "aes-256-cbc", $config_data['payment_access_key'], true, $salt); +} + +/** + * + * Payment method callback function: hash generation + * + * @param array $data + * @return string + */ +function uc_novalnet_create_hash($data) { + $basic_data = basic_params(); + $hash_string = array('auth_code','product','tariff','amount','test_mode','uniqid'); + $string = ''; + foreach ($hash_string as $param) { + $string .= $data[$param]; + } + $string .= strrev($basic_data['payment_access_key']); + return hash('sha256', $string); +} + +/** + * + * Payment method callback function: to check the payment hash + * + * @param array $parsed + * @param int $key + * @return bool + */ +function uc_novalnet_checkHash($parsed, $key) { + /* Check the hash2 values with generated hash values */ + if ($parsed['hash2'] != uc_novalnet_create_hash($parsed)) { + drupal_set_message(t('While redirecting some data has been changed. The hash check failed.'), 'error'); + drupal_goto('cart/checkout'); + } +} + +/** + * + * Payment method callback function: to check the payment status + * + * @param array $response + * @return string + */ +function uc_novalnet_check_status($response) { + /* Check the status i.e. recieved form the response */ + if (isset($response['status'])) { + if ($response['status'] == 100 || ($response['status'] == 90 && $response['payment_method'] == 'novalnet_paypal')) return 'success'; + elseif (isset($response['status_text'])) return $response['status_text']; + elseif (isset($response['status_desc'])) return $response['status_desc']; + elseif (isset($response['novaltel_status_message'])) return $response['novaltel_status_message']; + elseif (isset($response['status_message'])) { + if ($response['status'] == '0529006') { + $_SESSION['novalnet_error_payment'] = array($response['payment_method'] => array('error_time' => time())); + } + return $response['status_message']; + } + } /* Check the pin status */ + elseif (isset($response['pin_status'])) + return $response['pin_status']['status_message']; +} + +/** + * + * Payment method callback function: to append the payment comments in order success page, mail and invoices + * + * @param array $data + * @param object $new_order + * @param array $tid_details + * @return string $comment + */ +function uc_novalnet_get_comments($data, $new_order='', $tid_details='') { + /* Checking the test mode from the response */ + $test_mode = ($data['test_mode'] == 1) ? t('Test order') : ''; + /* Load the payment array using payment response */ + $payment = uc_novalnet_payment_methods($data['payment_method']); + if (!empty($tid_details)) { + $data['invoice_ref'] = "BNR-" . $tid_details['product_id'] . "-" . $tid_details['order_id']; + } + /* Check if it is a new order generated for recurring, from the callback-script */ + if (!empty($new_order)) { + /* Get the Basic parameters */ + $basic_data = basic_params(); + $data['order_no'] = $new_order->order_id; + $data['amount'] = $data['amount']/100; + $data['invoice_ref'] = "BNR-" . $basic_data['product_id'] . "-" . $data['order_no']; + } + $comment = ''; + if (!empty($data['payment_id']) && in_array($data['payment_id'], [41,40]) && in_array($data['tid_status'], [75,100])) { + $comment .= t('This is processed as a guarantee payment'). '
'; + } + + $comment .= $payment['name'] . '
' . strip_tags(t('Novalnet transaction ID%s', array('%s' => ':'))) . ' ' . '' . $data['tid'] . '
' . $test_mode . '
'; + + /* Comments formation for Invoice and Prepayment */ + if (in_array($data['payment_method'], array('novalnet_invoice', 'novalnet_prepayment')) || (!empty($data['invoice_det']))) { + + if ($data['tid_status'] == '75') { + $comment .= t('Your order is under verification and once confirmed, we will send you our bank details to where the order amount should be transferred. Please note that this may take upto 24 hours.'). '
'; + } + /* To remove the account details from the invoice mail after full amount paid to Novalnet */ + $nn_prepayment_comments = ($data['payment_method'] == 'novalnet_prepayment') ? '
' : ''; + if ($data['tid_status'] != '75') { + $comment .= $nn_prepayment_comments . t('Please transfer the amount to the below mentioned account details of our payment processor Novalnet') . '
'; + $comment .= t('Due date: @due_date', array('@due_date' => $data['due_date'])) . '
' . + t('Account holder: @comp', array('@comp' => $data['invoice_account_holder'])) . '
' . + t('IBAN: @invoice_iban', array('@invoice_iban' => $data['invoice_iban'])) . '
' . + t('BIC: @invoice_bic', array('@invoice_bic' => $data['invoice_bic'])) . '
' . + t('Bank: @bank', array('@bank' => $data['invoice_bankname'] . ' ' . $data['invoice_bankplace'])) . '
' . + t('Amount: @amount', array('@amount' => uc_currency_format($data['amount']))) . '
'; + /* Checking the new order flag */ + if (empty($new_order)) + $comment .= t('Please use any one of the following references as the payment reference, as only through this way your payment is matched and assigned to the order:') . '
'; + $comment .= t("Payment Reference 1") . ': ' . $data['invoice_ref'] . '
'; + $comment .= t("Payment Reference 2") . ': ' . t('TID') . ' ' . $data['tid'] . '
'; + } + } + + if ($data['payment_method'] == 'novalnet_cashpayment') { + $novalnet_slip_expiry_date = ($data['cp_due_date']) ? $data['cp_due_date'] : $novalnet_slip_expiry_date; + if ($novalnet_slip_expiry_date) { + $comment .= t('Slip expiry date') . ': ' . (($data['lang'] == 'EN') ? date('d M Y', strtotime($novalnet_slip_expiry_date)) : date('d.m.Y', strtotime($novalnet_slip_expiry_date))) . '
'; + } + $comment .= '
' . t('Store(s) near you') . '
'; + $nearest_storecounts = 1; + foreach ($data as $key => $value) { + if (strpos($key, 'nearest_store_title') !== FALSE) { + $nearest_storecounts++; + } + } + for ($i = 1; $i < $nearest_storecounts; $i++) { + $comment .= $data['nearest_store_title_' . $i] . '
'; + $comment .= $data['nearest_store_street_' . $i] . '
'; + $comment .= $data['nearest_store_city_' . $i] . '
'; + $comment .= $data['nearest_store_zipcode_' . $i] . '
'; + $comment .= $data['nearest_store_country_' . $i] . '
' . '
'; + } + } + + if (!empty($data['payment_id']) && $data['payment_id'] == 40 && $data['tid_status'] == '75') { + $comment .= t('Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.'). '
'; + } + return $comment; +} + +/** + * + * Payment method callback function: To update the transaction status in Novalnet(uc_novalnet_transaction) table. + * + * @param array $data + * @return none + */ +function uc_novalnet_update_status($data) { + /* Get the Basic parameters */ + $basic_data = basic_params(); + /* fetching the original transaction details from uc_novalnet_transaction table */ + $transaction_details = $data; + if (empty($data)) return $transaction_details; + /* Load the order object */ + $order = uc_order_load($data['order_no']); + $reference_order = 0; + /* Setting the flag for referenced transaction */ + if (!empty($data['payment_id']) && in_array( $data['payment_id'], array( 6, 37, 40, 34, 41))) + $reference_order = (empty($data['payment_ref']) && variable_get($data['payment_method'] . '_enable_one_shop_clicking') == 1 && !empty($data['create_payment_ref'])) ? 1 : 0; + /* Get the payment request from the session */ + $request = !empty($_SESSION['novalnet_session'][$data['payment_method']]['request']) ? $_SESSION['novalnet_session'][$data['payment_method']]['request'] : ''; + + /* Get the payment response from the session, during the procees of fraud preventions */ + if (!empty($_SESSION['novalnet_session'][$data['payment_method']]['masked_acc_details'])) + $transaction_details = $_SESSION['novalnet_session'][$data['payment_method']]['masked_acc_details']; + /* Unset the pan_hash from the response */ + if (isset($transaction_details['pan_hash'])) unset($transaction_details['pan_hash']); + + /* Based on the server response amount updation in novalnet transaction table */ + $amount = ( isset($transaction_details['key']) && (in_array($transaction_details['key'], array(49, 50, 33, 34, 69, 78)) || ($transaction_details['key'] == 6 && (variable_get('novalnet_cc_cc3d') || variable_get('novalnet_cc_force_cc3d'))))) ? $transaction_details['amount'] : round($transaction_details['amount'], 2) * 100; + $amount = empty($amount) ? 0 : $amount; + /* Update the transactions in Novalnet transaction (uc_novalnet_transaction) table */ + $update_data = array('tid' => $data['tid'], 'status' => $transaction_details['tid_status'], 'key' => $data['key'], 'amount' => $amount, 'request' => $request, 'masked_acc_details' => serialize($transaction_details), 'customer_id' => $order->uid, 'is_ref_order' => $reference_order, 'callback_total' => $amount); + + /* Unset the Novalnet payment session */ + unset($_SESSION['novalnet_session'][$data['payment_method']]); + foreach (array('vendor_id', 'auth_code', 'product_id', 'tariff_id') as $key) { + $update_data[$key] = $basic_data[$key]; + } + /* Update the due date in Novalnet transaction */ + $update_data['due_date'] = ($data['key'] == 27 || $data['key'] == 41) ? date('Y-m-d H:i:s', strtotime($data['due_date'])) : date('Y-m-d H:i:s') ; + + /* update the transaction details in novalnet transaction (uc_novalnet_transaction) table */ + update_variable(array('order_id' => $data['order_no']), $update_data, 'uc_novalnet_transaction'); + + /* update the transaction with affiliate, if it is activated */ + if (!empty($_SESSION['nn']['nn_aff_id'])) { + if (!empty($_SESSION['nn']['update'])) { + update_variable(array('aff_id' => $_SESSION['nn']['nn_aff_id']), array('aff_id' => $_SESSION['nn']['nn_aff_id'], 'customer_id' => $order->uid, 'aff_order_no' => $data['order_no']), 'nn_aff_user_detail'); + } + unset($_SESSION['nn']); + } +} + +/** + * + * Payment method callback function: to save the transaction details made from the shop + * @param string $order_id + * @param array $data + * @param string $type + * @return none + */ +function uc_novalnet_save_log($order_id, $data, $type) { + /* Stores the payment request in novalnet logs*/ + if ($type == 'request' && isset($data['key'])) { + /* Updating the pan hash as masked */ + if (!empty($data['pan_hash']) && !empty($data['unique_id'])) { + unset($data['unique_id'], $data['pan_hash']); + } + } + /* Stores the payment response in novalnet logs*/ + if ($type == 'response' && !is_array($data)) { + parse_str($data, $raw_data); + $data = $raw_data; + } + $db_data = array( + 'id' => '', + 'order_id' => $order_id, + 'logtype' => $type, + 'logvalue' => serialize($data), + 'logtime' => date('d.m.Y H:i:s ') + ); + drupal_write_record('uc_novalnet_logs', $db_data); +} + +/** + * + * Payment method callback function: request to the payment server + * + * @param array $request + * @param string $type (is curl or xml) + * @param string $order_no + * @return array | string + */ +function uc_novalnet_send_payport($request, $type = '', $order_no = '') { + if (array_search('', array_map('trim', $request)) && $type != 'curl') { + drupal_set_message(t('Required param missing!'), 'error'); + return FALSE; + } + /* To save the request log */ + uc_novalnet_save_log((!empty($request['order_no']) ? $request['order_no'] : $order_no), $request, 'request'); + /* Process the Curl request */ + if ($type == 'curl') { + $xml = http_build_query($request, '', '&'); + $host = uc_novalnet_get_url('nncurl_request'); + } + /* Process the xml request */ + else { + $xml = " + + "; + foreach ($request as $tag => $val) { + $xml .= "<" . $tag . ">" . $val . ""; + } + $xml .= " + "; + $host = uc_novalnet_get_url('nnxml_request'); + } + $options = array( + 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'), + 'method' => 'POST', + 'data' => $xml, + ); + + $global_setting = variable_get('novalnet_params', ''); + + if (!empty($global_setting['gateway_timeout'])) { + $options['timeout'] = $global_setting['gateway_timeout']; + } + + $response = drupal_http_request($host, $options); + $result = (($type == 'curl') ? (isset($response->data) ? $response->data : 'status=408&status_desc=Payment was not successful. An error occurred.') : (isset($response->data) ? json_decode(json_encode(simplexml_load_string($response->data)), TRUE) : 'status=408&status_desc=Payment was not successful. An error occurred.')); + uc_novalnet_save_log((!empty($request['order_no']) ? $request['order_no'] : $order_no), $result, 'response'); + return $result; +} + +/** + * + * Payment method callback function: to maintain payment information in session, while using fraud prevention + * + * @param object $order + * @return string + */ +function uc_novalnet_storervalues( $order ) { + $payment = $order->payment_method; + $basic_data = basic_params(); + /* To get enabled fraud prevention method */ + $fraud_method = variable_get($payment . '_pin_method', ''); + if ($fraud_method && isset($_SESSION['novalnet_session'][$payment][$payment . '_pinkey'])) { + $data = array(); + /* Load the payment call params */ + uc_novalnet_getparams($data, $order); + /* Check the TID is stored in payment session */ + if (!isset($_SESSION['novalnet_session'][$payment]['tid'])) { + if (variable_get($payment . '_pin_method')) { + $fraud_array = array( 'callback' => array('pin_by_callback', 'tel'), + 'sms' => array('pin_by_sms', 'mobile')); + $data[$fraud_array[$fraud_method][0]] = 1; + $data[$fraud_array[$fraud_method][1]] = $_SESSION['novalnet_session'][$payment][$payment . '_pinkey']; + } + /* Checks the stored order amount is grater than order total */ + if (variable_get($payment . '_pin_amount', '') && sprintf('%0.2f', $order->order_total) * 100 < variable_get($payment . '_pin_amount')) { + drupal_set_message(t('The order amount has been changed, please proceed with the new order'), 'error'); + drupal_goto('cart/checkout'); + } + /* Send the payment params to Novalnet payport */ + $response = uc_novalnet_send_payport($data, 'curl'); + parse_str($response, $parsed); + /* Store the response from the first call */ + $_SESSION['novalnet_session'][$payment]['masked_acc_details'] = $parsed; + /* To check the Transaction status form the response */ + $status_message = uc_novalnet_check_status($parsed); + if ($status_message != 'success') { + drupal_set_message(check_plain($status_message), 'error'); + watchdog('uc_novalnet', '
Payment Error: @error', array('@error' => $status_message), WATCHDOG_ERROR); + uc_novalnet_setsession($payment); + } + else { + /* store the payment details in session for first call response during the fraud check*/ + $session_array = array('tid' => $parsed['tid'], 'amount' => $parsed['amount'], 'test_mode' => $parsed['test_mode']); + if ($payment == 'novalnet_invoice') + $session_array = array_merge($session_array, array('invoice_bankcode' => $parsed['invoice_bankcode'], + 'invoice_iban' => $parsed['invoice_iban'], + 'invoice_ref' => "BNR-" . $basic_data['product_id'] . "-" . $parsed['order_no'], + 'due_date' => $parsed['due_date'], + 'invoice_bic' => $parsed['invoice_bic'], + 'invoice_bankname' => $parsed['invoice_bankname'], + 'invoice_bankplace' => $parsed['invoice_bankplace'])); + $message_array = array('callback' => t('You will shortly receive a transaction PIN through phone call to complete the payment'), + 'sms' => t('You will shortly receive an SMS containing your transaction PIN to complete the payment'), + ); + /* Store the session values in Novalnet session */ + uc_novalnet_setsession($payment, $session_array); + drupal_set_message(check_plain($message_array[$fraud_method]), 'warning'); + } + drupal_goto('cart/checkout'); + } else{ + if (!empty($_SESSION['novalnet_session'][$payment]['forget_pin']) && $_SESSION['novalnet_session'][$payment]['forget_pin']) { + /* Processed with forget pin */ + $parsed = uc_novalnet_send_payport(array( + 'vendor_id' => $data['vendor'], + 'vendor_authcode' => $data['auth_code'], + 'tid' => $_SESSION['novalnet_session'][$payment]['tid'], + 'lang' => $data['lang'], + 'request_type' => 'TRANSMIT_PIN_AGAIN' + ), '', $data['order_no']); + $msg = !empty($parsed['status_message']) ? $parsed['status_message'] : $parsed['status_desc']; + if ($parsed['status'] == '0529008' ) { + unset($_SESSION['novalnet_session'][$order->payment_method]); + } + drupal_set_message(check_plain($msg), 'warning'); + drupal_goto('cart/checkout'); + } + } + } + /* To unset the entire payment session */ + if (!isset($_SESSION['novalnet_session'][$payment])) uc_novalnet_setsession(); + else uc_novalnet_setsession($payment, $_SESSION['novalnet_session'][$payment], TRUE); +} + +/** + * + * Payment method callback function: to store the session details and also to unset them payment wise. + * + * @param string $payment + * @param array $values + * @param boolean $reset + * @return none + */ +function uc_novalnet_setsession($payment = '' , $values = array(), $reset = FALSE) { + /* Unset the entire Novalnet session when the flag is enabled($reset == TRUE) OR Payment is passed as empty */ + if ((isset($_SESSION['novalnet_session']) && empty($payment)) || $reset) unset($_SESSION['novalnet_session']); + /* Adding the values($values) into payment session array, if the values are not not empty */ + if (!empty($values)) { + $_SESSION['novalnet_session'][$payment] = isset($_SESSION['novalnet_session'][$payment]) ? array_merge( $_SESSION['novalnet_session'][$payment], $values) : $values; + } +} + +/** + * + * Payment method callback function: to update the callback amount + * + * @param object $order + * @param string $messages + * @param string $due_date + * @return string + */ +function callback_amt_update($order, $messages, $due_date='') { + /* $updated_data - Fetch the due_date from uc_novalnet_transaction table */ + $updated_data = nn_variable_get(array('order_id' => $order->order_id), 'uc_novalnet_transaction'); + /* Fetch the Previous order comments from the receipts to rebill the transaction */ + $result = nn_variable_get(array('order_id' => $order->order_id), 'uc_payment_receipts', array('comment')); + if (in_array($order->payment_method, array('novalnet_sepa', 'novalnet_cc', 'novalnet_paypal'))) + $result['comment'] = preg_replace('|(.+?)|s', $updated_data['tid'], $result['comment']); + + /* Update the order amount and due date during the extension(amount update / due date update) process */ + if (in_array($order->payment_method, array('novalnet_invoice', 'novalnet_prepayment'))) { + $due_date = !empty($due_date) ? date('m/d/Y', strtotime($due_date)) : date('m/d/Y', strtotime($updated_data['due_date'])); + $result['comment'] = preg_replace("/\d{2}\/\d{2}\/\d{4}/", $due_date , $result['comment']); + update_variable(array('order_id' => $order->order_id), array('comment' => $result['comment']), 'uc_payment_receipts'); + /* To update the due date in novalnet transaction table */ + update_variable(array('order_id' => $order->order_id), array('due_date' => date('Y-m-d H:i:s', strtotime($due_date))), 'uc_novalnet_transaction'); + if (!empty($_SESSION['novalnet_session'][$order->payment_method]['updated_amount'])) + $result['comment'] = preg_replace('|(.+?)|s', '' . t('Amount : @amount', array('@amount' => uc_currency_format($_SESSION['novalnet_session'][$order->payment_method]['updated_amount']))) . '' , $result['comment']); + } + update_variable(array('order_id' => $order->order_id), array('comment' => $result['comment']), 'uc_payment_receipts'); + $value = $result['comment'] . "
"; + return $messages; +} + +/** + * + * Payment method callback function: to update the columns in payment table + * + * @param array $condition + * @param array $data + * @param string $table + * @return none + */ +function update_variable($condition, $data, $table) { + /* If counter value is less than 3 Update the values($data - array) in table($table = table_name) using the condition($condition = condition) */ + if (count($data) <= 3) + db_update($table)->fields($data)->condition(key($condition), current($condition))->execute(); + /* else block - write the records into the table */ + else { + if ($table == 'uc_novalnet_transaction') { + $data['order_id'] = current($condition); + $data['paymentkey'] = $data['key']; unset($data['key']); + } + db_insert($table)->fields($data)->execute(); + } +} + +/** + * + * Payment method callback function: to fetch the columns from Tables + * + * $id - Primary condition + * + * $table - Table to select + * + * $column - Column to be fetched from the table + * + * $condition - Based on the condition the values to be fetched + * + * $condition2 - Based on the condition the values to be fetched + * + * @param array $id + * @param string $table + * @param string $column + * @param string $condition + * @param string $condition2 + * @return array + */ +function nn_variable_get($id, $table, $column = array(), $condition = '', $condition2 = '') { + /* If the column passed as empty - it will fetch all the columns based on the condition($id) */ + if (empty($column)) + return db_select($table, 'nn') + ->fields('nn') + ->condition(key($id), current($id)) + ->execute() + ->fetchAssoc(); + elseif (!empty($condition) && empty($condition2)) + return db_select($table, 'nn') + ->fields('nn', $column) + ->condition(key($id), current($id)) + ->condition(key($condition), current($condition)) + ->orderBy('order_id', 'DESC') + ->execute() + ->fetchAssoc(); + elseif (!empty($condition2)) + return db_select($table, 'nn') + ->fields('nn', $column) + ->condition(key($id), current($id)) + ->condition(key($condition), current($condition)) + ->condition(key($condition2), current($condition2)) + ->orderBy('order_id', 'DESC') + ->execute() + ->fetchAssoc(); + elseif ($table == 'uc_novalnet_cancel' && in_array('ref_orders', $column)) + return db_select($table, 'nn') + ->fields('nn', $column) + ->condition(key($id), current($id)) + ->execute() + ->fetchcol(); + else + return db_select($table, 'nn') + ->fields('nn', $column) + ->condition(key($id), current($id)) + ->orderBy('order_id', 'DESC') + ->execute() + ->fetchAssoc(); +} + +/** + * + * Implements hook_init(). + * + * @params none + * @return none + */ +function uc_novalnet_init() { + + if (!empty($_POST['tid']) && empty($_SESSION['nn']) && empty($_POST['sess_lost']) + && !preg_match("/callback_novalnet2ubercart/i", current_path())) { + $_POST['sess_lost'] = 1; + $return_url = url(current_path(), array('absolute' => TRUE)); + $params = drupal_http_build_query($_POST); + drupal_goto($return_url.'?'.$params); + } + + /* Checking th drupal front page for affiliate process */ + if (drupal_is_front_page()) { + $request = $_REQUEST; + if (!empty($request['nn_aff_id'])) { + $_SESSION['nn']['nn_aff_id'] = $request['nn_aff_id']; + $_SESSION['nn']['update'] = TRUE; + } + else { + global $user; + /* Get the current logged user details from Novalnet affiliate (nn_aff_user_detail) table */ + $aff_details = nn_variable_get(array('customer_id' => $user->uid), 'nn_aff_user_detail'); + if (!empty($aff_details['aff_id'])) { + $_SESSION['nn']['nn_aff_id'] = $aff_details['aff_id']; + $_SESSION['nn']['update'] = TRUE; + } + } + } +} + +/** + * + * Payment method callback function : to fetch the basic params + * + * @params none + * @return array + */ +function basic_params($stored_tid = '') { + /* Get the transaction details using TID */ + if ($stored_tid) { + return nn_variable_get(array('tid' => $stored_tid), 'uc_novalnet_transaction'); + } + else { + /* Get the Novalnet params from back-end */ + $basic_params = variable_get('novalnet_params', ''); + /* Get the affiliate details from the affiliate (nn_aff_account_detail) table if affiliate id present */ + if (!empty($_SESSION['nn']['nn_aff_id'])) { + $aff_details = nn_variable_get(array('aff_id' => $_SESSION['nn']['nn_aff_id']), 'nn_aff_account_detail'); + $basic_params['vendor_id'] = $aff_details['aff_id']; + $basic_params['auth_code'] = $aff_details['aff_authcode']; + $basic_params['payment_access_key'] = $aff_details['aff_accesskey']; + } + } + return $basic_params; +} + +/** + * + * Payment method validate function: to validate the Direct Debit SEPA duedate + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_element_validate_duedate($element, &$form_state) { + $payment = $form_state['build_info']['args'][0]; + $element_value = trim($element['#value']); + if ($payment != 'novalnet_sepa') return TRUE; + + if ($element_value != '') { + if (!preg_match("/^[0-9]+$/", $element_value) || $element_value < 2 || $element_value > 14) { + $errormsg = t('SEPA Due date is not valid'); + form_error($element, check_plain($errormsg)); + } + } +} + +/** + * + * Payment method callback function: to store the session values for Direct Debit SEPA + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_nnpaypalform_validate($element, &$form_state) { + /* if form bulids from the shop front-end, got different form state values */ + if (!empty($form_state['values']['panes']['payment']['details'])) { + $form_values = $form_state['values']['panes']['payment']['details']; + $payment = $form_state['values']['panes']['payment']['payment_method']; + }/* Form bulids from the admin reorder */ + else { + $form_values = $form_state['input']; + $payment = $form_values['payment_method']; + } + if ($payment != 'novalnet_paypal') return TRUE; + uc_novalnet_setsession($payment, array( + 'paypal_given_details' => $form_values['paypal_given_details'], + )); + if ((!empty($form_values['one_shop_paypal_enabled']) && $form_values['one_shop_paypal_enabled'] == 1) && variable_get($payment . '_enable_one_shop_clicking', 0) == 1 && (!empty($form_values['paypal_given_details']) && $form_values['paypal_given_details'] == 1)) { + + uc_novalnet_setsession($payment, array( + 'ref' => 1, + 'one_shop_paypal_enabled' => $form_values['one_shop_paypal_enabled'], + )); + return TRUE; + } +} + +/** + * + * Payment method callback function: to store the form values in session for Credit Card + * + * $payment - To get the current payment name + * + * $form_values - array that contains the form values for the current payment + * + * @param array $element + * @param array $form_state + * @return mixed + */ +function uc_novalnet_nnccform_validation($element, &$form_state) { + /* if form bulids from the shop front-end, got different form state values */ + if (!empty($form_state['values']['panes']['payment']['details'])) { + $form_values = $form_state['values']['panes']['payment']['details']; + $payment = $form_state['values']['panes']['payment']['payment_method']; + } + /* Form bulids from the admin reorder */ + else { + $form_values = $form_state['input']; + $payment = $form_values['payment_method']; + } + if ($payment != 'novalnet_cc') return TRUE; + if ($form_values['nn_cc_hash'] != '') { + uc_novalnet_setsession($payment, array( + 'nn_cc_hash' => trim($form_values['nn_cc_hash']), + 'novalnet_cc_uniqueid' => trim($form_values[$payment . '_uniqueid']), + )); + } + return TRUE; +} + +/** + * + * Payment method callback function: to store the form values in session for Credit Card + * + * $payment - To get the current payment name + * + * $form_values - array that contains the form values for the current payment + * + * @param array $element + * @param array $form_state + * @return mixed + */ +function uc_novalnet_nnccform_validate($element, &$form_state) { + /* if form bulids from the shop front-end, got different form state values */ + if (!empty($form_state['values']['panes']['payment']['details'])) { + $form_values = $form_state['values']['panes']['payment']['details']; + $payment = $form_state['values']['panes']['payment']['payment_method']; + }/* Form bulids from the admin reorder */ + else { + $form_values = $form_state['input']; + $payment = $form_values['payment_method']; + } + if ($payment != 'novalnet_cc') return TRUE; + + + uc_novalnet_setsession($payment, array( + 'one_shop_cc_enabled' => !empty($form_values['one_shop_cc_enabled']) ? $form_values['one_shop_cc_enabled'] : '', + )); + + /* Store the form value and set the payment ref flag as TRUE, if one step shopping enabled */ + if ((!empty($form_values['one_shop_cc_enabled']) && $form_values['one_shop_cc_enabled'] == 1) && variable_get($payment . '_enable_one_shop_clicking', 0) == 1 && (!empty($form_values['one_page_shopping']) && $form_values['one_page_shopping'] == 1) && (empty($form_values['nn_cc_hash']) && empty($form_values['novalnet_cc_uniqueid']))) { + uc_novalnet_setsession($payment, array('ref' => 1, 'form_type' => 1)); + return TRUE; + } +} + +/** + * + * Payment method callback function: to store the session values for Direct Debit SEPA + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_nnsepaform_validate($element, &$form_state) { + + /* if form bulids from the shop front-end, got differnt form values */ + if (!empty($form_state['values']['panes']['payment']['details'])) { + $form_values = $form_state['values']['panes']['payment']['details']; + $payment = $form_state['values']['panes']['payment']['payment_method']; + } /* Form bulids from the admin reorder */ + else { + $form_values = $form_state['input']; + $payment = $form_values['payment_method']; + } + + if ($payment != 'novalnet_sepa') return TRUE; + /* Set the flag for reference order, if the payment is done through previous account details*/ + if ((!empty($form_values['one_shop_sepa_enabled']) && $form_values['one_shop_sepa_enabled'] == 1) && empty($form_values['sepa_given_details'])) { + uc_novalnet_setsession($payment, array( + 'ref' => 1, + 'form_type' => 0 + )); + return TRUE; + } + /* organise the session values for sepa payment - with local form */ + if (!empty($form_values['nnsepa_iban']) ) { + uc_novalnet_setsession($payment, array( + 'nnsepa_owner' => trim($form_values['nnsepa_owner']), + 'nnsepa_iban' => trim($form_values['nnsepa_iban']), + 'form_type' => 1 + )); + } +} + +/** + * + * Back end validation for payment references: + * + * @param array $element + * @param array $form_state + * @return none + */ +function payment_gurantee_validation($element, &$form_state) { + $gurantee_validate = $form_state['values']; + $payment = $form_state['build_info']['args'][0]; + +/* validate the payment reference - atleast one reference should enabled in the shop back-end */ + if (!empty($gurantee_validate[$payment . '_payment_guarantee_check'])) { + if (!empty($gurantee_validate[$payment . '_minimum_payment_guarantee_check']) && $gurantee_validate[$payment . '_minimum_payment_guarantee_check'] < '999') { + form_error($element, check_plain(t('The minimum amount should be at least 9,99 EUR'))); + return ; + } + } +} + +/** + * + * Payment method validate function: to validate the email address + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_element_validate_email($element, &$form_state) { + $emails = explode(',', $element['#value']); + foreach ($emails as $email) { + if (($form_state['values']['cbk_mail_send'] == 0) && !valid_email_address($email)) { + $errormsg = $element['#title'] . ' ' . t('is invalid'); + form_error($element, check_plain($errormsg)); + } + } +} + +/** + * + * Payment method validate function: for birthdate + * + * @param array $element + * @param array $form_state + * @return none + */ +function uc_novalnet_element_validate_birth_date($element, &$form_state) { + /* if form bulids from the shop front-end, got differnt form values */ + if (!empty($form_state['values']['panes']['payment']['details'])) { + $form_values = $form_state['values']['panes']['payment']['details']; + $payment = $form_state['values']['panes']['payment']['payment_method']; + $dob = $element['#value']['year'] . '-' . $element['#value']['month'] . '-' . $element['#value']['day']; + $birth_date = $dob; + } /* Form bulids from the admin reorder */ + else { + $form_values = $form_state['input']; + $payment = $form_values['payment_method']; + $dob = $form_values['birth_date']['year'] . '-' . $form_values['birth_date']['month'] . '-' . $form_values['birth_date']['day']; + $birth_date = $dob; + } + if (!empty($dob)) { + /* To get the age details from the user input */ + $dob = (time() - strtotime($dob))/31536000; + uc_novalnet_setsession($payment, array($payment . '_birth_date' => $birth_date)); + + } +} + +/** + * + * Function to add birth date and payment keys for guaranteed payments. + * + * @param array data + * @param string payment + * @return none + */ +function uc_novalnet_check_guarantee_payments(&$data, $order) { + $gurantee_implements = ''; + $billing_country = uc_get_country_data(array('country_id' => $order->billing_country)); + $delivery_address = array($order->delivery_street1, $order->delivery_street2, $order->delivery_city, $order->delivery_postal_code, $order->delivery_country); + $billing_address = array($order->billing_street1, $order->billing_street2, $order->billing_city, $order->billing_postal_code, $order->billing_country); + $birth_date = isset($_SESSION['novalnet_session'][$order->payment_method][$order->payment_method . '_birth_date']) ? $_SESSION['novalnet_session'][$order->payment_method][$order->payment_method . '_birth_date'] : ''; + $min_amount = variable_get($order->payment_method . '_minimum_payment_guarantee_check') ? variable_get($order->payment_method . '_minimum_payment_guarantee_check') : 999; + $order_amt = $order->order_total * 100; + $dob = (time() - strtotime($birth_date))/31536000; + + echo $birth_date.'/'.$dob; + if (in_array($billing_country[0]['country_iso_code_2'], array('AT', 'DE', 'CH')) && (($order_amt >= $min_amount) && $order->currency == 'EUR') && ($delivery_address === $billing_address) && ($dob > 18 || !empty($order->billing_company))) { + + /* Get the payment key for the guaranteed payment */ + $key = uc_novalnet_payment_methods($order->payment_method); + $data['key'] = $key['guarantee_key']; + if(!empty($order->billing_company)) $data['company'] = $order->billing_company; + else $data['birth_date'] = $birth_date; + $gurantee_implements = 'gurantee'; + } + $_SESSION['novalnet_session'][$order->payment_method]['gurantee'] = $gurantee_implements; +} + +/** + * + * Function to get original transaction amount + * + * @param array tid_details + * @param integer amount + * @param boolean $get_amount + * @return array + */ +function uc_novalnet_get_original_amount($tid_details = array(''), $amount = '', $get_amount = FALSE) { + $original_amount = unserialize($tid_details['masked_acc_details']); + if ($get_amount) { + return empty($original_amount['original_amount']) ? $tid_details['callback_total'] : $original_amount['original_amount'] ; + } + $original_amount['original_amount'] = $amount; + return serialize($original_amount); +} + +/** + * + * Function to hide the novalnet payments in shop front-end (used for pin exceeds and guarantee payments) + * + * @param array $payment_array (referenced) + * @return boolean + */ +function uc_novalnet_unset_payment(&$payment_array) { + if (isset($_SESSION['novalnet_error_payment']) && arg(0) != 'admin') { + foreach (array_keys($_SESSION['novalnet_error_payment']) as $key) { + if (isset($_SESSION['novalnet_error_payment'][$key]['error_time']) && $_SESSION['novalnet_error_payment'][$key]['error_time'] + 30*60 > time()) + unset($payment_array[$key]); + elseif (!empty($_SESSION['novalnet_error_payment'][$key]['guarantee_check'])) + unset($payment_array[$key]); + else { + unset($_SESSION['novalnet_error_payment'][$key]); + } + } + } +} diff --git a/includes/uc_novalnet_admin.inc b/includes/uc_novalnet_admin.inc new file mode 100644 index 0000000..e5f4622 --- /dev/null +++ b/includes/uc_novalnet_admin.inc @@ -0,0 +1,568 @@ + 'Review payment', + 'page callback' => 'uc_novalnet_nnpayment_complete', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + 'file' => 'includes/uc_novalnet.inc', + ); + /* Menu callback for callback script */ + $items['callback_novalnet2ubercart'] = array( + 'title' => 'callbackscript', + 'page callback' => 'uc_novalnet_callbackscript', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + 'file' => 'includes/uc_novalnet_page.inc', + ); + /* Novalnet menu creation for configuring the global configuration and fetch the Novalnet orders */ + $items['admin/novalnet'] = array( + 'title' => 'Novalnet', + 'menu_name' => 'management', + 'description' => 'Novalnet' . ' ' . t('Configuration'), + 'page callback' => 'system_admin_menu_block_page', + 'access arguments' => array('administer site configuration'), + 'file' => 'system.admin.inc', + 'file path' => drupal_get_path('module', 'system'), + ); + /* Menu callback Novalnet global configuration ( Novalnet -> Novalnet Global Configuration ) */ + $items['admin/novalnet/globalconfig'] = array( + 'title callback' => 'uc_novalnet_global_config_title', + 'title arguments' => array('Novalnet Global Configuration'), + 'weight' => 2, + 'page callback' => 'drupal_get_form', + 'page arguments' => array('uc_novalnet_global_config_form'), + 'access arguments' => array('administer site configuration'), + 'file' => 'uc_novalnet.module' + ); + /* Menu callback for vendor details refil ( Novalnet -> Novalnet Global Configuration ) */ + $items['admin/novalnet/autofill_paymentdata'] = array( + 'title' => t('payment_data_config'), + 'file' => 'includes/uc_novalnet_form.inc', + 'type' => MENU_CALLBACK, + 'page callback' => 'uc_novalnet_publickey_submit', + 'access arguments' => array('access content'), + ); + /* Menu callback for Novalnet orders ( Novalnet -> Novalnet orders ) */ + $items['admin/novalnet/novalnet_orders'] = array( + 'title' => 'Novalnet' . ' ' . t('Orders'), + 'page callback' => 'drupal_goto', + 'access arguments' => array('Extension'), + 'page arguments' => array('admin/store/novalnet_orders/view'), + 'weight' => -99 + ); + /* Menu callback for log the Novalnet transaction details @ request and @ responses */ + $items['admin/novalnet/novalnet_orders/%uc_order/novalnet_log'] = array( + 'title' => 'Novalnet Transaction Log', + 'page callback' => 'uc_novalnet_payment_logs', + 'page arguments' => array(3), + 'access arguments' => array('view all orders'), + 'type' => MENU_LOCAL_TASK, + 'weight' => 10, + 'file' => 'includes/uc_novalnet_form.inc', + ); + /* Menu callback for Paypal configuartion link in Novalnet global configuration */ + $items['merchant_paypal_config'] = array( + 'title' => '', + 'type' => MENU_NORMAL_ITEM, + 'page callback' => 'drupal_get_form', + 'page arguments' => array('uc_novalnet_merchant_admin'), + 'access arguments' => array('administer site configuration') + ); + /* Menu callback to fetch the individual orders from Novalnet orders */ + $items['admin/store/orders/%uc_order/novalnet_payment'] = array( + 'title callback' => 'ttile', + 'title arguments' => array(3), + 'description' => 'Displays a form to process a Novalnet payment.', + 'page callback' => 'uc_novalnet_admin_reorder', + 'page arguments' => array(3), + 'access arguments' => array('process payment'), + ); + + + return $items; +} + +/** + * + * Implementation of callback title + * + * @params string $title + * @return string + */ +function uc_novalnet_global_config_title($title) { + return t($title); +} + +/** + * Implements hook_views_api(). + * + * @params none + * @return array + */ +function uc_novalnet_views_api() { + return array( + 'api' => 3, + 'path' => drupal_get_path('module', 'uc_novalnet') . '/views', + ); +} + +/** + * + * Implements hook_form_alter(). + * + * (Core function - Perform alterations before a form is rendered) + * + * @params array $form + * @params array $form_state + * @params string $form_id + * @return none + */ +function uc_novalnet_form_alter(&$form, &$form_state, $form_id) { + /* Novalnet payment settings handling */ + if ($form_id == 'uc_payment_methods_form') { + /* Get the Basic parameters */ + $config_data = basic_params(); + /* Setting up the flag for displaying the intimation to admin to configure the payment fields properly */ + $error_preserved = FALSE; + if (empty($config_data)) { + /* Get the Novalnet payment methods */ + foreach (uc_novalnet_payment_methods() as $key => $val) { + $form['pmtable'][$key]['#disabled'] = TRUE; + } + $error_preserved = TRUE; + } + if ($error_preserved) drupal_set_message(t('Please configure') . ' ' . l(t('Novalnet Global Configuration') . ' ' , 'admin/novalnet/globalconfig') . t('to enable the Novalnet Payment method'), 'warning'); + } + + /* Alters the order form for extension process */ + if ($form_id == 'uc_order_view_update_form') { + $form['#attributes']['autocomplete'] = 'off'; + $order = uc_order_load($form['order_id']['#value']); + /* Getting the order details from Novalnet table */ + $tid_details = nn_variable_get(array('order_id' => $order->order_id), 'uc_novalnet_transaction'); + /* Zero amount booking for the possible payments and check the zero amout flag is enabled for the current payment */ + $zero_payments_is_active = ((in_array($order->payment_method, array('novalnet_cc', 'novalnet_sepa', 'novalnet_paypal')) && $tid_details['amount'] == 0 ) ? 1 : 0); + /* Payment array - allowed payments for extension process */ + $allowed_for_extension = array('6', '37', '34', '49', '33', '50', '69', '40', '78', '41','59'); + /* checking the transaction status for extension process */ + if ((!empty($tid_details['status']) && in_array($tid_details['status'], array(85, 90, 91, 99, 98, 100)))) { + /* Checking the allowed payments with the suitable status for void and capture processes and payment allowed for void-capture process */ + if (in_array($tid_details['status'], array(85, 91, 99, 98)) && in_array($tid_details['paymentkey'], array('27', '6', '37', '34', '40', '41'))) { + $form['nn_void_capture'] = array( + '#type' => 'fieldset', + '#title' => t('Manage transaction process'), + '#collapsible' => 1, + '#collapsed' => 1, + '#attributes' => array('id' => 'void_capture_fieldset') + ); + $form['nn_void_capture']['on_hold_transaction_enable'] = array( + '#type' => 'checkbox', + '#title' => t('Manage transaction process'), + '#attributes' => array('id' => 'transaction_enable', 'data-text' => 'amount_update_fieldset') + ); + $form['nn_void_capture']['on_hold_transaction'] = array( + '#type' => 'select', + '#options' => array('' => t('--Select--'), 'capture' => t('Confirm'), 'void' => t('Cancel')), + '#default_value' => t('--select--'), + '#states' => array('visible' => array('input[id="transaction_enable"]' => array('checked' => TRUE))), + ); + } + /* Checking the allowed payemnts with the suitable status for amount update processes */ + if ((($tid_details['paymentkey'] == 27 && $tid_details['status'] == '100') || ($tid_details['paymentkey'] == '37' && $tid_details['status'] == '99')) && (int) $tid_details['amount'] > 0 || $tid_details['paymentkey'] == 59) { + if ($tid_details['paymentkey'] == '27') { + $title = t('Change the amount / due date'); + /* If it is invoice prepayment we have to show the total order amount */ + $amount = uc_novalnet_get_original_amount($tid_details, '', TRUE); + } + else if ($tid_details['paymentkey'] == '37') { + $title = t('Amount update'); + $amount = ''; + } else { + $title = t('Change the amount/slip expiry date'); + /* If it is invoice prepayment we have to show the total order amount */ + $amount = uc_novalnet_get_original_amount($tid_details, '', TRUE); + } + if (empty($amount)) + $amount = $tid_details['callback_total']; + + $form['nn_amount_update'] = array( + '#type' => 'fieldset', + '#title' => check_plain($title), + '#collapsible' => 1, + '#collapsed' => 1, + '#attributes' => array('id' => 'amount_update_fieldset') + ); + $form['nn_amount_update']['nn_amount_update_enable'] = array( + '#type' => 'checkbox', + '#title' => check_plain($title), + '#attributes' => array('id' => 'enable_amount_update', 'data-text' => 'void_capture_fieldset', 'data-refund' => 'refund_fieldset') + ); + $form['nn_amount_update']['transaction_amount_change'] = array( + '#type' => 'textfield', + '#title' => t('Update transaction amount') . ' ' . t('(in minimum unit of currency. E.g. enter 100 which is equal to 1.00)') , + '#attributes' => array('onkeypress' => 'return allow_numbers_only(event)'), + '#description' => strip_tags(t('Novalnet transaction ID%s', array('%s' => ': ' . $tid_details['tid']))), + '#states' => array('visible' => array('input[id="enable_amount_update"]' => array('checked' => TRUE))), + '#default_value' => $amount + ); + if ($tid_details['paymentkey'] == '59') + $form['nn_amount_update']['cashpayment_duedate_change'] = array( + '#type' => 'textfield', + '#title' => t('Change the slip expiry date'), + '#default_value' => isset($tid_details['due_date']) ? date('m/d/Y', strtotime($tid_details['due_date'])) : '', + '#states' => array('visible' => array('input[id="enable_amount_update"]' => array('checked' => TRUE))), + ); + if ($tid_details['paymentkey'] == '27') + $form['nn_amount_update']['invoice_duedate_change'] = array( + '#type' => 'textfield', + '#title' => t('Transaction due date'), + '#default_value' => isset($tid_details['due_date']) ? date('m/d/Y', strtotime($tid_details['due_date'])) : '', + '#states' => array('visible' => array('input[id="enable_amount_update"]' => array('checked' => TRUE))), + ); + } + /* unset the Credit card and SEPA payment, if it is processed as zero amount */ + if ($tid_details['amount'] == 0) + unset($allowed_for_extension[0], $allowed_for_extension[1], $allowed_for_extension[2]); + /* Checking the allowed payments with the suitable status for refund processes */ + + if ($tid_details['status'] == 100 && (in_array($tid_details['paymentkey'], $allowed_for_extension) || $tid_details['paymentkey'] == '27')) { + $form['nn_refund'] = array( + '#type' => 'fieldset', + '#title' => t('Refund'), + '#collapsible' => 1, + '#collapsed' => 1, + '#attributes' => array('id' => 'refund_fieldset') + ); + $form['nn_refund']['nn_refund_enable'] = array( + '#type' => 'checkbox', + '#title' => t('Refund process'), + '#attributes' => array('id' => 'enable_nn_refund', 'data-text' => 'amount_update_fieldset') + ); + if ($tid_details['paymentkey'] == '27' && empty($tid_details['amount'])) + $tid_details['callback_total'] = $tid_details['callback_amount']; + + $form['nn_refund']['transaction_refund'] = array( + '#type' => 'textfield', + '#title' => t('Please enter the refund amount') . ' ' . t('(in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'), + '#description' => strip_tags(t('Novalnet transaction ID%s', array('%s' => ': ' . $tid_details['tid']))), + '#attributes' => array('onkeypress' => 'return ccnumber_validate(event)'), + '#default_value' => uc_novalnet_get_original_amount($tid_details, '', TRUE), + '#states' => array('visible' => array('input[id="enable_nn_refund"]' => array('checked' => TRUE))), + ); + $refund_ref_visible = (time() >= strtotime("+1 days", $order->created)) ? TRUE : FALSE ; + /* Set the Refund reference flag after one day of order creation */ + if ($refund_ref_visible) { + $form['nn_refund']['refund_ref'] = array( + '#type' => 'textfield', + '#title' => t('Refund reference'), + ); + } + } + } + /* Checking the allowed payments with the suitable status for amount booking processes */ + if (in_array($tid_details['paymentkey'], array('6', '37', '34')) && in_array($tid_details['status'], array(90, 99, 98, 100)) && $zero_payments_is_active) { + $form['nn_book'] = array( + '#type' => 'fieldset', + '#title' => t('Book transaction'), + '#collapsible' => 1, + '#collapsed' => 1, + ); + $form['nn_book']['nn_book_enable'] = array( + '#type' => 'checkbox', + '#title' => t('Book'), + '#attributes' => array('id' => 'nn_book_enable', 'data-text' => 'amount_update_fieldset') + ); + $form['nn_book']['nn_amount_book_textfield'] = array( + '#type' => 'textfield', + '#title' => t('Transaction booking amount'), + '#description' => strip_tags(t('Novalnet transaction ID%s', array('%s' => ': ' . $tid_details['tid']))), + '#attributes' => array('id' => 'nn_amount_book_textfield'), + '#default_value' => !empty($tid_details['amount']) ? $tid_details['amount'] : round($order->order_total, 2) * 100 + ); + } + /* form submit handler */ + $form['#submit'][] = 'uc_refund_process_submit'; + } +} + +/** + * + * Payment method callback function: submit handler + * + * @params array $form + * @params array $form_state + * @return none + */ +function uc_refund_process_submit($form, &$form_state) { + $form_values = array_map('trim', $form_state['values']); + /* Get the order id from the form state value ( $order - object)*/ + $order = uc_order_load($form['order_id']['#value']); + /* Get the Novalnet params from shop back-end */ + $basic_config = basic_params(); + $comments = ''; + /* Get the transaction details from the novalnet transaction table */ + $tid_details = nn_variable_get(array('order_id' => $order->order_id), 'uc_novalnet_transaction'); + /* Parameter formation for extension process */ + $transaction_call = array( + 'vendor' => $tid_details['vendor_id'], + 'auth_code' => $tid_details['auth_code'], + 'product' => $tid_details['product_id'], + 'tariff' => $tid_details['tariff_id'], + 'key' => $tid_details['paymentkey'], + 'tid' => $tid_details['tid'], + ); + /* Void & Capture Block ( Line no 360 to 378 )- Organise the params to performing confirmation and cancelation of transaction */ + if (!empty($form_values['on_hold_transaction_enable'])) { + if ($form_values['on_hold_transaction'] == '') { + form_set_error('on_hold_transaction', t('Please select status')); + drupal_goto('admin/store/orders/' . $order->order_id); + } + /* Setting up a flag for capturing the transaction($ext_process_type = extension request type ) */ + $order_status = (variable_get($form_state['build_info']['args'][0]->payment_method . '_before_status')); + + if ($tid_details['status'] == '85' || $transaction_call['key'] == '41'|| $transaction_call['key'] == '6' || $transaction_call['key'] == '33'|| $transaction_call['key'] == '37') { + $order_status = (variable_get($form_state['build_info']['args'][0]->payment_method . '_after_status')); + } + + $transaction_call['edit_status'] = 1; + $transaction_call['status'] = 100; + $ext_process_type = ''; + /* Setting up a flag for cancelling the transaction */ + if ($form_values['on_hold_transaction'] == 'void') { + $transaction_call['status'] = 103; + $ext_process_type = 'onhold_void_cancel_status'; + /* Get the on-hold order status from the novalnet global configuration */ + $order_status = $basic_config[$ext_process_type]; + } + /* $update_variable - contains the array values which is to be updated in Novalnet transaction table */ + $update_variable = array('status' => $transaction_call['status']); + $comments = ($ext_process_type == 'onhold_void_cancel_status') ? t('The transaction has been canceled on @date, @time', array('@date' => date('Y:m:d'), '@time' => date('h:i:s'))) : t('The transaction has been confirmed on @date, @time', array('@date' => date('Y:m:d'), '@time' => date('h:i:s'))); + } + /* Amount update block ( Line no 381 to 405 )- Organise the params to perform amount update process */ + elseif (!empty($form_values['nn_amount_update_enable'])) { + /* Amount validation from the form fields (amount should not be 0) */ + if ($form_values['transaction_amount_change'] == 0) { + form_set_error('transaction_amount_change', t('The amount is invalid')); + drupal_goto('admin/store/orders/' . $order->order_id); + } + /* Set the amount update flag */ + $ext_process_type = 'amount_update'; + $transaction_call['status'] = 100; + $transaction_call['amount'] = $form_values['transaction_amount_change']; ### values from the form input ### + $transaction_call['update_inv_amount'] = 1; + $transaction_call['edit_status'] = 1; + /* Validation for due date */ + if ($tid_details['paymentkey'] == 27 && isset($form_values['invoice_duedate_change'])) { + if ($form_values['invoice_duedate_change'] != date('m/d/Y', strtotime($form_values['invoice_duedate_change']))) { + form_set_error('invoice_duedate_change', t('Please enter valid due date')); + drupal_goto('admin/store/orders/' . $order->order_id); + } + } + if ($tid_details['paymentkey'] == 27 && isset($form_values['invoice_duedate_change'])) { + $transaction_call['due_date'] = date('Y-m-d', strtotime($form_values['invoice_duedate_change'])); + $update_variable = array('amount' => $form_values['transaction_amount_change'], 'due_date' => date('m/d/Y', strtotime($transaction_call['due_date']))); + } else { + $update_variable = array('amount' => $form_values['transaction_amount_change']); + if($tid_details['paymentkey'] == 59) + $transaction_call['due_date'] = date('Y-m-d', strtotime($form_values['cashpayment_duedate_change'])); + + } + $due_date = isset($transaction_call['due_date']) ? $transaction_call['due_date'] : date('m/d/Y', strtotime($tid_details['due_date'])); + $comments = ($transaction_call['key'] == 37) ? t('The transaction amount @amount has been updated successfully on @date,@time', array('@amount' => uc_currency_format($update_variable['amount'] /100), '@date' => (date('d-m-Y')), '@time' => date('h:i:s') )) : t('The transaction has been updated with amount @amount and due date with @date,@time', array('@amount' => uc_currency_format($update_variable['amount'] /100), '@date' => ($due_date), '@time' => date('h:i:s'))); + } + /* Refund block ( Line no 406 to 447 )- Organise the params to perform refund process */ + elseif (!empty($form_values['nn_refund_enable'])) { + /* Amount validation from the form fields (amount should not be 0) */ + if ($form_values['transaction_refund'] == '0') { + form_set_error('transaction_refund', t('The amount is invalid')); + drupal_goto('admin/store/orders/' . $order->order_id); + } + /* Account details validation from the user input (Iban should not be empty) */ + elseif (!empty($form_values['enable_ddsepa_refund']) && empty($form_values['sepa_iban'])) { + form_set_error('transaction_refund', t('Your account details are invalid')); + drupal_goto('admin/store/orders/' . $order->order_id); + } + if ($form_values['transaction_refund'] == '') { + form_set_error('transaction_refund', t('The amount is invalid')); + drupal_goto('admin/store/orders/' . $order->order_id); + } + /* Set the refund flag */ + $ext_process_type = 'refund'; + $transaction_call['status'] = 100; + $transaction_call['refund_request'] = 1; + $transaction_call['refund_param'] = $form_values['transaction_refund']; + + /* Pass the refund reference when its not empty */ + if (!empty($form_values['refund_ref'])) + $transaction_call['refund_ref'] = $form_values['refund_ref']; + /* Checking the flag - Refund with SEPA account details is activated */ + if (isset($form_values['enable_ddsepa_refund']) && $form_values['enable_ddsepa_refund']) { + $transaction_call['account_holder'] = $form_values['account_holder']; + $transaction_call['account_no'] = $form_values['sepa_iban']; + } + if (in_array($order->payment_method, array('novalnet_invoice', 'novalnet_prepayment'))) { + $cancel_status = empty($tid_details['amount']) ? TRUE : FALSE; + $update_variable = array('callback_amount' => $form_values['transaction_refund']); + } + else { + $update_variable = array('amount' => $form_values['transaction_refund']); + $cancel_status = empty($form_values['transaction_refund']) ? TRUE : FALSE; + } + if ($cancel_status) { + $update_variable = (in_array($order->payment_method, array('novalnet_invoice', 'novalnet_prepayment'))) ? array('status' => 103, 'callback_amount' => 0 ) : array('status' => 103, 'amount' => 0 ); + } + $comments = sprintf(t('The refund has been executed for the TID: %s with the amount of %s'), $transaction_call['tid'], uc_currency_format($transaction_call['refund_param']/100)); + } + /* Parameter formation for amount booking process */ + elseif (!empty($form_values['nn_book_enable'])) { + if (empty($form_values['nn_amount_book_textfield']) && $form_values['nn_amount_book_textfield'] <= 0) { + form_set_error('nn_amount_book_textfield', t('The amount is invalid')); + drupal_goto('admin/store/orders/' . $order->order_id); + } + $ext_process_type = 'book_amount'; + $transaction_call = unserialize($tid_details['request']); ## first call request + + if (!empty($transaction_call)) { + unset($transaction_call['pan_hash'], $transaction_call['unique_id'], $transaction_call['create_payment_ref']); + $update_variable = array('amount' => $form_values['nn_amount_book_textfield']); + $enable_book_amount = 1; + $transaction_call['payment_ref'] = $tid_details['tid']; + $transaction_call['amount'] = $update_variable['amount']; + } + } + + /* Update the transaction in Novalnet transactio table */ + if (isset($update_variable)) { + /* to send the extension process request to server */ + $response = uc_novalnet_send_payport($transaction_call, 'curl', $order->order_id); + parse_str($response, $parsed); + /* Checking the success status */ + if ($parsed['status'] == 100) { + $transaction_value = unserialize($tid_details['masked_acc_details']); + $transaction_value['paypal_transaction_id'] = isset($parsed['paypal_transaction_id']) ? $parsed['paypal_transaction_id'] : ''; + $transaction_value = serialize($transaction_value); + update_variable(array('order_id' => $order->order_id), array('masked_acc_details' => $transaction_value), 'uc_novalnet_transaction'); + /* update the booked comments */ + if (!empty($enable_book_amount)) { + $comments = sprintf(t("Your order has been booked with the amount of %s. Your new TID for the booked amount: %s"), uc_currency_format($update_variable['amount'] /100), $parsed['tid']); + /* Update the transaction and amount on transaction success */ + update_variable(array('order_id' => $order->order_id), array('tid' => $parsed['tid'], 'amount' => $update_variable['amount']), 'uc_novalnet_transaction'); + /* Update the reference transaction on transaction success */ + update_variable(array('order_id' => $order->order_id), array('is_ref_order' => 0 ), 'uc_novalnet_transaction'); + } + /* Update the transaction refund comments */ + if (($ext_process_type == 'refund') && !empty($parsed['tid'])) + $comments = sprintf(t('The refund has been executed for the TID: %s with the amount of %s. Your new TID for the refund amount: %s'), $transaction_call['tid'], uc_currency_format($transaction_call['refund_param']/100), $parsed['tid']); + if (!empty($transaction_call['amount'])) { + $_SESSION['novalnet_session'][$order->payment_method]['updated_amount'] = $transaction_call['amount']/100; + $original_amount = uc_novalnet_get_original_amount($tid_details, $transaction_call['amount']); + update_variable(array('order_id' => $order->order_id), array('masked_acc_details' => $original_amount), 'uc_novalnet_transaction'); + if (in_array($order->payment_method, array('novalnet_invoice', 'novalnet_prepayment'))) { + $transaction_call['amount'] = abs($transaction_call['amount'] - $tid_details['callback_amount']); + } + update_variable(array('order_id' => $order->order_id), array('amount' => $transaction_call['amount'], 'callback_total' => $transaction_call['amount'] ), 'uc_novalnet_transaction'); + } + $comments = callback_amt_update($order, $comments, ($ext_process_type == 'amount_update' && $tid_details['paymentkey'] == 27) ? $update_variable['due_date'] : ''); + $order_status = (($parsed['tid_status'] == '103') ? $basic_config['onhold_void_cancel_status'] : (!empty($order_status) ? $order_status : $order->order_status)); + /* Update the original status of the TID in Novalnet transaction*/ + update_variable(array('order_id' => $order->order_id), array('status' => $parsed['tid_status'] ), 'uc_novalnet_transaction'); + /* Updating the order comments */ + uc_order_comment_save($order->order_id, 0, $comments , 'order', $order_status, 'TRUE'); + /* Updatig the order status */ + uc_order_update_status($order->order_id, $order_status); + if (isset($_SESSION['novalnet_session'][$order->payment_method]['updated_amount'])) + unset($_SESSION['novalnet_session'][$order->payment_method]['updated_amount']); + drupal_set_message($comments); + } + else isset($parsed['status_desc']) ? drupal_set_message($parsed['status_desc'], 'error') : ''; + } +} + +/** + * + * Implements hook_mail(). + * + * @params string $key + * @params array $message + * @params array $params + * @return none + */ +function uc_novalnet_mail($key, &$message, $params) { + $message['headers']['Content-Type'] = "text/html; charset=UTF-8; format=flowed; delsp=yes"; + $message['headers'] += $params['headers']; + $message['subject'] = $params['subject']; + $message['body'][] = $params['body']; +} +/** + * + * Implements hook_mail_alter(). + * + * @params array $message + * @return none + */ +function uc_novalnet_mail_alter(&$message) { + $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed'; + if ($message['id'] == 'uc_order_invoice' && $message['params']['order']->payment_method == 'novalnet_prepayment') + $message['body'][0] = preg_replace('|
(.+?)
|s', ' ', $message['body'][0]); +} + +/** + * + * Implements hook_cron(). + * + * @params none + * @return none + */ +function uc_novalnet_cron() { + if ( date('d', variable_get('cron_last')) != date('d', time() ) ) { + drupal_flush_all_caches(); + } +} + + +/** + * + * Displays the payment form in admin reorder page. + * + * @params object $order + * @return array $build + */ +function uc_novalnet_admin_reorder($order) { + $build['details']['order_total'] = array('#markup' => '
' . t('Order total: @total', array('@total' => uc_currency_format($order->order_total))) . '
'); + $build['details']['balance'] = array('#markup' => '
' . t('Balance: @balance', array('@balance' => uc_currency_format(uc_payment_balance($order)))) . '
'); + + $build['form'] = drupal_get_form('uc_novalnet_admin_reorder_form', $order); + + return $build; +} + diff --git a/includes/uc_novalnet_form.inc b/includes/uc_novalnet_form.inc new file mode 100644 index 0000000..a6ca6d5 --- /dev/null +++ b/includes/uc_novalnet_form.inc @@ -0,0 +1,1266 @@ + TRUE)); + drupal_add_css(drupal_get_path('module', 'uc_novalnet') . '/css/uc_novalnet.css'); + $module_url = drupal_get_path('module', 'uc_novalnet'); + $module_url = url($module_url, array('relative' => TRUE)); + + /* To load the admin portal in shop back-end */ + $admin_portal = t("For additional configurations login to %sNovalnet Merchant Administration Portal.%s To login to the Portal you need to have an account at Novalnet. If you don't have one yet, please contact %ssales@novalnet.de%s / tel. +49 (089) 923068320"); + $paypal_config = t('To use the PayPal payment method please enter your PayPal API details in %sNovalnet Merchant Administration portal%s'); + $form['merchant_details'] = array( + '#markup' => sprintf($admin_portal, "", "", "", "") . '
' + ); + $form['paypal_account'] = array( + '#markup' => sprintf($paypal_config, "", "") . '
' + ); + $form['novalnet_settings'] = array( + '#type' => 'vertical_tabs', + ); + /* To get Novalnet basic params from the shop back-end */ + $basic_data = basic_params(); + $cbk_data = variable_get('novalnet_cbk_data', ''); + /* Global configuration field-set (Line no 64 - 164) - contains the payment releated configurations(E.g.: Vendor id, payment access key etc.)*/ + $form['global_config'] = array( + '#type' => 'fieldset', + '#title' => t('Global Configuration'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#group' => 'novalnet_settings', + ); + $form['global_config']['nn_global_loading'] = array( + '#type' => 'markup', + '#markup' => '' + ); + $form['global_config']['public_key'] = array( + '#type' => 'textfield', + '#description' => t('Enter Novalnet Product activation key'), + '#title' => t('Product activation key'), + '#attributes' => array('id' => 'publicKey', 'autocomplete' => 'off'), + '#required' => TRUE, + '#default_value' => isset($basic_data['public_key'])? $basic_data['public_key'] : '', + ); + + $form['base_url'] = array( + '#type' => 'hidden', + '#attributes' => array('id' => 'base_url'), + '#value' => $base_url + ); + $form['global_config']['vendor_id'] = array( + '#type' => 'hidden', + '#title' => t('Merchant ID'), + '#default_value' => isset($basic_data['vendor_id'])? $basic_data['vendor_id'] : '', + '#attributes' => array('readonly' => 'readonly', 'id' => 'vendor_id'), + '#required' => TRUE, + '#validated' => TRUE, + '#element_validate' => array('uc_novalnet_element_validate_number'), + ); + $form['global_config']['auth_code'] = array( + '#type' => 'hidden', + '#title' => t('Authentication code'), + '#attributes' => array('readonly' => 'readonly', 'id' => 'auth_code'), + '#required' => TRUE, + '#validated' => TRUE, + '#default_value' => isset($basic_data['auth_code'])? $basic_data['auth_code'] : '', + ); + $form['global_config']['product_id'] = array( + '#type' => 'hidden', + '#title' => t('Project ID'), + '#attributes' => array('readonly' => 'readonly', 'id' => 'product_id'), + '#required' => TRUE, + '#validated' => TRUE, + '#default_value' => isset($basic_data['product_id'])? $basic_data['product_id'] : '', + '#element_validate' => array('uc_novalnet_element_validate_number'), + ); + $form['global_config']['tariff_id'] = array( + '#type' => 'select', + '#attributes' => array('id' => 'tariff_id'), + '#description' => t('Select Novalnet tariff ID'), + '#title' => t('Tariff ID'), + '#required' => TRUE, + '#validated' => TRUE, + '#options' => !variable_get('novalnet_tariff_options') ? variable_get('novalnet_tariff_options', array(0 => t('--Select--'))) : variable_get('novalnet_tariff_options'), + '#default_value' => isset($basic_data['tariff_id'])? $basic_data['tariff_id'] : '', + ); + $form['global_config']['payment_access_key'] = array( + '#type' => 'hidden', + '#attributes' => array('readonly' => 'readonly', 'id' => 'payment_access_key'), + '#title' => t('Payment access key'), + '#required' => TRUE, + '#validated' => TRUE, + '#default_value' => isset($basic_data['payment_access_key'])? $basic_data['payment_access_key'] : '', + ); + + $form['global_config']['paymentlogo'] = array( + '#type' => 'select', + '#title' => t('Display payment method logo'), + '#description' => t('The payment method logo will be displayed on the checkout page'), + '#options' => array( 1 => t('True'), 0 => t('False')), + '#default_value' => isset($basic_data['paymentlogo'])? $basic_data['paymentlogo'] : 1 + ); + $form['global_config']['onhold_transaction_status'] = array( + '#type' => 'select', + '#title' => t('Onhold order status'), + '#options' => uc_order_status_options_list(), + '#default_value' => (isset($basic_data['onhold_transaction_status']))? $basic_data['onhold_transaction_status'] : 'pending', + ); + $form['global_config']['onhold_void_cancel_status'] = array( + '#type' => 'select', + '#title' => t('Cancellation order status'), + '#options' => uc_order_status_options_list(), + '#default_value' => (isset($basic_data['onhold_void_cancel_status']))? $basic_data['onhold_void_cancel_status'] : 'canceled', + ); + $form['global_config']['referrer_id'] = array( + '#type' => 'textfield', + '#title' => t('Referrer ID'), + '#description' => t('Enter the referrer ID of the person/company who recommended you Novalnet'), + '#default_value' => isset($basic_data['referrer_id'])? $basic_data['referrer_id'] : '', + '#element_validate' => array('uc_novalnet_element_validate_number'), + '#required' => FALSE, + ); + $form['global_config']['gateway_timeout'] = array( + '#type' => 'textfield', + '#title' => t('Gateway timeout (in seconds)'), + '#description' => t('In case the order processing time exceeds the gateway timeout, the order will not be placed'), + '#default_value' => isset($basic_data['gateway_timeout']) ? $basic_data['gateway_timeout'] : 240, + '#element_validate' => array('uc_novalnet_element_validate_number'), + '#required' => FALSE, + ); + /* Callback script configuration field-set (Line no 231 - 301) - contains the Callback releated configurations(E.g.: test mode etc.) */ + $form['callback_config'] = array( + '#type' => 'fieldset', + '#title' => t('Merchant script management'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#group' => 'novalnet_settings', + ); + $form['callback_config']['cbk_mail_test_mode'] = array( + '#type' => 'select', + '#title' => t('Deactivate IP address control (for test purpose only)'), + '#options' => array(1 => t('True'), 0 => t('False')), + '#description' => t('This option will allow performing a manual execution. Please disable this option before setting your shop to LIVE mode, to avoid unauthorized calls from external parties (excl. Novalnet).'), + '#default_value' => (!empty($cbk_data['cbk_mail_test_mode']))? $cbk_data['cbk_mail_test_mode'] : 0, + ); + + $form['callback_config']['cbk_mail_send'] = array( + '#type' => 'select', + '#title' => t('Enable E-mail notification for callback'), + '#options' => array(0 => t('True'), 1 => t('False')), + '#default_value' => (!empty($cbk_data)) ? $cbk_data['cbk_mail_send'] : 1, + '#attributes' => array('id' => 'nn_cbk_mail_send'), + ); + $form['callback_config']['cbk_mail_to'] = array( + '#type' => 'textfield', + '#title' => t('E-mail address (To)'), + '#description' => t('E-mail address of the recipient'), + '#default_value' => (!empty($cbk_data))? $cbk_data['cbk_mail_to'] : '', + '#element_validate' => array('uc_novalnet_element_validate_email'), + '#states' => array('visible' => array('select[id="nn_cbk_mail_send"]' => array('value' => 0))) + ); + $form['callback_config']['cbk_mail_bcc'] = array( + '#type' => 'textfield', + '#required' => FALSE, + '#title' => t("E-mail address (Bcc)"), + '#description' => t('E-mail address of the recipient for BCC'), + '#default_value' => (!empty($cbk_data['cbk_mail_bcc']))? $cbk_data['cbk_mail_bcc'] : '', + '#states' => array('visible' => array('select[id="nn_cbk_mail_send"]' => array('value' => 0))) + ); + $form['callback_config']['cbk_mail_subject'] = array( + '#type' => 'textfield', + '#title' => t('E-mail subject'), + '#default_value' => !empty($cbk_data['cbk_mail_subject']) ? $cbk_data['cbk_mail_subject'] : t('Novalnet callback script notification'), + '#states' => array('visible' => array('select[id="nn_cbk_mail_send"]' => array('value' => 0))) + ); + $form['callback_config']['cbk_mail_body'] = array( + '#type' => 'textarea', + '#title' => t('E-mail body'), + '#default_value' => (!empty($cbk_data))? $cbk_data['cbk_mail_body'] : '', + '#states' => array('visible' => array('select[id="nn_cbk_mail_send"]' => array('value' => 0))) + ); + $form['callback_config']['notify_url'] = array( + '#type' => 'textfield', + '#title' => t('Notification URL'), + '#description' => t('The notification URL is used to keep your database/system actual and synchronizes with the Novalnet transaction status'), + '#value' => url('callback_novalnet2ubercart', array('absolute' => TRUE)), + '#default_value' => (isset($basic_data['notify_url']))? $basic_data['notify_url'] : '', + ); + + /* Submit hanlder for Novalnet global configuration */ + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Save configuration'), + '#submit' => array('uc_novalnet_globalconfig_form_submit'), + ); + return $form; +} + +/** + * + * Submit handler for Global configuration form + * + * Function that used to save the global configuration details in drupal variables + * + * @param array $form + * @param array $form_state + * @return none + */ +function uc_novalnet_globalconfig_form_submit($form, &$form_state) { + $config = array_map('trim' , $form_state['values']); + + $basic_params = variable_get('novalnet_params', array()); + if(!empty($basic_params['vendor_id'])) { + /* Assigning the configured global confg values to Novalnet params */ + variable_set('novalnet_params', array_merge($basic_params, array( + 'public_key' => $config['public_key'], + 'onhold_transaction_status' => $config['onhold_transaction_status'], + 'onhold_void_cancel_status' => $config['onhold_void_cancel_status'], + 'referrer_id' => $config['referrer_id'], + 'gateway_timeout' => $config['gateway_timeout'], + 'is_details_saved' => TRUE, + 'tariff_id' => $config['tariff_id'], + 'paymentlogo' => $config['paymentlogo'], + 'referrer_id' => $config['referrer_id'], + 'onhold_transaction_status' => $config['onhold_transaction_status'], + 'onhold_void_cancel_status' => $config['onhold_void_cancel_status'], + 'notify_url' => $config['notify_url'], + ))); + variable_set('novalnet_cc_key', $config['payment_access_key']); + /* Assigning the configured callback values to Novalnet params */ + variable_set('novalnet_cbk_data', array( + 'cbk_mail_send' => $config['cbk_mail_send'], + 'cbk_mail_to' => $config['cbk_mail_to'], + 'cbk_mail_subject' => $config['cbk_mail_subject'], + 'cbk_mail_bcc' => $config['cbk_mail_bcc'], + 'cbk_mail_test_mode' => $config['cbk_mail_test_mode'], + 'cbk_mail_body' => $config['cbk_mail_body'], + )); + drupal_set_message(t('Your Basic Configuration has been saved.') . ' ' . t('Please configure') . ' ' . t('Payment method') . 's ' . l(t('Here'), 'admin/store/settings/payment')); +} +} + +/** + * + * Submit handler for Auto public API + * + * Function that used to send the Auto API request to payment server for refilling the + * + * vendor details in respective form fields. + * + * @param array $form + * @param array $form_state + * @return none + */ +function uc_novalnet_publickey_submit() { + global $language; + /* Checking the public key is non-empty*/ + if (!empty($_REQUEST['api_config_hash'])) { + $data['hash'] = trim($_REQUEST['api_config_hash']); + $data['lang'] = $language->language; + $query = http_build_query($data, '', '&'); + $options = array( + 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'), + 'method' => 'POST', + 'data' => $query + ); + $basic_params = variable_get('novalnet_params', ''); + $host = uc_novalnet_get_url('novalnet_auto_config'); + $response = drupal_http_request($host, $options); + $response = json_decode($response->data); + if (!empty($response->vendor)) { + variable_set('novalnet_params', array( + 'public_key' => $data['hash'], + 'vendor_id' => $response->vendor, + 'auth_code' => $response->auth_code, + 'product_id' => $response->product, + 'payment_access_key' => $response->access_key, + 'onhold_transaction_status' => 'pending', + 'onhold_void_cancel_status' => 'canceled', + 'referrer_id' => $basic_params['referrer_id'] + )); + $tariff = $response->tariff; + foreach ($tariff as $key => $value) { + if ($value->type == '2' ||$value->type == '3') { + $tariffVal[$key] = $value->name; + } + } + /* Stores the tariff id's in drupal variable */ + variable_set('novalnet_tariff_options', $tariffVal); + drupal_json_output(array('status' => 100, 'data' => $response)); + + } else { + variable_set('novalnet_params', ''); + /* Stores the tariff id's in drupal variable */ + variable_set('novalnet_tariff_options', array()); + drupal_json_output(array('status' => 1, 'data' => $response)); + } + } + else { + variable_set('novalnet_params', ''); + /* Stores the tariff id's in drupal variable */ + variable_set('novalnet_tariff_options', array()); + drupal_json_output(array('status' => 0, 'data' => $response)); + } + +} + +/** + * + * Back end configuration for Individual payments + * + * Function that used to create the individual payment configuration form(E.g.: Fraud preventions, test mode etc.) + * + * @param array $payment + * @return array $form + */ +function uc_novalnet_backend_config($payment) { + /* To get Novalnet basic params from the shop back-end */ + $config_data = basic_params(); + /* error message will triggered - when Global configuration is not configured, instead of configuring the individual payment configuration */ + if (empty($config_data)) { + drupal_set_message(t('Please configure Novalnet Global Configuration'), 'error'); + drupal_goto('admin/novalnet/globalconfig'); + } + $desc = uc_novalnet_payment_methods($payment); + $form = array(); + $form['nn_title'] = array( + '#title' => t('Novalnet Payment Settings'), + ); + $base_url = url('admin/novalnet/globalconfig', array('relative' => TRUE)); + $global = t("For additional configurations go to %sNovalnet Global Configuration.%s"); + $form['global_link'] = array( + '#markup' => sprintf($global, "", "") . '
' + ); + $form[$payment.'_payment_title'] = array( + '#type' => 'textfield', + '#title' => t('Payment Title'), + '#default_value' => variable_get($payment.'_payment_title', t($desc['name'])), + '#description' => t('Help message shown at checkout.'), + ); + $form[$payment.'_novalnet_description'] = array( + '#type' => 'textarea', + '#title' => t('Payment Description'), + '#default_value' => variable_get($payment.'_novalnet_description', t($desc['desc'])), + '#description' => t('Help message shown at checkout.'), + ); + $form[$payment . '_test_mode'] = array( + '#type' => 'select', + '#title' => t('Enable test mode'), + '#description' => t('The payment will be processed in the test mode therefore amount for this transaction will not be charged'), + '#default_value' => variable_get($payment . '_test_mode', 0), + '#options' => array( 1 => t('True'), 0 => t('False')), + ); + /* One step check-out and zero amount booking flags for allowed payments (Line no 448 - 460) */ + if (in_array($payment, array('novalnet_cc', 'novalnet_sepa', 'novalnet_paypal'))) { + $zero_amount_options = array( 0 => t('None'), 1 => t('One click shopping'), 2 => t('Zero amount booking')); + + $form[$payment . '_enable_one_shop_clicking'] = array( + '#type' => 'select', + '#title' => t('Shopping type'), + '#description' => t('Select shopping type'), + '#options' => $zero_amount_options, + '#default_value' => variable_get($payment . '_enable_one_shop_clicking', 0), + ); + } + /* One step check-out and zero amount booking flags for allowed payments (Line no 448 - 460) */ + if (in_array($payment, array('novalnet_cc', 'novalnet_sepa', 'novalnet_paypal','novalnet_invoice'))) { + $form[$payment.'_paymentoption'] = array( + '#type' => 'select', + '#title' => t('Payment action'), + '#options' => array( 'capture' => t('Capture'), 'authorize' => t('Authorize')), + '#default_value' => variable_get($payment.'_paymentoption') ? variable_get($payment.'_paymentoption') : 1, + '#attributes' => array('id' => $payment.'_paymentoption'), + ); + $form[$payment.'_manualamount'] = array( + '#type' => 'textfield', + '#title' => t('Minimum transaction limit for authorization (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'), + '#description' => t('In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold.'), + '#default_value' => variable_get($payment.'_manualamount') ? variable_get($payment.'_manualamount') : '', + '#required' => FALSE, + '#element_validate' => array('uc_novalnet_element_validate_number'), + '#states' => array('visible' => array('select[id="'.$payment.'_paymentoption'.'"]' => array('value' => 'authorize'))) + ); + } + if ($payment == 'novalnet_paypal') { + $form[$payment . '_notification'] = array( + '#type' => 'fieldset', + '#title' => t('Note:'), + '#attributes' => array('style' => "background-color:#ffff99; color:#0074BD"), + '#description' => t('In order to use this option you must have billing agreement option enabled in your PayPal account. Please contact your account manager at PayPal.'), + '#states' => array('invisible' => array('select[id="edit-novalnet-paypal-enable-one-shop-clicking"]' => array('value' => 0))), + ); + } + /* Specific configuration fields for CC payment(E.g.: CC expiry year limit etc.) Line 463 - 510 */ + if ($payment == 'novalnet_cc') { + $form['novalnet_cc_cc3d'] = array( + '#type' => 'checkbox', + '#title' => '' . t('Enable 3D secure') . '', + '#description' => t('The 3D-Secure will be activated for credit cards. The issuing bank prompts the buyer for a password what, in turn, help to prevent a fraudulent payment. It can be used by the issuing bank as evidence that the buyer is indeed their card holder. This is intended to help decrease a risk of charge-back.'), + '#default_value' => variable_get('novalnet_cc_cc3d', ''), + ); + $form['novalnet_cc_force_cc3d'] = array( + '#type' => 'checkbox', + '#title' => '' . t('Force 3D secure on predefined conditions') . '', + '#description' => t('If 3D secure is not enabled in the above field, then force 3D secure process as per the “Enforced 3D secure (as per predefined filters & settings)” module configuration at the Novalnet Merchant Administration portal. If the predefined filters & settings from Enforced 3DSecure module are met, then the transaction will be processed as 3D secure transaction otherwise it will be processed as non 3D secure. Please note that the “Enforced 3D secure (as per predefined filters & settings)” module should be configured at Novalnet Merchant Administration portal prior to the activation here. For further information, please refer the description of this fraud module at “Fraud Modules” tab, below “Projects” menu, under the selected project in Novalnet Merchant Administration portal or contact novalnet support team.'), + '#default_value' => variable_get('novalnet_cc_force_cc3d', ''), + ); + $form['novalnet_cc_amex'] = array( + '#type' => 'select', + '#title' => t('Display AMEX logo'), + '#description' => t('Display AMEX logo in checkout page'), + '#default_value' => variable_get('novalnet_cc_amex', 0), + '#options' => array( 1 => t('True'), 0 => t('False')), + ); + $form['novalnet_cc_maestro'] = array( + '#type' => 'select', + '#title' => t('Display Maestro logo'), + '#description' => t('Display Maestro logo in checkout page'), + '#default_value' => variable_get('novalnet_cc_maestro', 0), + '#options' => array( 1 => t('True'), 0 => t('False')), + ); + $form['novalnet_cc_style'] = array( + '#type' => 'fieldset', + '#title' => t('CSS settings for Credit Card iframe'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form['novalnet_cc_style']['common_label_style'] = array( + '#type' => 'textfield', + '#title' => t('Label'), + '#description' => t('E.g:') . 'color:#999999; background-color:#FFFFFF;', + '#default_value' => variable_get('common_label_style') ? variable_get('common_label_style') : '' + ); + $form['novalnet_cc_style']['common_field_style'] = array( + '#type' => 'textarea', + '#title' => t('Input'), + '#description' => t('E.g.') . 'color:#999999; background-color:#FFFFFF;', + '#default_value' => variable_get('common_field_style') ? variable_get('common_field_style') : 'border-color: #cccccc; border-radius: 4px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset; color: #000; height: 34px; padding: 6px 12px; transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;' + ); + $form['novalnet_cc_style']['common_style_text'] = array( + '#type' => 'textarea', + '#title' => t('CSS Text'), + '#description' => t('E.g:') . '#idselector{color:#999999;}.classSelector{color:#000000}', + '#default_value' => variable_get('common_style_text') ? variable_get('common_style_text') : 'body{ color: #9a9a9a; font-family: sans-serif; font-size: 13px } .input-group{ width: 50%; float:left; margin-bottom: 2px } .label-group{ margin-bottom: 5px; } .form-group{ padding-right: 15px; } .form-group label{ text-transform: uppercase; font-size: 12}' + ); + $form['novalnet_cc_key'] = array( + '#type' => 'hidden', + '#default_value' => variable_get('novalnet_cc_key', '') + ); + } + /* Order status configuration for individula payments */ + $cat_option = uc_order_status_options_list(); + if (in_array($payment, array('novalnet_prepayment', 'novalnet_invoice', 'novalnet_paypal', 'novalnet_przelewy24', 'novalnet_cashpayment'))) { + $form[$payment . '_before_status'] = array( + '#type' => 'select', + '#title' => in_array($payment, array('novalnet_paypal', 'novalnet_przelewy24')) ? t('Order status for the pending payment') : t('Order completion status'), + '#options' => $cat_option, + '#default_value' => variable_get($payment . '_before_status', 'pending'), + ); + } + $form[$payment . '_after_status'] = array( + '#type' => 'select', + '#title' => in_array($payment, array('novalnet_prepayment', 'novalnet_invoice', 'novalnet_cashpayment')) ? t('Callback order status') : t('Order completion status'), + '#options' => $cat_option, + '#default_value' => variable_get($payment . '_after_status', 'completed'), + ); + if (in_array($payment, array('novalnet_sepa', 'novalnet_invoice'))) { + /* Allowed payment methods for fraud prevention */ + $form['fraud_prevention'] = array( + '#type' => 'fieldset', + '#title' => t('Risk and control management'), + '#collapsible' => TRUE, + '#collapsed' => TRUE + ); + $form['fraud_prevention'][$payment . '_pin_method'] = array( + '#type' => 'radios', + '#title' => t('Enable fraud prevention'), + '#description' => t('To authenticate the buyer for a transaction, the PIN will be automatically generated and sent to the buyer. This service is only available for customers from DE, AT, CH'), + '#default_value' => variable_get($payment . '_pin_method', '0'), + '#options' => array(0 => t('None'), 'callback' => t('PIN by callback'), 'sms' => t('PIN by SMS')) + ); + $form['fraud_prevention'][$payment . '_pin_amount'] = array( + '#type' => 'textfield', + '#title' => t('Minimum value of goods') . ' ' . t('(in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'), + '#description' => t('Enter the minimum value of goods from which the fraud module should be activated'), + '#default_value' => variable_get($payment . '_pin_amount', ''), + '#element_validate' => array('uc_novalnet_element_validate_number'), + '#states' => array('invisible' => array('input[name="' . $payment . '_pin_method"]' => array('value' => 0))), + ); + /* Allowed payment methods for Due date */ + $form[$payment . '_due_date'] = array( + '#type' => 'textfield', + '#title' => ($payment == 'novalnet_invoice') ? t('Payment due date (in days)') : t('SEPA payment duration (in days)'), + '#description' => ($payment == 'novalnet_invoice') ? t('Enter the number of days to transfer the payment amount to Novalnet (must be greater than 7 days). In case if the field is empty, 14 days will be set as due date by default') : t('Enter the number of days after which the payment should be processed (must be between 2 and 14 days)'), + '#default_value' => variable_get($payment . '_due_date', ''), + '#element_validate' => array('uc_novalnet_element_validate_duedate'), + ); + /* Allowed payments for Guaranteed payments */ + $form['payment_guarantee_validate_check'] = array( + '#type' => 'fieldset', + '#title' => t('Payment guarantee configuration'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#element_validate' => array('payment_gurantee_validation'), + ); + $form['payment_guarantee_validate_check'][$payment . '_payment_guarantee_check'] = array( + '#type' => 'radios', + '#title' => t("Enable payment guarantee"), + '#default_value' => variable_get($payment . '_payment_guarantee_check', 0), + '#options' => array(1 => t('True'), 0 => t('False')) + ); + $form['payment_guarantee_validate_check'][$payment . '_guarantee_before_status'] = array( + '#type' => 'select', + '#title' => t('Order status for the pending payment'), + '#options' => $cat_option, + '#default_value' => variable_get($payment . '_guarantee_before_status', 'pending'), + ); + $form['payment_guarantee_validate_check'][$payment . '_payment_guarantee_condition_check'] = array( + '#type' => 'markup', + '#markup' => ' +
    +
  • ' . t('Allowed countries: AT, DE, CH') . '
  • +
  • ' . t('Allowed currency: EUR') . '
  • +
  • ' . t('Minimum amount of order >= 9,99 EUR') . '
  • +
  • ' . t('Minimum age of end customer >= 18 Years') . '
  • +
  • ' . t('The billing address must be the same as the shipping address') . '
  • +
  • ' . t('Gift certificates/vouchers are not allowed') . '
  • +
', + ); + $form['payment_guarantee_validate_check'][$payment . '_minimum_payment_guarantee_check'] = array( + '#type' => 'textfield', + '#title' => t('Minimum order amount') . ' ' . t('(in minimum unit of currency. E.g. enter 100 which is equal to 1.00)'), + '#description' => t("This setting will override the default setting made in the minimum order amount. Note that amount should be in the range of 9,99 EUR."), + '#default_value' => variable_get($payment . '_minimum_payment_guarantee_check'), + ); + $form['payment_guarantee_validate_check'][$payment . '_payment_guarantee_active'] = array( + '#type' => 'radios', + '#title' => t("Force Non-Guarantee payment"), + '#description' => t("If the payment guarantee is activated (True), but the above mentioned requirements are not met, the payment should be processed as non-guarantee payment."), + '#default_value' => variable_get($payment . '_payment_guarantee_active', 1), + '#options' => array(1 => t('True'), 0 => t('False')) + ); + } + if ($payment == 'novalnet_cashpayment') { + $form[$payment . '_due_date'] = array( + '#type' => 'textfield', + '#title' => t('Slip expiry date (in days)'), + '#description' => t('Enter the number of days to pay the amount at store near you. If the field is empty, 14 days will be set as default.'), + '#default_value' => variable_get($payment . '_due_date', ''), + ); + } + /* Information to the end-customer */ + $form[$payment . '_user_info'] = array( + '#type' => 'textfield', + '#title' => t('Notification for the buyer'), + '#description' => t('The entered text will be displayed on the checkout page.'), + '#default_value' => variable_get($payment . '_user_info', ''), + '#element_validate' => array('uc_novalnet_sanitize_referid') + ); + return $form; +} + +/** + * + * Payment method callback function: display the payment form + * + * @param object $order + * @param array $form_state + * @return array $form + */ +function uc_novalnet_getform($form, $form_state, $order) { + $data = array(); + $payment_method = $order->payment_method; + $config_data = basic_params(); + $implementation = ''; + /* To get country details from the billing address */ + $billing_country = uc_get_country_data(array('country_id' => $order->billing_country)); + /* Guaranteed payments - Birthdate form */ + $show_calendar = FALSE; + /* Guaranteed payments for allowed payments and for allowed countries */ + if (in_array($payment_method, array('novalnet_invoice', 'novalnet_sepa')) && !isset($_SESSION['novalnet_session'][$payment_method]['tid'])) { + /* Check the guarantee payment active flag */ + if (variable_get($payment_method . '_payment_guarantee_check', 0)) { + $delivery_address = $form_state['build_info']['args']; + foreach ($delivery_address as $value) { + $address_fields = $value; + } + $delivery_address = array($address_fields->delivery_street1, $address_fields->delivery_street2, $address_fields->delivery_city, $address_fields->delivery_postal_code, $address_fields->delivery_country); + $billing_address = array($address_fields->billing_street1, $address_fields->billing_street2, $address_fields->billing_city, $address_fields->billing_postal_code, $address_fields->billing_country); + $min_amount = variable_get($order->payment_method . '_minimum_payment_guarantee_check') ? variable_get($order->payment_method . '_minimum_payment_guarantee_check') : 999; + $order_amt = $order->order_total * 100; + + /* Check the amount is greater than 9,99 euro */ + if (($order_amt >= $min_amount) && $order->currency == 'EUR' && in_array($billing_country[0]['country_iso_code_2'], array('AT', 'DE', 'CH')) && ($delivery_address === $billing_address)) { + $show_calendar = TRUE; + $implementation = 'gurantee'; + if (isset($_SESSION['novalnet_session'][$payment_method][$payment_method . '_pinkey'])) + unset( $_SESSION['novalnet_session'][$payment_method][$payment_method . '_pinkey'] ); + } + } + } + $zero_amount = uc_novalnet_zero_amount_booking($data, $payment_method, $config_data); + /* Fraud prevention - checking the order amount with stored order amount */ + if ((isset($_SESSION['novalnet_session'][$payment_method]['amount']) && $_SESSION['novalnet_session'][$payment_method]['amount'] != (string) $order->order_total ) && (!$zero_amount)) { + unset($_SESSION['novalnet_session']); + drupal_set_message(t('The order amount has been changed, please proceed with the new order'), 'error'); + } + /* Paypal perform one click process */ + if ($payment_method == 'novalnet_paypal' && variable_get('novalnet_paypal_enable_one_shop_clicking', 0) == 1) { + $form = uc_novalnet_get_paypal_form($order); + } + $form['payment_method'] = array( + '#type' => 'hidden', + '#title' => t('Payment method'), + '#default_value' => $payment_method, + '#attributes' => array('id' => 'payment_method') + ); + /* Allowed payments for Fraud prevention */ + if ($payment_method == 'novalnet_sepa' && !isset($_SESSION['novalnet_session'][$payment_method]['tid'])) { + $form['nn_authcode'] = array( + '#type' => 'hidden', + '#default_value' => $config_data['auth_code'], + '#attributes' => array('id' => 'nn_authcode'), + '#prefix' => '