shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

pp_button.php (1383B)


      1 <?php
      2 class ControllerExtensionModulePPButton extends Controller {
      3 	public function index() {
      4 		if ($this->config->get('payment_pp_express_status') == 1) {
      5 			$status = true;
      6 
      7 			if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) || (!$this->customer->isLogged() && ($this->cart->hasRecurringProducts() || $this->cart->hasDownload()))) {
      8 				$status = false;
      9 			}
     10 
     11 			if ($status) {
     12 				$this->load->model('extension/payment/pp_express');
     13 
     14 				if (preg_match('/Mobile|Android|BlackBerry|iPhone|Windows Phone/', $this->request->server['HTTP_USER_AGENT'])) {
     15 					$data['mobile'] = true;
     16 				} else {
     17 					$data['mobile'] = false;
     18 				}
     19 
     20 				$data['payment_pp_express_incontext_disable'] = $this->config->get('payment_pp_express_incontext_disable');
     21 
     22 				if ($this->config->get('payment_pp_express_test') == 1) {
     23 					$data['username'] = $this->config->get('payment_pp_express_sandbox_username');
     24 					$data['environment'] = 'sandbox';
     25 				} else {
     26 					$data['username'] = $this->config->get('payment_pp_express_username');
     27 					$data['environment'] = 'live';
     28 				}
     29 
     30 				$data['payment_url'] = $this->url->link('extension/payment/pp_express/express', '', true);
     31 
     32 				return $this->load->view('extension/module/pp_button', $data);
     33 			}
     34 		}
     35 	}
     36 }