Skip to content

Commit

Permalink
Promo-config related improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
fulopattila122 committed Aug 25, 2024
1 parent 22a49f0 commit 04475dd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Promotion/Actions/CartFixedDiscount.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function getName(): string
public function getTitle(array $configuration): string
{
if (null === $amount = $configuration['amount'] ?? null) {
return __('Invalid Configuration: The `:parameter` parameter is missing', ['parameter' => 'amount']);
return __('X amount discount on the entire cart [Invalid Configuration: The `:parameter` parameter is missing]', ['parameter' => 'amount']);
}

return __(':amount discount on the entire cart', ['amount' => format_price($amount)]);
Expand Down
2 changes: 1 addition & 1 deletion src/Promotion/Actions/CartPercentageDiscount.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static function getName(): string
public function getTitle(array $configuration): string
{
if (null === $percent = $configuration['percent'] ?? null) {
return __('X% discount on the entire cart. Invalid Configuration: the `:parameter` parameter is missing', ['parameter' => 'percent']);
return __('X% discount on the entire cart [Invalid Configuration: the `:parameter` parameter is missing]', ['parameter' => 'percent']);
}

return __(':percent% discount on the entire cart', ['percent' => $percent]);
Expand Down
2 changes: 1 addition & 1 deletion src/Promotion/Models/PromotionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function execute(object $subject): array

public function getConfigurationSchema(): ?Schematized
{
return SchemaDefinition::wrap($this->getActionType());
return null !== $this->type ? SchemaDefinition::wrap($this->getActionType()) : null;
}

public function getTitle(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Promotion/Models/PromotionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function isPassing(object $subject): bool

public function getConfigurationSchema(): ?Schematized
{
return SchemaDefinition::wrap($this->getRuleType());
return null !== $this->type ? SchemaDefinition::wrap($this->getRuleType()) : null;
}

public function getTitle(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Promotion/Rules/CartQuantity.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static function getName(): string
public function getTitle(array $configuration): string
{
if (null === $count = $configuration['count'] ?? null) {
return __('Invalid Configuration: The `:parameter` parameter is missing', ['parameter' => 'count']);
return __('At least X items in the cart [Invalid Configuration: The `:parameter` parameter is missing]', ['parameter' => 'count']);
}

return __('At least :count items in the cart', ['count' => (int) $count]);
Expand Down

0 comments on commit 04475dd

Please sign in to comment.