Skip to content

Commit a60515e

Browse files
authored
Merge pull request #24 from marinsagovac/feature/hnb_tecaj_v3
feat: hnb tecaj v3 change
2 parents 4bef6b1 + c450519 commit a60515e

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

CHANGELOG.md

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

77
## Versions
88

9+
### 1.7.1
10+
11+
* Change HNB URL tecajna to v3
12+
913
### 1.7
1014

1115
Use since 01.01.2023 as EUR mandatory currency:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ Removed
4141

4242
Latest version:
4343

44-
* Version [1.7](https://github.com/marinsagovac/woocommerce-tcom-payway/archive/refs/tags/1.7.zip) December/2022
44+
* Version [1.7.1](https://github.com/marinsagovac/woocommerce-tcom-payway/archive/refs/tags/1.7.1.zip) January/2023
4545

4646
API 2.x.x:
4747

48+
* Version [1.7.1](https://github.com/marinsagovac/woocommerce-tcom-payway/archive/refs/tags/1.7.1.zip) January/2023
4849
* Version [1.7](https://github.com/marinsagovac/woocommerce-tcom-payway/archive/refs/tags/1.7.zip) December/2022
4950
* Version [1.6.1](https://github.com/marinsagovac/woocommerce-tcom-payway/archive/refs/tags/1.6.1.zip) September/2022
5051

classes/class-wc-tpayway.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct()
2121
$this->curlExtension = extension_loaded('curl');
2222

2323
$this->ratehrkfixed = 7.53450;
24-
$this->tecajnaHnbApi = "https://api.hnb.hr/tecajn/v2";
24+
$this->tecajnaHnbApi = "https://api.hnb.hr/tecajn-eur/v3";
2525

2626
$this->api_version = '2.0';
2727

@@ -205,7 +205,7 @@ private function get_last_modified_hnb_file()
205205
/**
206206
* Retrieve by currency conversion rate
207207
*
208-
* @return void
208+
* @return array|string|string[]|void
209209
*/
210210
private function fetch_hnb_currency($currency) {
211211

@@ -216,7 +216,8 @@ private function fetch_hnb_currency($currency) {
216216

217217
foreach ($jsonFile as $val) {
218218
if ($val['valuta'] === $currency) {
219-
return $val['jedinica'] * $val['srednji_tecaj'];
219+
/** @var float $val */
220+
return str_replace(",", ".", $val['srednji_tecaj']);
220221
}
221222

222223
}
@@ -410,16 +411,16 @@ public function generate_ipg_form($order_id)
410411
}
411412

412413
return '<p></p>
413-
<p>Total amount will be <b>' . number_format(($order_total)) . ' ' . $curr_symbole . '</b></p>
414-
<form action="' . $pgDomain . '" method="post" name="payway-authorize-form" id="payway-authorize-form" type="application/x-www-form-urlencoded">
415-
' . implode('', $form_args_array) . '
416-
<input type="submit" class="button-alt" id="submit_ipg_payment_form" value="' . __('Pay via PayWay', 'tcom-payway-wc') . '" />
417-
<a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order &amp; restore cart', 'tcom-payway-wc') . '</a>
418-
</form>
419-
<!-- autoform submit -->
420-
<script type="text/javascript">
421-
jQuery("#submit_ipg_payment_form").trigger("click");
422-
</script>
414+
<p>Total amount will be <b>' . number_format(($order_total)) . ' ' . $curr_symbole . '</b></p>
415+
<form action="' . $pgDomain . '" method="post" name="payway-authorize-form" id="payway-authorize-form" type="application/x-www-form-urlencoded">
416+
' . implode('', $form_args_array) . '
417+
<input type="submit" class="button-alt" id="submit_ipg_payment_form" value="' . __('Pay via PayWay', 'tcom-payway-wc') . '" />
418+
<a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . __('Cancel order &amp; restore cart', 'tcom-payway-wc') . '</a>
419+
</form>
420+
<!-- autoform submit -->
421+
<script type="text/javascript">
422+
jQuery("#submit_ipg_payment_form").trigger("click");
423+
</script>
423424
';
424425
}
425426

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.7
6+
* Version: 1.7.1
77
* Licence: MIT
88
* License URI: https://opensource.org/licenses/MIT
99
* Author: Marin Šagovac

0 commit comments

Comments
 (0)