Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update SDK from api-definitions #694

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/healthy-guests-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rebilly/client-php": patch
---

Add SecureTrading recurring settings Rebilly/api-definitions#1889
22 changes: 22 additions & 0 deletions src/Model/SecureTrading.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public function __construct(array $data = [])
if (array_key_exists('credentials', $data)) {
$this->setCredentials($data['credentials']);
}
if (array_key_exists('settings', $data)) {
$this->setSettings($data['settings']);
}
if (array_key_exists('threeDSecureServer', $data)) {
$this->setThreeDSecureServer($data['threeDSecureServer']);
}
Expand All @@ -52,6 +55,22 @@ public function setCredentials(SecureTradingCredentials|array $credentials): sta
return $this;
}

public function getSettings(): ?SecureTradingSettings
{
return $this->fields['settings'] ?? null;
}

public function setSettings(null|SecureTradingSettings|array $settings): static
{
if ($settings !== null && !($settings instanceof SecureTradingSettings)) {
$settings = SecureTradingSettings::from($settings);
}

$this->fields['settings'] = $settings;

return $this;
}

public function getThreeDSecureServer(): ?ThreeDSecureIO3dsServer
{
return $this->fields['threeDSecureServer'] ?? null;
Expand All @@ -74,6 +93,9 @@ public function jsonSerialize(): array
if (array_key_exists('credentials', $this->fields)) {
$data['credentials'] = $this->fields['credentials']->jsonSerialize();
}
if (array_key_exists('settings', $this->fields)) {
$data['settings'] = $this->fields['settings']?->jsonSerialize();
}
if (array_key_exists('threeDSecureServer', $this->fields)) {
$data['threeDSecureServer'] = $this->fields['threeDSecureServer']?->jsonSerialize();
}
Expand Down
55 changes: 55 additions & 0 deletions src/Model/SecureTradingSettings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* This source file is proprietary and part of Rebilly.
*
* (c) Rebilly SRL
* Rebilly Ltd.
* Rebilly Inc.
*
* @see https://www.rebilly.com
*/

declare(strict_types=1);

namespace Rebilly\Sdk\Model;

use JsonSerializable;

class SecureTradingSettings implements JsonSerializable
{
private array $fields = [];

public function __construct(array $data = [])
{
if (array_key_exists('enableRecurring', $data)) {
$this->setEnableRecurring($data['enableRecurring']);
}
}

public static function from(array $data = []): self
{
return new self($data);
}

public function getEnableRecurring(): ?bool
{
return $this->fields['enableRecurring'] ?? null;
}

public function setEnableRecurring(null|bool $enableRecurring): static
{
$this->fields['enableRecurring'] = $enableRecurring;

return $this;
}

public function jsonSerialize(): array
{
$data = [];
if (array_key_exists('enableRecurring', $this->fields)) {
$data['enableRecurring'] = $this->fields['enableRecurring'];
}

return $data;
}
}
Loading