/home/techb158/ileadtechnology.com/vendor/mollie/mollie-api-php/src/Resources
Edit: /home/techb158/ileadtechnology.com/vendor/mollie/mollie-api-php/src/Resources/Subscription.php (4889B)
$this->amount,
"times" => $this->times,
"startDate" => $this->startDate,
"webhookUrl" => $this->webhookUrl,
"description" => $this->description,
"mandateId" => $this->mandateId,
"metadata" => $this->metadata,
"interval" => $this->interval,
];
$result = $this->client->subscriptions->update($this->customerId, $this->id, $body);
return ResourceFactory::createFromApiResult($result, new Subscription($this->client));
}
/**
* Returns whether the Subscription is active or not.
*
* @return bool
*/
public function isActive()
{
return $this->status === SubscriptionStatus::STATUS_ACTIVE;
}
/**
* Returns whether the Subscription is pending or not.
*
* @return bool
*/
public function isPending()
{
return $this->status === SubscriptionStatus::STATUS_PENDING;
}
/**
* Returns whether the Subscription is canceled or not.
*
* @return bool
*/
public function isCanceled()
{
return $this->status === SubscriptionStatus::STATUS_CANCELED;
}
/**
* Returns whether the Subscription is suspended or not.
*
* @return bool
*/
public function isSuspended()
{
return $this->status === SubscriptionStatus::STATUS_SUSPENDED;
}
/**
* Returns whether the Subscription is completed or not.
*
* @return bool
*/
public function isCompleted()
{
return $this->status === SubscriptionStatus::STATUS_COMPLETED;
}
/**
* Cancels this subscription
*
* @return Subscription
* @throws \Mollie\Api\Exceptions\ApiException
*/
public function cancel()
{
if (! isset($this->_links->self->href)) {
return $this;
}
$body = null;
if ($this->client->usesOAuth()) {
$body = json_encode([
"testmode" => $this->mode === "test" ? true : false,
]);
}
$result = $this->client->performHttpCallToFullUrl(
MollieApiClient::HTTP_DELETE,
$this->_links->self->href,
$body
);
return ResourceFactory::createFromApiResult($result, new Subscription($this->client));
}
/**
* Get subscription payments
*
* @return \Mollie\Api\Resources\PaymentCollection
* @throws \Mollie\Api\Exceptions\ApiException
*/
public function payments()
{
if (! isset($this->_links->payments->href)) {
return new PaymentCollection($this->client, 0, null);
}
$result = $this->client->performHttpCallToFullUrl(
MollieApiClient::HTTP_GET,
$this->_links->payments->href
);
return ResourceFactory::createCursorResourceCollection(
$this->client,
$result->_embedded->payments,
Payment::class,
$result->_links
);
}
}