public static function maxExcessCaptureAmount($gateway, $currency = null)
    {
        $setting = self::getConfigSetting($gateway, 'max_capture');
        if (!$setting) {
            return 0;
        }

        if (!is_array($setting)) {
            if (preg_match('/^\d+%$/', $setting)) {
                return -1;
            }

            if (is_numeric($setting)) {
                return max(0, $setting);
            }
        } elseif (!empty($setting['amount'])) {
            if (is_numeric($setting['amount'])) {
                return max(0, $setting['amount']);
            }

            if (is_array($setting['amount'])
                && $currency
                && !empty($setting['amount'][$currency])
                && is_numeric($setting['amount'][$currency])
            ) {
                return max(0, $setting['amount'][$currency]);
            }
        }

        return 0;
    }
public static function maxExcessCaptureAmount($gateway, $currency = null)
    {
        $setting = self::getConfigSetting($gateway, 'max_capture');
        if (!$setting) {
            return 0;
        }

        if (!is_array($setting)) {
            if (preg_match('/^\d+%$/', $setting)) {
                return -1;
            }

            if (is_numeric($setting)) {
                return max(0, $setting);
            }
        } elseif (!empty($setting['amount'])) {
            if (is_numeric($setting['amount'])) {
                return max(0, $setting['amount']);
            }

            if (is_array($setting['amount'])
                && $currency
                && !empty($setting['amount'][$currency])
                && is_numeric($setting['amount'][$currency])
            ) {
                return max(0, $setting['amount'][$currency]);
            }
        }

        return 0;
    }
public static function maxExcessCaptureAmount ( $ gateway , $ currency = null ) { $ setting = self :: getConfigSetting ( $ gateway , 'max_capture' ) ; if ( ! $ setting ) { return 0 ; } if ( ! is_array ( $ setting ) ) { if ( preg_match ( '/^\d+%$/' , $ setting ) ) { return - 1 ; } if ( is_numeric ( $ setting ) ) { return max ( 0 , $ setting ) ; } } elseif ( ! empty ( $ setting [ 'amount' ] ) ) { if ( is_numeric ( $ setting [ 'amount' ] ) ) { return max ( 0 , $ setting [ 'amount' ] ) ; } if ( is_array ( $ setting [ 'amount' ] ) && $ currency && ! empty ( $ setting [ 'amount' ] [ $ currency ] ) && is_numeric ( $ setting [ 'amount' ] [ $ currency ] ) ) { return max ( 0 , $ setting [ 'amount' ] [ $ currency ] ) ; } } return 0 ; }
Get the max excess capture amount for the given gateway and an optional currency.

Some payment providers allow capturing a slightly higher amount than was authorized.
If $200.00 was authorized and maxExcessCaptureAmount returns `70`, you're allowed to capture at max $270.00,
unless further restricted by maxExcessCapturePercent.
To get the correct max-capture amount, both maxExcessCapturePercent and maxExcessCaptureAmount
have to be considered.

@param string $gateway the gateway name
@param string $currency the currency to look up. Defaults to `null` and is only needed when the config contains
amounts for different currencies.
@return int|string the max excess amount or `-1` if the excess amount isn't limited (only limited by percentage)
Get the max excess capture amount for the given gateway and an optional currency .