commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
MyPaymentUpdateActionModel.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 'addTransaction' => MyPaymentAddTransactionActionModel::class,
35 'changeAmountPlanned' => MyPaymentChangeAmountPlannedActionModel::class,
36 'setCustomField' => MyPaymentSetCustomFieldActionModel::class,
37 'setMethodInfoCustomField' => MyPaymentSetMethodInfoCustomFieldActionModel::class,
38 'setMethodInfoCustomType' => MyPaymentSetMethodInfoCustomTypeActionModel::class,
39 'setMethodInfoInterface' => MyPaymentSetMethodInfoInterfaceActionModel::class,
40 'setMethodInfoInterfaceAccount' => MyPaymentSetMethodInfoInterfaceAccountActionModel::class,
41 'setMethodInfoMethod' => MyPaymentSetMethodInfoMethodActionModel::class,
42 'setMethodInfoName' => MyPaymentSetMethodInfoNameActionModel::class,
43 'setTransactionCustomField' => MyPaymentSetTransactionCustomFieldActionModel::class,
44 ];
45
49 public function __construct(
50 ?string $action = null
51 ) {
52 $this->action = $action;
53 }
54
59 public function getAction()
60 {
61 if (is_null($this->action)) {
63 $data = $this->raw(self::FIELD_ACTION);
64 if (is_null($data)) {
65 return null;
66 }
67 $this->action = (string) $data;
68 }
69
70 return $this->action;
71 }
72
73
74
75
76
81 public static function resolveDiscriminatorClass($value): string
82 {
84 if (is_object($value) && isset($value->$fieldName)) {
86 $discriminatorValue = $value->$fieldName;
87 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
88 return self::$discriminatorClasses[$discriminatorValue];
89 }
90 }
91 if (is_array($value) && isset($value[$fieldName])) {
93 $discriminatorValue = $value[$fieldName];
94 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
95 return self::$discriminatorClasses[$discriminatorValue];
96 }
97 }
98
100 $type = MyPaymentUpdateActionModel::class;
101 return $type;
102 }
103}