Skip to content

Commit

Permalink
fix!: Consistent naming for Adjustment totals obj (#33)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Any existing typing for TotalAdjustments will cause  a class not found error until refactored to AdjustmentTotals
  • Loading branch information
mikeymike authored Feb 13, 2024
1 parent 97f8baa commit 07bbac5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Entities/Adjustment.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
use Paddle\SDK\Entities\Adjustment\AdjustmentItem;
use Paddle\SDK\Entities\Shared\Action;
use Paddle\SDK\Entities\Shared\AdjustmentStatus;
use Paddle\SDK\Entities\Shared\AdjustmentTotals;
use Paddle\SDK\Entities\Shared\CurrencyCode;
use Paddle\SDK\Entities\Shared\PayoutTotalsAdjustment;
use Paddle\SDK\Entities\Shared\TotalAdjustments;

class Adjustment implements Entity
{
Expand All @@ -36,7 +36,7 @@ protected function __construct(
public CurrencyCode $currencyCode,
public AdjustmentStatus $status,
public array $items,
public TotalAdjustments $totals,
public AdjustmentTotals $totals,
public PayoutTotalsAdjustment|null $payoutTotals,
public \DateTimeInterface $createdAt,
public \DateTimeInterface|null $updatedAt,
Expand All @@ -56,7 +56,7 @@ public static function from(array $data): self
currencyCode: CurrencyCode::from($data['currency_code']),
status: AdjustmentStatus::from($data['status']),
items: array_map(fn (array $item) => AdjustmentItem::from($item), $data['items']),
totals: TotalAdjustments::from($data['totals']),
totals: AdjustmentTotals::from($data['totals']),
payoutTotals: isset($data['payout_totals']) ? PayoutTotalsAdjustment::from($data['payout_totals']) : null,
createdAt: DateTime::from($data['created_at']),
updatedAt: DateTime::from($data['updated_at']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Paddle\SDK\Entities\Shared;

class TotalAdjustments
class AdjustmentTotals
{
public function __construct(
public string $subtotal,
Expand Down
6 changes: 3 additions & 3 deletions src/Entities/Subscription/SubscriptionAdjustmentPreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Paddle\SDK\Entities\Subscription;

use Paddle\SDK\Entities\Shared\TotalAdjustments;
use Paddle\SDK\Entities\Shared\AdjustmentTotals;

class SubscriptionAdjustmentPreview
{
Expand All @@ -14,7 +14,7 @@ class SubscriptionAdjustmentPreview
public function __construct(
public string $transactionId,
public array $items,
public TotalAdjustments $totals,
public AdjustmentTotals $totals,
) {
}

Expand All @@ -23,7 +23,7 @@ public static function from(array $data): self
return new self(
transactionId: $data['transaction_id'],
items: array_map(fn (array $item) => SubscriptionAdjustmentItem::from($item), $data['items']),
totals: TotalAdjustments::from($data['totals']),
totals: AdjustmentTotals::from($data['totals']),
);
}
}

0 comments on commit 07bbac5

Please sign in to comment.