121 lines
4.8 KiB
PHP
121 lines
4.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* App\Models\PaymentTransaction
|
|
*
|
|
* @property int $id
|
|
* @property int $shopping_payment_id
|
|
* @property string $request
|
|
* @property int|null $txid
|
|
* @property int|null $userid
|
|
* @property string|null $status
|
|
* @property string|null $key
|
|
* @property string|null $txaction
|
|
* @property array|null $transmitted_data
|
|
* @property int|null $errorcode
|
|
* @property string|null $errormessage
|
|
* @property string|null $customermessage
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read \App\Models\ShoppingPayment $shopping_payment
|
|
*
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereCustomermessage($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereErrorcode($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereErrormessage($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereKey($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereRequest($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereShoppingPaymentId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereStatus($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereTransmittedData($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereTxaction($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereTxid($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereUserid($value)
|
|
*
|
|
* @property string|null $mode
|
|
*
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentTransaction whereMode($value)
|
|
*
|
|
* @mixin \Eloquent
|
|
*/
|
|
class PaymentTransaction extends Model
|
|
{
|
|
protected $table = 'payment_transactions';
|
|
|
|
protected $casts = [
|
|
'transmitted_data' => 'array',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'shopping_payment_id',
|
|
'request',
|
|
'txid',
|
|
'userid',
|
|
'status',
|
|
'key',
|
|
'txaction',
|
|
'transmitted_data',
|
|
'errorcode',
|
|
'errormessage',
|
|
'customermessage',
|
|
'mode',
|
|
];
|
|
|
|
public function shopping_payment()
|
|
{
|
|
return $this->belongsTo('App\Models\ShoppingPayment', 'shopping_payment_id');
|
|
}
|
|
|
|
/**
|
|
* Returns a human-readable description for known PAYONE error codes.
|
|
*
|
|
* @return array<int, string>
|
|
*/
|
|
public static function payoneErrorDescriptions(): array
|
|
{
|
|
return [
|
|
2 => 'Allgemeiner Fehler',
|
|
4 => 'Karte gesperrt',
|
|
5 => 'Zahlung abgelehnt',
|
|
12 => 'Ungültige Kartennummer',
|
|
14 => 'Ungültige Kartendaten',
|
|
33 => 'Karte abgelaufen',
|
|
34 => 'Karte gesperrt/gestohlen',
|
|
55 => 'Falsche PIN',
|
|
56 => 'Kunde hat abgebrochen',
|
|
58 => 'Transaktion nicht erlaubt',
|
|
62 => 'Karte für internationale Transaktionen nicht zugelassen',
|
|
104 => 'Karte für Online-Zahlungen nicht erlaubt',
|
|
105 => 'Karte ungültig',
|
|
120 => 'Falsche Prüfziffer (CVV)',
|
|
130 => 'Limit überschritten',
|
|
131 => 'Währung nicht unterstützt',
|
|
135 => 'Bank antwortet nicht',
|
|
136 => 'Bank nicht gefunden',
|
|
137 => 'Betrag stimmt nicht überein',
|
|
900 => '3D-Secure Authentifizierung fehlgeschlagen',
|
|
902 => 'Bank hat abgelehnt',
|
|
970 => 'Keine Antwort (Timeout)',
|
|
4218 => 'Karte unter Betrugsverdacht',
|
|
4219 => 'Transaktion von Kartenaussteller abgelehnt',
|
|
];
|
|
}
|
|
|
|
public function getErrorDescriptionAttribute(): ?string
|
|
{
|
|
if (! $this->errorcode) {
|
|
return null;
|
|
}
|
|
|
|
return self::payoneErrorDescriptions()[(int) $this->errorcode] ?? null;
|
|
}
|
|
}
|