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

Commit 825ed7e

Browse files
committed
Release 1.0.18
1 parent 779b807 commit 825ed7e

File tree

6 files changed

+60
-26
lines changed

6 files changed

+60
-26
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.17/docs/en/documentation.html)
14+
* [English](https://plugin-documentation.wallee.com/wallee-payment/opencart-2.0/1.0.18/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.17/LICENSE) for more information.
18+
Please see the [license file](https://github.com/wallee-payment/opencart-2.0/blob/1.0.18/LICENSE) for more information.

docs/en/assets/base.css

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,27 @@ h1 {
7070
h2 {
7171
font-size: 1.625rem;
7272
font-weight: 300;
73-
margin-bottom: 1.875rem;
73+
margin-bottom: 1.3rem;
7474
}
7575

7676
h3 {
7777
font-size: 1.3rem;
7878
font-weight: 300;
79-
margin-top: 1.875rem;
79+
margin-top: 1.3rem;
8080
}
8181

8282
h4 {
8383
font-size: 1.125rem;
8484
font-weight: 400;
8585
margin-top: 1.875rem;
86-
margin-bottom: 1.875rem;
86+
margin-bottom: 1.3rem;
8787
}
8888

8989
h5 {
9090
font-size: 1rem;
9191
font-weight: bold;
9292
margin-top: 1.875rem;
93-
margin-bottom: 1.875rem;
93+
margin-bottom: 1.3rem;
9494
}
9595

9696
p {
@@ -452,12 +452,18 @@ ol.glossary li::before {
452452
margin-top: 0;
453453
}
454454

455+
.chapter > .chapter-title h1 {
456+
border-bottom: 2px solid #eeeeee;
457+
margin-bottom: 1.5rem;
458+
padding-bottom: 0.2em;
459+
}
460+
455461
.chapter-title .title-number, .section-title .title-number {
456462
display: none;
457463
}
458464

459465
.paragraph {
460-
line-height: 2em;
466+
line-height: 1.75em;
461467
}
462468

463469
.paragraph + .paragraph {
@@ -554,14 +560,17 @@ ol.glossary li::before {
554560

555561
.admonitionblock.important {
556562
background: #fce1e1;
563+
border-left: 5px solid #ff6060;
557564
}
558565

559566
.admonitionblock.note, .admonitionblock.tip {
560567
background: #e0f2fc;
568+
border-left: 5px solid #88d5ff;
561569
}
562570

563571
.admonitionblock.caution, .admonitionblock.warning {
564572
background: #fdf3d8;
573+
border-left: 5px solid #f1c654;
565574
}
566575

567576
table.tableblock {

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.17/">
24+
<a href="https://github.com/wallee-payment/opencart-2.0/releases/tag/1.0.18/">
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.17/">Download</a> the extension.</p>
51+
<p><a href="https://github.com/wallee-payment/opencart-2.0/releases/tag/1.0.18/">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/system/library/wallee/helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function compareStoredCustomerSessionIdentifier(){
115115
case 'customer':
116116
return isset($customer['customer_id']) && 'customer_' . $customer['customer_id'] == $id;
117117
case 'user':
118-
return isset($customer['user_id']) && 'user_' . $customer['user_id'] == $id;
118+
return (isset($customer['user_id']) && 'user_' . $customer['user_id'] == $id) || (isset($data['user_id']) && 'user_' . $data['user_id'] == $id);
119119
case 'guest':
120120
return $this->buildGuestSessionIdentifier($customer) == $id;
121121
case 'cart':

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

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class LineItem extends AbstractService {
1616
private $products;
1717
private $shipping;
1818
private $coupon;
19+
private $coupon_total;
1920
private $voucher;
2021
private $total;
2122
private $xfeepro;
@@ -36,6 +37,7 @@ public function getReducedItemsFromOrder(array $order_info, $transaction_id, $sp
3637
$this->tax = \WalleeVersionHelper::newTax($this->registry);
3738
$this->tax->setShippingAddress($order_info['shipping_country_id'], $order_info['shipping_zone_id']);
3839
$this->tax->setPaymentAddress($order_info['payment_country_id'], $order_info['payment_zone_id']);
40+
$this->coupon_total = 0;
3941

4042
\WalleeHelper::instance($this->registry)->xfeeproDisableIncVat();
4143
$line_items = $this->getItemsFromOrder($order_info, $transaction_id, $space_id);
@@ -88,6 +90,7 @@ public function getItemsFromOrder(array $order_info){
8890
$order_total = 0;
8991
$items = array();
9092

93+
$this->coupon_total = 0;
9194
$this->fixed_taxes = array();
9295
$this->products = $order_model->getOrderProducts($order_info['order_id']);
9396
$voucher = $order_model->getOrderVouchers($order_info['order_id']);
@@ -190,6 +193,11 @@ private function createLineItems($currency_code){
190193
$calculated_total += $item->getAmountIncludingTax();
191194
}
192195

196+
if($this->coupon) {
197+
$items[] = $item = $this->createLineItemFromCoupon();
198+
$calculated_total += $item->getAmountIncludingTax();
199+
}
200+
193201
if ($this->shipping) {
194202
$items[] = $item = $this->createLineItemFromShipping();
195203
$calculated_total += $item->getAmountIncludingTax();
@@ -358,7 +366,13 @@ private function createLineItemFromProduct($product){
358366
elseif ($this->coupon['type'] == 'P') {
359367
$discount = $product['total'] / 100 * $this->coupon['discount'];
360368
}
361-
$amount_excluding_tax -= $discount;
369+
$this->coupon_total -= $discount;
370+
$line_item->setAttributes(array(
371+
"coupon" => new \Wallee\Sdk\Model\LineItemAttributeCreate(array(
372+
'label' => $this->coupon['name'],
373+
'value' => $discount
374+
))
375+
));
362376
}
363377

364378
$line_item->setName($product['name']);
@@ -403,8 +417,21 @@ private function createUniqueIdFromProduct($product){
403417
}
404418
return $id;
405419
}
406-
407-
private function createLineItemFromVoucher($voucher, $id){
420+
421+
private function createLineItemFromCoupon(){
422+
$line_item = new LineItemCreate();
423+
424+
$line_item->setName($this->coupon['name']);
425+
$line_item->setQuantity(1);
426+
$line_item->setType(LineItemType::DISCOUNT);
427+
$line_item->setSKU($this->coupon['code']);
428+
$line_item->setUniqueId($this->coupon['coupon_id']);
429+
$line_item->setAmountIncludingTax(\WalleeHelper::instance($this->registry)->formatAmount($this->coupon_total));
430+
431+
return $this->cleanLineItem($line_item);
432+
}
433+
434+
private function createLineItemFromVoucher(){
408435
$line_item = new LineItemCreate();
409436

410437
$line_item->setName($this->voucher['name']);

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

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ private function persist($transaction, array $order_info){
162162
}
163163
$this->updateTransactionInfo($transaction, $id);
164164
$this->storeTransactionIdsInSession($transaction);
165-
$this->storeCoupon($transaction);
166165
$this->storeShipping($transaction);
167166
}
168167

@@ -335,6 +334,10 @@ public function updateTransactionInfo(\Wallee\Sdk\Model\Transaction $transaction
335334
$info->setFailureReason($transaction->getFailureReason()->getDescription());
336335
}
337336
}
337+
// TODO into helper?
338+
if($this->hasSaveableCoupon()) {
339+
$info->setCouponCode($this->getCoupon());
340+
}
338341
$info->save();
339342
return $info;
340343
}
@@ -522,17 +525,12 @@ private function storeShipping(\Wallee\Sdk\Model\Transaction $transaction){
522525
$shipping_info->save();
523526
}
524527
}
525-
526-
private function storeCoupon(\Wallee\Sdk\Model\Transaction $transaction){
527-
if (isset($this->registry->get('session')->data['coupon']) && isset($this->registry->get('session')->data['order_id'])) {
528-
$transaction_info = \Wallee\Entity\TransactionInfo::loadByOrderId($this->registry,
529-
$this->registry->get('session')->data['order_id']);
530-
$transaction_info->setTransactionId($transaction->getId());
531-
$transaction_info->setSpaceId($transaction->getLinkedSpaceId());
532-
$transaction_info->setOrderId($this->registry->get('session')->data['order_id']);
533-
$transaction_info->setCouponCode($this->registry->get('session')->data['coupon']);
534-
$transaction_info->setState(\Wallee\Sdk\Model\TransactionState::CREATE);
535-
$transaction_info->save();
536-
}
528+
529+
private function hasSaveableCoupon() {
530+
return isset($this->registry->get('session')->data['coupon']) && isset($this->registry->get('session')->data['order_id']);
531+
}
532+
533+
private function getCoupon() {
534+
return $this->registry->get('session')->data['coupon'];
537535
}
538536
}

0 commit comments

Comments
 (0)