/** * Add surcharge by details * @uses SagepayUtil::cardTypes List of cards * * @param string $paymentType * @param float $percentage * @param float $fixed * * @return boolean */ public function addSurchargeDetails($paymentType, $percentage = null, $fixed = null) { if (!in_array(strtolower($paymentType), SagepayUtil::cardTypes())) { return false; } $surcharge = array('paymentType' => $paymentType); if (!empty($percentage)) { $surcharge['percentage'] = $percentage; $this->_addSurcharge($surcharge); return true; } if (!empty($fixed)) { $surcharge['fixed'] = $fixed; $this->_addSurcharge($surcharge); return true; } return false; }