1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Transformers/CompanyGatewayTransformer.php
2019-10-03 20:59:19 +10:00

70 lines
2.3 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Transformers;
use App\Models\CompanyGateway;
use App\Utils\Traits\MakesHash;
/**
* Class CompanyGatewayTransformer.
*/
class CompanyGatewayTransformer extends EntityTransformer
{
use MakesHash;
/**
* @var array
*/
protected $defaultIncludes = [
];
/**
* @var array
*/
protected $availableIncludes = [
];
/**
* @param CompanyGateway $company_gateway
*
* @return array
*/
public function transform(CompanyGateway $company_gateway)
{
return [
'id' => (string)$this->encodePrimaryKey($company_gateway->id),
'gateway_key' => (string)$company_gateway->gateway_key ?: '',
'accepted_credit_cards' => (int)$company_gateway->accepted_credit_cards,
'require_cvv' => (bool)$company_gateway->require_cvv,
'show_address' => (bool)$company_gateway->show_address,
'show_shipping_address' => (bool)$company_gateway->show_shipping_address,
'update_details' => (bool)$company_gateway->update_details,
'config' => (string) $company_gateway->getConfigTransformed(),
'priority_id' => (int)$company_gateway->priority_id,
'min_limit' => (float)$company_gateway->min_limit,
'max_limit' => (float)$company_gateway->max_limit,
'fee_amount' => (float) $company_gateway->fee_amount,
'fee_percent' => (float)$company_gateway->fee_percent ?: '',
'fee_tax_name1' => (string)$company_gateway->fee_tax_name1 ?: '',
'fee_tax_name2' => (string) $company_gateway->fee_tax_name2 ?: '',
'fee_tax_rate1' => (float) $company_gateway->fee_tax_rate1,
'fee_tax_rate2' => (float)$company_gateway->fee_tax_rate2,
'fee_cap' => (float)$company_gateway->fee_cap,
'adjust_fee_percent' => (bool)$company_gateway->adjust_fee_percent,
'updated_at' => $company_gateway->updated_at,
'deleted_at' => $company_gateway->deleted_at,
];
}
}