commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyPaymentUpdateActionModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use 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  'setMethodInfoInterface' => MyPaymentSetMethodInfoInterfaceActionModel::class,
38  'setMethodInfoMethod' => MyPaymentSetMethodInfoMethodActionModel::class,
39  'setMethodInfoName' => MyPaymentSetMethodInfoNameActionModel::class,
40  'setTransactionCustomField' => MyPaymentSetTransactionCustomFieldActionModel::class,
41  ];
42 
46  public function __construct(
47  ?string $action = null
48  ) {
49  $this->action = $action;
50  }
51 
56  public function getAction()
57  {
58  if (is_null($this->action)) {
60  $data = $this->raw(self::FIELD_ACTION);
61  if (is_null($data)) {
62  return null;
63  }
64  $this->action = (string) $data;
65  }
66 
67  return $this->action;
68  }
69 
70 
71 
72 
73 
78  public static function resolveDiscriminatorClass($value): string
79  {
81  if (is_object($value) && isset($value->$fieldName)) {
83  $discriminatorValue = $value->$fieldName;
84  if (isset(self::$discriminatorClasses[$discriminatorValue])) {
85  return self::$discriminatorClasses[$discriminatorValue];
86  }
87  }
88  if (is_array($value) && isset($value[$fieldName])) {
90  $discriminatorValue = $value[$fieldName];
91  if (isset(self::$discriminatorClasses[$discriminatorValue])) {
92  return self::$discriminatorClasses[$discriminatorValue];
93  }
94  }
95 
97  $type = MyPaymentUpdateActionModel::class;
98  return $type;
99  }
100 }