Skip to content

Commit

Permalink
PHPStan Paypal v3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
condor2 committed Jun 4, 2024
1 parent f107c69 commit 59ce965
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions upload/admin/controller/extension/payment/paypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -3014,6 +3014,7 @@ public function capturePayment() {
$transaction_id = $paypal_order_info['transaction_id'];
$currency_code = $paypal_order_info['currency_code'];
$order_status_id = 0;
$transaction_status = '';

$_config = new Config();
$_config->load('paypal');
Expand Down Expand Up @@ -3635,7 +3636,7 @@ public function createTracker() {

$this->load->model('extension/payment/paypal');

$order_id = $this->request->post['order_id'];
$order_id = (int)$this->request->post['order_id'];
$country_code = $this->request->post['country_code'];
$tracking_number = $this->request->post['tracking_number'];
$carrier_name = $this->request->post['carrier_name'];
Expand Down Expand Up @@ -3777,7 +3778,7 @@ public function cancelTracker() {

$this->load->model('extension/payment/paypal');

$order_id = $this->request->post['order_id'];
$order_id = (int)$this->request->post['order_id'];
$tracking_number = $this->request->post['tracking_number'];

$paypal_order_info = $this->model_extension_payment_paypal->getPayPalOrder($order_id);
Expand Down
12 changes: 8 additions & 4 deletions upload/catalog/controller/extension/payment/paypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ public function createOrder() {
$tax_total = number_format($tax_total * $currency_value, $decimal_place, '.', '');
$order_total = number_format($item_total + $tax_total, $decimal_place, '.', '');

if ($page_code == 'checkout') {
if ($page_code == 'checkout' && isset($order_info)) {
$discount_total = 0;
$handling_total = 0;
$shipping_total = 0;
Expand Down Expand Up @@ -1025,7 +1025,7 @@ public function createOrder() {
'value' => $tax_total
];

if ($page_code == 'checkout') {
if ($page_code == 'checkout' && isset($shipping_total) && isset($handling_total) && isset($discount_total) && isset($order_info) && isset($shipping_info)) {
$amount_info['breakdown']['shipping'] = [
'currency_code' => $currency_code,
'value' => $shipping_total
Expand All @@ -1049,11 +1049,11 @@ public function createOrder() {
$paypal_order_info['purchase_units'][0]['items'] = $item_info;
$paypal_order_info['purchase_units'][0]['amount'] = $amount_info;

if ($page_code == 'checkout') {
if ($page_code == 'checkout' && isset($order_info)) {
$paypal_order_info['purchase_units'][0]['description'] = 'Your order ' . $order_info['order_id'];
$paypal_order_info['purchase_units'][0]['invoice_id'] = $order_info['order_id'] . '_' . date('Ymd_His');

if ($this->cart->hasShipping()) {
if ($this->cart->hasShipping() && isset($shipping_info)) {
$paypal_order_info['purchase_units'][0]['shipping'] = $shipping_info;
}
}
Expand Down Expand Up @@ -1652,6 +1652,7 @@ public function approveOrder() {
$card_nice_type = (!empty($this->request->post['card_nice_type']) ? $this->request->post['card_nice_type'] : '');
$card_last_digits = '';
$card_expiry = '';
$paypal_order_data = [];

if (!$this->cart->hasShipping()) {
$seller_protection_status = 'NOT_ELIGIBLE';
Expand Down Expand Up @@ -1785,6 +1786,7 @@ public function approveOrder() {
$card_nice_type = (!empty($this->request->post['card_nice_type']) ? $this->request->post['card_nice_type'] : '');
$card_last_digits = '';
$card_expiry = '';
$paypal_order_data = [];

if (!$this->cart->hasShipping()) {
$seller_protection_status = 'NOT_ELIGIBLE';
Expand Down Expand Up @@ -2998,6 +3000,7 @@ public function completeOrder() {
$card_nice_type = '';
$card_last_digits = '';
$card_expiry = '';
$paypal_order_data = [];

if (!$this->cart->hasShipping()) {
$seller_protection_status = 'NOT_ELIGIBLE';
Expand Down Expand Up @@ -3131,6 +3134,7 @@ public function completeOrder() {
$card_nice_type = '';
$card_last_digits = '';
$card_expiry = '';
$paypal_order_data = [];

if (!$this->cart->hasShipping()) {
$seller_protection_status = 'NOT_ELIGIBLE';
Expand Down

0 comments on commit 59ce965

Please sign in to comment.