Plugin Directory

Changeset 2800136


Ignore:
Timestamp:
10/17/2022 06:12:11 PM (3 years ago)
Author:
hasanayoub
Message:

updated version and enhanced logging.

Location:
paylink/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • paylink/trunk/paylink.php

    r2754238 r2800136  
    88Plugin Name: Paylink
    99Description: Use this woocommerce payment gateway plugin to enable clients of your store to pay using Paylink gateway.
    10 Version: 1.09
     10Version: 1.10
    1111Author: Paylink Co
    1212text-domain: paylink
     
    4242        private $_token_auth;
    4343
     44        private function postError($error, $calledUrl, $method)
     45        {
     46            try {
     47                $apiId = $this->get_option('app_id');
     48                $apiKey = $this->get_option('secret_key');
     49
     50                $post_parameter = [
     51                    'error' => $error,
     52                    'calledUrl' => $calledUrl,
     53                    'apiId' => $apiId,
     54                    'apiKey' => $apiKey,
     55                    'method' => $method
     56                ];
     57                wp_safe_remote_post('https://paylinkapp.paylink.sa/careapi/wp_log_error', [
     58                    'headers' => [
     59                        'Content-Type' => 'application/json',
     60                    ],
     61                    'body' => wp_json_encode($post_parameter),
     62                ]);
     63            } catch (Exception $ex) {
     64            }
     65        }
     66
    4467        /**
    4568         * Constructor for the gateway.
     
    164187                update_post_meta($order_id, 'login_token', $this->_token_auth);
    165188                return $this->createPaylinkInvoiceUrl($this->_token_auth, $order_id);
    166             }
    167             return false;
     189            } else {
     190                $this->postError(print_r($this->_token_auth, true), 'n/a', 'generate_paylink_url');
     191                return false;
     192            }
    168193        }
    169194
     
    185210            $note = '';
    186211            $lang = 'ar';
    187             $customerName = $order-> get_billing_first_name() . ' ' . $order->get_billing_last_name();
     212            $customerName = $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
    188213            $customerPhone = $order->get_billing_phone();
    189214
     
    217242            } catch (Exception $exception) {
    218243                error_log(print_r($exception, true));
     244                $this->postError(print_r($exception, true), $this->_addInvoiceUrl, 'createPaylinkInvoiceUrl');
    219245                return false;
    220246            }
     
    241267                    'body' => wp_json_encode($login_parameter),
    242268                ]);
     269                $this->postError('logged in', $this->_loginUrl, 'login');
    243270                return json_decode($login_response['body'])->id_token;
    244271            } catch (Exception $ex) {
    245272                error_log(print_r($ex, true));
     273                $this->postError(print_r($ex, true), $this->_loginUrl, 'login');
    246274                return false;
    247275            }
  • paylink/trunk/readme.txt

    r2754238 r2800136  
    22Contributors: Paylink
    33Requires at least: 5.5.1
    4 Tested up to: 6.0
    5 Stable tag: 1.09
     4Tested up to: 6.0.2
     5Stable tag: 1.10
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.