Invoice/Resolver/InvoicePaymentResolver.php
protected function buildPaymentList(PM\PaymentSubjectInterface $subject)
    {
        // TODO Deal with refund when implemented
        $payments = array_filter($subject->getPayments()->toArray(), function (PM\PaymentInterface $p) {
            if ($p->getMethod()->isOutstanding()) {
                return false;
            }

            if (!PM\PaymentStates::isPaidState($p->getState())) {
                return false;
            }

            return true;
        });

        usort($payments, function (PM\PaymentInterface $a, PM\PaymentInterface $b) {
            return $a->getCompletedAt()->getTimestamp() - $b->getCompletedAt()->getTimestamp();
        });

        // TODO Currency conversion

        return array_map(function (PM\PaymentInterface $payment) {
            return [
                'payment' => $payment,
                'amount'  => $payment->getAmount(),
            ];
        }, $payments);
    }
protected function buildPaymentList(PM\PaymentSubjectInterface $subject)
    {
        // TODO Deal with refund when implemented
        $payments = array_filter($subject->getPayments()->toArray(), function (PM\PaymentInterface $p) {
            if ($p->getMethod()->isOutstanding()) {
                return false;
            }

            if (!PM\PaymentStates::isPaidState($p->getState())) {
                return false;
            }

            return true;
        });

        usort($payments, function (PM\PaymentInterface $a, PM\PaymentInterface $b) {
            return $a->getCompletedAt()->getTimestamp() - $b->getCompletedAt()->getTimestamp();
        });

        // TODO Currency conversion

        return array_map(function (PM\PaymentInterface $payment) {
            return [
                'payment' => $payment,
                'amount'  => $payment->getAmount(),
            ];
        }, $payments);
    }
protected function buildPaymentList ( PM \ PaymentSubjectInterface $ subject ) { // TODO Deal with refund when implemented $ payments = array_filter ( $ subject -> getPayments ( ) -> toArray ( ) , function ( PM \ PaymentInterface $ p ) { if ( $ p -> getMethod ( ) -> isOutstanding ( ) ) { return false ; } if ( ! PM \ PaymentStates :: isPaidState ( $ p -> getState ( ) ) ) { return false ; } return true ; } ) ; usort ( $ payments , function ( PM \ PaymentInterface $ a , PM \ PaymentInterface $ b ) { return $ a -> getCompletedAt ( ) -> getTimestamp ( ) - $ b -> getCompletedAt ( ) -> getTimestamp ( ) ; } ) ; // TODO Currency conversion return array_map ( function ( PM \ PaymentInterface $ payment ) { return [ 'payment' => $ payment , 'amount' => $ payment -> getAmount ( ) , ] ; } , $ payments ) ; }
Builds the sale payments list.

@param PM\PaymentSubjectInterface $subject

@return array
Builds the sale payments list .