@@ -1190,18 +1190,22 @@ public function createShipment(&$route, &$data, $orderID = "", $orderStatusID =
1190
1190
}
1191
1191
1192
1192
if (((isset ($ shipment_status_id ) && $ order_status_id == $ shipment_status_id )) || ((isset ($ order_complete_statuses ) && in_array ($ order_status_id , $ order_complete_statuses )))) {
1193
- //Shipment lines
1194
- $ shipmentLine = array ();
1195
- foreach ($ mollieOrder ->lines as $ line ) {
1196
- $ shipmentLine [] = array (
1197
- 'id ' => $ line ->id ,
1198
- 'quantity ' => $ line ->quantity
1199
- );
1200
- }
1193
+ try {
1194
+ //Shipment lines
1195
+ $ shipmentLine = array ();
1196
+ foreach ($ mollieOrder ->lines as $ line ) {
1197
+ $ shipmentLine [] = array (
1198
+ 'id ' => $ line ->id ,
1199
+ 'quantity ' => $ line ->quantity
1200
+ );
1201
+ }
1201
1202
1202
- $ shipmentData ['lines ' ] = $ shipmentLine ;
1203
- $ mollieShipment = $ mollieOrder ->createShipment ($ shipmentData );
1204
- $ this ->writeToMollieLog ("Shipment created for order - {$ order_id }, {$ mollie_order_id }" );
1203
+ $ shipmentData ['lines ' ] = $ shipmentLine ;
1204
+ $ mollieShipment = $ mollieOrder ->createShipment ($ shipmentData );
1205
+ $ this ->writeToMollieLog ("Shipment created for order - {$ order_id }, {$ mollie_order_id }" );
1206
+ } catch (Mollie \Api \Exceptions \ApiException $ e ) {
1207
+ $ this ->writeToMollieLog ("Shipment could not be created for order - {$ order_id }, {$ mollie_order_id }; " . htmlspecialchars ($ e ->getMessage ()));
1208
+ }
1205
1209
}
1206
1210
}
1207
1211
}
@@ -1360,21 +1364,25 @@ public function callback()
1360
1364
satisfies the 'Create shipment immediately after order creation' condition. */
1361
1365
1362
1366
if (($ orderDetails ->isPaid () || $ orderDetails ->isAuthorized ()) && ($ this ->config ->get ($ moduleCode . "_create_shipment " )) == 1 ) {
1363
- //Shipment lines
1364
- $ shipmentLine = array ();
1365
- foreach ($ orderDetails ->lines as $ line ) {
1366
- $ shipmentLine [] = array (
1367
- 'id ' => $ line ->id ,
1368
- 'quantity ' => $ line ->quantity
1369
- );
1370
- }
1367
+ try {
1368
+ //Shipment lines
1369
+ $ shipmentLine = array ();
1370
+ foreach ($ orderDetails ->lines as $ line ) {
1371
+ $ shipmentLine [] = array (
1372
+ 'id ' => $ line ->id ,
1373
+ 'quantity ' => $ line ->quantity
1374
+ );
1375
+ }
1371
1376
1372
- $ shipmentData ['lines ' ] = $ shipmentLine ;
1373
- $ mollieShipment = $ orderDetails ->createShipment ($ shipmentData );
1374
- $ shipped_status_id = intval ($ this ->config ->get ($ moduleCode . "_ideal_shipping_status_id " ));
1375
- $ this ->addOrderHistory ($ order , $ shipped_status_id , $ this ->language ->get ("shipment_success " ), true );
1376
- $ this ->writeToMollieLog ("Shipment created for order - {$ order_id }, {$ mollie_order_id }" );
1377
- $ order ['order_status_id ' ] = $ shipped_status_id ;
1377
+ $ shipmentData ['lines ' ] = $ shipmentLine ;
1378
+ $ mollieShipment = $ orderDetails ->createShipment ($ shipmentData );
1379
+ $ shipped_status_id = intval ($ this ->config ->get ($ moduleCode . "_ideal_shipping_status_id " ));
1380
+ $ this ->addOrderHistory ($ order , $ shipped_status_id , $ this ->language ->get ("shipment_success " ), true );
1381
+ $ this ->writeToMollieLog ("Shipment created for order - {$ order_id }, {$ mollie_order_id }" );
1382
+ $ order ['order_status_id ' ] = $ shipped_status_id ;
1383
+ } catch (Mollie \Api \Exceptions \ApiException $ e ) {
1384
+ $ this ->writeToMollieLog ("Shipment could not be created for order - {$ order_id }, {$ mollie_order_id }; " . htmlspecialchars ($ e ->getMessage ()));
1385
+ }
1378
1386
}
1379
1387
// Show a 'transaction failed' page if we couldn't find the order or if the payment failed.
1380
1388
$ failed_status_id = $ this ->config ->get ($ moduleCode . "_ideal_failed_status_id " );
0 commit comments