|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Oledrion; |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
You may not change or alter any portion of this comment or credits |
|
7
|
|
|
of supporting developers from this source code or any supporting source code |
|
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
9
|
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
|
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* oledrion |
|
17
|
|
|
* |
|
18
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
19
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
20
|
|
|
* @author Hossein Azizabadi ([email protected]) |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
use XoopsModules\Oledrion; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Class PaymentHandler |
|
27
|
|
|
*/ |
|
28
|
|
|
class PaymentHandler extends OledrionPersistableObjectHandler |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* PaymentHandler constructor. |
|
32
|
|
|
* @param \XoopsDatabase|null $db |
|
33
|
|
|
*/ |
|
34
|
|
|
public function __construct(\XoopsDatabase $db = null) |
|
35
|
|
|
{ |
|
36
|
|
|
// Table Classe Id |
|
37
|
|
|
parent::__construct($db, 'oledrion_payment', Payment::class, 'payment_id'); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param Parameters $parameters |
|
42
|
|
|
* @return array |
|
43
|
|
|
*/ |
|
44
|
|
|
public function getAllPayment(Parameters $parameters) |
|
45
|
|
|
{ |
|
46
|
|
|
$parameters = $parameters->extend(new Oledrion\Parameters([ |
|
47
|
|
|
'start' => 0, |
|
48
|
|
|
'limit' => 0, |
|
49
|
|
|
'sort' => 'payment_id', |
|
50
|
|
|
'order' => 'ASC', |
|
51
|
|
|
])); |
|
52
|
|
|
$critere = new \Criteria('payment_id', 0, '<>'); |
|
53
|
|
|
$critere->setLimit($parameters['limit']); |
|
54
|
|
|
$critere->setStart($parameters['start']); |
|
55
|
|
|
$critere->setSort($parameters['sort']); |
|
56
|
|
|
$critere->setOrder($parameters['order']); |
|
57
|
|
|
$categories = []; |
|
58
|
|
|
$categories = $this->getObjects($critere); |
|
59
|
|
|
|
|
60
|
|
|
return $categories; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @param $delivery_id |
|
65
|
|
|
* @return array |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getThisDeliveryPayment($delivery_id) |
|
68
|
|
|
{ |
|
69
|
|
|
/** @var \XoopsDatabase $db */ |
|
70
|
|
|
$db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
71
|
|
|
$deliveryPaymentHandler = new Oledrion\DeliveryPaymentHandler($db); |
|
72
|
|
|
$ret = []; |
|
73
|
|
|
$parameters = ['delivery' => $delivery_id]; |
|
74
|
|
|
$deliveryPayment = $deliveryPaymentHandler->getDeliveryPaymantId($parameters); |
|
75
|
|
|
foreach ($deliveryPayment as $payment) { |
|
76
|
|
|
$id[] = $payment['dp_payment']; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
$critere = new \CriteriaCompo(); |
|
80
|
|
|
$critere->add(new \Criteria('payment_id', '(' . implode(',', $id) . ')', 'IN')); |
|
|
|
|
|
|
81
|
|
|
$critere->add(new \Criteria('payment_online', 1)); |
|
82
|
|
|
$obj = $this->getObjects($critere); |
|
83
|
|
|
if ($obj) { |
|
84
|
|
|
foreach ($obj as $root) { |
|
85
|
|
|
$tab = []; |
|
86
|
|
|
$tab = $root->toArray(); |
|
87
|
|
|
$ret[] = $tab; |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
return $ret; |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|