crucialwebstudio / chargify-sdk-php

Chargify SDK for PHP
Apache License 2.0
26 stars 44 forks source link

added a new method Subscription::clearPendingCancellation #32

Open esokullu opened 4 years ago

esokullu commented 4 years ago

just read CONTRIBUTING.md (sorry for the duplicate)

esokullu commented 4 years ago

sorry I had to release this on packagist for a package we use internally, hence the composer.json name change. messed things up a bit, will roll it back.

esokullu commented 4 years ago

You may add manually:

    /**
     * Clears the pending cancellation from a subscription in delayed cancellation
     *
     * @param int $id
     *
     * @return Subscription
     * @see Subscription::cancelDelayed()
     */
    public function clearPendingCancellation($id)
    {
        $service = $this->getService();
        $response = $service->request('subscriptions/' . (int)$id .'/delayed_cancel', 'DELETE', []);
        $responseArray = $this->getResponseArray($response);
        if (!$this->isError()) {
            $this->_data = $responseArray['subscription'];
        } else {
            $this->_data = array();
        }

        return $this;
    }