Skip to content

Commit c9bd09d

Browse files
committed
+ prro sum with tax
+ proo shipping summ + support fondy api ^1.0.1 + uk lang + new logo
1 parent 71e40e7 commit c9bd09d

9 files changed

Lines changed: 144 additions & 25 deletions

File tree

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
[![GitHub release](https://img.shields.io/github/v/release/cloudipsp/opencart-v3)](https://github.com/cloudipsp/opencart-v3/releases/latest)
33
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/cloudipsp/opencart-v3)
44
![License](https://img.shields.io/badge/license-MIT-green)
5+
6+
# UK
7+
8+
Встановлення
9+
-------------
10+
1. [Завантажити модуль](https://github.com/cloudipsp/opencart-v3/releases/latest/download/fondy.ocmod.zip "Завантажити") і встановити його через установку модулів opencart (``Навігація/Модулі/Установка модулів``).
11+
>**або** [завантажити репозиторій](https://github.com/cloudipsp/opencart-v3/archive/main.zip) та скопіювати все з каталогу `upload` в корінь сайту (якщо встановлена стороння тема - каталог `payment` з ```/catalog/view/theme/default/template/payment/``` скопіювати в каталог з темою)
12+
2. У списку модулів (``Навігація/Модулі/Модулі/Оплата``) знайти спосіб оплати ***Fondy*** та натиснути кнопку ***"Інсталювати"***.
13+
3. Натиснути кнопку ***"Редагувати"*** та заповнити необхідні поля.
14+
4. Зберегти зміни.
15+
16+
-------------
17+
518
# EN
619

720
Installation
@@ -12,15 +25,3 @@ Installation
1225
3. Click the ***"Edit"*** button and fill in the required fields.
1326
4. Save the changes.
1427
-------------
15-
16-
# RU
17-
18-
Установка
19-
-------------
20-
1. [Скачать модуль](https://github.com/cloudipsp/opencart-v3/releases/latest/download/fondy.ocmod.zip "Скачать") и установить его через установщик модулей opencart (``Навигация/Расширения/Установка расширений``).
21-
>**или** [скачать репозиторий](https://github.com/cloudipsp/opencart-v3/archive/main.zip) и скопировать все из папки `upload` в корень сайта (если установлена сторонняя тема папку `payment` из ```/catalog/view/theme/default/template/payment/``` скопировать в папку с темой)
22-
2. В списке расширений (``Навигация/Расширения/Расширения/Оплата``) найти способ оплаты ***Fondy*** и нажать кнопку ***"Активировать"***.
23-
3. Нажать кнопку ***"Редактировать"*** и заполнить необходимые поля.
24-
4. Сохранить изменения.
25-
26-
-------------

upload/admin/controller/extension/payment/oplata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class ControllerExtensionPaymentOplata extends Controller
44
{
55
private $error = [];
6-
private $extensionVersion = '2.1.1';
6+
private $extensionVersion = '2.1.2';
77

88
public function install() {
99
$this->load->model('extension/payment/oplata');

upload/admin/language/en-gb/extension/payment/oplata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Text
1111
$_['text_edit'] = 'Edit module';
1212
$_['text_payment'] = 'Payment';
13-
$_['text_oplata'] = '<a onclick="window.open(\'http://fondy.eu/\');"><img src="view/image/payment/oplata.png" alt="Fondy" title="Fondy" style="border: 1px solid #EEEEEE;" /></a>';
13+
$_['text_oplata'] = '<a onclick="window.open(\'https://fondy.io/\');"><img src="view/image/payment/oplata.png" alt="Fondy" title="Fondy" style="border: 1px solid #EEEEEE;" /></a>';
1414
$_['text_success'] = 'Settings updated';
1515
$_['text_pay'] = 'Fondy';
1616
$_['text_card'] = 'Credit Card';
@@ -70,7 +70,7 @@
7070
$_['tooltip_entry_secretkey'] = 'Can be found in the Fondy portal (section \'Merchant Settings\'\'Technical settings\')';
7171
$_['tooltip_entry_process_payment_type'] = 'Select where the Fondy payment page will be displayed';
7272
$_['tooltip_entry_payment_type'] = 'If you select \'' . $_['entry_preauth_type'] . '\' the order amount is blocked on the payer\'s card';
73-
$_['tooltip_field_payment_id'] = 'Unique payment ID generated by FONDY payment gateway';
73+
$_['tooltip_field_payment_id'] = 'Unique payment ID generated by Fondy payment gateway';
7474
$_['tooltip_btn_preauth_reverse'] = 'Available only for the entire order amount';
7575

7676
$_['help_entry_environment'] = '<i class="fa fa-info-circle" aria-hidden="true"></i> You have been assigned <a href="https://docs.fondy.eu/docs/page/2/">test</a> <em>' . $_['entry_merchant'] . '</em> and <em>' . $_['entry_secretkey'] . '</em>';

upload/admin/language/ru-ru/extension/payment/oplata.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
// Tab
66
$_['tab_general'] = 'Основные настройки';
77
$_['tab_order_status'] = 'Статус заказа';
8-
$_['tab_style'] = 'Стили';
8+
$_['tab_style'] = 'Стили';
99

1010
// Text
11-
$_['text_edit'] = 'Редакторование модуля';
11+
$_['text_edit'] = 'Редактирование модуля';
1212
$_['text_payment'] = 'Оплата';
13-
$_['text_oplata'] = '<a onclick="window.open(\'http://fondy.eu\');"><img src="view/image/payment/oplata.png" alt="Fondy" title="Fondy" style="border: 1px solid #EEEEEE;" /></a>';
13+
$_['text_oplata'] = '<a onclick="window.open(\'https://fondy.io\');"><img src="view/image/payment/oplata.png" alt="Fondy" title="Fondy" style="border: 1px solid #EEEEEE;" /></a>';
1414
$_['text_success'] = 'Настройки модуля обновлены!';
1515
$_['text_pay'] = 'Fondy';
1616
$_['text_card'] = 'Visa/MasterCard';
@@ -70,7 +70,7 @@
7070
$_['tooltip_entry_secretkey'] = 'Можно найти в портале Fondy (раздел \'Настройки мерчанта\'\'Технические\')';
7171
$_['tooltip_entry_process_payment_type'] = 'Выберите где будет отображаться платежная страница Fondy';
7272
$_['tooltip_entry_payment_type'] = 'При выборе \'' . $_['entry_preauth_type'] . '\' сумма заказа блокируется на карте плательщика';
73-
$_['tooltip_field_payment_id'] = 'Уникальный идентификатор платежа, присвоенный платежным шлюзом FONDY';
73+
$_['tooltip_field_payment_id'] = 'Уникальный идентификатор платежа, присвоенный платежным шлюзом Fondy';
7474
$_['tooltip_btn_preauth_reverse'] = 'Доступно только на всю сумму заказа';
7575

7676
$_['help_entry_environment'] = '<i class="fa fa-info-circle" aria-hidden="true"></i> Вам присвоен <a href="https://docs.fondy.eu/docs/page/2/">тестовый</a> <em>' . $_['entry_merchant'] . '</em> и <em>' . $_['entry_secretkey'] . '</em>';
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
// Heading
3+
$_['heading_title'] = 'Fondy';
4+
5+
// Tab
6+
$_['tab_general'] = 'Основні налаштування';
7+
$_['tab_order_status'] = 'Статус замовлення';
8+
$_['tab_style'] = 'Стилі';
9+
10+
// Text
11+
$_['text_edit'] = 'Редагування модуля';
12+
$_['text_payment'] = 'Оплата';
13+
$_['text_oplata'] = '<a onclick="window.open(\'https://fondy.io\');"><img src="view/image/payment/oplata.png" alt="Fondy" title="Fondy" style="border: 1px solid #EEEEEE;" /></a>';
14+
$_['text_success'] = 'Налаштування модуля оновлено!';
15+
$_['text_pay'] = 'Fondy';
16+
$_['text_card'] = 'Visa/MasterCard';
17+
$_['text_response_description'] = 'Текст помилки:';
18+
$_['text_oplata_order_status'] = 'Статус замовлення:';
19+
$_['text_response_code'] = 'Код помилки:';
20+
$_['text_payment_details'] = 'Платіжні реквізити Fondy';
21+
$_['text_fondy_order_id'] = 'ID замовлення Fondy';
22+
$_['text_payment_id'] = 'ID платежу';
23+
$_['text_order_total'] = 'Сумма замовлення';
24+
$_['text_masked_card'] = 'Маскований номер картки';
25+
$_['text_order_status'] = 'Статус замовлення';
26+
$_['text_order_last_tran_type'] = 'Тип останньої транзакції';
27+
$_['text_charge_the_amount'] = 'Списання заблокованої суми';
28+
$_['text_total'] = 'Введіть суму';
29+
$_['text_refund'] = 'Повернення';
30+
$_['text_success_action'] = 'Успішно!';
31+
32+
// Entry
33+
$_['entry_env'] = 'Cередовище';
34+
$_['entry_merchant'] = 'Merchant ID';
35+
$_['entry_secretkey'] = 'Secret key';
36+
$_['entry_geo_zone'] = 'Географічна зона';
37+
$_['entry_order_success_status'] = 'Статус оплаченого замовлення';
38+
$_['entry_order_process_status'] = 'Статус замовлення в обробці';
39+
$_['entry_order_cancelled_status'] = 'Статус скасованого замовлення';
40+
$_['entry_order_reverse_status'] = 'Статус поверненого замовлення';
41+
$_['entry_currency'] = 'Валюта мерчанта';
42+
$_['entry_payment_type'] = 'Тип платежу';
43+
$_['entry_common_type'] = 'Купівля';
44+
$_['entry_preauth_type'] = 'Передавторизація';
45+
$_['entry_status'] = 'Статус';
46+
$_['entry_sort_order'] = 'Порядок сортування';
47+
$_['entry_styles'] = 'Стилі';
48+
$_['entry_process_payment_type'] = 'Спосіб інтеграції';
49+
$_['entry_redirect'] = 'Перенаправлення на Fondy';
50+
$_['entry_built_in_checkout'] = 'Вбудована форма в кошику';
51+
$_['entry_style_theme'] = 'Тема';
52+
$_['entry_light'] = 'Світла';
53+
$_['entry_dark'] = 'Темна';
54+
$_['entry_style_preset'] = 'Пресет';
55+
56+
// Btn
57+
$_['btn_capture'] = 'Списати';
58+
$_['btn_preauth_reverse'] = 'Скасування передавторизації';
59+
$_['btn_reverse'] = 'Повернення';
60+
61+
// Error
62+
$_['error_permission'] = 'У вас немає прав для керування цим модулем!';
63+
$_['error_merchant'] = 'Невірний ID магазину (Merchant ID)!';
64+
$_['error_secretkey'] = 'Немає секретного ключа!';
65+
66+
// Tooltip
67+
$_['tooltip_entry_status'] = 'Відображати Fondy у списку платіжних методів на сайті';
68+
$_['tooltip_entry_environment'] = 'Оберіть \'Test\' для тестування Fondy';
69+
$_['tooltip_entry_merchant'] = 'Можна знайти у порталі Fondy (розділ \'Налаштування мерчанта\'\'Технічні налаштування\')';
70+
$_['tooltip_entry_secretkey'] = $_['tooltip_entry_merchant'];
71+
$_['tooltip_entry_process_payment_type'] = 'Оберіть, де саме буде відображатись платіжна сторінка Fondy';
72+
$_['tooltip_entry_payment_type'] = 'При виборі \'' . $_['entry_preauth_type'] . '\' сума замовлення блокується на картці платника';
73+
$_['tooltip_field_payment_id'] = 'Унікальний ідентифікатор платежу, присвоєний платіжним шлюзом Fondy';
74+
$_['tooltip_btn_preauth_reverse'] = 'Доступно тільки на всю суму замовлення';
75+
76+
$_['help_entry_environment'] = '<i class="fa fa-info-circle" aria-hidden="true"></i> Вам присвоєно <a href="https://docs.fondy.eu/docs/page/2/">тестовий</a> <em>' . $_['entry_merchant'] . '</em> і <em>' . $_['entry_secretkey'] . '</em>';
77+
?>
263 Bytes
Loading

upload/catalog/controller/extension/payment/oplata.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,14 @@ public function validate($request)
164164
$responseSignature = $request['signature'];
165165
unset($request['response_signature_string']);
166166
unset($request['signature']);
167+
168+
# API ^1.0.1
169+
if ($request['additional_info'])
170+
$request['additional_info'] = htmlspecialchars_decode($request['additional_info']);
171+
167172
$orderSignature = $this->model_extension_payment_oplata->getSignature($request, $secretKey);
168173

169-
if ($orderSignature != $responseSignature)
174+
if ($orderSignature !== $responseSignature)
170175
return $this->language->get('error_payment') . $this->language->get('error_signature');
171176

172177
return true;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
// Text
3+
$_['text_title'] = 'FONDY VISA/MasterCard';
4+
$_['error_merchant'] = 'An error has occurred during payment. Merchant data is incorrect.';
5+
$_['error_signature'] = 'An error has occurred during payment. Signature is not valid.';
6+
$_['error_transaction'] = 'Transaction has been declined.';
7+
$_['error_payment'] = '&nbspОплата відхилена через: ';
8+
$_['error_code'] = 'Код помилки: ';
9+
$_['order_desq'] = 'Оплата замовлення №:';

upload/catalog/model/extension/payment/oplata.php

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,27 @@ public function getReservationData($orderInfo)
105105
];
106106

107107
foreach ($orderProducts as $orderProduct){
108+
$productPriceWithTax = $orderProduct['price'] + $orderProduct['tax'];
109+
$productTotalWitTax = $orderProduct['total'] + ($orderProduct['tax'] * $orderProduct['quantity']);
110+
108111
$reservationData['products'][] = [
109-
'id' => $orderProduct['product_id'],
112+
'id' => (int)$orderProduct['product_id'],
110113
'name' => $orderProduct['name'],
111-
'price' => $this->formatPrice($orderProduct['price']),
112-
'total_amount' => $this->formatPrice($orderProduct['total']),
113-
'quantity' => $orderProduct['quantity'],
114+
'price' => $this->formatPrice($productPriceWithTax),
115+
'total_amount' => $this->formatPrice($productTotalWitTax),
116+
'quantity' => (int)$orderProduct['quantity'],
117+
];
118+
}
119+
120+
if (isset($this->session->data['shipping_method']['cost']) && $this->session->data['shipping_method']['cost'] > 0){
121+
$shippingCoast = $this->getShippingCoast();
122+
$reservationData['products'][] = [
123+
'id' => 1,
124+
'name' => $this->session->data['shipping_method']['title'],
125+
'price' => $this->formatPrice($shippingCoast),
126+
'total_amount' => $this->formatPrice($shippingCoast),
127+
'quantity' => 1,
128+
'payment_object' => 'shipping',
114129
];
115130
}
116131

@@ -119,7 +134,19 @@ public function getReservationData($orderInfo)
119134

120135
public function formatPrice($sum)
121136
{
122-
return number_format($sum, 2,'.','');
137+
return (float)number_format($sum, 2,'.','');
138+
}
139+
140+
public function getShippingCoast()
141+
{
142+
$currency_code = $this->session->data['currency'];
143+
$currency_value = $this->currency->getValue($this->session->data['currency']);
144+
145+
return $this->currency->format(
146+
$this->tax->calculate(
147+
$this->session->data['shipping_method']['cost'], $this->session->data['shipping_method']['tax_class_id']
148+
), $currency_code, $currency_value, false
149+
);
123150
}
124151

125152
public function sendToAPI($endpoint, $requestData)

0 commit comments

Comments
 (0)