Esempio n. 1
0
 /**
  * Do something when payment method is enabled or disabled
  *
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return void
  */
 public function enableMethod(\XLite\Model\Payment\Method $method)
 {
     $methods = array(Paypal\Main::PP_METHOD_PPA, Paypal\Main::PP_METHOD_PFL);
     // Add Express Checkout if the admin enables PPA or PFL methods
     if (in_array($method->getServiceName(), $methods) && $method->getEnabled()) {
         $m = Paypal\Main::getPaymentMethod(Paypal\Main::PP_METHOD_EC);
         if ($m) {
             $m->setAdded(true);
             $m->setEnabled(true);
         }
     }
     $methods[] = Paypal\Main::PP_METHOD_EC;
     // Add Paypal Credit if the admin enables PPA or PFL methods
     if (in_array($method->getServiceName(), $methods) && $method->getEnabled()) {
         $m = Paypal\Main::getPaymentMethod(Paypal\Main::PP_METHOD_PC);
         if ($m) {
             $m->setAdded(true);
             $m->setEnabled(true);
         }
     }
 }
Esempio n. 2
0
 /**
  * Get payment method admin zone icon URL
  *
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return string | boolean
  */
 public function getAdminIconURL(\XLite\Model\Payment\Method $method)
 {
     if (false !== strpos($method->getServiceName(), 'XPayments.Allowed')) {
         $name = $method->getServiceName();
     } else {
         $name = str_replace('XPayments', 'XPayments.Allowed', $method->getServiceName());
     }
     $file = 'modules/CDev/XPaymentsConnector/icons/' . $name . '.png';
     $filePath = LC_DIR_SKINS . 'admin' . LC_DS . 'en' . LC_DS . str_replace('/', LC_DS, $file);
     return \Includes\Utils\FileManager::isExists($filePath) ? \XLite\Core\Layout::getInstance()->getResourceWebPath($file) : true;
 }
Esempio n. 3
0
 /**
  * Return true if current payment method is PayPal
  * 
  * @param \XLite\Model\Payment\Method $method Payment method object
  *  
  * @return boolean
  */
 protected function isPaypalMethod($method)
 {
     return isset($method) && in_array($method->getServiceName(), array(\XLite\Module\CDev\Paypal\Main::PP_METHOD_PPA, \XLite\Module\CDev\Paypal\Main::PP_METHOD_PFL, \XLite\Module\CDev\Paypal\Main::PP_METHOD_EC, \XLite\Module\CDev\Paypal\Main::PP_METHOD_PPS));
 }
Esempio n. 4
0
 /**
  * Get payemnt method icon path
  *
  * @param \XLite\Model\Order          $order  Order
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return string
  */
 public function getIconPath(\XLite\Model\Order $order, \XLite\Model\Payment\Method $method)
 {
     $type = $this->convertServiceNameToType($method->getServiceName());
     $icon = isset($this->paymentTypeIcons[$type]) ? $this->paymentTypeIcons[$type] : null;
     if (is_array($icon)) {
         $code3 = $order->getProfile() && $order->getProfile()->getBillingAddress() ? $order->getProfile()->getBillingAddress()->getCountry()->getCode3() : null;
         $icon = $code3 && isset($icon[$code3]) ? $icon[$code3] : null;
     }
     return $icon ? 'modules/CDev/Moneybookers/icons/' . $icon : parent::getIconPath($order, $method);
 }
Esempio n. 5
0
 /**
  * Returns 'after' list name (with payment method service name)
  *
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return string
  */
 protected function getAfterListName(\XLite\Model\Payment\Method $method)
 {
     $serviceName = $method->getServiceName();
     return 'after.' . preg_replace('/[^\\w]/', '_', $serviceName);
 }
Esempio n. 6
0
 /**
  * Set payment method
  *
  * @param \XLite\Model\Payment\Method $method Payment method OPTIONAL
  *
  * @return void
  */
 public function setPaymentMethod(\XLite\Model\Payment\Method $method = null)
 {
     $this->payment_method = $method;
     if ($method) {
         $this->setMethodName($method->getServiceName());
         $this->setMethodLocalName($method->getName());
         $this->renewTransactionId();
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getServiceName()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getServiceName', array());
     return parent::getServiceName();
 }
Esempio n. 8
0
 /**
  * Do something when payment method is enabled 
  * 
  * @return void
  */
 public function enableMethod(\XLite\Model\Payment\Method $method)
 {
     $methods = array(\XLite\Module\CDev\Paypal\Main::PP_METHOD_PPA, \XLite\Module\CDev\Paypal\Main::PP_METHOD_PFL);
     if (in_array($method->getServiceName(), $methods)) {
         $m = \XLite\Core\Database::getRepo('XLite\\Model\\Payment\\Method')->findOneBy(array('service_name' => \XLite\Module\CDev\Paypal\Main::PP_METHOD_EC));
         if ($m) {
             $m->setAdded(true);
             $m->setEnabled(true);
         }
     }
 }