1 | <?php |
||
10 | class Threatmetrix |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $organizationId; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $sessionId; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $session; |
||
26 | |||
27 | /** |
||
28 | * @param string $organizationId |
||
29 | * @param string $clientId |
||
30 | */ |
||
31 | 1 | public function __construct($organizationId, $clientId) |
|
37 | |||
38 | /** |
||
39 | * @return string |
||
40 | */ |
||
41 | 1 | public function getOrganizationId() |
|
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | 1 | public function getSessionId() |
|
53 | |||
54 | /** |
||
55 | * @return string |
||
56 | */ |
||
57 | 1 | public function getSession() |
|
61 | |||
62 | /** |
||
63 | * @return string |
||
64 | */ |
||
65 | 1 | public function getUrlQuery() |
|
66 | { |
||
67 | 1 | return http_build_query(array( |
|
68 | 1 | 'org_id' => $this->organizationId, |
|
69 | 1 | 'session_id' => $this->sessionId, |
|
70 | 1 | )); |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * Return the tracking code, that has to be placed to the page where the payment form is |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | 1 | public function getTrackingCode() |
|
79 | { |
||
80 | 1 | $urlQuery = $this->getUrlQuery(); |
|
81 | |||
82 | return <<<TRACKING |
||
83 | <div style="position:absolute;left:0;bottom:0"> |
||
84 | 1 | <p style="margin:0;background:url(https://h.online-metrix.net/fp/clear.png?{$urlQuery}&session2={$this->session}&m=1)"></p> |
|
85 | 1 | <img src="https://h.online-metrix.net/fp/clear.png?{$urlQuery}&m=2"/> |
|
86 | 1 | <script src="https://h.online-metrix.net/fp/check.js?{$urlQuery}"></script> |
|
87 | 1 | <object type="application/x-shockwave-flash" data="https://h.online-metrix.net/fp/fp.swf?{$urlQuery}" width="1" height="1" id="thm_fp"> |
|
88 | 1 | <param name="movie" value="https://h.online-metrix.net/fp/fp.swf?{$urlQuery}" /> |
|
89 | </object> |
||
90 | 1 | </div> |
|
91 | 1 | TRACKING; |
|
92 | } |
||
93 | |||
94 | /** |
||
95 | * @return string |
||
96 | */ |
||
97 | 1 | public function getTrackingUrl() |
|
103 | } |
||
104 |
Let’s take a look at an example: