00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00041 if (!is_object($this) || !is_object($this->cObj)) die('$this and $this->cObj must be objects!');
00042
00043
00044
00045 $lConf = $conf;
00046 $localTemplateCode = $this->cObj->fileResource($lConf[templateFile] ? $lConf[templateFile] : "EXT:tt_products/pi/payment_DIBS_template.tmpl");
00047 $localTemplateCode = $this->cObj->substituteMarkerArrayCached($localTemplateCode, $this->globalMarkerArray);
00048
00049 $orderUid = $this->getBlankOrderUid();
00050
00051 switch(t3lib_div::_GP("products_cmd")) {
00052 case "cardno":
00053 $tSubpart = $lConf["soloe"] ? "###DIBS_SOLOE_TEMPLATE###" : "###DIBS_CARDNO_TEMPLATE###";
00054 $content=$this->getBasket($tSubpart,$localTemplateCode);
00055
00056 $markerArray=array();
00057 $markerArray["###HIDDEN_FIELDS###"] = '
00058 <input type=hidden name=merchant value="'.$lConf["merchant"].'">
00059 <input type=hidden name=amount value="'.round($this->calculatedSums_tax["total"]*100).'">
00060 <input type=hidden name=currency value="'.$lConf["currency"].'"> <!--Valuta som angivet i ISO4217, danske kroner=208-->
00061 <input type=hidden name=orderid value="'.$this->getOrderNumber($orderUid).'"> <!--Butikkens ordrenummer der skal knyttes til denne transaktion-->
00062 <input type=hidden name=uniqueoid value="1">
00063 <input type=hidden name="accepturl" value="https://payment.architrade.com/cgi-ssl/relay.cgi/'.$lConf["relayURL"].'&products_cmd=accept&products_finalize=1&HTTP_COOKIE='.rawurlencode("fe_typo_user=".$GLOBALS["TSFE"]->fe_user->id).'">
00064 <input type=hidden name="declineurl" value="https://payment.architrade.com/cgi-ssl/relay.cgi/'.$lConf["relayURL"].'&products_cmd=decline&products_finalize=1&HTTP_COOKIE='.rawurlencode("fe_typo_user=".$GLOBALS["TSFE"]->fe_user->id).'">';
00065 if ($lConf["soloe"]) {
00066 $markerArray["###HIDDEN_FIELDS###"].= '
00067 <input type=hidden name="cancelurl" value="https://payment.architrade.com/cgi-ssl/relay.cgi/'.$lConf["relayURL"].'&products_cmd=cancel&products_finalize=1&HTTP_COOKIE='.rawurlencode("fe_typo_user=".$GLOBALS["TSFE"]->fe_user->id).'">';
00068 }
00069 if ($lConf["test"]) {
00070 $markerArray["###HIDDEN_FIELDS###"].= '
00071 <input type=hidden name=test value="foo">
00072 ';
00073 }
00074 if ($lConf["cardType"] && !$lConf["soloe"]) {
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 $markerArray["###HIDDEN_FIELDS###"].= '
00087 <input type=hidden name=cardtype value="'.$lConf["cardType"].'">
00088 ';
00089 }
00090 if ($lConf["account"]) {
00091 $markerArray["###HIDDEN_FIELDS###"].= '
00092 <input type=hidden name=account value="'.$lConf["account"].'">
00093 ';
00094 }
00095
00096
00097
00098 if ($lConf["addOrderInfo"]) {
00099 $theFields="";
00100
00101 reset($this->deliveryInfo);
00102 $cc=0;
00103 while(list($field,$value)=each($this->deliveryInfo)) {
00104 $value = trim($value);
00105 if ($value) {
00106 $cc++;
00107 $theFields.=chr(10).'<input type=hidden name="delivery'.$cc.'.'.$field.'" value="'.htmlspecialchars($value).'">';
00108 }
00109 }
00110
00111
00112 reset($this->calculatedBasket);
00113 $theFields.='
00114 <input type=hidden name="ordline1-1" value="Varenummer">
00115 <input type=hidden name="ordline1-2" value="Beskrivelse">
00116 <input type=hidden name="ordline1-3" value="Antal">
00117 <input type=hidden name="ordline1-4" value="Pris">
00118 ';
00119 $cc=1;
00120 while(list(,$rec)=each($this->calculatedBasket)) {
00121 $cc++;
00122 $theFields.='
00123 <input type=hidden name="ordline'.$cc.'-1" value="'.htmlspecialchars($rec["rec"]["itemnumber"]).'">
00124 <input type=hidden name="ordline'.$cc.'-2" value="'.htmlspecialchars($rec["rec"]["title"]).'">
00125 <input type=hidden name="ordline'.$cc.'-3" value="'.$rec["count"].'">
00126 <input type=hidden name="ordline'.$cc.'-4" value="'.$this->priceFormat($rec["totalTax"]).'">';
00127 }
00128
00129 $theFields.='
00130 <input type=hidden name="priceinfo1.Shipping" value="'.$this->priceFormat($this->calculatedSums_tax["shipping"]).'">';
00131 $theFields.='
00132 <input type=hidden name="priceinfo2.Payment" value="'.$this->priceFormat($this->calculatedSums_tax["payment"]).'">';
00133 $theFields.='
00134 <input type=hidden name="priceinfo3.Tax" value="'.$this->priceFormat($this->calculatedSums_tax["total"]-$this->calculatedSums_no_tax["total"]).'">';
00135 $markerArray["###HIDDEN_FIELDS###"].=$theFields;
00136 }
00137 $content= $this->cObj->substituteMarkerArrayCached($content, $markerArray);
00138 break;
00139 case "decline":
00140 $markerArray=array();
00141 $markerArray["###REASON_CODE###"] = t3lib_div::_GP("reason");
00142 $content=$this->getBasket("###DIBS_DECLINE_TEMPLATE###",$localTemplateCode, $markerArray);
00143 break;
00144 case "cancel":
00145 $content=$this->getBasket("###DIBS_SOLOE_CANCEL_TEMPLATE###",$localTemplateCode, $markerArray);
00146 break;
00147 case "accept":
00148 $content=$this->getBasket("###DIBS_ACCEPT_TEMPLATE###",$localTemplateCode);
00149
00150
00151 $k1=$lConf["k1"];
00152 $k2=$lConf["k2"];
00153
00154
00155 $amount=round($this->calculatedSums_tax["total"]*100);
00156 $currency="208";
00157 $transact=t3lib_div::_GP("transact");
00158 $md5key= md5($k2.md5($k1."transact=".$transact."&amount=".$amount."¤cy=".$currency));
00159 $authkey=t3lib_div::_GP("authkey");
00160 if ($md5key != $authkey) {
00161 $content=$this->getBasket("###DIBS_DECLINE_MD5_TEMPLATE###",$localTemplateCode);
00162 } elseif (t3lib_div::_GP("orderid")!=$this->getOrderNumber($orderUid)) {
00163 $content=$this->getBasket("###DIBS_DECLINE_ORDERID_TEMPLATE###",$localTemplateCode);
00164 } else {
00165 $markerArray=array();
00166 $markerArray["###TRANSACT_CODE###"] = t3lib_div::_GP("transact");
00167
00168 $content=$this->getBasket("###BASKET_ORDERCONFIRMATION_TEMPLATE###","",$markerArray);
00169 $this->finalizeOrder($orderUid,$markerArray);
00170 }
00171
00172
00173
00174
00175
00176
00177
00178
00179 break;
00180 default:
00181 if ($lConf["relayURL"]) {
00182 $markerArray=array();
00183 $markerArray["###REDIRECT_URL###"] = 'https:
00184 $content=$this->getBasket("###DIBS_REDIRECT_TEMPLATE###",$localTemplateCode, $markerArray);
00185 } else {
00186 $content = "NO .relayURL given!!";
00187 }
00188 break;
00189 }
00190 ?>