Back to Opencart

File extension\opencart\catalog\controller\payment\cheque.php

docs/api/source-extension.opencart.catalog.controller.payment.cheque.html

4.1.0.36.4 KB
Original Source

Namespaces

Classes

| 1: | <?php | | 2: | namespace Opencart\Catalog\Controller\Extension\Opencart\Payment; | | 3: | /** | | 4: | * Class Cheque | | 5: | * | | 6: | * @package Opencart\Catalog\Controller\Extension\Opencart\Payment | | 7: | */ | | 8: | class Cheque extends \Opencart\System\Engine\Controller { | | 9: | /** | | 10: | * Index | | 11: | * | | 12: | * @return string | | 13: | */ | | 14: | public function index(): string { | | 15: | $this->load->language('extension/opencart/payment/cheque'); | | 16: | | | 17: | $data['payable'] = $this->config->get('payment_cheque_payable'); | | 18: | $data['address'] = nl2br($this->config->get('config_address')); | | 19: | | | 20: | $data['language'] = $this->config->get('config_language'); | | 21: | | | 22: | return $this->load->view('extension/opencart/payment/cheque', $data); | | 23: | } | | 24: | | | 25: | /** | | 26: | * Confirm | | 27: | * | | 28: | * @return void | | 29: | */ | | 30: | public function confirm(): void { | | 31: | $this->load->language('extension/opencart/payment/cheque'); | | 32: | | | 33: | $json = []; | | 34: | | | 35: | if (!isset($this->session->data['order_id'])) { | | 36: | $json['error'] = $this->language->get('error_order'); | | 37: | } | | 38: | | | 39: | if (!isset($this->session->data['payment_method']) || $this->session->data['payment_method']['code'] != 'cheque.cheque') { | | 40: | $json['error'] = $this->language->get('error_payment_method'); | | 41: | } | | 42: | | | 43: | if (!$json) { | | 44: | $comment = $this->language->get('text_payable') . "\n"; | | 45: | $comment .= $this->config->get('payment_cheque_payable') . "\n\n"; | | 46: | $comment .= $this->language->get('text_address') . "\n"; | | 47: | $comment .= $this->config->get('config_address') . "\n\n"; | | 48: | $comment .= $this->language->get('text_payment') . "\n"; | | 49: | | | 50: | $this->load->model('checkout/order'); | | 51: | | | 52: | $this->model_checkout_order->addHistory($this->session->data['order_id'], $this->config->get('payment_cheque_order_status_id'), $comment, true); | | 53: | | | 54: | $json['redirect'] = $this->url->link('checkout/success', 'language=' . $this->config->get('config_language'), true); | | 55: | } | | 56: | | | 57: | $this->response->addHeader('Content-Type: application/json'); | | 58: | $this->response->setOutput(json_encode($json)); | | 59: | } | | 60: | } | | 61: | |

OpenCart API API documentation generated by ApiGen dev-master