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

Add additional properties to GiftcardProgram #35

Merged
merged 4 commits into from
Oct 3, 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: 4 additions & 1 deletion src/Mappers/Giftcards/GiftcardProgramMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ public function map(stdClass $data): GiftcardProgram
return new GiftcardProgram(
$data->uuid,
$data->name,
$data->active ?? true
$data->active ?? true,
$data->max_amount_in_cents ?? null,
$data->calculator_flow ?? null,
$data->expiration_days ?? null
);
}
}
35 changes: 34 additions & 1 deletion src/Models/Giftcards/GiftcardProgram.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,34 @@ class GiftcardProgram
*/
protected $active;

/**
* @var ?int
*/
protected $max_amount_in_cents;

/**
* @var ?string
*/
protected $calculator_flow;

/**
* @var ?int
*/
protected $expiration_days;

const resourceUri = '/api/v3/oauth/clients/giftcard-programs';

/**
* GiftcardProgram constructor.
*/
public function __construct(string $uuid, string $name, bool $active)
public function __construct(string $uuid, string $name, bool $active, ?int $max_amount_in_cents, ?string $calculator_flow, ?int $expiration_days)
{
$this->uuid = $uuid;
$this->name = $name;
$this->active = $active;
$this->max_amount_in_cents = $max_amount_in_cents;
$this->calculator_flow = $calculator_flow;
$this->expiration_days = $expiration_days;
}

public function getUuid(): string
Expand All @@ -52,6 +70,21 @@ public function isActive(): bool
return $this->active;
}

public function getMaxAmountInCents(): ?int
{
return $this->max_amount_in_cents;
}

public function getCalculatorFlow(): ?string
{
return $this->calculator_flow;
}

public function getExpirationDays(): ?int
{
return $this->expiration_days;
}

/**
* @return GiftcardProgram[]
*
Expand Down
Loading