Subversion Repositories wpShopGermany4

Rev

Rev 5922 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

        /**
        * Dieses Template wird nach einer Targo Zahlung angezeigt
        */

        if ($this->get_option('wpsg_mod_targo_url_use') == 0)
        {
                $url = $this->get_option('wpsg_mod_targo_url_live');
        }
        else
        {
                $url = $this->get_option('wpsg_mod_targo_url_test');
        }
        
?>

<p><?php echo __('Um den Betrag mit einer Finanzierung bei der TARGOBANK zu bezahlen, klicken Sie bitte auf folgendes Logo.', 'wpsg'); ?></p> 
<p>
<!--
        <a title="<?php echo __('Mit Targo bezahlen', 'wpsg'); ?>" href="<?php echo $url; ?>">
                <img src="<?php echo $this->getRessourceURL('gfx/targologo.png'); ?>" align="left" alt="<?php echo __('Finanzierung bei Targo beantragen.', 'wpsg'); ?>" style="margin-right:7px;">
         
        </a>
-->
</p>
<script type="text/javascript">document.charset = 'ISO-8859-1';</script>
<form class="wpsg_productform" id="wpsg_produktform" accept-charset="ISO-8859-1" method="post" action="<?php echo $url ?>">

<input type="image" name="image" src="<?php echo $this->getRessourceURL('gfx/targologo.png'); ?>" alt="<?php echo __('Finanzierung bei Targo beantragen.', 'wpsg'); ?>" style="margin-right:7px;">

<div style="display:none;">
<?php $o_id = $this->view['o_id'];
          $k_id = $this->view['k_id'];
          $oOrder = wpsg_order::getInstance($o_id);
          $brutto = $oOrder->getAmount(WPSG_BRUTTO);
          $brutto = wpsg_round($brutto, 2);
          /** @var wpsg_customer */
          $oCustomer = wpsg_customer::getInstance($k_id);
          /*
          $geb1 = $oCustomer->getBirthdate("Y-m-d");
          $geb2 = $oCustomer->getBirthdate();
          $geb3 = $oCustomer->data["geb"];
          $geb4 = wpsg_date("Y-m-d", strtotime($geb3));
          $geb5 = strtotime($geb3);
          $geb6 = strtotime("0000-00-00");
          $geb6 = strtotime("1901-12-13");
          $geb6 = strtotime("1901-12-14");
          */ 
          $dl = $this->view['targoLink'];
          
          $street = $oOrder-> getInvoiceStreetClear(true);
          $nr = $oOrder-> getInvoiceStreetNr();
          
?>
<?php ?>
<?php 

if (method_exists($oCustomer, getTitle)) {
        $titel = $oCustomer->getTitle();
}
else
{
        $titel = $oCustomer->title;
}
$isotitel = '';
if (($titel == "Herr") || ($titel == "Frau")) $isotitel = toIso($titel);

$dt = $oCustomer->getBirthdate("Y-m-d");

if ($oCustomer->geb == '0000-00-00' || strtotime($dt) === false)
{

        $bd = '';

}
else
{

        $bd = $oCustomer->getBirthdate("Y-m-d");

}


function toIso($string) {
        //return mb_convert_encoding($string, "ISO-8859-1");
    return utf8_decode(utf8_encode($string));
}

$hash = '';
$key = '123456';
$key = $this->get_option('wpsg_mod_targo_hashkey');
//$param = "amount=5000&koop_id=testidkk89&dealerText=https%3A%2F%2Fwww.targobank.de&documentno=&".
//              "dealerShopURL=&dealerAbortURL=&dealerID=123456&birthday=1970-12-31";

$arr = Array("koop_id" => $this->get_option('wpsg_mod_targo_koop_id'),
        "SessionID" => session_id(),
        "amount" => $brutto,
        "dealerID" => $this->get_option('wpsg_mod_targo_dealerid'),
        "dealerText" => ($this->view['targoLink']),
        "documentno" => $this->view['o_id'],
        "gender" => $isotitel,
        "surname" => toIso($oCustomer->getName()),
        "firstname" => toIso($oCustomer->getFirstname()),
        "street" => toIso($oOrder->getInvoiceStreetClear(true)),
        "streetnumber" => toIso($oOrder->getInvoiceStreetNr()),
        "zip" =>  toIso($oCustomer->getZip()),
        "city" => toIso($oCustomer->getCity()),
        "telnocode" => '',
        "telno" => toIso($oCustomer->getPhone()),
        "birthday" => $bd,
        "email" => toIso($oCustomer->getEMail()),
        "dealerShopURL" => ($this->get_option('wpsg_mod_targo_dealerShopURL')),
        "dealerAbortURL" => ($this->get_option('wpsg_mod_targo_dealerAbortURL'))
);

