Dodanie obsługi błędów dla integracji z APILO w przypadku braku punktu ORLEN PACZKA w zamówieniu

This commit is contained in:
2025-10-26 23:16:40 +01:00
parent 53fd9f8126
commit a1a85e8489
3 changed files with 10 additions and 3 deletions

View File

@@ -503,6 +503,7 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
$access_token = \admin\factory\Integrations::apilo_get_access_token();
$order_date = new DateTime( $order['date_order'] );
$paczkomatData = parsePaczkomatAddress( $order['inpost_paczkomat'] );
$orlenPointData = parseOrlenAddress( $order['orlen_point'] );
@@ -516,7 +517,7 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
$street = $paczkomatData['address'];
else if ( $orlenPointData )
$street = $orlenPointData['address'];
else if ( $order['transport_id'] == 3 )
else if ( $order['transport_id'] == 3 or ( $order['transport_id'] == 9 and $order['orlen_point'] == null ) )
$street = 'ul. Krakowska 156/104';
if ( $order['client_city'] )
@@ -525,7 +526,7 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
$city = $paczkomatData['city'];
else if ( $orlenPointData )
$city = $orlenPointData['city'];
else if ( $order['transport_id'] == 3 )
else if ( $order['transport_id'] == 3 or ( $order['transport_id'] == 9 and $order['orlen_point'] == null ) )
$city = 'Rzeszów';
if ( $order['client_postal_code'] )
@@ -534,9 +535,14 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
$postal_code = $paczkomatData['postalCode'];
else if ( $orlenPointData )
$postal_code = $orlenPointData['postalCode'];
else if ( $order['transport_id'] == 3 )
else if ( $order['transport_id'] == 3 or ( $order['transport_id'] == 9 and $order['orlen_point'] == null ) )
$postal_code = '35-506';
if ( $order['transport_id'] == 9 and $order['orlen_point'] == null )
{
\S::send_email( 'biuro@project-pro.pl', 'Błąd integracji APILO - brak punktu ORLEN PACZKA', 'W zamówieniu #' . $order['id'] . ' wybrano dostawę ORLEN PACZKA, ale nie podano punktu odbioru. Proszę o uzupełnienie danych w panelu sklepu.' );
}
$postData = [
'idExternal' => $order['id'],
'isInvoice' => $order['firm_name'] ? true : false,
@@ -707,6 +713,7 @@ if ( $apilo_settings['enabled'] and $apilo_settings['sync_orders'] and $apilo_se
if ( $responseData['id'] and $responseData['status'] )
{
$shop_status_id = \front\factory\ShopStatuses::get_shop_status_by_integration_status_id( 'apilo', $responseData['status'] );
$order_tmp = new Order( $order['id'] );
if ( $shop_status_id )