Skip to content
Open

V2 #9

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions admin/controller/extension/payment/coingate.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,9 @@ private function validate()

return !$this->error;
}

public function install() {
$this->load->model('extension/payment/coingate');
$this->model_extension_payment_coingate->install();
}
}
18 changes: 18 additions & 0 deletions admin/model/extension/payment/coingate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

class ModelExtensionPaymentCoingate extends Model {
public function install() {
// Modify the currency table to allow 4-character currency code
$query = $this->db->query("
SELECT character_maximum_length
FROM information_schema.columns
WHERE table_name = '" . DB_PREFIX . "currency' and column_name = 'code';
");
if ((int)$query->row['character_maximum_length'] < 4) {
$this->db->query("
ALTER TABLE `" . DB_PREFIX . "currency`
MODIFY `code` VARCHAR(4) COLLATE utf8_general_ci NOT NULL;
");
}
}
}
2 changes: 1 addition & 1 deletion catalog/controller/extension/payment/coingate.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function confirm()

$order = \CoinGate\Merchant\Order::createOrFail(array(
'order_id' => $order['order_id'],
'price_amount' => number_format($order['total'] * $this->currency->getvalue($order['currency_code']), 2, '.', ''),
'price_amount' => number_format($order['total'] * $this->currency->getvalue($order['currency_code']), 8, '.', ''),
'price_currency' => $order['currency_code'],
'receive_currency' => $this->config->get('coingate_receive_currency'),
'cancel_url' => $this->url->link('extension/payment/coingate/cancel', '', $this->config->get('config_secure')),
Expand Down
14 changes: 14 additions & 0 deletions install.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>CoinGate</name>
<code>coningate</code>
<version>3.1.3</version>
<author>Ivan</author>
<!-- Allow 4 characters in form validation -->
<file path="admin/controller/localisation/currency.php">
<operation>
<search><![CDATA[if (utf8_strlen($this->request->post['code']) != 3)]]></search>
<add position="replace"><![CDATA[if (!in_array(utf8_strlen($this->request->post['code']), array(3, 4)))]]></add>
</operation>
</file>
</modification>