Customer/Updater/CustomerUpdater.php
protected function updateCustomerBalance(PaymentInterface $payment, $amount = null)
    {
        if (null === $customer = $payment->getSale()->getCustomer()) {
            // TODO Deals with customer change
            return false;
        }

        $amount = $amount ?: $payment->getAmount();
        if ($this->isAcceptedPayment($payment)) {
            $amount = -$amount;
        }

        if ($payment->getMethod()->isCredit()) {
            return $this->updateCreditBalance($customer, $amount, true);
        } elseif ($payment->getMethod()->isOutstanding()) {
            return $this->updateOutstandingBalance($customer, $amount, true);
        }

        return false;
    }
protected function updateCustomerBalance(PaymentInterface $payment, $amount = null)
    {
        if (null === $customer = $payment->getSale()->getCustomer()) {
            // TODO Deals with customer change
            return false;
        }

        $amount = $amount ?: $payment->getAmount();
        if ($this->isAcceptedPayment($payment)) {
            $amount = -$amount;
        }

        if ($payment->getMethod()->isCredit()) {
            return $this->updateCreditBalance($customer, $amount, true);
        } elseif ($payment->getMethod()->isOutstanding()) {
            return $this->updateOutstandingBalance($customer, $amount, true);
        }

        return false;
    }
protected function updateCustomerBalance ( PaymentInterface $ payment , $ amount = null ) { if ( null === $ customer = $ payment -> getSale ( ) -> getCustomer ( ) ) { // TODO Deals with customer change return false ; } $ amount = $ amount ? : $ payment -> getAmount ( ) ; if ( $ this -> isAcceptedPayment ( $ payment ) ) { $ amount = - $ amount ; } if ( $ payment -> getMethod ( ) -> isCredit ( ) ) { return $ this -> updateCreditBalance ( $ customer , $ amount , true ) ; } elseif ( $ payment -> getMethod ( ) -> isOutstanding ( ) ) { return $ this -> updateOutstandingBalance ( $ customer , $ amount , true ) ; } return false ; }
Updates the customer's balance regarding to the payment method.

@param PaymentInterface $payment
@param float            $amount The previous amount (update case)

@return bool Whether the customer has been changed.
Updates the customer s balance regarding to the payment method .