2015-03-18 00:39:03 +01:00
|
|
|
<?php namespace App\Models;
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-15 18:35:41 +02:00
|
|
|
use App\Models\Gateway;
|
2015-03-31 11:38:24 +02:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
class AccountGateway extends EntityModel
|
|
|
|
{
|
2015-03-31 11:38:24 +02:00
|
|
|
use SoftDeletes;
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
public function gateway()
|
|
|
|
{
|
2015-03-31 11:38:24 +02:00
|
|
|
return $this->belongsTo('App\Models\Gateway');
|
2015-03-16 22:45:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getCreditcardTypes()
|
|
|
|
{
|
|
|
|
$flags = unserialize(CREDIT_CARDS);
|
|
|
|
$arrayOfImages = [];
|
|
|
|
|
|
|
|
foreach ($flags as $card => $name) {
|
|
|
|
if (($this->accepted_credit_cards & $card) == $card) {
|
|
|
|
$arrayOfImages[] = ['source' => asset($name['card']), 'alt' => $name['text']];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $arrayOfImages;
|
|
|
|
}
|
|
|
|
|
2015-04-15 18:35:41 +02:00
|
|
|
public function getPaymentType() {
|
|
|
|
return Gateway::getPaymentType($this->gateway_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isPaymentType($type) {
|
|
|
|
return $this->getPaymentType() == $type;
|
2015-03-16 22:45:25 +01:00
|
|
|
}
|
2015-07-01 21:01:12 +02:00
|
|
|
|
|
|
|
public function isGateway($gatewayId) {
|
|
|
|
return $this->gateway_id == $gatewayId;
|
|
|
|
}
|
2015-03-16 22:45:25 +01:00
|
|
|
}
|
|
|
|
|