ItellaPlugins / itella-shipping-woocommerce

Itella Shipping Plugin for Woocommerce
GNU General Public License v2.0
4 stars 3 forks source link

Plugin's API (create shipment) does not work with Estonia's Smartpost API #97

Closed skyzer closed 1 week ago

skyzer commented 9 months ago

I created API key at https://my.smartpost.ee/ and there is just 1 key and not user/secret pair that this plugin expects.

When I press "create shipment" I get bad credentials error {"status":"error","msg":"An error occurred. Status: 401\n Error: Unauthorized\n Message: Bad credentials"}

Digging further, this plugin uses https://nextshipping.posti.fi for API base URI https://github.com/ItellaPlugins/itella-shipping-woocommerce/blob/271b7f795660795be588c7338b2c638d861f225a/libs/itella-api/src/Shipment/Shipment.php#L103 And Oauth2 for authentication (https://oauth2.posti.com), so plugin expects to return authentication token, but with my API key does not do it.

Itella.ee has API documentation where API URI is different https://gateway.posti.fi/smartpost/ Find documentation here: https://itella.ee/api-dokumentatsioon/ And authorization method is just passing authorization key into header Headers: Content-Type: application/json / application/xml Authorization: example-uuid-api-key-123xyz

Does this mean API from Estonian Smartpost is incompatible with this plugin's API? Any possible quick fixes for this?

Also there is $is_test hardcoded as true in register_pickup_point_shipment function, so it could lead to some nasty bugs. https://github.com/ItellaPlugins/itella-shipping-woocommerce/blob/271b7f795660795be588c7338b2c638d861f225a/admin/class-itella-shipping-method.php#L2182

markakk commented 1 week ago

Please contact Smartpost Itella about the problem. If they see that the problem is in the module, then they will inform us.