public function canRefund($member = null, $partial = false)
    {
        if (!(
            $this->Status == 'Captured' &&
            ($partial ? GatewayInfo::allowPartialRefund($this->Gateway) : GatewayInfo::allowRefund($this->Gateway))
        )) {
            return false;
        }

        if ($this->isInDB()) {
            // Check if there are partial refunds and deny further refunds if multiple refunds aren't enabled
            $hasPartials = $this->getPartialPayments()
                    ->filter('Status', array('Refunded', 'PendingRefund'))
                    ->count() > 0;
            if ($hasPartials && GatewayInfo::refundMode($this->Gateway) !== GatewayInfo::MULTIPLE) {
                return false;
            }
        }

        $extended = $this->extendedCan('canRefund', $member);
        if ($extended !== null) {
            return $extended;
        }

        return Permission::check('REFUND_PAYMENTS', 'any', $member);
    }
public function canRefund($member = null, $partial = false)
    {
        if (!(
            $this->Status == 'Captured' &&
            ($partial ? GatewayInfo::allowPartialRefund($this->Gateway) : GatewayInfo::allowRefund($this->Gateway))
        )) {
            return false;
        }

        if ($this->isInDB()) {
            // Check if there are partial refunds and deny further refunds if multiple refunds aren't enabled
            $hasPartials = $this->getPartialPayments()
                    ->filter('Status', array('Refunded', 'PendingRefund'))
                    ->count() > 0;
            if ($hasPartials && GatewayInfo::refundMode($this->Gateway) !== GatewayInfo::MULTIPLE) {
                return false;
            }
        }

        $extended = $this->extendedCan('canRefund', $member);
        if ($extended !== null) {
            return $extended;
        }

        return Permission::check('REFUND_PAYMENTS', 'any', $member);
    }
public function canRefund ( $ member = null , $ partial = false ) { if ( ! ( $ this -> Status == 'Captured' && ( $ partial ? GatewayInfo :: allowPartialRefund ( $ this -> Gateway ) : GatewayInfo :: allowRefund ( $ this -> Gateway ) ) ) ) { return false ; } if ( $ this -> isInDB ( ) ) { // Check if there are partial refunds and deny further refunds if multiple refunds aren't enabled $ hasPartials = $ this -> getPartialPayments ( ) -> filter ( 'Status' , array ( 'Refunded' , 'PendingRefund' ) ) -> count ( ) > 0 ; if ( $ hasPartials && GatewayInfo :: refundMode ( $ this -> Gateway ) !== GatewayInfo :: MULTIPLE ) { return false ; } } $ extended = $ this -> extendedCan ( 'canRefund' , $ member ) ; if ( $ extended !== null ) { return $ extended ; } return Permission :: check ( 'REFUND_PAYMENTS' , 'any' , $ member ) ; }
Whether or not this payment can be refunded
@param Member|int $member the member/memberID to check permissions on
@param boolean $partial check if payment can be partially refunded. Defaults to false
@return bool
Whether or not this payment can be refunded