_links->self->href)) { return $this; } $body = json_encode([ "amount" => $this->amount, "times" => $this->times, "startDate" => $this->startDate, "webhookUrl" => $this->webhookUrl, "description" => $this->description, "mandateId" => $this->mandateId, ]); $result = $this->client->performHttpCallToFullUrl( MollieApiClient::HTTP_PATCH, $this->_links->self->href, $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 */ 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)); } }