commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Payment
PaymentChangeTransactionTimestampActionModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Payment
;
10
11
use
Commercetools\Base\DateTimeImmutableCollection
;
12
use
Commercetools\Base\JsonObject
;
13
use
Commercetools\Base\JsonObjectModel
;
14
use
Commercetools\Base\MapperFactory
;
15
use DateTimeImmutable;
16
use stdClass;
17
21
final
class
PaymentChangeTransactionTimestampActionModel
extends
JsonObjectModel
implements
PaymentChangeTransactionTimestampAction
22
{
23
public
const
DISCRIMINATOR_VALUE
=
'changeTransactionTimestamp'
;
28
protected
$action
;
29
34
protected
$transactionId
;
35
40
protected
$timestamp
;
41
42
46
public
function
__construct
(
47
?
string
$transactionId
=
null
,
48
?DateTimeImmutable
$timestamp
=
null
,
49
?
string
$action
=
null
50
) {
51
$this->transactionId =
$transactionId
;
52
$this->timestamp =
$timestamp
;
53
$this->action =
$action
??
self::DISCRIMINATOR_VALUE
;
54
}
55
60
public
function
getAction
()
61
{
62
if
(is_null($this->action)) {
64
$data = $this->
raw
(self::FIELD_ACTION);
65
if
(is_null($data)) {
66
return
null
;
67
}
68
$this->action = (string) $data;
69
}
70
71
return
$this->action
;
72
}
73
80
public
function
getTransactionId
()
81
{
82
if
(is_null($this->transactionId)) {
84
$data = $this->
raw
(self::FIELD_TRANSACTION_ID);
85
if
(is_null($data)) {
86
return
null
;
87
}
88
$this->transactionId = (string) $data;
89
}
90
91
return
$this->transactionId
;
92
}
93
100
public
function
getTimestamp
()
101
{
102
if
(is_null($this->timestamp)) {
104
$data = $this->
raw
(self::FIELD_TIMESTAMP);
105
if
(is_null($data)) {
106
return
null
;
107
}
108
$data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
109
if
(
false
=== $data) {
110
return
null
;
111
}
112
$this->timestamp = $data;
113
}
114
115
return
$this->timestamp
;
116
}
117
118
122
public
function
setTransactionId
(?
string
$transactionId
): void
123
{
124
$this->transactionId =
$transactionId
;
125
}
126
130
public
function
setTimestamp
(?DateTimeImmutable
$timestamp
): void
131
{
132
$this->timestamp =
$timestamp
;
133
}
134
135
136
#[\ReturnTypeWillChange]
137
public
function
jsonSerialize
()
138
{
139
$data = $this->
toArray
();
140
if
(isset($data[
PaymentChangeTransactionTimestampAction::FIELD_TIMESTAMP
]) && $data[
PaymentChangeTransactionTimestampAction::FIELD_TIMESTAMP
] instanceof \DateTimeImmutable) {
141
$data[
PaymentChangeTransactionTimestampAction::FIELD_TIMESTAMP
] = $data[
PaymentChangeTransactionTimestampAction::FIELD_TIMESTAMP
]->setTimeZone(
new
\DateTimeZone(
'UTC'
))->format(
'c'
);
142
}
143
return
(
object
) $data;
144
}
145
}
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel
Definition
PaymentChangeTransactionTimestampActionModel.php:22
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition
PaymentChangeTransactionTimestampActionModel.php:23
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\$transactionId
$transactionId
Definition
PaymentChangeTransactionTimestampActionModel.php:34
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\getTransactionId
getTransactionId()
Definition
PaymentChangeTransactionTimestampActionModel.php:80
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\jsonSerialize
jsonSerialize()
Definition
PaymentChangeTransactionTimestampActionModel.php:137
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\setTransactionId
setTransactionId(?string $transactionId)
Definition
PaymentChangeTransactionTimestampActionModel.php:122
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\getAction
getAction()
Definition
PaymentChangeTransactionTimestampActionModel.php:60
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\setTimestamp
setTimestamp(?DateTimeImmutable $timestamp)
Definition
PaymentChangeTransactionTimestampActionModel.php:130
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\__construct
__construct(?string $transactionId=null, ?DateTimeImmutable $timestamp=null, ?string $action=null)
Definition
PaymentChangeTransactionTimestampActionModel.php:46
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\$timestamp
$timestamp
Definition
PaymentChangeTransactionTimestampActionModel.php:40
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\$action
$action
Definition
PaymentChangeTransactionTimestampActionModel.php:28
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampActionModel\getTimestamp
getTimestamp()
Definition
PaymentChangeTransactionTimestampActionModel.php:100
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\JsonObjectModel\toArray
toArray()
Definition
JsonObjectModel.php:32
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampAction
Definition
PaymentChangeTransactionTimestampAction.php:16
Commercetools\Api\Models\Payment\PaymentChangeTransactionTimestampAction\FIELD_TIMESTAMP
const FIELD_TIMESTAMP
Definition
PaymentChangeTransactionTimestampAction.php:18
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Payment
Definition
Payment.php:9
Generated by
1.9.8