Skip to content

Commit

Permalink
Release 1.0.26
Browse files Browse the repository at this point in the history
  • Loading branch information
sbossert committed Sep 6, 2019
1 parent a106b6a commit b2c3ab6
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 131 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.1/1.0.24/docs/en/documentation.html)
* [English](https://plugin-documentation.postfinance-checkout.ch/pfpayments/opencart-2.1/1.0.26/docs/en/documentation.html)

## License

Please see the [license file](https://github.com/pfpayments/opencart-2.1/blob/1.0.24/LICENSE) for more information.
Please see the [license file](https://github.com/pfpayments/opencart-2.1/blob/1.0.26/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.1/releases/tag/1.0.24/">
<a href="https://github.com/pfpayments/opencart-2.1/releases/tag/1.0.26/">
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.1/releases/tag/1.0.24/">Download</a> the extension.</p>
<p><a href="https://github.com/pfpayments/opencart-2.1/releases/tag/1.0.26/">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
8 changes: 8 additions & 0 deletions upload/admin/controller/payment/postfinancecheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ private function persistStoreSettings(array $global, array $store){
$newSettings['postfinancecheckout_download_invoice'] = isset($store['postfinancecheckout_download_invoice']);
$newSettings['postfinancecheckout_download_packaging'] = isset($store['postfinancecheckout_download_packaging']);

$newSettings['postfinancecheckout_rounding_adjustment'] = isset($store['postfinancecheckout_rounding_adjustment']);

PostFinanceCheckoutVersionHelper::persistPluginStatus($this->registry, $newSettings);

$this->model_setting_setting->editSetting('postfinancecheckout', $newSettings, $store['id']);
Expand Down Expand Up @@ -240,6 +242,10 @@ private function getSettingsPageTranslatedVariables(){
$data['help_log_level'] = $this->language->get('help_log_level');
$data['log_levels'] = $this->getLogLevels();

$data['title_rounding_adjustment'] = $this->language->get('title_rounding_adjustment');
$data['entry_rounding_adjustment'] = $this->language->get('entry_rounding_adjustment');
$data['description_rounding_adjustment'] = $this->language->get('description_rounding_adjustment');

$data['entry_email'] = $this->language->get("entry_email");
$data['description_email'] = $this->language->get("description_email");
$data['entry_alerts'] = $this->language->get("entry_alerts");
Expand Down Expand Up @@ -432,6 +438,8 @@ private function getSettingsDefaults(){

"postfinancecheckout_notification_url" => null,

"postfinancecheckout_rounding_adjustment" => 0,

"postfinancecheckout_download_packaging" => 1,
"postfinancecheckout_download_invoice" => 1,
\PostFinanceCheckout\Service\ManualTask::CONFIG_KEY => 0
Expand Down
7 changes: 7 additions & 0 deletions upload/admin/language/english/payment/postfinancecheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
$_['log_level_error'] = 'Error';
$_['log_level_debug'] = 'Debug';

// Rounding
$_['title_rounding_adjustment'] = 'Rounding adjustments';
$_['entry_rounding_adjustment'] = 'Send Item';
$_['description_rounding_adjustment'] = 'If we cannot map the Opencart totals to PostFinance Checkout line items exactly, instead of disabling the payment methods you can instead choose to send an Adjustment Item which contains the difference. In this case tax amounts may no longer be exact, and features such as reconciliation in PostFinance Checkout and refunds from the Opencart backend may not fully work.';

// Status
$_['title_payment_status'] = "Status mapping";
$_['entry_processing_status'] = "Processing status";
Expand Down Expand Up @@ -252,6 +257,8 @@
$_['entry_sku'] = 'SKU';
$_['entry_id'] = 'Unique ID';

$_['rounding_adjustment_item_name'] = 'Rounding Adjustment';

$_['entry_restock'] = 'Restock products';
$_['button_reset'] = 'Reset';
$_['button_full'] = 'Full order';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

require_once modification(DIR_SYSTEM . 'library/postfinancecheckout/helper.php');

class ModelExtensionPostFinanceCheckoutMigration extends Model {
Expand All @@ -16,33 +17,39 @@ class ModelExtensionPostFinanceCheckoutMigration extends Model {
);

public function migrate(){
\PostFinanceCheckoutHelper::instance($this->registry)->log("Starting migration");
$currentVersion = '0.0.0';
if ($this->config->has('postfinancecheckout_migration_version')) {
$currentVersion = $this->config->get('postfinancecheckout_migration_version');
\PostFinanceCheckoutHelper::instance($this->registry)->log("Current version: $currentVersion");
}
$startingVersion = $currentVersion;

foreach (self::$migrations as $migration) {
\PostFinanceCheckoutHelper::instance($this->registry)->dbTransactionStart();
try {
if (version_compare($currentVersion, $migration['version']) === -1) {
\PostFinanceCheckoutHelper::instance($this->registry)->log("Running {$migration['name']}");
$this->{$migration['function']}();
\PostFinanceCheckoutHelper::instance($this->registry)->dbTransactionCommit();
$currentVersion = $migration['version'];
}
}
catch (Exception $e) {
\PostFinanceCheckoutHelper::instance($this->registry)->log($e->getMessage());
\PostFinanceCheckoutHelper::instance($this->registry)->dbTransactionRollback();
break;
}
}

// update version if required
if (version_compare($startingVersion, $currentVersion) !== 0) {
\PostFinanceCheckoutHelper::instance($this->registry)->log("Updating version");
$this->load->model('setting/setting');
$settings = $this->model_setting_setting->getSetting('postfinancecheckout');
$settings['postfinancecheckout_migration_version'] = self::$migrations[$currentVersion]['version'];
$settings['postfinancecheckout_migration_name'] = self::$migrations[$currentVersion]['name'];
\PostFinanceCheckoutHelper::instance($this->registry)->log("Currently at ". self::$migrations[$currentVersion]['version'].": ".self::$migrations[$currentVersion]['name']);
$this->model_setting_setting->editSetting('postfinancecheckout', $settings);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function echoAmount($amount, $currency_decimals){
</dl>
</td>
<td>
<?php if (count($line_item->getTaxes()) >= 1) : ?>
<?php if (!empty($line_item->getTaxes())) : ?>
<dl class="row" style="margin-right: 0px">
<?php foreach ($line_item->getTaxes() as $tax_rate) :?>
<dt class="col-sm-6"><?php echo $tax_rate->getTitle(); ?></dt>
Expand Down
15 changes: 15 additions & 0 deletions upload/admin/view/template/payment/postfinancecheckout.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,21 @@
</div>
</div>
</fieldset>

<fieldset>
<legend><?php echo htmlspecialchars($title_rounding_adjustment) ?></legend>
<div class="form-group">
<label class="col-sm-2 control-label"><?php echo htmlspecialchars($entry_rounding_adjustment) ?></label>

<div class="col-sm-10">
<input type="checkbox"
name="stores[<?php echo $store['id'] ?>][postfinancecheckout_rounding_adjustment]"
<?php if($stores[$store['id']]['postfinancecheckout_rounding_adjustment']) { ?>
checked <?php } ?> value="1"/>
<p class="form-control-static"><?php echo $description_rounding_adjustment ?></p>
</div>
</div>
</fieldset>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
$_['error_not_pending'] = 'Transaction exists and is not in state pending.';
$_['error_confirmation'] = 'The transaction could not be confirmed. Please check to see if any payment has been made from your account, and retry if no charge has taken place.';

$_['rounding_adjustment_item_name'] = 'Rounding Adjustment';

// Order overview / download buttons
$_['button_invoice'] = 'Invoice';
$_['button_packing_slip'] = 'Packing slip';
Expand All @@ -27,4 +29,4 @@
$_['message_webhook_voided'] = 'Transaction has been voided via webhook.';

$_['message_webhook_manual'] = 'A manual decision about whether to accept the payment is required.';
$_['message_refund_successful'] = 'The refund \'%s\' over amount %s was successful.';
$_['message_refund_successful'] = 'The refund \'%s\' over amount %s was successful.';
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getMethod($address, $total){
}

$available_methods = \PostFinanceCheckout\Service\Transaction::instance($this->registry)->getPaymentMethods($order_info);
$configuration_id = substr($this->getCode(), \PostFinanceCheckoutHelper::extractPaymentMethodId($this->getCode()));
$configuration_id = \PostFinanceCheckoutHelper::extractPaymentMethodId($this->getCode());

foreach ($available_methods as $method) {
if ($method->getId() == $configuration_id) {
Expand Down
Loading

0 comments on commit b2c3ab6

Please sign in to comment.