Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit 779b807

Browse files
committed
Release 1.0.17
1 parent 3e718b7 commit 779b807

File tree

8 files changed

+36
-15
lines changed

8 files changed

+36
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ This repository contains the OpenCart wallee payment module that enables the sh
1111

1212
## Documentation
1313

14-
* [English](https://plugin-documentation.wallee.com/wallee-payment/opencart-2.0/1.0.16/docs/en/documentation.html)
14+
* [English](https://plugin-documentation.wallee.com/wallee-payment/opencart-2.0/1.0.17/docs/en/documentation.html)
1515

1616
## License
1717

18-
Please see the [license file](https://github.com/wallee-payment/opencart-2.0/blob/1.0.16/LICENSE) for more information.
18+
Please see the [license file](https://github.com/wallee-payment/opencart-2.0/blob/1.0.17/LICENSE) for more information.

docs/en/documentation.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h2>Documentation</h2> </div>
2121
</a>
2222
</li>
2323
<li>
24-
<a href="https://github.com/wallee-payment/opencart-2.0/releases/tag/1.0.16/">
24+
<a href="https://github.com/wallee-payment/opencart-2.0/releases/tag/1.0.17/">
2525
Source
2626
</a>
2727
</li>
@@ -48,7 +48,7 @@ <h1>
4848
<div class="olist arabic">
4949
<ol class="arabic">
5050
<li>
51-
<p><a href="https://github.com/wallee-payment/opencart-2.0/releases/tag/1.0.16/">Download</a> the extension.</p>
51+
<p><a href="https://github.com/wallee-payment/opencart-2.0/releases/tag/1.0.17/">Download</a> the extension.</p>
5252
</li>
5353
<li>
5454
<p>Extract the files and upload the content of the <code>Upload</code> directory into the root directory of your store using FTP/SSH.</p>

upload/admin/model/extension/wallee/migration.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ class ModelExtensionWalleeMigration extends Model {
77
'name' => 'initialize',
88
'version' => '1.0.0',
99
'function' => 'oc_wallee_update_1_0_0_initialize'
10-
)
10+
),
11+
'1.0.1' => array(
12+
'name' => 'order_id_nullable',
13+
'version' => '1.0.1',
14+
'function' => 'oc_wallee_update_1_0_1_order_id_nullable'
15+
)
1116
);
1217

1318
public function migrate(){
@@ -230,4 +235,9 @@ private function oc_wallee_update_1_0_0_initialize(){
230235
UNIQUE KEY (`constraint_key`)
231236
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
232237
}
238+
239+
private function oc_wallee_update_1_0_1_order_id_nullable(){
240+
$this->db->query(
241+
"ALTER TABLE `" . DB_PREFIX . "wallee_transaction_info` MODIFY COLUMN `order_id` int(11) unsigned NULL;");
242+
}
233243
}

upload/admin/view/template/extension/wallee/transaction.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
<input type="text" class="form-control" name="filters[space_view_id]" value="<?php if(isset($filters['space_view_id'])) { echo $filters['space_view_id']; }?>">
9494
</td>
9595
<td class="text-right">
96-
<!-- TODO dropdown -->
9796
<select class="form-control" name="filters[state]">
9897
<?php foreach ($order_statuses as $status): ?>
9998
<option value="<?php echo $status?>" <?php if(isset($filters['state']) && $filters['state'] == $status) { echo "selected"; } ?>><?php echo $status; ?></option>

upload/system/library/wallee/dynamic/catalog/controller.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function confirm(){
4343
$this->load->language('payment/wallee');
4444
$result['message'] = $this->language->get('error_confirmation');
4545
unset($this->session->data['order_id']); // this order number cannot be used anymore
46+
Wallee\Service\Transaction::instance($this->registry)->clearTransactionInSession();
4647
}
4748

4849
$this->response->addHeader('Content-Type: application/json');

upload/system/library/wallee/entity/abstract_entity.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,15 @@ public function save(){
170170
$valuesQuery = '';
171171

172172
foreach ($data_array as $key => $value) {
173-
$valuesQuery .= "`" . $key . '`="' . $db->escape($value) . '",';
173+
if($value === null) {
174+
$value = 'NULL';
175+
}
176+
else {
177+
$value = '"'.$db->escape($value) .'"';
178+
}
179+
if($value !== null) {
180+
$valuesQuery .= "`$key`=$value,";
181+
}
174182
}
175183

176184
$valuesQuery = rtrim($valuesQuery, ',');

upload/system/library/wallee/helper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private function __construct(Registry $registry){
5151
*/
5252
public function getCustomerSessionIdentifier(){
5353
$customer = $this->getCustomer();
54-
if (isset($customer['customer_id']) && $this->registry->get('customer')->isLogged()) {
54+
if (isset($customer['customer_id']) && $this->registry->get('customer') && $this->registry->get('customer')->isLogged()) {
5555
return "customer_" . $customer['customer_id'];
5656
}
5757
$guestId = $this->buildGuestSessionIdentifier($customer);
@@ -73,7 +73,7 @@ public function getCustomerSessionIdentifier(){
7373
}
7474

7575
private function buildCartSessionIdentifier(array $data){
76-
if (isset($data['cart']) && is_array($data['cart']) && count($data['cart'] == 1)) {
76+
if (isset($data['cart']) && is_array($data['cart']) && count($data['cart']) == 1) {
7777
$cartKeys = array_keys($data['cart']);
7878
return "cart_" . hash('sha512', $cartKeys[0]);
7979
}
@@ -151,7 +151,7 @@ public function getAddress($key, $order_info = array()){
151151
$address = $this->getAddress('payment', $order_info);
152152
}
153153
if(empty($address)) {
154-
if ($customer->isLogged() && isset($session[$key . '_address_id'])) {
154+
if ($customer && $customer->isLogged() && isset($session[$key . '_address_id'])) {
155155
$address = $address_model->getAddress($session[$key . '_address_id']);
156156
}
157157
if (isset($session['guest'][$key]) && is_array($session['guest'][$key])) { // billing only
@@ -297,7 +297,7 @@ public function getOrderModel(){
297297

298298
public function getCustomer(){
299299
$data = $this->registry->get('session')->data;
300-
if ($this->registry->get('customer')->isLogged()) {
300+
if ($this->registry->get('customer') && $this->registry->get('customer')->isLogged()) {
301301
$customer_id = $this->registry->get('session')->data['customer_id'];
302302
$this->registry->get('load')->model('account/customer');
303303
$customer = $this->registry->get('model_account_customer')->getCustomer($customer_id);
@@ -494,7 +494,7 @@ public function getWebhookUrl(){
494494
public function isValidOrder($order_id){
495495
if (!$this->isAdmin()) {
496496
$order_info = $this->getOrder($order_id);
497-
if ($this->registry->get('customer')->isLogged() && isset($this->registry->get('session')->data['customer_id'])) {
497+
if ($this->registry->get('customer') && $this->registry->get('customer')->isLogged() && isset($this->registry->get('session')->data['customer_id'])) {
498498
if ($this->registry->get('session')->data['customer_id'] != $order_info['customer_id']) {
499499
return false;
500500
}

upload/system/library/wallee/service/transaction.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function getJavascriptUrl(){
3939
$transaction = $this->getTransaction(array(), false, array(
4040
\Wallee\Sdk\Model\TransactionState::PENDING
4141
));
42+
$this->persist($transaction, array());
4243
return $this->getTransactionService()->buildJavaScriptUrl($transaction->getLinkedSpaceId(), $transaction->getId());
4344
}
4445

@@ -142,7 +143,7 @@ public function getTransaction($order_info = array(), $cache = true, $allowed_st
142143
$create = empty($allowed_states) ? false : !in_array(self::$transaction_cache[$sessionId]->getState(), $allowed_states);
143144
}
144145
if ($create) {
145-
unset($order_info['order_id']);
146+
throw new Exception("Order ID was already used."); // Todo test
146147
}
147148
}
148149

@@ -155,9 +156,11 @@ public function getTransaction($order_info = array(), $cache = true, $allowed_st
155156
}
156157

157158
private function persist($transaction, array $order_info){
159+
$id = null;
158160
if (isset($order_info['order_id'])) {
159-
$this->updateTransactionInfo($transaction, $order_info['order_id']);
161+
$id = $order_info['order_id']; // Todo test
160162
}
163+
$this->updateTransactionInfo($transaction, $id);
161164
$this->storeTransactionIdsInSession($transaction);
162165
$this->storeCoupon($transaction);
163166
$this->storeShipping($transaction);
@@ -485,7 +488,7 @@ private function hasTransactionInSession(){
485488
\WalleeHelper::instance($this->registry)->compareStoredCustomerSessionIdentifier();
486489
}
487490

488-
private function clearTransactionInSession(){
491+
public function clearTransactionInSession(){
489492
if ($this->hasTransactionInSession()) {
490493
unset($this->registry->get('session')->data['wallee_transaction_id']);
491494
unset($this->registry->get('session')->data['wallee_customer']);

0 commit comments

Comments
 (0)