Skip to content

Commit 418c2a8

Browse files
committed
1.6.0 rc1
1 parent 4d33b59 commit 418c2a8

65 files changed

Lines changed: 1194 additions & 781 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/issue_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ Issues with outdated version will be rejected.
4444

4545
### TIG support
4646

47-
- Please ask your question in English to ensure that your issue can help other people internationally. Nevertheless we will respond in English.
47+
- Please ask your question in English to ensure that your issue can help other people internationally. Nevertheless, we will respond in English.

Block/Adminhtml/Config/Credentials/Button.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public function render(AbstractElement $element)
6262
*
6363
* @return \Magento\Framework\Phrase
6464
*/
65-
public function getLabel()
65+
public function getSignUpLabel()
6666
{
67-
return __('Get Credentials');
67+
return __('Sign Up For A Paid Account');
6868
}
6969

7070
/**

Block/Adminhtml/Config/Support/Tab.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Tab extends Template implements RendererInterface
4040
{
4141
const MODULE_NAME = 'TIG_Postcode';
4242

43-
const EXTENSION_VERSION = '1.5.6';
43+
const EXTENSION_VERSION = '1.6.0';
4444

4545
// @codingStandardsIgnoreLine
4646
protected $_template = 'TIG_Postcode::config/support/tab.phtml';

Config/Provider/ApiConfiguration.php

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,31 @@
2929
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright
3030
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
3131
*/
32+
3233
namespace TIG\Postcode\Config\Provider;
3334

