Skip to content

Commit

Permalink
fix: webhook data nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkhansrc committed Mar 8, 2022
1 parent 13b1b13 commit 8e1ebee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Factory/WebhookFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ private static function instanciateWebhookData(array $dataPayload): WebhookData
new DateTime($dataPayload['expirationDate']),
isset($dataPayload['autoResumeDate']) ? new DateTime($dataPayload['autoResumeDate']) : null,
$dataPayload['nextPurchase'] ?? null,
$dataPayload['linkedPurchase'],
$dataPayload['originalPurchase']
$dataPayload['linkedPurchase'] ?? null,
$dataPayload['originalPurchase'] ?? null
) : null,
);
}
Expand Down
24 changes: 12 additions & 12 deletions src/Model/Webhook/SubscriptionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ class SubscriptionData
/**
* Previous purchase id of a renewable subscription.
*/
private string $linkedPurchase;
private ?string $linkedPurchase;
/**
* Original purchase id of a renewable subscription.
*/
private string $originalPurchase;
private ?string $originalPurchase;

public function __construct(
bool $isSubscriptionActive,
Expand All @@ -125,8 +125,8 @@ public function __construct(
DateTime $expirationDate,
?DateTime $autoResumeDate,
?string $nextPurchase,
string $linkedPurchase,
string $originalPurchase
?string $linkedPurchase,
?string $originalPurchase
)
{
$this->isSubscriptionActive = $isSubscriptionActive;
Expand Down Expand Up @@ -400,36 +400,36 @@ public function setNextPurchase(?string $nextPurchase): SubscriptionData
}

/**
* @return string
* @return null|string
*/
public function getLinkedPurchase(): string
public function getLinkedPurchase(): ?string
{
return $this->linkedPurchase;
}

/**
* @param string $linkedPurchase
* @param null|string $linkedPurchase
* @return SubscriptionData
*/
public function setLinkedPurchase(string $linkedPurchase): SubscriptionData
public function setLinkedPurchase(?string $linkedPurchase): SubscriptionData
{
$this->linkedPurchase = $linkedPurchase;
return $this;
}

/**
* @return string
* @return null|string
*/
public function getOriginalPurchase(): string
public function getOriginalPurchase(): ?string
{
return $this->originalPurchase;
}

/**
* @param string $originalPurchase
* @param null|string $originalPurchase
* @return SubscriptionData
*/
public function setOriginalPurchase(string $originalPurchase): SubscriptionData
public function setOriginalPurchase(?string $originalPurchase): SubscriptionData
{
$this->originalPurchase = $originalPurchase;
return $this;
Expand Down

0 comments on commit 8e1ebee

Please sign in to comment.