invoiceninja/app/Models/GatewayType.php

79 lines
1.9 KiB
PHP
Raw Normal View History

2019-08-22 10:25:30 +10:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
2019-08-22 10:25:30 +10:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
2019-08-22 10:25:30 +10:00
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Models;
use App\Models\Gateway;
use Illuminate\Database\Eloquent\Model;
class GatewayType extends StaticModel
2019-08-22 10:25:30 +10:00
{
public $timestamps = false;
2019-08-22 10:25:30 +10:00
2019-09-08 22:13:55 +10:00
const CREDIT_CARD = 1;
const BANK_TRANSFER = 2;
const PAYPAL = 3;
const CRYPTO = 4;
2020-10-12 07:59:25 +11:00
const CUSTOM = 5;
const ALIPAY = 6;
const SOFORT = 7;
const APPLE_PAY = 8;
2020-10-12 10:21:24 +11:00
const SEPA = 9;
2020-10-15 11:37:16 +11:00
const CREDIT = 10;
2020-10-12 10:21:24 +11:00
public function gateway()
{
return $this->belongsTo(Gateway::class);
}
2020-07-15 15:05:02 +10:00
public function payment_methods()
{
return $this->hasMany(PaymentType::class);
}
public static function getAlias($type)
{
switch ($type) {
case self::CREDIT_CARD:
return ctrans('texts.credit_card');
break;
case self::BANK_TRANSFER:
return ctrans('texts.bank_transfer');
break;
case self::PAYPAL:
return ctrans('texts.paypal');
break;
case self::CRYPTO:
return ctrans('texts.crypto');
break;
case self::CUSTOM:
return ctrans('texts.custom');
break;
case self::ALIPAY:
return ctrans('texts.alipay');
break;
case self::SOFORT:
return ctrans('texts.sofort');
break;
case self::APPLE_PAY:
return ctrans('texts.apple_pay');
break;
case self::SEPA:
return ctrans('texts.sepa');
break;
default:
return 'Undefined.';
break;
}
}
2019-08-22 10:25:30 +10:00
}