myparcelnl / magento

The Magento 2 MyParcel plugin
https://developer.myparcel.nl/nl/documentatie/13.magento2.html
MIT License
19 stars 26 forks source link

Order gets status Completed when MyParcel API gave an error #521

Open gerben86 opened 3 years ago

gerben86 commented 3 years ago

Describe the bug The status of the Order is "Complete" (finished/voltooid) while no label was printed due to an error of the MyParcel-API. So, in fact, the order isn't complete, because we can't ship that order at that moment.

I see this error in the log: [2020-12-22 04:38:53] main.CRITICAL: Error in MyParcel API request: data.shipments[0].carrier - data.shipments[0].carrier Maximum amount of 0 PostNL package shipments per day exceeded - Shipment validation error Url: https://api.myparcel.nl/shipments Request: {"data":{"shipments":[{"recipient":{"cc":"NL","person":..SENSITIVE DATA!.} {"exception":"[object] (MyParcelNL\\Sdk\\src\\Exception\\ApiException(code: 0): Error in MyParcel API request: data.shipments[0].carrier - data.shipments[0].carrier Maximum amount of 0 PostNL package shipments per day exceeded - Shipment validation error Url: https://api.myparcel.nl/shipments Request: {\"data\":{\"shipmeSENSITIVE DATA! p\":0}}]}} at vendor/myparcelnl/sdk/src/Model/MyParcelRequest.php:183)"} []

Expected behavior The order would keep the status "Gaande" if there's an error in the MyParcel-API when the shipping-label is created.

Desktop (please complete the following information):

gerben86 commented 3 years ago

Another situation where this happens: [2021-01-20 15:54:32] main.CRITICAL: Error in MyParcel API request: data.shipments[0].options.delivery_date - data.shipments[0].options.delivery_date delivery_date can not be in the past - Shipment validation error Url: https://api.myparcel.nl/shipments Request: {"data":{"shipments":[...."delivery_date":"2021-01-20 16:00:00","delivery_type":4},....]}} {"exception":"[object] (MyParcelNL\\Sdk\\src\\Exception\\ApiException(code: 0): Error in MyParcel API request: data.shipments[0].options.delivery_date - data.shipments[0].options.delivery_date delivery_date can not be in the past - Shipment validation error Url: https://api.myparcel.nl/shipments Request: {\"data\":{\"shipments\":[{...,\"delivery_date\":\"2021-01-20 16:00:00\"...}}]}} at /vendor/myparcelnl/sdk/src/Model/MyParcelRequest.php:183)"} []

gerben86 commented 3 years ago

Another situation where this happens: [2021-05-05 14:45:21] main.CRITICAL: Error in MyParcel API request: 0 - data.shipments[8].recipient.phone Must be at most 25 characters long - Failed validation against JSON-SCHEMA shipment/post_shipments_request-v1.1.json Url: https://api.myparcel.nl/shipments Request: {"data":{"shipments":............."disable_auto_detect_pickup\":0}}]}} at vendor/myparcelnl/sdk/src/Model/MyParcelRequest.php:183)"} []

It's very annoying that we need to check the logs to see what's the functional reason behind the error...