31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace KupShop\BalikonosBundle\BalikobotAdapters;
|
|
|
|
class BalikobotPPLAdapter implements IBalikobotAdapter
|
|
{
|
|
use \DatabaseCommunication;
|
|
|
|
public function transformOrderData(\Order $order, array $data, array &$custom_data): array
|
|
{
|
|
if (!empty($order->getData('delivery_data', false)['pplparcelshop_id'])) {
|
|
// remove KM prefix according to Balikobot docs
|
|
$data['branch_id'] = mb_substr($order->getData('delivery_data', false)['pplparcelshop_id'], 2);
|
|
} elseif (!empty($order->getData('delivery_data', false)['PPLParcelShop_data']['code'])) {
|
|
// remove KM prefix according to Balikobot docs
|
|
$data['branch_id'] = mb_substr($order->getData('delivery_data', false)['PPLParcelShop_data']['code'], 2);
|
|
}
|
|
|
|
// V Nemecku se do boxu posila na ID, nikoliv na jmeno
|
|
if (!empty($order->getData('delivery_data', false)['rec_id'])) {
|
|
$data['rec_id'] = $order->getData('delivery_data', false)['rec_id'];
|
|
}
|
|
|
|
if ($data['require_full_age'] ?? false) {
|
|
$data['full_age_minimum'] = 18;
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
}
|