2019-10-17 13:49:09 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-10-17 13:49:09 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-10-17 13:49:09 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Transformers;
|
|
|
|
|
|
|
|
use App\Models\Gateway;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* class ClientTransformer.
|
2019-10-17 13:49:09 +02:00
|
|
|
*/
|
|
|
|
class GatewayTransformer extends EntityTransformer
|
|
|
|
{
|
|
|
|
use MakesHash;
|
|
|
|
|
|
|
|
protected $defaultIncludes = [
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $availableIncludes = [
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
2020-10-28 11:10:49 +01:00
|
|
|
* @param Gateway $gateway
|
2019-10-17 13:49:09 +02:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function transform(Gateway $gateway)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => $this->encodePrimaryKey($gateway->id),
|
2020-09-06 11:38:10 +02:00
|
|
|
'name' => (string) $gateway->name ?: '',
|
|
|
|
'key' => (string) $gateway->key ?: '',
|
|
|
|
'provider' => (string) $gateway->provider ?: '',
|
|
|
|
'visible' => (bool) $gateway->visible,
|
|
|
|
'sort_order' => (int) $gateway->sort_order,
|
|
|
|
'default_gateway_type_id' => (string) $gateway->default_gateway_type_id,
|
|
|
|
'site_url' => (string) $gateway->site_url ?: '',
|
|
|
|
'is_offsite' => (bool) $gateway->is_offsite,
|
|
|
|
'is_secure' => (bool) $gateway->is_secure,
|
|
|
|
'fields' => (string) $gateway->fields ?: '',
|
|
|
|
'updated_at' => (int) $gateway->updated_at,
|
|
|
|
'created_at' => (int) $gateway->created_at,
|
2020-10-08 00:25:39 +02:00
|
|
|
'options' => $gateway->getMethods(),
|
2019-10-17 13:49:09 +02:00
|
|
|
];
|
|
|
|
}
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|