| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | namespace Worldline\Connect\Sdk\V1\Domain; |
| 7: | |
| 8: | use UnexpectedValueException; |
| 9: | use Worldline\Connect\Sdk\Domain\DataObject; |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | class PaymentProduct extends DataObject |
| 15: | { |
| 16: | |
| 17: | |
| 18: | |
| 19: | public $accountsOnFile = null; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public $acquirerCountry = null; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public $allowsClickToPay = null; |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public $allowsInstallments = null; |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public $allowsRecurring = null; |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | public $allowsTokenization = null; |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | public $authenticationIndicator = null; |
| 50: | |
| 51: | |
| 52: | |
| 53: | |
| 54: | public $autoTokenized = null; |
| 55: | |
| 56: | |
| 57: | |
| 58: | |
| 59: | public $canBeIframed = null; |
| 60: | |
| 61: | |
| 62: | |
| 63: | |
| 64: | public $clickToPayConfiguration = null; |
| 65: | |
| 66: | |
| 67: | |
| 68: | |
| 69: | public $deviceFingerprintEnabled = null; |
| 70: | |
| 71: | |
| 72: | |
| 73: | |
| 74: | public $displayHints = null; |
| 75: | |
| 76: | |
| 77: | |
| 78: | |
| 79: | public $fields = null; |
| 80: | |
| 81: | |
| 82: | |
| 83: | |
| 84: | public $fieldsWarning = null; |
| 85: | |
| 86: | |
| 87: | |
| 88: | |
| 89: | public $id = null; |
| 90: | |
| 91: | |
| 92: | |
| 93: | |
| 94: | public $isAuthenticationSupported = null; |
| 95: | |
| 96: | |
| 97: | |
| 98: | |
| 99: | public $isJavaScriptRequired = null; |
| 100: | |
| 101: | |
| 102: | |
| 103: | |
| 104: | public $maxAmount = null; |
| 105: | |
| 106: | |
| 107: | |
| 108: | |
| 109: | public $minAmount = null; |
| 110: | |
| 111: | |
| 112: | |
| 113: | |
| 114: | public $mobileIntegrationLevel = null; |
| 115: | |
| 116: | |
| 117: | |
| 118: | |
| 119: | public $paymentMethod = null; |
| 120: | |
| 121: | |
| 122: | |
| 123: | |
| 124: | public $paymentProduct302SpecificData = null; |
| 125: | |
| 126: | |
| 127: | |
| 128: | |
| 129: | public $paymentProduct320SpecificData = null; |
| 130: | |
| 131: | |
| 132: | |
| 133: | |
| 134: | public $paymentProduct863SpecificData = null; |
| 135: | |
| 136: | |
| 137: | |
| 138: | |
| 139: | public $paymentProductGroup = null; |
| 140: | |
| 141: | |
| 142: | |
| 143: | |
| 144: | public $supportsMandates = null; |
| 145: | |
| 146: | |
| 147: | |
| 148: | |
| 149: | public $usesRedirectionTo3rdParty = null; |
| 150: | |
| 151: | |
| 152: | |
| 153: | |
| 154: | public function toObject() |
| 155: | { |
| 156: | $object = parent::toObject(); |
| 157: | if (!is_null($this->accountsOnFile)) { |
| 158: | $object->accountsOnFile = []; |
| 159: | foreach ($this->accountsOnFile as $element) { |
| 160: | if (!is_null($element)) { |
| 161: | $object->accountsOnFile[] = $element->toObject(); |
| 162: | } |
| 163: | } |
| 164: | } |
| 165: | if (!is_null($this->acquirerCountry)) { |
| 166: | $object->acquirerCountry = $this->acquirerCountry; |
| 167: | } |
| 168: | if (!is_null($this->allowsClickToPay)) { |
| 169: | $object->allowsClickToPay = $this->allowsClickToPay; |
| 170: | } |
| 171: | if (!is_null($this->allowsInstallments)) { |
| 172: | $object->allowsInstallments = $this->allowsInstallments; |
| 173: | } |
| 174: | if (!is_null($this->allowsRecurring)) { |
| 175: | $object->allowsRecurring = $this->allowsRecurring; |
| 176: | } |
| 177: | if (!is_null($this->allowsTokenization)) { |
| 178: | $object->allowsTokenization = $this->allowsTokenization; |
| 179: | } |
| 180: | if (!is_null($this->authenticationIndicator)) { |
| 181: | $object->authenticationIndicator = $this->authenticationIndicator->toObject(); |
| 182: | } |
| 183: | if (!is_null($this->autoTokenized)) { |
| 184: | $object->autoTokenized = $this->autoTokenized; |
| 185: | } |
| 186: | if (!is_null($this->canBeIframed)) { |
| 187: | $object->canBeIframed = $this->canBeIframed; |
| 188: | } |
| 189: | if (!is_null($this->clickToPayConfiguration)) { |
| 190: | $object->clickToPayConfiguration = $this->clickToPayConfiguration->toObject(); |
| 191: | } |
| 192: | if (!is_null($this->deviceFingerprintEnabled)) { |
| 193: | $object->deviceFingerprintEnabled = $this->deviceFingerprintEnabled; |
| 194: | } |
| 195: | if (!is_null($this->displayHints)) { |
| 196: | $object->displayHints = $this->displayHints->toObject(); |
| 197: | } |
| 198: | if (!is_null($this->fields)) { |
| 199: | $object->fields = []; |
| 200: | foreach ($this->fields as $element) { |
| 201: | if (!is_null($element)) { |
| 202: | $object->fields[] = $element->toObject(); |
| 203: | } |
| 204: | } |
| 205: | } |
| 206: | if (!is_null($this->fieldsWarning)) { |
| 207: | $object->fieldsWarning = $this->fieldsWarning; |
| 208: | } |
| 209: | if (!is_null($this->id)) { |
| 210: | $object->id = $this->id; |
| 211: | } |
| 212: | if (!is_null($this->isAuthenticationSupported)) { |
| 213: | $object->isAuthenticationSupported = $this->isAuthenticationSupported; |
| 214: | } |
| 215: | if (!is_null($this->isJavaScriptRequired)) { |
| 216: | $object->isJavaScriptRequired = $this->isJavaScriptRequired; |
| 217: | } |
| 218: | if (!is_null($this->maxAmount)) { |
| 219: | $object->maxAmount = $this->maxAmount; |
| 220: | } |
| 221: | if (!is_null($this->minAmount)) { |
| 222: | $object->minAmount = $this->minAmount; |
| 223: | } |
| 224: | if (!is_null($this->mobileIntegrationLevel)) { |
| 225: | $object->mobileIntegrationLevel = $this->mobileIntegrationLevel; |
| 226: | } |
| 227: | if (!is_null($this->paymentMethod)) { |
| 228: | $object->paymentMethod = $this->paymentMethod; |
| 229: | } |
| 230: | if (!is_null($this->paymentProduct302SpecificData)) { |
| 231: | $object->paymentProduct302SpecificData = $this->paymentProduct302SpecificData->toObject(); |
| 232: | } |
| 233: | if (!is_null($this->paymentProduct320SpecificData)) { |
| 234: | $object->paymentProduct320SpecificData = $this->paymentProduct320SpecificData->toObject(); |
| 235: | } |
| 236: | if (!is_null($this->paymentProduct863SpecificData)) { |
| 237: | $object->paymentProduct863SpecificData = $this->paymentProduct863SpecificData->toObject(); |
| 238: | } |
| 239: | if (!is_null($this->paymentProductGroup)) { |
| 240: | $object->paymentProductGroup = $this->paymentProductGroup; |
| 241: | } |
| 242: | if (!is_null($this->supportsMandates)) { |
| 243: | $object->supportsMandates = $this->supportsMandates; |
| 244: | } |
| 245: | if (!is_null($this->usesRedirectionTo3rdParty)) { |
| 246: | $object->usesRedirectionTo3rdParty = $this->usesRedirectionTo3rdParty; |
| 247: | } |
| 248: | return $object; |
| 249: | } |
| 250: | |
| 251: | |
| 252: | |
| 253: | |
| 254: | |
| 255: | |
| 256: | public function fromObject($object) |
| 257: | { |
| 258: | parent::fromObject($object); |
| 259: | if (property_exists($object, 'accountsOnFile')) { |
| 260: | if (!is_array($object->accountsOnFile) && !is_object($object->accountsOnFile)) { |
| 261: | throw new UnexpectedValueException('value \'' . print_r($object->accountsOnFile, true) . '\' is not an array or object'); |
| 262: | } |
| 263: | $this->accountsOnFile = []; |
| 264: | foreach ($object->accountsOnFile as $element) { |
| 265: | $value = new AccountOnFile(); |
| 266: | $this->accountsOnFile[] = $value->fromObject($element); |
| 267: | } |
| 268: | } |
| 269: | if (property_exists($object, 'acquirerCountry')) { |
| 270: | $this->acquirerCountry = $object->acquirerCountry; |
| 271: | } |
| 272: | if (property_exists($object, 'allowsClickToPay')) { |
| 273: | $this->allowsClickToPay = $object->allowsClickToPay; |
| 274: | } |
| 275: | if (property_exists($object, 'allowsInstallments')) { |
| 276: | $this->allowsInstallments = $object->allowsInstallments; |
| 277: | } |
| 278: | if (property_exists($object, 'allowsRecurring')) { |
| 279: | $this->allowsRecurring = $object->allowsRecurring; |
| 280: | } |
| 281: | if (property_exists($object, 'allowsTokenization')) { |
| 282: | $this->allowsTokenization = $object->allowsTokenization; |
| 283: | } |
| 284: | if (property_exists($object, 'authenticationIndicator')) { |
| 285: | if (!is_object($object->authenticationIndicator)) { |
| 286: | throw new UnexpectedValueException('value \'' . print_r($object->authenticationIndicator, true) . '\' is not an object'); |
| 287: | } |
| 288: | $value = new AuthenticationIndicator(); |
| 289: | $this->authenticationIndicator = $value->fromObject($object->authenticationIndicator); |
| 290: | } |
| 291: | if (property_exists($object, 'autoTokenized')) { |
| 292: | $this->autoTokenized = $object->autoTokenized; |
| 293: | } |
| 294: | if (property_exists($object, 'canBeIframed')) { |
| 295: | $this->canBeIframed = $object->canBeIframed; |
| 296: | } |
| 297: | if (property_exists($object, 'clickToPayConfiguration')) { |
| 298: | if (!is_object($object->clickToPayConfiguration)) { |
| 299: | throw new UnexpectedValueException('value \'' . print_r($object->clickToPayConfiguration, true) . '\' is not an object'); |
| 300: | } |
| 301: | $value = new ClickToPayConfiguration(); |
| 302: | $this->clickToPayConfiguration = $value->fromObject($object->clickToPayConfiguration); |
| 303: | } |
| 304: | if (property_exists($object, 'deviceFingerprintEnabled')) { |
| 305: | $this->deviceFingerprintEnabled = $object->deviceFingerprintEnabled; |
| 306: | } |
| 307: | if (property_exists($object, 'displayHints')) { |
| 308: | if (!is_object($object->displayHints)) { |
| 309: | throw new UnexpectedValueException('value \'' . print_r($object->displayHints, true) . '\' is not an object'); |
| 310: | } |
| 311: | $value = new PaymentProductDisplayHints(); |
| 312: | $this->displayHints = $value->fromObject($object->displayHints); |
| 313: | } |
| 314: | if (property_exists($object, 'fields')) { |
| 315: | if (!is_array($object->fields) && !is_object($object->fields)) { |
| 316: | throw new UnexpectedValueException('value \'' . print_r($object->fields, true) . '\' is not an array or object'); |
| 317: | } |
| 318: | $this->fields = []; |
| 319: | foreach ($object->fields as $element) { |
| 320: | $value = new PaymentProductField(); |
| 321: | $this->fields[] = $value->fromObject($element); |
| 322: | } |
| 323: | } |
| 324: | if (property_exists($object, 'fieldsWarning')) { |
| 325: | $this->fieldsWarning = $object->fieldsWarning; |
| 326: | } |
| 327: | if (property_exists($object, 'id')) { |
| 328: | $this->id = $object->id; |
| 329: | } |
| 330: | if (property_exists($object, 'isAuthenticationSupported')) { |
| 331: | $this->isAuthenticationSupported = $object->isAuthenticationSupported; |
| 332: | } |
| 333: | if (property_exists($object, 'isJavaScriptRequired')) { |
| 334: | $this->isJavaScriptRequired = $object->isJavaScriptRequired; |
| 335: | } |
| 336: | if (property_exists($object, 'maxAmount')) { |
| 337: | $this->maxAmount = $object->maxAmount; |
| 338: | } |
| 339: | if (property_exists($object, 'minAmount')) { |
| 340: | $this->minAmount = $object->minAmount; |
| 341: | } |
| 342: | if (property_exists($object, 'mobileIntegrationLevel')) { |
| 343: | $this->mobileIntegrationLevel = $object->mobileIntegrationLevel; |
| 344: | } |
| 345: | if (property_exists($object, 'paymentMethod')) { |
| 346: | $this->paymentMethod = $object->paymentMethod; |
| 347: | } |
| 348: | if (property_exists($object, 'paymentProduct302SpecificData')) { |
| 349: | if (!is_object($object->paymentProduct302SpecificData)) { |
| 350: | throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct302SpecificData, true) . '\' is not an object'); |
| 351: | } |
| 352: | $value = new PaymentProduct302SpecificData(); |
| 353: | $this->paymentProduct302SpecificData = $value->fromObject($object->paymentProduct302SpecificData); |
| 354: | } |
| 355: | if (property_exists($object, 'paymentProduct320SpecificData')) { |
| 356: | if (!is_object($object->paymentProduct320SpecificData)) { |
| 357: | throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct320SpecificData, true) . '\' is not an object'); |
| 358: | } |
| 359: | $value = new PaymentProduct320SpecificData(); |
| 360: | $this->paymentProduct320SpecificData = $value->fromObject($object->paymentProduct320SpecificData); |
| 361: | } |
| 362: | if (property_exists($object, 'paymentProduct863SpecificData')) { |
| 363: | if (!is_object($object->paymentProduct863SpecificData)) { |
| 364: | throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct863SpecificData, true) . '\' is not an object'); |
| 365: | } |
| 366: | $value = new PaymentProduct863SpecificData(); |
| 367: | $this->paymentProduct863SpecificData = $value->fromObject($object->paymentProduct863SpecificData); |
| 368: | } |
| 369: | if (property_exists($object, 'paymentProductGroup')) { |
| 370: | $this->paymentProductGroup = $object->paymentProductGroup; |
| 371: | } |
| 372: | if (property_exists($object, 'supportsMandates')) { |
| 373: | $this->supportsMandates = $object->supportsMandates; |
| 374: | } |
| 375: | if (property_exists($object, 'usesRedirectionTo3rdParty')) { |
| 376: | $this->usesRedirectionTo3rdParty = $object->usesRedirectionTo3rdParty; |
| 377: | } |
| 378: | return $this; |
| 379: | } |
| 380: | } |
| 381: | |