51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Domains\Purchase\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
#[Fillable([
|
|
'telepagos_payment_id',
|
|
'compra_id',
|
|
'dni_matches',
|
|
'dni_distance',
|
|
'payment_dni',
|
|
'purchase_dni',
|
|
'amount_matches',
|
|
'payment_amount',
|
|
'purchase_amount',
|
|
'amount_difference',
|
|
'match_reason',
|
|
'confidence',
|
|
])]
|
|
class TelepagosPaymentCandidate extends Model
|
|
{
|
|
protected $table = 'telepagos_payment_candidates';
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'telepagos_payment_id' => 'integer',
|
|
'compra_id' => 'integer',
|
|
'dni_matches' => 'boolean',
|
|
'dni_distance' => 'integer',
|
|
'amount_matches' => 'boolean',
|
|
'payment_amount' => 'decimal:2',
|
|
'purchase_amount' => 'decimal:2',
|
|
'amount_difference' => 'decimal:2',
|
|
];
|
|
}
|
|
|
|
public function payment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(TelepagosPayment::class, 'telepagos_payment_id');
|
|
}
|
|
|
|
public function purchase(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Purchase::class, 'compra_id');
|
|
}
|
|
}
|