ACC SHELL
<?php
//Lyoness step by step instruction for Grisport.cz
/*
* Organisation ID: 1828435
* Checksum-Code: 862146702
* Currency: CZK
* Event-ID (9%): 283552
*/
class Lyoness {
/**
* This parameter is Mandatory. it is your Advertiser ID in our system.
* It is a fixed parameter provided by Lyoness
*/
const ORGANIZATION = "1828435";
/**
* Secret code for generating checkSumCode
*/
const SECRET_CODE = "862146702";
/**
* This parameter is Mandatory. It is linked to your organization. Several envets
* can be used by one advertiser. For example if you sell DVDs and CDs, it can be suitable
* to have one event per product type. This is for reporting and commission purposes.
* It is a fixed parameter provided by Lyoness.
*/
const EVENT = "283552";
/**
* This parameter is Mandatory. It depends on the country in which your program is open.
* You must send us the currency in which the sale has been made
*/
const CURRENCY = "CZK";
/**
* Event type:
* in most cases $isSale should be left as true unsless you are arranged a lead commission with Lyoness
* true = Sale, false = Lead
*/
const isSale = true;
/**
* This parameter is Mandatory. This value has to be unique for each order.
* Ideally you should send us your internall reference id for the transaction
* @var type
*/
public $orderNumber = false;
/**
* This parameter is Mandatory. You need to send us the value of the transaction
* (gross or net amount, with or without delivery - depends on the agreement)
* @var type
*/
public $orderValue = "0.00";
/**
* You should implement the checksum to guarantee high quality tracking though
* is is not really mandatory. If you do not implement the checksum, please give us the
* info as we have do disable it in our System. The checksum is an aggegated variable used to
* make sure that each transaction is unique.
* It is built as follows: V04 + md5 (secretCode + orderNumber + orderValue).
* All parameters between barckets are hashed ind the md5
*/
public $checkSum = false;
/**
* This parameter is mandatory. This variable is filled with the TDUID value
* that was stOred in a permanent cookie called TRADEDOUBLER and set by your domain.
* It is also stored in a session variable.
*/
public $tduid = false;
/**
* This parameter is optional. You can use it to send extra information about
* the sale, e.g. the content of the basket. As this variable contains a character
* string, it has to be URL encoded and in the UTF-8 encoding format
* @var type
*/
public $reportInfo = false;
/*
* Encrypted connection on this page:
* true = Yes (https), false = No (http)
*/
public $isSecure = false;
public function __construct() {
}
/**
* It is built as follows: V04 + md5 (secretCode + orderNumber + orderValue).
* All parameters between barckets are hashed ind the md5
* V04 is constant, secretCode is constant provided by Lyoness
* @param type $orderNumber
* @param type $orderValue
* @return string md5 hash
*/
public function calculateCheckSum($orderNumber, $orderValue) {
$this->checkSum = 'V04' . md5(self::SECRET_CODE . $orderNumber . $orderValue);
return $this->checkSum;
}
/**
* Encrypted connection on this page:
* true = Yes (https), false = No (http)
* @return string
*/
public function getScheme() {
return $this->isSecure == true ? 'https' : 'http';
}
}
$Lyoness = new Lyoness();
$organization = Lyoness::ORGANIZATION;
$currency = Lyoness::CURRENCY;
$event = Lyoness::EVENT;
$isSale = Lyoness::isSale;
$scheme = $Lyoness->getScheme();
// Value of the sale. sale specific value has to be assigned dynamically out of the shop DB
// Leave as "0.00" if not applicable.
$orderValue = isset($_SESSION['heureka']['cena_celkem']) ? $_SESSION['heureka']['cena_celkem'] : 0;
$orderNumber = isset($_SESSION['heureka']['id_objednavky']) ? $_SESSION['heureka']['id_objednavky'] : '000000';
// If you do not use the built-in session functionality in PHP, modify
// the following expressions to work with your session handling routines.
//
$tduid = "";
if (!empty($_SESSION["TRADEDOUBLER"])) {
$tduid = $_SESSION["TRADEDOUBLER"];
}
// OPTIONAL: You may transmit a list of items ordered in the reportInfo
// parameter. See the chapter reportInfo for details.
//
$reportInfo = "";
$reportInfo = urlencode($reportInfo);
/* * *** IMPORTANT: **** */
/* * *** In most cases, you should not edit anything below this line. **** */
/* * *** Please consult with TradeDoubler before modifying the code. **** */
if (!empty($_COOKIE["TRADEDOUBLER"])) {
$tduid = $_COOKIE["TRADEDOUBLER"];
}
if ($isSale) {
$domain = "tbs.tradedoubler.com";
$checkNumberName = "orderNumber";
} else {
$domain = "tbl.tradedoubler.com";
$checkNumberName = "leadNumber";
$orderValue = "1";
}
$checksum = $Lyoness->calculateCheckSum($orderNumber, $orderValue);
$trackBackUrl = $scheme . "://" . $domain . "/report"
. "?organization=" . $organization
. "&event=" . $event
. "&" . $checkNumberName . "=" . $orderNumber
. "&checksum=" . $checksum
. "&tduid=" . $tduid
. "&reportInfo=" . $reportInfo;
if ($isSale) {
$trackBackUrl
.= "&orderValue=" . $orderValue
.= "&currency=" . $currency;
}
echo "<img src=\"" . $trackBackUrl . "\" alt=\"\" style=\"border: none\" />";
/*
* <img src="http://tbs.tradedoubler.com/report?
* organization=1828435&
* event=283552&
* orderNumber=204&
* checksum=V040a80827c165ef530b4c463ae5a922524&
* tduid=&
* reportInfo=&
* orderValue=2417&
* currency=CZK" alt="" style="border: none">
*
*
*/
?>
ACC SHELL 2018