Skip to content

Commit

Permalink
Merge pull request #313 from mollie/v13.0.0
Browse files Browse the repository at this point in the history
V13.0.0
  • Loading branch information
QualityWorks authored Nov 15, 2023
2 parents 1991aef + 5ab593d commit 9436541
Show file tree
Hide file tree
Showing 1,761 changed files with 40,350 additions and 1,868 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

# Changelog #

#### Changes in release 13.0.0
+ Removed VQMod from module for opencart version 4 - now uses events
+ Added 'Payment Link' payment method for orders created through admin
+ New payment methods 'Klarna One', 'MyBank' and 'Billie' added
+ New feature - Create credit order on (partial) refund
+ Added option whether or not to re-stock the product after partial refund
+ Minimum required PHP version 7.2.0
+ Fixed payment methods loading time issue on checkout
+ Other bugfix and improvements

#### Changes in release 12.0.0
+ New module for Opencart version 4.x
+ Dropped PHP 5.6 support
+ Fixed bug related to recurring payment in opencart version 2.3 and earlier
+ Fixed double listing of mollie payment fee (total)
+ Fixed autofill api key bug
+ Fixed bug regarding customer(not exists)
+ Other bugfix and improvements

#### Changes in release 11.2.0
+ Added IN3 Payment Method
+ Fixed issue related to currencies decimal places
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
include_once(DIR_APPLICATION . "controller/payment/mollie_billie.php");
class ControllerExtensionPaymentMollieBillie extends ControllerPaymentMollieBillie{}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
include_once(DIR_APPLICATION . "controller/payment/mollie_klarna.php");
class ControllerExtensionPaymentMollieKlarna extends ControllerPaymentMollieKlarna{}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
include_once(DIR_APPLICATION . "controller/payment/mollie_mybank.php");
class ControllerExtensionPaymentMollieMybank extends ControllerPaymentMollieMybank{}
?>
Original file line number Diff line number Diff line change
Expand Up @@ -132,78 +132,71 @@ public function install () {
}

// Create mollie payments table
$this->db->query(
sprintf(
"CREATE TABLE IF NOT EXISTS `%smollie_payments` (
`order_id` INT(11) NOT NULL,
`method` VARCHAR(32) NOT NULL,
`mollie_order_id` VARCHAR(32) NOT NULL,
`transaction_id` VARCHAR(32),
`bank_account` VARCHAR(15),
`bank_status` VARCHAR(20),
`refund_id` VARCHAR(32),
`subscription_id` VARCHAR(32),
`order_recurring_id` INT(11),
`next_payment` DATETIME,
`subscription_end` DATETIME,
`date_modified` DATETIME NOT NULL,
`payment_attempt` INT(11) NOT NULL,
PRIMARY KEY (`mollie_order_id`),
UNIQUE KEY `mollie_order_id` (`mollie_order_id`)
) DEFAULT CHARSET=utf8",
DB_PREFIX
)
);
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "mollie_payments` (
`order_id` INT(11) NOT NULL,
`method` VARCHAR(32) NOT NULL,
`mollie_order_id` VARCHAR(32) NOT NULL,
`transaction_id` VARCHAR(32),
`bank_account` VARCHAR(15),
`bank_status` VARCHAR(20),
`refund_id` VARCHAR(32),
`subscription_id` VARCHAR(32),
`order_recurring_id` INT(11),
`next_payment` DATETIME,
`subscription_end` DATETIME,
`date_modified` DATETIME NOT NULL,
`payment_attempt` INT(11) NOT NULL,
PRIMARY KEY (`mollie_order_id`),
UNIQUE KEY `mollie_order_id` (`mollie_order_id`)
) DEFAULT CHARSET=utf8");

// Create mollie customers table
$this->db->query(
sprintf(
"CREATE TABLE IF NOT EXISTS `%smollie_customers` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`mollie_customer_id` VARCHAR(32) NOT NULL,
`customer_id` INT(11) NOT NULL,
`email` VARCHAR(96) NOT NULL,
`date_created` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8",
DB_PREFIX
)
);
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "mollie_customers` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`mollie_customer_id` VARCHAR(32) NOT NULL,
`customer_id` INT(11) NOT NULL,
`email` VARCHAR(96) NOT NULL,
`date_created` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8");

