Skip to content

Commit

Permalink
Release 1.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
sbossert committed Feb 20, 2019
1 parent 735594d commit 6020e2c
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ This repository contains the OpenCart PostFinance Checkout payment module that

## Documentation

* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/opencart-2.3/1.0.9/docs/en/documentation.html)
* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/opencart-2.3/1.0.10/docs/en/documentation.html)

## License

Please see the [license file](https://github.com/pfpayments/opencart-2.3/blob/1.0.9/LICENSE) for more information.
Please see the [license file](https://github.com/pfpayments/opencart-2.3/blob/1.0.10/LICENSE) for more information.
4 changes: 2 additions & 2 deletions docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/pfpayments/opencart-2.3/releases/tag/1.0.9/">
<a href="https://github.com/pfpayments/opencart-2.3/releases/tag/1.0.10/">
Source
</a>
</li>
Expand All @@ -48,7 +48,7 @@ <h1>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="https://github.com/pfpayments/opencart-2.3/releases/tag/1.0.9/">Download</a> the extension.</p>
<p><a href="https://github.com/pfpayments/opencart-2.3/releases/tag/1.0.10/">Download</a> the extension.</p>
</li>
<li>
<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,6 @@
<p class="form-control-static"><?php echo $description_checkout; ?></p>
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label"><?php echo $entry_events; ?></label>

<div class="col-sm-10">
<p class="form-control-static"><?php echo $description_events; ?></p>
</div>
</div>
</fieldset>

<fieldset>
Expand Down
28 changes: 24 additions & 4 deletions upload/catalog/view/javascript/postfinancecheckout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
running : false,
initCalls : 0,
initMaxCalls : 10,
confirmationButtonSources: ['#button-confirm', '#journal-checkout-confirm-button'],

initialized : function() {
$('#button-confirm').removeAttr('disabled');
$('#postfinancecheckout-iframe-spinner').hide();
$('#postfinancecheckout-iframe-container').show();
PostFinanceCheckout.enableConfirmButton();
$('#button-confirm').click(function(event) {
PostFinanceCheckout.handler.validate();
$('#button-confirm').attr('disabled', 'disabled');
PostFinanceCheckout.disableConfirmButton();
});
},

fallback : function(methodConfigurationId) {
PostFinanceCheckout.methodConfigurationId = methodConfigurationId;
$('#button-confirm').click(PostFinanceCheckout.submit);
$('#button-confirm').removeAttr('disabled');
$('#postfinancecheckout-iframe-spinner').toggle();
PostFinanceCheckout.enableConfirmButton();
},

reenable: function() {
$('#button-confirm').removeAttr('disabled');
PostFinanceCheckout.enableConfirmButton();
if($('html').hasClass('quick-checkout-page')) { // modifications do not work for js
triggerLoadingOff();
}
Expand Down Expand Up @@ -63,6 +64,7 @@

init : function(methodConfigurationId) {
PostFinanceCheckout.initCalls++;
PostFinanceCheckout.disableConfirmButton();
if (typeof window.IframeCheckoutHandler === 'undefined') {
if (PostFinanceCheckout.initCalls < PostFinanceCheckout.initMaxCalls) {
setTimeout(function() {
Expand All @@ -82,6 +84,24 @@
PostFinanceCheckout.handler
.create('postfinancecheckout-iframe-container');
}
},

enableConfirmButton : function() {
for(var i = 0; i < PostFinanceCheckout.confirmationButtonSources.length; i++) {
var button = $(PostFinanceCheckout.confirmationButtonSources[i]);
if(button.length) {
button.removeAttr('disabled');
}
}
},

disableConfirmButton : function() {
for(var i = 0; i < PostFinanceCheckout.confirmationButtonSources.length; i++) {
var button = $(PostFinanceCheckout.confirmationButtonSources[i]);
if(button.length) {
button.attr('disabled', 'disabled');
}
}
}
}
})(jQuery);
25 changes: 24 additions & 1 deletion upload/system/library/postfinancecheckout/service/line_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private function createLineItemFromProduct($product){
else {
$line_item->setSku($product['model']);
}
$line_item->setUniqueId($product['product_id']);
$line_item->setUniqueId($this->createUniqueIdFromProduct($product));
$line_item->setType(LineItemType::PRODUCT);

$tax_amount = $this->addTaxesToLineItem($line_item, $amount_excluding_tax, $product['tax_class_id']);
Expand All @@ -346,6 +346,29 @@ private function createLineItemFromProduct($product){
return $this->cleanLineItem($line_item);
}

private function createUniqueIdFromProduct($product){
$id = $product['product_id'];
foreach ($product['option'] as $option) {
$hasValue = false;
if (isset($option['product_option_id'])) {
$id .= '_po-' . $option['product_option_id'];
if (isset($option['product_option_value_id'])) {
$id .= '=' . $option['product_option_value_id'];
}
}
if (isset($option['option_id']) && isset($option['option_value_id'])) {
$id .= '_o-' . $option['option_id'];
if (isset($option['option_value_id']) && !empty($option['option_value_id'])) {
$id .= '=' . $option['option_value_id'];
}
}
if(isset($option['value']) && !$hasValue) {
$id .= '_v=' . $option['value'];
}
}
return $id;
}

private function createLineItemFromVoucher($voucher, $id){
$line_item = new LineItemCreate();

Expand Down

0 comments on commit 6020e2c

Please sign in to comment.