<?php

namespace Nascom\TeamleaderApiClient\Request\Creditnote;

use Nascom\TeamleaderApiClient\Request\AbstractPostRequest;

/**
 * Class RetrieveCreditnoteRequest
 *
 * @package Nascom\TeamleaderApiClient\Request\Creditnote
 */
class RetrieveCreditnoteRequest extends AbstractPostRequest
{
    /**
     * RetrieveCreditnoteRequest constructor.
     *
     * @param $credit_id
     * @param array $options
     */
    public function __construct($credit_id, array $options = [])
    {
        $this->options = $options;
        $this->setCreditnoteId($credit_id);
    }

    /**
     * @param $credit_id
     */
    public function setCreditnoteId($credit_id)
    {
        $this->options['credit_id'] = $credit_id;
    }

    /**
     * @return string
     */
    public function getUri()
    {
        return 'getCreditnote.php';
    }
}

<?php

namespace Nascom\TeamleaderApiClient\Request\Creditnote;

use Nascom\TeamleaderApiClient\Request\AbstractPostRequest;

/**
 * Class RetrieveCreditnoteRequest
 *
 * @package Nascom\TeamleaderApiClient\Request\Creditnote
 */
class RetrieveCreditnoteRequest extends AbstractPostRequest
{
    /**
     * RetrieveCreditnoteRequest constructor.
     *
     * @param $credit_id
     * @param array $options
     */
    public function __construct($credit_id, array $options = [])
    {
        $this->options = $options;
        $this->setCreditnoteId($credit_id);
    }

    /**
     * @param $credit_id
     */
    public function setCreditnoteId($credit_id)
    {
        $this->options['creditnote_id'] = $credit_id;
    }

    /**
     * @return string
     */
    public function getUri()
    {
        return 'getCreditnote.php';
    }
}

Fix bad request when retrieving creditnote detail
Fix bad request when retrieving creditnote detail

When retrieving a creditnote detail, the Teamleader API threw an error
400 (bad request) because the required option "creditnote_id" was
missing.

The RetrieveCreditnoteRequest class was using the "credit_id" option
intead of "creditnote_id".
Fixed!