// Create mollie recurring payments table
$this->db->query(
sprintf(
"CREATE TABLE IF NOT EXISTS `%smollie_recurring_payments` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`transaction_id` VARCHAR(32),
`order_recurring_id` INT(11),
`subscription_id` VARCHAR(32) NOT NULL,
`mollie_customer_id` VARCHAR(32) NOT NULL,
`method` VARCHAR(32) NOT NULL,
`status` VARCHAR(32) NOT NULL,
`date_created` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8",
DB_PREFIX
)
);
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "mollie_recurring_payments` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`transaction_id` VARCHAR(32),
`order_recurring_id` INT(11),
`subscription_id` VARCHAR(32) NOT NULL,
`mollie_customer_id` VARCHAR(32) NOT NULL,
`method` VARCHAR(32) NOT NULL,
`status` VARCHAR(32) NOT NULL,
`date_created` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8");

// Create mollie refund table
$this->db->query(
sprintf(
"CREATE TABLE IF NOT EXISTS `%smollie_refund` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`refund_id` VARCHAR(32),
`order_id` INT(11) NOT NULL,
`transaction_id` VARCHAR(32),
`amount` decimal(15,4),
`currency_code` VARCHAR(32),
`date_created` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8",
DB_PREFIX
)
);
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "mollie_refund` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`refund_id` VARCHAR(32),
`order_id` INT(11) NOT NULL,
`transaction_id` VARCHAR(32),
`amount` decimal(15,4),
`currency_code` VARCHAR(32),
`date_created` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8");

// Create mollie payment link table
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "mollie_payment_link` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`payment_link_id` VARCHAR(32),
`order_id` INT(11) NOT NULL,
`transaction_id` VARCHAR(32),
`amount` decimal(15,4),
`currency_code` VARCHAR(32),
`date_created` DATETIME NOT NULL,
`date_payment` DATETIME,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8");

$this->db->query("ALTER TABLE `" . DB_PREFIX . "order` MODIFY `payment_method` VARCHAR(255) NOT NULL;");

Expand Down Expand Up @@ -265,6 +258,11 @@ public function install () {
$this->db->query("ALTER TABLE `" . DB_PREFIX . "product` ADD `voucher_category` VARCHAR(20) NULL");
}

// Add stock mutation field
if(!$this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "order_product` LIKE 'stock_mutation'")->row) {
$this->db->query("ALTER TABLE `" . DB_PREFIX . "order_product` ADD `stock_mutation` BOOLEAN NOT NULL DEFAULT TRUE");
}

