3
3
* Payrexx Payment Gateway.
4
4
*
5
5
* @author Payrexx <[email protected] >
6
- * @copyright 2023 Payrexx
6
+ * @copyright 2024 Payrexx
7
7
* @license MIT License
8
8
*/
9
9
10
10
namespace Payrexx \PayrexxPaymentGateway \Service ;
11
11
12
- use Cart ;
13
- use Configuration ;
14
- use Context ;
15
- use Customer ;
16
- use Db ;
17
- use Module ;
18
- use OrderHistory ;
19
-
20
12
if (!defined ('_PS_VERSION_ ' )) {
21
13
exit ;
22
14
}
@@ -50,10 +42,10 @@ public function createOrder(
50
42
$ paymentMethod ,
51
43
array $ extraVars = []
52
44
) {
53
- $ payrexxModule = Module::getInstanceByName ('payrexx ' );
54
- $ cart = new Cart ($ cartId );
55
- $ customer = new Customer ($ cart ->id_customer );
56
- $ statusId = (int ) Configuration::get ($ prestaStatus );
45
+ $ payrexxModule = \ Module::getInstanceByName ('payrexx ' );
46
+ $ cart = new \ Cart ($ cartId );
47
+ $ customer = new \ Customer ($ cart ->id_customer );
48
+ $ statusId = (int ) \ Configuration::get ($ prestaStatus );
57
49
58
50
$ payrexxModule ->validateOrder (
59
51
(int ) $ cart ->id ,
@@ -66,7 +58,7 @@ public function createOrder(
66
58
false ,
67
59
$ customer ->secure_key
68
60
);
69
- $ context = Context::getContext ();
61
+ $ context = \ Context::getContext ();
70
62
$ context ->cart = $ cart ;
71
63
}
72
64
@@ -108,13 +100,13 @@ public function transitionAllowed($newStatus, $oldStatusId)
108
100
{
109
101
switch ($ newStatus ) {
110
102
case self ::PS_STATUS_ERROR :
111
- return !in_array ($ oldStatusId , [(int ) Configuration::get (self ::PS_STATUS_PAYMENT ), (int ) Configuration::get (self ::PS_STATUS_REFUND )]);
103
+ return !in_array ($ oldStatusId , [(int ) \ Configuration::get (self ::PS_STATUS_PAYMENT ), (int ) \ Configuration::get (self ::PS_STATUS_REFUND )]);
112
104
case self ::PS_STATUS_REFUND :
113
- return in_array ($ oldStatusId , [(int ) Configuration::get (self ::PS_STATUS_PAYMENT ), (int ) Configuration::get (self ::PS_STATUS_REFUND )]);
105
+ return in_array ($ oldStatusId , [(int ) \ Configuration::get (self ::PS_STATUS_PAYMENT ), (int ) \ Configuration::get (self ::PS_STATUS_REFUND )]);
114
106
case self ::PS_STATUS_PAYMENT :
115
- return $ oldStatusId !== (int ) Configuration::get (self ::PS_STATUS_PAYMENT );
107
+ return $ oldStatusId !== (int ) \ Configuration::get (self ::PS_STATUS_PAYMENT );
116
108
case self ::PS_STATUS_BANKWIRE :
117
- return $ oldStatusId !== (int ) Configuration::get (self ::PS_STATUS_BANKWIRE );
109
+ return $ oldStatusId !== (int ) \ Configuration::get (self ::PS_STATUS_BANKWIRE );
118
110
}
119
111
}
120
112
@@ -125,8 +117,8 @@ public function transitionAllowed($newStatus, $oldStatusId)
125
117
*/
126
118
public function updateOrderStatus ($ prestaStatus , $ order )
127
119
{
128
- $ orderHistory = new OrderHistory ();
129
- $ prestaStatusId = Configuration::get ($ prestaStatus );
120
+ $ orderHistory = new \ OrderHistory ();
121
+ $ prestaStatusId = \ Configuration::get ($ prestaStatus );
130
122
131
123
$ orderHistory ->id_order = (int ) $ order ->id ;
132
124
$ orderHistory ->changeIdOrderState ($ prestaStatusId , $ order , true );
@@ -145,7 +137,7 @@ public function getCartGatewayId($id_cart)
145
137
return 0 ;
146
138
}
147
139
148
- return (int ) Db::getInstance (_PS_USE_SQL_SLAVE_ )->getValue ('
140
+ return (int ) \ Db::getInstance (_PS_USE_SQL_SLAVE_ )->getValue ('
149
141
SELECT id_gateway FROM ` ' . _DB_PREFIX_ . 'payrexx_gateway`
150
142
WHERE id_cart = ' . (int ) $ id_cart );
151
143
}
0 commit comments