commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
PaymentUpdateActionModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
22 public const DISCRIMINATOR_VALUE = '';
27 protected $action;
28
33 private static $discriminatorClasses = [
34 'addInterfaceInteraction' => PaymentAddInterfaceInteractionActionModel::class,
35 'addTransaction' => PaymentAddTransactionActionModel::class,
36 'changeAmountPlanned' => PaymentChangeAmountPlannedActionModel::class,
37 'changeTransactionInteractionId' => PaymentChangeTransactionInteractionIdActionModel::class,
38 'changeTransactionState' => PaymentChangeTransactionStateActionModel::class,
39 'changeTransactionTimestamp' => PaymentChangeTransactionTimestampActionModel::class,
40 'setAnonymousId' => PaymentSetAnonymousIdActionModel::class,
41 'setCustomField' => PaymentSetCustomFieldActionModel::class,
42 'setCustomType' => PaymentSetCustomTypeActionModel::class,
43 'setCustomer' => PaymentSetCustomerActionModel::class,
44 'setInterfaceId' => PaymentSetInterfaceIdActionModel::class,
45 'setKey' => PaymentSetKeyActionModel::class,
46 'setMethodInfoInterface' => PaymentSetMethodInfoInterfaceActionModel::class,
47 'setMethodInfoMethod' => PaymentSetMethodInfoMethodActionModel::class,
48 'setMethodInfoName' => PaymentSetMethodInfoNameActionModel::class,
49 'setStatusInterfaceCode' => PaymentSetStatusInterfaceCodeActionModel::class,
50 'setStatusInterfaceText' => PaymentSetStatusInterfaceTextActionModel::class,
51 'setTransactionCustomField' => PaymentSetTransactionCustomFieldActionModel::class,
52 'setTransactionCustomType' => PaymentSetTransactionCustomTypeActionModel::class,
53 'transitionState' => PaymentTransitionStateActionModel::class,
54 ];
55
59 public function __construct(
60 ?string $action = null
61 ) {
62 $this->action = $action;
63 }
64
69 public function getAction()
70 {
71 if (is_null($this->action)) {
73 $data = $this->raw(self::FIELD_ACTION);
74 if (is_null($data)) {
75 return null;
76 }
77 $this->action = (string) $data;
78 }
79
80 return $this->action;
81 }
82
83
84
85
86
91 public static function resolveDiscriminatorClass($value): string
92 {
94 if (is_object($value) && isset($value->$fieldName)) {
96 $discriminatorValue = $value->$fieldName;
97 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
98 return self::$discriminatorClasses[$discriminatorValue];
99 }
100 }
101 if (is_array($value) && isset($value[$fieldName])) {
103 $discriminatorValue = $value[$fieldName];
104 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
105 return self::$discriminatorClasses[$discriminatorValue];
106 }
107 }
108
110 $type = PaymentUpdateActionModel::class;
111 return $type;
112 }
113}