3435
class ApiConfiguration extends AbstractConfigProvider
3536
{
36-
public const XPATH_API_BASE = 'tig_postcode/api/base';
37-
public const XPATH_API_VERSION = 'tig_postcode/api/version';
38-
public const XPATH_API_TYPE = 'tig_postcode/api/type';
37+
public const XPATH_API_BASE = 'tig_postcode/api/base';
38+
39+
public const XPATH_API_VERSION = 'tig_postcode/api/version';
40+
41+
public const XPATH_API_TYPE = 'tig_postcode/api/type';
42+
43+
public const XPATH_API_BE_BASE = 'tig_postcode/api_be/base';
3944

40-
public const XPATH_API_BE_BASE = 'tig_postcode/api_be/base';
41-
public const XPATH_API_BE_POSTCODE_VERSION = 'tig_postcode/api_be/postcode_version';
42-
public const XPATH_API_BE_STREET_VERSION = 'tig_postcode/api_be/street_version';
45+
public const XPATH_API_BE_POSTCODE_VERSION = 'tig_postcode/api_be/postcode_version';
46+
47+
public const XPATH_API_BE_STREET_VERSION = 'tig_postcode/api_be/street_version';
4348

4449
/**
4550
* Get base Uri
4651
*
4752
* @return string
4853
*/
49-
public function getBaseUri()
54+
public function getBaseUri(): string
5055
{
51-
return $this->getBase() . '/' . $this->getVersion() . '/' . $this->getType() . '/';
56+
return $this->getBase() . '/' . $this->getVersion() . '/';
5257
}
5358

5459
/**
@@ -58,20 +63,20 @@ public function getBaseUri()
5863
*
5964
* @return string
6065
*/
61-
public function getBeBaseUri($endpoint)
66+
public function getBEBaseUri(string $endpoint): string
6267
{
6368
return $this->getBase('BE') . '/' . $this->getVersion('BE', $endpoint) . '/';
6469
}
6570

6671
/**
6772
* Get base path via country and store ID
6873
*
69-
* @param string $country
70-
* @param string|int|null $store
74+
* @param string $country
75+
* @param int|string|null $store
7176
*
7277
* @return mixed
7378
*/
74-
public function getBase($country = 'NL', $store = null)
79+
public function getBase(string $country = 'NL', int|string $store = null): mixed
7580
{
7681
$xpath = static::XPATH_API_BASE;
7782
if ($country == 'BE') {
@@ -82,23 +87,27 @@ public function getBase($country = 'NL', $store = null)
8287
}
8388

8489
/**
85-
* Versioning for BE is not live yet. Implement this function in getBeBaseUri when this goes live.
90+
* Versioning handling for multiple countries
8691
*
87-
* @param string $country
88-
* @param string|null $endpoint
89-
* @param string|int|null $store
92+
* @param string $country
93+
* @param string|null $endpoint
94+
* @param int|string|null $store
9095
*
9196
* @return mixed
9297
*/
93-
public function getVersion($country = 'NL', $endpoint = null, $store = null)
98+
public function getVersion(string $country = 'NL', string $endpoint = null, int|string $store = null): mixed
9499
{
95100
$xpath = static::XPATH_API_VERSION;
96-
if ($country == 'BE' && $endpoint == 'postcode-find/') {
97-
$xpath = static::XPATH_API_BE_POSTCODE_VERSION;
98-
}
99101

100-
if ($country == 'BE' && $endpoint == 'street-find/') {
101-
$xpath = static::XPATH_API_BE_STREET_VERSION;
102+
if ($country == 'BE') {
103+
switch ($endpoint) {
104+
case 'zipcode-find/':
105+
$xpath = static::XPATH_API_BE_POSTCODE_VERSION;
106+
break;
107+
case 'street-find/':
108+
$xpath = static::XPATH_API_BE_STREET_VERSION;
109+
break;
110+
}
102111
}
103112

104113
return $this->getConfigFromXpath($xpath, $store);
@@ -107,11 +116,11 @@ public function getVersion($country = 'NL', $endpoint = null, $store = null)
107116
/**
108117
* Get type via store ID
109118
*
110-
* @param string|int|null $store
119+
* @param int|string|null $store
111120
*
112121
* @return mixed
113122
*/
114-
public function getType($store = null)
123+
public function getType(int|string $store = null): mixed
115124
{
116125
return $this->getConfigFromXpath(static::XPATH_API_TYPE, $store);
117126
}

Config/Provider/ClientConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getClientId($store = null)
8888
* @return string
8989
* @throws \Exception
9090
*/
91-
public function getApiKey($store = null)
91+
public function getSecureCode($store = null)
9292
{
9393
$modusXpath = $this->getModusXpath(static::XPATH_CONFIGURATION_API_KEY, $store);
9494
$key = $this->getConfigFromXpath($modusXpath, $store);

Config/Source/Modus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Modus implements ArrayInterface
4040
*
4141
* @return array
4242
*/
43-
public function toOptionArray()
43+
public function toOptionArray(): array
4444
{
4545
// @codingStandardsIgnoreStart
4646
$options = [

Config/Source/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Parser implements ArrayInterface
4444
*
4545
* @return array
4646
*/
47-
public function toOptionArray()
47+
public function toOptionArray(): array
4848
{
4949
// @codingStandardsIgnoreStart
5050
$options = [

Helper/TigFieldsHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(
6464
* @param mixed $extensionAttributes
6565
* @param mixed $object
6666
*/
67-
public function copyFieldsFromExtensionAttributesToObject($extensionAttributes, $object)
67+
public function copyFieldsFromExtensionAttributesToObject($extensionAttributes, $object): void
6868
{
6969
if (empty($extensionAttributes)) {
7070
return;
@@ -87,7 +87,7 @@ public function copyFieldsFromExtensionAttributesToObject($extensionAttributes,
8787
public function copyFieldsFromQuoteAddressToCustomerAddress(
8888
QuoteAddressInterface $quoteAddress,
8989
CustomerAddressInterface $customerAddress
90-
) {
90+
): void {
9191
try {
9292
foreach (self::TIG_FIELDS as $fieldName) {
9393
$value = $quoteAddress->getData($fieldName);

NEWS.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Postcode Service 1.6.0 Release
2+
3+
## New features
4+
5+
- Switched from Netherlands V3 API to Netherlands V5 API for quicker responses:
6+
7+
from:
8+
9+
```text
10+
V3: https://api.postcodeservice.com/nl/v3/getAddress?postcode=4201KB&huisnummer=63
11+
```
12+
13+
to:
14+
15+
```text
16+
V5: https://api.postcodeservice.com/nl/v5/find?zipcode=4201KB&houseno=63
17+
```
18+
19+
- Added support for Belgium bilingual results in bilingual municipalities,
20+
see https://developers.postcodeservice.com/#belgium-api-GETbe-v3-zipcode-find
21+
- Switched from Belgium V2 API to Belgium V3 API, also enabling bilingual results for zipcodes, for
22+
example:
23+
24+
```text
25+
V3: https://api.postcodeservice.com/be/v3/zipcode-find?zipcodezone=1050&multiresults=1
26+
```
27+
28+
```json
29+
[
30+
{
31+
"zipcode": 1050,
32+
"city": "Brussel",
33+
"latitude": 50.8222854,
34+
"longitude": 4.3815707
35+
},
36+
{
37+
"zipcode": 1050,
38+
"city": "Bruxelles",
39+
"latitude": 50.8222854,
40+
"longitude": 4.3815707
41+
}
42+
...
43+
]
44+
```
45+
46+
- Added Germany as a configuration option in the Magento Admin panel, expanding geographical
47+
support.
48+
- Added Germany V1 API support in the Magento extension, for example this returns all zipcodes
49+
starting with 4072XX when the end-user starts typing `4072..` in the zipcode field:
50+
51+
```text
52+
https://api.postcodeservice.com/de/v1/zipcode-find?zipcodezone=4072
53+
```
54+
55+
```json
56+
[
57+
{
58+
"zipcode": 40721,
59+
"city": "Hilden"
60+
},
61+
{
62+
"zipcode": 40723,
63+
"city": "Hilden"
64+
},
65+
{
66+
"zipcode": 40724,
67+
"city": "Hilden"
68+
}
69+
]
70+
```
71+
72+
- Added console logging and info message display when the Postcode Service API is called and an
73+
issue occurs, for example when the authorization is failed, improving overal debuggability. The
74+
code can be found in the folder `view/base/web/js/postcode-handler` in files `postcode-nl.js`
75+
and `postcode-be.js`:
76+
77+
```js
78+
if (data.error_code) {
79+
// show error in console
80+
console.error('Postcodeservice.com extension: ' + JSON.stringify(data));
81+
if (data.error_code > 400) {
82+
errorMessage = 'Could not perform address validation.';
83+
}
84+
if (data.error_code === 429) {
85+
errorMessage = 'Address validation temporarily unavailable.';
86+
}
87+
}
88+
```
89+
90+
- Added handling of rate limiting errors from api.postcodeservice.com in JSON format instead of
91+
plain text.
92+
- Revised and updated the Magento User manual to ensure it matches the latest changes.
93+
- Updated `SECURITY.md` with GitHub’s private reporting option, providing a secure channel for issue
94+
reporting.
95+
- Successfully tested the extension with the new Magento 2.4.7-beta1, confirming compatibility and
96+
performance.
97+
98+
## UX/UC improvements
99+
100+
- Substantially decreased the loading speed of the address results for the Netherlands, reducing the
101+
wait time from 500 milliseconds to a mere 30 milliseconds by default. This can be changed
102+
in `postcode-nl.js`,
103+
see comment `// The last parameter is the delay in millisecond` in the file.
104+
- Similarly, decreased the loading speed of the address results for Belgium from 500 milliseconds to
105+
50 milliseconds for
106+
streets and 30 milliseconds for zipcodes by default. This can be changed in `postcode-be.js`, see
107+
twice
108+
the comment `// Parameter for the results delay in milliseconds`.
109+
- Eliminated the redundant loading screen for Nederlands in Magento Checkout, enhancing the overall
110+
user experience in the vanilla Magento Luma checkout theme. You can still turn this on in the
111+
file `postcode-api.js` in the method `getPostCodeNL` by setting the variable `showLoader: false` to `true`.
112+
- Deactivated advanced settings that were not being utilized, thereby simplifying the user
113+
interface.
114+
- Added new documentation links from within the extension to the Magento User manual and underlying
115+
API.
116+
- Integrated direct support form links to the Postcode Service support team in the Magento Admin
117+
panel, ensuring more efficient assistance when required.
118+
- Transitioned inline SVG images to external links, resulting in a cleaner codebase and smaller svg
119+
files.
120+
- Modified the external image link to align with the Postcode Service color scheme.
121+
- Introduced explanatory text for test credentials in the Magento Admin panel to prevent confusion,
122+
improving user comprehension.
123+
- Revised info messages such as `Loading streets ...`, `Cannot find street, is it correct?` to be
124+
more clear and consistent, enhancing
125+
end-user communication clarity.
126+
- Renamed menu item in `Stores -> Configuration -> Sales` name from `Postcode Service International`
127+
to `Postcode Service` to make it more intuitive.
128+
129+
## Fixed bugs
130+
131+
- Rectified a typo error in the sign-up button.
132+
- Undertook code refactoring in `tab.phtml`, `postcode-nl.js`, `postcode-be.js`,
133+
and `postcode-handler.js` to improve readability and maintainability.
134+
- Resolved a z-index/overlap issue on Belgium data fields that occurred when more than 7 results
135+
were returned, ensuring proper display of the result set in the checkout.
136+
- Addressed a bug where info messages such as `Loading zipcodes ...` could inadvertently be copied
137+
into
138+
the postcode, street, or city field.
139+
140+
## Language changes
141+
142+
- Updated the language files `nl_NL.csv`, `be_BE.csv`, and `fr_FR.csv` by adding new
143+
JavaScript and PHP output strings for improved localization support.
144+
145+
## Release credits
146+
147+
- Thanks go out to the following people for contributing to this release: Robert, Tim S., Vincent, Erik de
148+
Groot, Viktoriia and Peter S.

Plugin/Checkout/Model/GuestPaymentInformationManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function beforeSavePaymentInformation(
6969
$email,
7070
$paymentMethod,
7171
$address
72-
) {
72+
): void {
7373
if (!$address) {
7474
return;
7575
}

0 commit comments

Comments
 (0)