1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00
invoiceninja/app/Ninja/Import/Ronin/PaymentTransformer.php

27 lines
637 B
PHP
Raw Normal View History

2015-12-10 14:35:40 +01:00
<?php namespace App\Ninja\Import\Ronin;
use App\Ninja\Import\BaseTransformer;
use League\Fractal\Resource\Item;
/**
* Class PaymentTransformer
*/
2015-12-10 14:35:40 +01:00
class PaymentTransformer extends BaseTransformer
{
/**
* @param $data
* @return Item
*/
2016-06-02 21:03:59 +02:00
public function transform($data)
2015-12-10 14:35:40 +01:00
{
2016-06-02 21:03:59 +02:00
return new Item($data, function ($data) {
2015-12-10 14:35:40 +01:00
return [
'amount' => (float) $data->total - (float) $data->balance,
'payment_date_sql' => $data->date_paid,
'client_id' => $data->client_id,
'invoice_id' => $data->invoice_id,
2015-12-10 14:35:40 +01:00
];
});
}
2016-06-02 21:03:59 +02:00
}