/** * Returns the allowed payment methods. * * @return ArrayList|Boolean */ public function getAllowedPaymentMethods() { if (is_null($this->allowedPaymentMethods)) { $allowedPaymentMethods = new ArrayList(); $stepData = $this->controller->getCombinedStepData(); if (SilvercartCustomer::currentUser() instanceof Member && is_array($stepData) && array_key_exists('Shipping_Country', $stepData) && $stepData['Shipping_Country'] != "") { $shippingCountry = DataObject::get_by_id('SilvercartCountry', $stepData['Shipping_Country']); if ($shippingCountry instanceof SilvercartCountry) { $allowedPaymentMethods = SilvercartPaymentMethod::getAllowedPaymentMethodsFor($shippingCountry, SilvercartCustomer::currentUser()->getCart()); if (!$allowedPaymentMethods instanceof ArrayList) { $allowedPaymentMethods = new ArrayList(); } } } $this->setAllowedPaymentMethods($allowedPaymentMethods); } return $this->allowedPaymentMethods; }
/** * Returns all payment methods * * @return DataList * * @author Sebastian Diel <*****@*****.**> * @since 14.05.2012 */ public function PaymentMethods() { $PaymentMethods = SilvercartPaymentMethod::getAllowedPaymentMethodsFor($this->ShippingCountry(), singleton('SilvercartShoppingCart'), true); return $PaymentMethods; }