1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Ninja/Import/CSV/PaymentTransformer.php

19 lines
568 B
PHP
Raw Normal View History

2015-11-24 20:45:38 +01:00
<?php namespace App\Ninja\Import\CSV;
2015-12-08 11:10:20 +01:00
use App\Ninja\Import\BaseTransformer;
2015-11-24 20:45:38 +01:00
use League\Fractal\Resource\Item;
2015-12-08 11:10:20 +01:00
class PaymentTransformer extends BaseTransformer
2015-11-24 20:45:38 +01:00
{
2015-12-08 11:10:20 +01:00
public function transform($data)
2015-11-24 20:45:38 +01:00
{
2015-12-08 11:10:20 +01:00
return new Item($data, function ($data) {
2015-11-24 20:45:38 +01:00
return [
'amount' => $data->paid,
2015-11-24 21:41:08 +01:00
'payment_date_sql' => isset($data->invoice_date) ? $data->invoice_date : null,
2015-11-24 20:45:38 +01:00
'client_id' => $data->client_id,
'invoice_id' => $this->getInvoiceId($data->invoice_id),
2015-11-24 20:45:38 +01:00
];
});
}
}