/
PaymentSource.php
61 lines (54 loc) · 1.38 KB
/
PaymentSource.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/
namespace craft\commerce\records;
use craft\commerce\db\Table;
use craft\db\ActiveRecord;
use craft\records\User;
use yii\db\ActiveQueryInterface;
/**
* Payment source record.
*
* @property string $description
* @property Gateway $gateway
* @property int $gatewayId
* @property int $id
* @property string $response
* @property string $token
* @property int $userId
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 2.0
*/
class PaymentSource extends ActiveRecord
{
// Public Methods
// =========================================================================
/**
* @inheritdoc
*/
public static function tableName(): string
{
return Table::PAYMENTSOURCES;
}
/**
* Return the payment source's gateway
*
* @return ActiveQueryInterface The relational query object.
*/
public function getGateway(): ActiveQueryInterface
{
return $this->hasOne(Gateway::class, ['id' => 'gatewayId']);
}
/**
* Return the payment source's owner user.
*
* @return ActiveQueryInterface The relational query object.
*/
public function getUser(): ActiveQueryInterface
{
return $this->hasOne(User::class, ['id' => 'userId']);
}
}