public function listPayments(Payplug\Payplug $payplug = null)
    {
        if ($payplug === null) {
            $payplug = Payplug\Payplug::getDefaultConfiguration();
        }

        if (!array_key_exists('id', $this->getAttributes())) {
            throw new Payplug\Exception\UndefinedAttributeException(
                "This installment plan object has no id. You can't list payments on it.");
        }
        $httpClient = new Payplug\Core\HttpClient($payplug);
        $response = $httpClient->get(
            Payplug\Core\APIRoutes::getRoute(Payplug\Core\APIRoutes::INSTALLMENT_PLAN_RESOURCE, $this->id)
        );

        $payments = array();
        foreach ($response['httpResponse']['schedule'] as $schedule) {
            foreach ($schedule['payment_ids'] as $payment_id) {
                $payments[$payment_id] = Payment::retrieve($payment_id, $payplug);
            }
        }

        return $payments;

    }
public function listPayments(Payplug\Payplug $payplug = null)
    {
        if ($payplug === null) {
            $payplug = Payplug\Payplug::getDefaultConfiguration();
        }

        if (!array_key_exists('id', $this->getAttributes())) {
            throw new Payplug\Exception\UndefinedAttributeException(
                "This installment plan object has no id. You can't list payments on it.");
        }
        $httpClient = new Payplug\Core\HttpClient($payplug);
        $response = $httpClient->get(
            Payplug\Core\APIRoutes::getRoute(Payplug\Core\APIRoutes::INSTALLMENT_PLAN_RESOURCE, $this->id)
        );

        $payments = array();
        foreach ($response['httpResponse']['schedule'] as $schedule) {
            foreach ($schedule['payment_ids'] as $payment_id) {
                $payments[$payment_id] = Payment::retrieve($payment_id, $payplug);
            }
        }

        return $payments;

    }
public function listPayments ( Payplug \ Payplug $ payplug = null ) { if ( $ payplug === null ) { $ payplug = Payplug \ Payplug :: getDefaultConfiguration ( ) ; } if ( ! array_key_exists ( 'id' , $ this -> getAttributes ( ) ) ) { throw new Payplug \ Exception \ UndefinedAttributeException ( "This installment plan object has no id. You can't list payments on it." ) ; } $ httpClient = new Payplug \ Core \ HttpClient ( $ payplug ) ; $ response = $ httpClient -> get ( Payplug \ Core \ APIRoutes :: getRoute ( Payplug \ Core \ APIRoutes :: INSTALLMENT_PLAN_RESOURCE , $ this -> id ) ) ; $ payments = array ( ) ; foreach ( $ response [ 'httpResponse' ] [ 'schedule' ] as $ schedule ) { foreach ( $ schedule [ 'payment_ids' ] as $ payment_id ) { $ payments [ $ payment_id ] = Payment :: retrieve ( $ payment_id , $ payplug ) ; } } return $ payments ; }
List the payments of this installment plan.

@param   Payplug\Payplug     $payplug    the client configuration

@return  null|Payment[]   the array of payments of this installment plan

@throws  Payplug\Exception\UndefinedAttributeException
@throws  Payplug\Exception\UnexpectedAPIResponseException
List the payments of this installment plan .