33 lines
984 B
PHP
33 lines
984 B
PHP
<?php
|
|
|
|
namespace KupShop\BalikonosBundle\BalikobotAdapters;
|
|
|
|
class BalikobotJAPOAdapter implements IBalikobotAdapter
|
|
{
|
|
use \DatabaseCommunication;
|
|
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public function transformOrderData(\Order $order, array $data, array &$custom_data): array
|
|
{
|
|
// formát bez mezer v kódu neprojde - "85181000" => "8518.10.00",
|
|
if (!empty($data['content_data'])) {
|
|
$data['content_data'] = array_map(function ($d) {
|
|
$d['content_customs_code'] = substr($d['content_customs_code'], 0, 4).'.'.
|
|
substr($d['content_customs_code'], 4, 2).'.'.substr($d['content_customs_code'], 6, 2);
|
|
|
|
return $d;
|
|
}, $data['content_data']);
|
|
}
|
|
|
|
$note_admin = json_decode($order['note_admin'], true);
|
|
if (!empty($note_admin['expando']['orderId'])) {
|
|
$data['reference'] = $note_admin['expando']['orderId'];
|
|
}
|
|
|
|
return $data;
|
|
}
|
|
}
|