Skip to content

Commit

Permalink
Improved addReport() validation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCartpenter committed Jun 2, 2024
1 parent 7a8f9cf commit 1cf9cc6
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions upload/catalog/controller/extension/payment/paypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -4311,33 +4311,31 @@ public function addReport(&$route, &$args): void {
$order_recurring_id = 0;
}

if ($order_recurring_id) {
$this->load->model('checkout/recurring');
$this->load->model('checkout/order');

$recurring_info = $this->model_checkout_recurring->getOrderRecurring($order_recurring_id);
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);

if ($recurring_info) {
$this->load->model('checkout/order');
if ($order_recurring_id && $order_info) {
$this->load->model('checkout/recurring');

$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$order_recurring_info = $this->model_checkout_recurring->getOrderRecurring($order_recurring_id);

if ($order_info) {
if (isset($this->request->server['HTTP_X_REAL_IP'])) {
$ip = $this->request->server['HTTP_X_REAL_IP'];
} elseif (oc_get_ip()) {
$ip = oc_get_ip();
} else {
$ip = '';
}
if ($order_recurring_info && $order_recurring_info['order_id'] == $this->session->data['order_id']) {
if (isset($this->request->server['HTTP_X_REAL_IP'])) {
$ip = $this->request->server['HTTP_X_REAL_IP'];
} elseif (oc_get_ip()) {
$ip = oc_get_ip();
} else {
$ip = '';
}

$this->model_checkout_recurring->addReport($order_recurring_id, $this->config->get('config_store_id'), $ip, $this->session->data['payment_address']['country']);
$this->model_checkout_recurring->addReport($order_recurring_id, $this->config->get('config_store_id'), $ip, $this->session->data['payment_address']['country']);

$comment = $this->language->get('text_new_subscription');
$comment = $this->language->get('text_new_subscription');

$this->model_checkout_order->addHistory($this->session->data['order_id'], $order_info['order_status_id'], $comment, true);
}
$this->model_checkout_order->addHistory($this->session->data['order_id'], $order_info['order_status_id'], $comment, true);
}
}
}
}

private function validateShipping($code) {
Expand Down

0 comments on commit 1cf9cc6

Please sign in to comment.