shop.balmet.com

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

pp_standard.php (8462B)


      1 <?php
      2 class ControllerExtensionPaymentPPStandard extends Controller {
      3 	private $error = array();
      4 
      5 	public function index() {
      6 		$this->load->language('extension/payment/pp_standard');
      7 
      8 		$this->document->setTitle($this->language->get('heading_title'));
      9 
     10 		$this->load->model('setting/setting');
     11 
     12 		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
     13 			$this->model_setting_setting->editSetting('payment_pp_standard', $this->request->post);
     14 
     15 			$this->session->data['success'] = $this->language->get('text_success');
     16 
     17 			$this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true));
     18 		}
     19 
     20 		if (isset($this->error['warning'])) {
     21 			$data['error_warning'] = $this->error['warning'];
     22 		} else {
     23 			$data['error_warning'] = '';
     24 		}
     25 
     26 		if (isset($this->error['email'])) {
     27 			$data['error_email'] = $this->error['email'];
     28 		} else {
     29 			$data['error_email'] = '';
     30 		}
     31 
     32 		$data['breadcrumbs'] = array();
     33 
     34 		$data['breadcrumbs'][] = array(
     35 			'text' => $this->language->get('text_home'),
     36 			'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
     37 		);
     38 
     39 		$data['breadcrumbs'][] = array(
     40 			'text' => $this->language->get('text_extension'),
     41 			'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true)
     42 		);
     43 
     44 		$data['breadcrumbs'][] = array(
     45 			'text' => $this->language->get('heading_title'),
     46 			'href' => $this->url->link('extension/payment/pp_standard', 'user_token=' . $this->session->data['user_token'], true)
     47 		);
     48 
     49 		$data['action'] = $this->url->link('extension/payment/pp_standard', 'user_token=' . $this->session->data['user_token'], true);
     50 
     51 		$data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true);
     52 
     53 		if (isset($this->request->post['payment_pp_standard_email'])) {
     54 			$data['payment_pp_standard_email'] = $this->request->post['payment_pp_standard_email'];
     55 		} else {
     56 			$data['payment_pp_standard_email'] = $this->config->get('payment_pp_standard_email');
     57 		}
     58 
     59 		if (isset($this->request->post['payment_pp_standard_test'])) {
     60 			$data['payment_pp_standard_test'] = $this->request->post['payment_pp_standard_test'];
     61 		} else {
     62 			$data['payment_pp_standard_test'] = $this->config->get('payment_pp_standard_test');
     63 		}
     64 
     65 		if (isset($this->request->post['payment_pp_standard_transaction'])) {
     66 			$data['payment_pp_standard_transaction'] = $this->request->post['payment_pp_standard_transaction'];
     67 		} else {
     68 			$data['payment_pp_standard_transaction'] = $this->config->get('payment_pp_standard_transaction');
     69 		}
     70 
     71 		if (isset($this->request->post['payment_pp_standard_debug'])) {
     72 			$data['payment_pp_standard_debug'] = $this->request->post['payment_pp_standard_debug'];
     73 		} else {
     74 			$data['payment_pp_standard_debug'] = $this->config->get('payment_pp_standard_debug');
     75 		}
     76 
     77 		if (isset($this->request->post['payment_pp_standard_total'])) {
     78 			$data['payment_pp_standard_total'] = $this->request->post['payment_pp_standard_total'];
     79 		} else {
     80 			$data['payment_pp_standard_total'] = $this->config->get('payment_pp_standard_total');
     81 		}
     82 
     83 		if (isset($this->request->post['payment_pp_standard_canceled_reversal_status_id'])) {
     84 			$data['payment_pp_standard_canceled_reversal_status_id'] = $this->request->post['payment_pp_standard_canceled_reversal_status_id'];
     85 		} else {
     86 			$data['payment_pp_standard_canceled_reversal_status_id'] = $this->config->get('payment_pp_standard_canceled_reversal_status_id');
     87 		}
     88 
     89 		if (isset($this->request->post['payment_pp_standard_completed_status_id'])) {
     90 			$data['payment_pp_standard_completed_status_id'] = $this->request->post['payment_pp_standard_completed_status_id'];
     91 		} else {
     92 			$data['payment_pp_standard_completed_status_id'] = $this->config->get('payment_pp_standard_completed_status_id');
     93 		}
     94 
     95 		if (isset($this->request->post['payment_pp_standard_denied_status_id'])) {
     96 			$data['payment_pp_standard_denied_status_id'] = $this->request->post['payment_pp_standard_denied_status_id'];
     97 		} else {
     98 			$data['payment_pp_standard_denied_status_id'] = $this->config->get('payment_pp_standard_denied_status_id');
     99 		}
    100 
    101 		if (isset($this->request->post['payment_pp_standard_expired_status_id'])) {
    102 			$data['payment_pp_standard_expired_status_id'] = $this->request->post['payment_pp_standard_expired_status_id'];
    103 		} else {
    104 			$data['payment_pp_standard_expired_status_id'] = $this->config->get('payment_pp_standard_expired_status_id');
    105 		}
    106 
    107 		if (isset($this->request->post['payment_pp_standard_failed_status_id'])) {
    108 			$data['payment_pp_standard_failed_status_id'] = $this->request->post['payment_pp_standard_failed_status_id'];
    109 		} else {
    110 			$data['payment_pp_standard_failed_status_id'] = $this->config->get('payment_pp_standard_failed_status_id');
    111 		}
    112 
    113 		if (isset($this->request->post['payment_pp_standard_pending_status_id'])) {
    114 			$data['payment_pp_standard_pending_status_id'] = $this->request->post['payment_pp_standard_pending_status_id'];
    115 		} else {
    116 			$data['payment_pp_standard_pending_status_id'] = $this->config->get('payment_pp_standard_pending_status_id');
    117 		}
    118 
    119 		if (isset($this->request->post['payment_pp_standard_processed_status_id'])) {
    120 			$data['payment_pp_standard_processed_status_id'] = $this->request->post['payment_pp_standard_processed_status_id'];
    121 		} else {
    122 			$data['payment_pp_standard_processed_status_id'] = $this->config->get('payment_pp_standard_processed_status_id');
    123 		}
    124 
    125 		if (isset($this->request->post['payment_pp_standard_refunded_status_id'])) {
    126 			$data['payment_pp_standard_refunded_status_id'] = $this->request->post['payment_pp_standard_refunded_status_id'];
    127 		} else {
    128 			$data['payment_pp_standard_refunded_status_id'] = $this->config->get('payment_pp_standard_refunded_status_id');
    129 		}
    130 
    131 		if (isset($this->request->post['payment_pp_standard_reversed_status_id'])) {
    132 			$data['payment_pp_standard_reversed_status_id'] = $this->request->post['payment_pp_standard_reversed_status_id'];
    133 		} else {
    134 			$data['payment_pp_standard_reversed_status_id'] = $this->config->get('payment_pp_standard_reversed_status_id');
    135 		}
    136 
    137 		if (isset($this->request->post['payment_pp_standard_voided_status_id'])) {
    138 			$data['payment_pp_standard_voided_status_id'] = $this->request->post['payment_pp_standard_voided_status_id'];
    139 		} else {
    140 			$data['payment_pp_standard_voided_status_id'] = $this->config->get('payment_pp_standard_voided_status_id');
    141 		}
    142 
    143 		$this->load->model('localisation/order_status');
    144 
    145 		$data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
    146 
    147 		if (isset($this->request->post['payment_pp_standard_geo_zone_id'])) {
    148 			$data['payment_pp_standard_geo_zone_id'] = $this->request->post['payment_pp_standard_geo_zone_id'];
    149 		} else {
    150 			$data['payment_pp_standard_geo_zone_id'] = $this->config->get('payment_pp_standard_geo_zone_id');
    151 		}
    152 
    153 		$this->load->model('localisation/geo_zone');
    154 
    155 		$data['geo_zones'] = $this->model_localisation_geo_zone->getGeoZones();
    156 
    157 		if (isset($this->request->post['payment_pp_standard_status'])) {
    158 			$data['payment_pp_standard_status'] = $this->request->post['payment_pp_standard_status'];
    159 		} else {
    160 			$data['payment_pp_standard_status'] = $this->config->get('payment_pp_standard_status');
    161 		}
    162 
    163 		if (isset($this->request->post['payment_pp_standard_sort_order'])) {
    164 			$data['payment_pp_standard_sort_order'] = $this->request->post['payment_pp_standard_sort_order'];
    165 		} else {
    166 			$data['payment_pp_standard_sort_order'] = $this->config->get('payment_pp_standard_sort_order');
    167 		}
    168 
    169 		$data['header'] = $this->load->controller('common/header');
    170 		$data['column_left'] = $this->load->controller('common/column_left');
    171 		$data['footer'] = $this->load->controller('common/footer');
    172 
    173 		$this->response->setOutput($this->load->view('extension/payment/pp_standard', $data));
    174 	}
    175 
    176 	private function validate() {
    177 		if (!$this->user->hasPermission('modify', 'extension/payment/pp_standard')) {
    178 			$this->error['warning'] = $this->language->get('error_permission');
    179 		}
    180 
    181 		if (!$this->request->post['payment_pp_standard_email']) {
    182 			$this->error['email'] = $this->language->get('error_email');
    183 		}
    184 
    185 		return !$this->error;
    186 	}
    187 }