$param = http_build_query($arr);


$hash = hash_hmac( 'sha256', $param, $key);     // HMAC-SHA256

// Test
//$hash = "85ef6ddce9bbebffa250d6f8183f3f727af5f9fda879b73aa0685eb2d9386e70";

?>

<br /><br />
<b>Obligatorische Daten für Targobank</b><br />
<input type="text" id="koop_id" name="koop_id" value="<?php echo $this->get_option('wpsg_mod_targo_koop_id');?>" placeholder="koop_id"><br />
<input type="text" id="SessionID" name="sessionID" value="<?php echo session_id();?>" placeholder="sessionID"><br />
<input type="text" id="amount" name="amount" value="<?php echo $brutto;?>" placeholder="amount"><br />
<input type="text" id="dealerID" name="dealerID" value="<?php echo $this->get_option('wpsg_mod_targo_dealerid');?>" placeholder="dealerID"><br />
<input type="text" id="dealerText" name="dealerText" value="<?php echo $this->view['targoLink'];?>" placeholder="dealerText"><br />
<input type="text" id="documentno" name="documentno" value="<?php echo $this->view['o_id'];?>" placeholder="documentno"><br />




<b>Adressdaten aus Kundendaten</b><br />
<input type="text" id="gender" name="gender" value="<?php echo $isotitel;?>" placeholder="titel"><br />
<input type="text" id="surname" name="surname" value="<?php echo toIso($oCustomer->getName());?>" placeholder="surname"><br />
<input type="text" id="firstname" name="firstname" value="<?php echo toIso($oCustomer->getFirstname());?>" placeholder="firstname"><br />
<input type="text" id="street" name="street" value="<?php echo toIso($oOrder->getInvoiceStreetClear(true));?>" placeholder="street"><br />
<input type="text" id="streetnumber" name="streetnumber" value="<?php echo toIso($oOrder->getInvoiceStreetNr());?>" placeholder="streetnumber"><br />
<input type="text" id="zip" name="zip" value="<?php echo toIso($oCustomer->getZip());?>" placeholder="zip"><br />
<input type="text" id="city" name="city" value="<?php echo toIso($oCustomer->getCity());?>" placeholder="city"><br />
<input type="text" id="telnocode" name="telnocode" value="" placeholder="vorwahl"><br />
<input type="text" id="telno" name="telno" value="<?php echo toIso($oCustomer->getPhone());?>" placeholder="telno"><br />
<input type="text" id="birthday" name="birthday" value="<?php echo $bd;?>" placeholder="birthday"><br />
<input type="text" id="email" name="email" value="<?php echo toIso($oCustomer->getEMail());?>"  placeholder="email"><br />

<b>Optionale Daten für Targobank</b><br />
<input type="text" id="dealerShopURL" name="dealerShopURL" value="<?php echo $this->get_option('wpsg_mod_targo_dealerShopURL');?>" placeholder="dealerShopURL"><br />
<input type="text" id="dealerAbortURL" name="dealerAbortURL" value="<?php echo $this->get_option('wpsg_mod_targo_dealerAbortURL');?>" placeholder="dealerAbortURL"><br />
<input type="text" id="hash" name="hash" value="<?php echo $hash;?>" placeholder="hash">(hashkey)<br />


<input type="submit" id="submit" name="submit" value="submit" >

</div>
</form>


<?php if ($this->get_option('wpsg_mod_targo_autostart') == '1') { ?>
<script type="text/javascript">/* <![CDATA[ */
 
        jQuery(document).ready(function() { 
                window.setTimeout(function() {
                        //location.href = "<?php echo $url;?>";
                        jQuery('#submit').trigger("click");
                }, 1000);
        } );
        
/* ]]> */</script>
<?php } ?>