2019-10-25 20:49:38 +11:00
|
|
|
<?php
|
|
|
|
|
/**
|
2020-09-06 19:38:10 +10:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-10-25 20:49:38 +11:00
|
|
|
*
|
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
|
*
|
2020-01-07 11:13:47 +11:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-10-25 20:49:38 +11:00
|
|
|
*
|
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace App\Transformers;
|
|
|
|
|
|
|
|
|
|
use App\Models\ClientGatewayToken;
|
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class ClientGatewayTokenTransformer.
|
|
|
|
|
*/
|
|
|
|
|
class ClientGatewayTokenTransformer extends EntityTransformer
|
|
|
|
|
{
|
|
|
|
|
use MakesHash;
|
2020-09-06 19:38:10 +10:00
|
|
|
|
2019-10-25 20:49:38 +11:00
|
|
|
/**
|
|
|
|
|
* @param ClientGatewayToken $cgt
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function transform(ClientGatewayToken $cgt)
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'id' => $this->encodePrimaryKey($cgt->id),
|
2020-09-06 19:38:10 +10:00
|
|
|
'token' => (string) $cgt->token ?: '',
|
2019-10-25 20:49:38 +11:00
|
|
|
'gateway_customer_reference' => $cgt->gateway_customer_reference ?: '',
|
2020-09-06 19:38:10 +10:00
|
|
|
'gateway_type_id' => (string) $cgt->gateway_type_id ?: '',
|
|
|
|
|
'company_gateway_id' => (string) $this->encodePrimaryKey($cgt->company_gateway_id) ?: '',
|
2019-10-25 20:49:38 +11:00
|
|
|
'is_default' => (bool) $cgt->is_default,
|
2020-08-13 19:59:29 +10:00
|
|
|
'meta' => $cgt->meta,
|
2020-09-06 19:38:10 +10:00
|
|
|
'created_at' => (int) $cgt->created_at,
|
|
|
|
|
'updated_at' => (int) $cgt->updated_at,
|
|
|
|
|
'archived_at' => (int) $cgt->deleted_at,
|
2020-08-12 08:17:32 +10:00
|
|
|
'is_deleted' => (bool) $cgt->is_deleted,
|
2019-10-25 20:49:38 +11:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|