Skip to content

Commit 023eab2

Browse files
committed
feat: IntCurrency to HRK, EUR mandatory, removed old HRK to EUR conversion, CurrencyCode mandatory added property
1 parent 2a9e06f commit 023eab2

File tree

4 files changed

+40
-47
lines changed

4 files changed

+40
-47
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ Most recent latest changes is defined on every major, minor and bug fixes.
66

77
## Versions
88

9+
### 1.7
10+
11+
Use since 01.01.2023 as EUR mandatory currency:
12+
13+
* EUR as main currency set 1.1.2022., removed unnecessary codes for conversion from HRK to EUR
14+
* Added Currency code 978 and sent mandatory as `CurrencyCode` property [ISO 4217 HR](https://www.six-group.com/en/products-services/financial-information/data-standards.html)
15+
* IntCurrency/IntAmount set as HRK currency for informative calculation
16+
17+
> Na svim Vašim shopID-evima će se sa 01.01.2023 od strane PayWay-a automatski postaviti EUR valuta, a na platnoj formi će i dalje biti dvojni prikaz cijena, no sa EUR valutom kao osnovnom i informativnim iznosom u HRK.
18+
919
### 1.6.1
1020

1121
* Curl module load checks

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ Support payment gateway for PayWay HT payment gateway.
1111

1212
## API
1313

14-
API 2.0 support updated to latest IntlCurrency and IntAmount
14+
API 2.x.x support updated to latest IntlCurrency and IntAmount
1515

1616
Official Croatia Hrvatski Telekom [PayWay](https://www.hrvatskitelekom.hr/poslovni/ict/poslovna-rjesenja/web-shop#payway).
1717

1818
## FEATURES
1919

2020
Features
21+
* EUR mandatory currency, HRK set as IntAmount from 1.1.2023.
22+
* Added Currency code 978 and sent mandatory as `CurrencyCode` property [ISO 4217 HR](https://www.six-group.com/en/products-services/financial-information/data-standards.html)
2123
* IntlCurrency and IntAmount added
2224
* API 2.0 Support
2325
* Production and testing API
@@ -31,25 +33,30 @@ Features
3133
Removed
3234
* Removed woo-multi-currency support and integration
3335
* Removed T-Com names
36+
* Removed HRK to EUR conversion
3437

3538
## RELEASES
3639

3740
### OFFICIAL RELEASES
3841

39-
API 2.0:
42+
Latest version:
4043

44+
* Version [1.7](https://github.com/marinsagovac/woocommerce-tcom-payway/archive/refs/tags/1.7.zip) December/2022
45+
46+
API 2.x.x:
47+
48+
* Version [1.7](https://github.com/marinsagovac/woocommerce-tcom-payway/archive/refs/tags/1.7.zip) December/2022
4149
* Version [1.6.1](https://github.com/marinsagovac/woocommerce-tcom-payway/archive/refs/tags/1.6.1.zip) September/2022
42-
* Version [1.5](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tags/1.5.zip) November/2021
43-
* Version [1.4](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tags/1.4.zip) June/2021
4450

45-
Old releases:
51+
Old releases (not recommended):
4652

53+
* Version [1.5](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tags/1.5.zip) November/2021
54+
* Version [1.4](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tags/1.4.zip) June/2021
4755
* Version [1.3.3](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.3.3) January/2021
4856
* Version [1.3](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.3) December/2019
4957
* Release [1.2](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.2)
5058
* Release [1.1](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.1)
5159

52-
5360
## INSTALLATION
5461

5562
Download ZIP archive, upload via plugin page and apply package. Activate plugin. Change settings under Woocomerce settings page on the checkout page.

classes/class-wc-tpayway.php

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ public function admin_options()
119119
echo '</table>';
120120
echo '<p>';
121121
echo '<p>' . 'HNB rates fetched: ' . $this->get_last_modified_hnb_file() . '</p>';
122-
echo '<p>Until 12.12.2022. calculation will be fixed between HRK-EUR: 1 HRK = '. $this->ratehrkfixed .'</p>';
123-
echo '<p>If you use other curency it can automatically convert from USD (Wordpress) to HRK (PayWay) using ' .$hnbRatesUri . '</p>';
122+
echo '<p>Preferred currency will be EUR, make sure that default currency on your webshop is set to EUR</p>';
123+
echo '<p>Other currency will automatically calculated and sent to PayWay using HNB rates: USD (Wordpress) to HRK (PayWay) using ' .$hnbRatesUri . '</p>';
124124
echo '</p>';
125125
}
126126

@@ -151,7 +151,7 @@ private function get_hnb_currency()
151151

152152
curl_setopt($ch, CURLOPT_URL, $this->tecajnaHnbApi);
153153
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
154-
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0');
154+
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0');
155155

156156
$content = curl_exec($ch);
157157
if (curl_errno($ch)) {
@@ -325,46 +325,19 @@ public function generate_ipg_form($order_id)
325325

326326
$pgw_language = strtoupper($pgw_language);
327327

328-
// $order->order_total = $order->order_total;
329-
if ('HR' === $woocommerce->customer->country) {
330-
if ('HRK' === $order->get_order_currency()) {
331-
$order_total = $order_total;
332-
}
333-
} else {
334-
$order_total = $order_total;
335-
}
336-
337328
$curr_symbole = get_woocommerce_currency();
338-
$hrk_rate = 1;
339-
$convert = 'HRK' !== $curr_symbole;
340-
341329
$wcml_settings = get_option('_wcml_settings'); // WooCommerce Multilingual - Multi Currency (WPML plugin)
342330

343-
// HRK currency
344-
if (false === $convert && $hrk_rate) {
345-
if ($wcml_settings) {
346-
$curr_rates = $wcml_settings['currency_options'];
347-
348-
$hrk_rate = $curr_rates[$curr_symbole]['rate'];
349-
$order_total = $woocommerce->cart->total * (1 / $hrk_rate);
350-
}
351-
} else {
352-
// Difference than HRK
353-
354-
// HNB Tecaj
355-
if (!$wcml_settings) {
356-
if ($curr_symbole === "EUR") {
357-
// Force to 7,3450 until 12.12.2022. fixed rate
358-
$order_total = $woocommerce->cart->total * $this->ratehrkfixed;
359-
360-
} else {
361-
if ($this->curlExtension) {
362-
$order_total = $woocommerce->cart->total * $this->fetch_hnb_currency($curr_symbole);
363-
}
364-
}
365-
} else {
331+
if (!$wcml_settings) {
332+
if ($curr_symbole === "EUR") {
366333
$order_total = $woocommerce->cart->total;
334+
} else {
335+
if ($this->curlExtension) {
336+
$order_total = $woocommerce->cart->total * $this->fetch_hnb_currency($curr_symbole);
337+
}
367338
}
339+
} else {
340+
$order_total = $woocommerce->cart->total;
368341
}
369342

370343
$order_format_value = str_pad(($order_total * 100), 12, '0', STR_PAD_LEFT);
@@ -412,13 +385,16 @@ public function generate_ipg_form($order_id)
412385
'CustomerEmail' => substr($pgw_email, 0, 254),
413386
'CustomerPhone' => substr($pgw_telephone, 0, 20),
414387
// 'PaymentPlan' => 0000, // No payment plan
415-
'IntAmount' => $total_amount_request / $this->ratehrkfixed,
416388
'ReturnMethod' => 'POST',
417389

418390
'acq_id' => $this->acq_id, // secret key
419391
'PurchaseAmt' => $order_format_value,
420392

421-
'IntCurrency' => 'EUR',
393+
'IntCurrency' => 'HRK',
394+
'IntAmount' => $total_amount_request * $this->ratehrkfixed,
395+
396+
// ISO 4217
397+
'CurrencyCode' => 978
422398
);
423399

424400
$form_args_array = array();

tcom-payway-woocommerce.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WooCommerce PayWay Hrvatski Telekom payment gateway
44
* Plugin URI: https://github.com/marinsagovac/woocommerce-tcom-payway
55
* Description: WooCommerce PayWay Hrvatski Telekom payment gateway
6-
* Version: 1.6
6+
* Version: 1.7
77
* Licence: MIT
88
* License URI: https://opensource.org/licenses/MIT
99
* Author: Marin Šagovac

0 commit comments

Comments
 (0)