1: | <?php
2: | namespace Opencart\Catalog\Controller\Extension\Opencart\Payment;
3: | /**
4: | * Class BankTransfer
5: | *
6: | * @package Opencart\Catalog\Controller\Extension\Opencart\Module
7: | */
8: | class BankTransfer 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/bank_transfer');
16: |
17: | $data['bank'] = nl2br($this->config->get('payment_bank_transfer_bank_' . $this->config->get('config_language_id')));
18: |
19: | $data['language'] = $this->config->get('config_language');
20: |
21: | return $this->load->view('extension/opencart/payment/bank_transfer', $data);
22: | }
23: |
24: | /**
25: | * Confirm
26: | *
27: | * @return void
28: | */
29: | public function confirm(): void {
30: | $this->load->language('extension/opencart/payment/bank_transfer');
31: |
32: | $json = [];
33: |
34: | if (!isset($this->session->data['order_id'])) {
35: | $json['error'] = $this->language->get('error_order');
36: | }
37: |
38: | if (!isset($this->session->data['payment_method']) || $this->session->data['payment_method']['code'] != 'bank_transfer.bank_transfer') {
39: | $json['error'] = $this->language->get('error_payment_method');
40: | }
41: |
42: | if (!$json) {
43: | $comment = $this->language->get('text_instruction') . "\n\n";
44: | $comment .= $this->config->get('payment_bank_transfer_bank_' . $this->config->get('config_language_id')) . "\n\n";
45: | $comment .= $this->language->get('text_payment');
46: |
47: | $this->load->model('checkout/order');
48: |
49: | $this->model_checkout_order->addHistory($this->session->data['order_id'], $this->config->get('payment_bank_transfer_order_status_id'), $comment, true);
50: |
51: | $json['redirect'] = $this->url->link('checkout/success', 'language=' . $this->config->get('config_language'), true);
52: | }
53: |
54: | $this->response->addHeader('Content-Type: application/json');
55: | $this->response->setOutput(json_encode($json));
56: | }
57: | }
58: |

OpenCart API API documentation generated by ApiGen dev-master