// Fix for empty transaction id in old versions
$query = $this->db->query("SELECT * FROM `" .DB_PREFIX. "mollie_payments`");
if ($query->num_rows) {
Expand Down Expand Up @@ -891,11 +889,11 @@ public function index () {
$paymentAPIToUse[] = $code . '_' . $module_name . '_api_to_use';
}

$fields = array("show_icons", "show_order_canceled_page", "description", "api_key", "ideal_processing_status_id", "ideal_expired_status_id", "ideal_canceled_status_id", "ideal_failed_status_id", "ideal_pending_status_id", "ideal_shipping_status_id", "create_shipment_status_id", "ideal_refund_status_id", "create_shipment", "payment_screen_language", "debug_mode", "mollie_component", "mollie_component_css_base", "mollie_component_css_valid", "mollie_component_css_invalid", "default_currency", "recurring_email", "align_icons", "single_click_payment", "order_expiry_days", "partial_refund", "ideal_partial_refund_status_id", "payment_fee_tax_class_id");
$fields = array("show_icons", "show_order_canceled_page", "description", "api_key", "ideal_processing_status_id", "ideal_expired_status_id", "ideal_canceled_status_id", "ideal_failed_status_id", "ideal_pending_status_id", "ideal_shipping_status_id", "create_shipment_status_id", "ideal_refund_status_id", "create_shipment", "payment_screen_language", "debug_mode", "mollie_component", "mollie_component_css_base", "mollie_component_css_valid", "mollie_component_css_invalid", "default_currency", "recurring_email", "align_icons", "single_click_payment", "order_expiry_days", "ideal_partial_refund_status_id", "payment_link", "payment_link_email", "partial_credit_order");

$settingFields = $this->addPrefix($code . '_', $fields);

$storeFormFields = array_merge($settingFields, $paymentDesc, $paymentImage, $paymentStatus, $paymentSortOrder, $paymentGeoZone, $paymentTotalMin, $paymentTotalMax);
$storeFormFields = array_merge($settingFields, $paymentDesc, $paymentImage, $paymentStatus, $paymentSortOrder, $paymentGeoZone, $paymentTotalMin, $paymentTotalMax, $paymentAPIToUse);

$data['stores'] = $this->getStores();

Expand Down Expand Up @@ -969,6 +967,10 @@ public function index () {
$data['text_payment_api'] = $this->language->get('text_payment_api');
$data['text_order_api'] = $this->language->get('text_order_api');
$data['text_info_orders_api'] = $this->language->get('text_info_orders_api');
$data['text_pay_link_variables'] = $this->language->get('text_pay_link_variables');
$data['text_pay_link_text'] = $this->language->get('text_pay_link_text');
$data['text_recurring_payment'] = $this->language->get('text_recurring_payment');
$data['text_payment_link'] = $this->language->get('text_payment_link');

$data['title_global_options'] = $this->language->get('title_global_options');
$data['title_payment_status'] = $this->language->get('title_payment_status');
Expand All @@ -994,6 +996,9 @@ public function index () {
$data['name_mollie_przelewy24'] = $this->language->get('name_mollie_przelewy24');
$data['name_mollie_applepay'] = $this->language->get('name_mollie_applepay');
$data['name_mollie_in3'] = $this->language->get('name_mollie_in3');
$data['name_mollie_mybank'] = $this->language->get('name_mollie_mybank');
$data['name_mollie_billie'] = $this->language->get('name_mollie_billie');
$data['name_mollie_klarna'] = $this->language->get('name_mollie_klarna');
// Deprecated names
$data['name_mollie_bitcoin'] = $this->language->get('name_mollie_bitcoin');
$data['name_mollie_mistercash'] = $this->language->get('name_mollie_mistercash');
Expand Down Expand Up @@ -1039,7 +1044,6 @@ public function index () {
$data['entry_create_shipment_on_order_complete'] = $this->language->get('entry_create_shipment_on_order_complete');
$data['entry_single_click_payment'] = $this->language->get('entry_single_click_payment');
$data['entry_order_expiry_days'] = $this->language->get('entry_order_expiry_days');
$data['entry_partial_refund'] = $this->language->get('entry_partial_refund');
$data['entry_partial_refund_status'] = $this->language->get('entry_partial_refund_status');
$data['entry_amount'] = $this->language->get('entry_amount');
$data['entry_payment_fee'] = $this->language->get('entry_payment_fee');
Expand All @@ -1049,8 +1053,14 @@ public function index () {
$data['entry_maximum'] = $this->language->get('entry_maximum');
$data['entry_api_to_use'] = $this->language->get('entry_api_to_use');
$data['entry_status'] = $this->language->get('entry_status');
$data['entry_payment_link'] = $this->language->get('entry_payment_link');
$data['entry_payment_link_sep_email'] = $this->language->get('entry_payment_link_sep_email');
$data['entry_payment_link_ord_email'] = $this->language->get('entry_payment_link_ord_email');
$data['entry_partial_credit_order'] = $this->language->get('entry_partial_credit_order');

$data['error_order_expiry_days'] = $this->language->get('error_order_expiry_days');

$data['summernote'] = $this->language->get('summernote');

$data['help_view_profile'] = $this->language->get('help_view_profile');
$data['help_status'] = $this->language->get('help_status');
Expand All @@ -1063,6 +1073,7 @@ public function index () {
$data['help_shipment'] = $this->language->get('help_shipment');
$data['help_single_click_payment'] = $this->language->get('help_single_click_payment');
$data['help_total'] = $this->language->get('help_total');
$data['help_payment_link'] = $this->language->get('help_payment_link');

$data['button_save'] = $this->language->get('button_save');
$data['button_cancel'] = $this->language->get('button_cancel');
Expand Down Expand Up @@ -1189,8 +1200,10 @@ public function index () {
$code . "_recurring_email" => array(),
$code . "_mollie_component" => FALSE,
$code . "_single_click_payment" => FALSE,
$code . "_partial_refund" => FALSE,
$code . "_partial_credit_order" => FALSE,
$code . "_order_expiry_days" => 25,
$code . "_payment_link" => 0,
$code . "_payment_link_email" => array(),
$code . "_mollie_component_css_base" => array(
"background_color" => "#fff",
"color" => "#555",
Expand Down Expand Up @@ -1404,6 +1417,7 @@ public function index () {
}

$data['store_email'] = $this->config->get('config_email');
$data['oc_version'] = VERSION;

if (version_compare(VERSION, '2', '>=')) {
$data['header'] = $this->load->controller('common/header');
Expand Down Expand Up @@ -1560,18 +1574,28 @@ public function saveAPIKey() {
private function getUpdateUrl() {
$client = new mollieHttpClient();
$info = $client->get(MOLLIE_VERSION_URL);
if (isset($info["tag_name"]) && ($info["tag_name"] != MOLLIE_VERSION) && version_compare(MOLLIE_VERSION, $info["tag_name"], "<")) {
$updateUrl = array(
"updateUrl" => $this->url->link("payment/mollie_" . static::MODULE_NAME . "/update", $this->token, 'SSL'),
"updateVersion" => $info["tag_name"]
);

return $updateUrl;
if(strpos($info["tag_name"], 'oc3') !== false) {
$tag_name = explode('_', explode("-", $info["tag_name"])[0]); // New tag_name = oc3_version-oc4_version
} else {
$tag_name = ["oc3", $info["tag_name"]]; // Old tag_name = release version
}

if (isset($tag_name[0]) && ($tag_name[0] == 'oc3')) {
if (isset($tag_name[1]) && ($tag_name[1] != MOLLIE_VERSION) && version_compare(MOLLIE_VERSION, $tag_name[1], "<")) {
$updateUrl = array(
"updateUrl" => $this->url->link("payment/mollie_" . static::MODULE_NAME . "/update", $this->token, 'SSL'),
"updateVersion" => $tag_name[1]
);

return $updateUrl;
}
}

return false;
}

function update() {
public function update() {

// Check for PHP version
if (version_compare(phpversion(), MollieHelper::NEXT_PHP_VERSION, "<")) {
Expand All @@ -1591,7 +1615,30 @@ function update() {
//save tmp file
$temp_file = MOLLIE_TMP . "/mollieUpdate.zip";
$handle = fopen($temp_file, "w+");
$content = $client->get($info["assets"][0]["browser_download_url"], false, false);

$browser_download_url = '';
if (!empty($info["assets"])) {
foreach($info["assets"] as $asset) {
if(strpos($asset["name"], 'oc3') !== false) {
$browser_download_url = $asset['browser_download_url'];

break;
}
}
}

if (!empty($browser_download_url)) {
$content = $client->get($browser_download_url, false, false);
} else {
if (version_compare(VERSION, '2.3', '>=')) {
$this->response->redirect($this->url->link('extension/payment/mollie_' . static::MODULE_NAME, $this->token, true));
} elseif (version_compare(VERSION, '2', '>=')) {
$this->response->redirect($this->url->link('payment/mollie_' . static::MODULE_NAME, $this->token, 'SSL'));
} else {
$this->redirect($this->url->link('payment/mollie_' . static::MODULE_NAME, $this->token, 'SSL'));
}
}

fwrite($handle, $content);
fclose($handle);

Expand Down Expand Up @@ -1667,7 +1714,7 @@ public function rmDirRecursive($dir) {
return rmdir($dir);
}

function cpy($source, $dest) {
private function cpy($source, $dest) {
if (is_dir($source)) {
$dir_handle = opendir($source);
while ($file = readdir($dir_handle)) {
Expand Down
File renamed without changes.
Loading

0 comments on commit 9436541

Please sign in to comment.