1
|
|
|
<?php |
2
|
|
|
class Install_Helper_OnlinePayment { |
3
|
|
|
|
4
|
|
|
private $kernel; |
5
|
|
|
private $db; |
6
|
|
|
|
7
|
|
|
public function __construct($kernel, $db) { |
8
|
|
|
$this->kernel = $kernel; |
9
|
|
|
$this->db = $db; |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
public function setProvider() |
13
|
|
|
{ |
14
|
|
|
require_once 'Intraface/modules/onlinepayment/OnlinePayment.php'; |
15
|
|
|
$onlinepayment = new OnlinePayment($this->kernel); |
16
|
|
|
$onlinepayment->setProvider(array('provider_key' => 2)); |
17
|
|
|
$onlinepayment = OnlinePayment::factory($this->kernel); |
18
|
|
|
$onlinepayment->setSettings(array('merchant_id' => '12345678', 'md5_secret' => 'qqqaaasss')); |
|
|
|
|
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
|
22
|
|
|
public function createAndAttachToOrder() { |
23
|
|
|
|
24
|
|
|
require_once 'Intraface/modules/onlinepayment/OnlinePayment.php'; |
25
|
|
|
$onlinepayment = new OnlinePayment($this->kernel); |
26
|
|
View Code Duplication |
if (!$onlinepayment->save(array('belong_to' => 'order', 'belong_to_id' => 1, 'transaction_number' => 111, 'transaction_status' => '000', 'amount' => 200))) { |
27
|
|
|
echo $onlinepayment->error->view(); |
|
|
|
|
28
|
|
|
die; |
|
|
|
|
29
|
|
|
} |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function createInEurAndAttachToInvoice() { |
33
|
|
|
|
34
|
|
|
require_once 'Intraface/modules/currency/Currency/Gateway.php'; |
35
|
|
|
$doctrine = Doctrine_Manager::connection(DB_DSN); |
36
|
|
|
$gateway = new Intraface_modules_currency_Currency_Gateway($doctrine); |
37
|
|
|
$currency = $gateway->findByIsoCode('Eur'); |
38
|
|
|
|
39
|
|
|
require_once 'Intraface/modules/onlinepayment/OnlinePayment.php'; |
40
|
|
|
$onlinepayment = new OnlinePayment($this->kernel); |
41
|
|
View Code Duplication |
if (!$onlinepayment->save(array('belong_to' => 'invoice', 'belong_to_id' => 1, 'transaction_number' => 111, 'transaction_status' => '000', 'amount' => 100, 'currency' => $currency))) { |
42
|
|
|
echo $onlinepayment->error->view(); |
|
|
|
|
43
|
|
|
die; |
|
|
|
|
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
} |
48
|
|
|
?> |
|
|
|
|
49
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.