mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 06:02:39 +01:00
39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
|
<?php namespace App\Ninja\Import\Wave;
|
||
|
|
||
|
use App\Ninja\Import\BaseTransformer;
|
||
|
use League\Fractal\Resource\Item;
|
||
|
|
||
|
class VendorTransformer extends BaseTransformer
|
||
|
{
|
||
|
public function transform($data)
|
||
|
{
|
||
|
if ($this->hasVendor($data->customer_name)) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return new Item($data, function ($data) {
|
||
|
return [
|
||
|
'name' => $data->customer_name,
|
||
|
'id_number' => $data->account_number,
|
||
|
'work_phone' => $data->phone,
|
||
|
'website' => $data->website,
|
||
|
'address1' => $data->address_line_1,
|
||
|
'address2' => $data->address_line_2,
|
||
|
'city' => $data->city,
|
||
|
'state' => $data->provincestate,
|
||
|
'postal_code' => $data->postal_codezip_code,
|
||
|
'private_notes' => $data->delivery_instructions,
|
||
|
'contacts' => [
|
||
|
[
|
||
|
'first_name' => $data->contact_first_name,
|
||
|
'last_name' => $data->contact_last_name,
|
||
|
'email' => $data->email,
|
||
|
'phone' => $data->mobile,
|
||
|
],
|
||
|
],
|
||
|
'country_id' => $this->getCountryId($data->country),
|
||
|
];
|
||
|
});
|
||
|
}
|
||
|
}
|