Northern Territory Postcodes return an error
JEifert opened this issue · 1 comments
Hi,
We're using version 1.0.4 of the extension and are not able to complete checkout using a postcode from the Northern Territory, such as 0800. We can enter the address, but no Shipping Methods appear.
The following error is logged when we use the postcode "0800":
[2019-08-16 04:36:05] main.CRITICAL: Report ID: webapi-5d5632b57258d; Message: Client error response
[status code] 404
[reason phrase] Not Found
[url] https://digitalapi.auspost.com.au/postage/parcel/domestic/service?from_postcode=5000&to_postcode=800&length=20&width=20&height=20&weight=0.0045 {"exception":"[object] (Exception(code: 0): Report ID: webapi-5d5632b57258d; Message: Client error response
[status code] 404
[reason phrase] Not Found
[url] https://digitalapi.auspost.com.au/postage/parcel/domestic/service?from_postcode=5000&to_postcode=800&length=20&width=20&height=20&weight=0.0045 at {MAGENTO ROOT}/vendor/magento/framework/Webapi/ErrorProcessor.php:205, Guzzle\Http\Exception\ClientErrorResponseException(code: 0): Client error response
From our investigation, it looks like Line #137 of australia-mage2/Model/Shipping/Carrier/AustraliaPost.php (https://github.com/fontis/australia-mage2/blob/master/Model/Shipping/Carrier/AustraliaPost.php#L137) converts the To Postcode to an integer, causing Northern Territory postcodes to drop the "0" at the front, changing it to "800".