linccce

Does not return in execption status and message

May 7th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.01 KB | None | 0 0
  1. wp-content/plugins/woocommerce-gateway-klarna/vendor/klarna/checkout/src/Klarna/Checkout/BasicConnector.php
  2.  
  3.     protected function verifyResponse(Klarna_Checkout_HTTP_Response $result)
  4.     {
  5.         // Error Status Code recieved. Throw an exception.
  6.         if ($result->getStatus() >= 400 && $result->getStatus() <= 599) {
  7.  
  8.             $json = json_decode($result->getData(), true);
  9.             $payload = ($json && is_array($json)) ? $json : array();
  10.  
  11.             var_dump($result->getStatus(), $payload);
  12.             throw new Klarna_Checkout_ApiErrorException(
  13.                 "API Error", $result->getStatus(), $payload
  14.             );
  15.         }
  16.     }
  17.  
  18. Is not throwing status code and payload message
  19.  
  20. Its class chain inheritance chain below (from last to processor):
  21. <?php
  22. /**
  23.  * Copyright 2015 Klarna AB
  24.  *
  25.  * Licensed under the Apache License, Version 2.0 (the "License");
  26.  * you may not use this file except in compliance with the License.
  27.  * You may obtain a copy of the License at
  28.  *
  29.  *     http://www.apache.org/licenses/LICENSE-2.0
  30.  *
  31.  * Unless required by applicable law or agreed to in writing, software
  32.  * distributed under the License is distributed on an "AS IS" BASIS,
  33.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  34.  * See the License for the specific language governing permissions and
  35.  * limitations under the License.
  36.  *
  37.  * File containing the Klarna_Checkout_ConnectorException class
  38.  *
  39.  * PHP version 5.3
  40.  *
  41.  * @category  Payment
  42.  * @package   Klarna_Checkout
  43.  * @author    Klarna <[email protected]>
  44.  * @copyright 2015 Klarna AB
  45.  * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
  46.  * @link      http://developers.klarna.com/
  47.  */
  48.  
  49. /**
  50.  * Api Error exception
  51.  *
  52.  * @category  Payment
  53.  * @package   Klarna_Checkout
  54.  * @author    Matthias Feist <[email protected]>
  55.  * @copyright 2015 Klarna AB
  56.  * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
  57.  * @link      http://developers.klarna.com/
  58.  */
  59. class Klarna_Checkout_ApiErrorException extends Klarna_Checkout_Exception
  60. {
  61.     /**
  62.      * Payload of the error
  63.      *
  64.      * @var array
  65.      */
  66.     protected $payload = array();
  67.    
  68.     /**
  69.      * Custom contructor
  70.      *
  71.      * @param string    $message  Error message
  72.      * @param int       $code     Error code
  73.      * @param Array     $payload  Payload
  74.      * @param Exception $previous Previous Exception
  75.      */
  76.     public function __construct(
  77.         $message,
  78.         $code,
  79.         Array $payload = array(),
  80.         Exception $previous = null
  81.     ) {
  82.         parent::__construct($message, $code, $previous);
  83.         $this->payload = $payload;
  84.     }
  85.  
  86.     /**
  87.      * Gets the payload
  88.      *
  89.      * @return array
  90.      */
  91.     public function getPayload()
  92.     {
  93.         return $this->payload;
  94.     }
  95. }
  96.  
  97.  
  98. <?php
  99. /**
  100.  * Copyright 2015 Klarna AB
  101.  *
  102.  * Licensed under the Apache License, Version 2.0 (the "License");
  103.  * you may not use this file except in compliance with the License.
  104.  * You may obtain a copy of the License at
  105.  *
  106.  *     http://www.apache.org/licenses/LICENSE-2.0
  107.  *
  108.  * Unless required by applicable law or agreed to in writing, software
  109.  * distributed under the License is distributed on an "AS IS" BASIS,
  110.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  111.  * See the License for the specific language governing permissions and
  112.  * limitations under the License.
  113.  *
  114.  * File containing the Klarna_Checkout_Exception class
  115.  *
  116.  * PHP version 5.3
  117.  *
  118.  * @category  Payment
  119.  * @package   Klarna_Checkout
  120.  * @author    Klarna <[email protected]>
  121.  * @copyright 2015 Klarna AB
  122.  * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
  123.  * @link      http://developers.klarna.com/
  124.  */
  125.  
  126. /**
  127.  * Basic exception class
  128.  *
  129.  * @category  Payment
  130.  * @package   Klarna_Checkout
  131.  * @author    Majid G. <[email protected]>
  132.  * @author    David K. <[email protected]>
  133.  * @copyright 2015 Klarna AB
  134.  * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache license v2.0
  135.  * @link      http://developers.klarna.com/
  136.  */
  137. class Klarna_Checkout_Exception extends Exception
  138. {
  139.  
  140. }
  141.  
  142.  
  143. Core_c.php
  144. class Exception implements Throwable {
  145.     protected $message;
  146.     protected $code;
  147.     protected $file;
  148.     protected $line;
  149.  
  150.  
  151.     /**
  152.      * Clone the exception
  153.      * @link http://php.net/manual/en/exception.clone.php
  154.      * @return void
  155.      * @since 5.1.0
  156.      */
  157.     final private function __clone() { }
  158.  
  159.     /**
  160.      * Construct the exception. Note: The message is NOT binary safe.
  161.      * @link http://php.net/manual/en/exception.construct.php
  162.      * @param string $message [optional] The Exception message to throw.
  163.      * @param int $code [optional] The Exception code.
  164.      * @param Exception $previous [optional] The previous exception used for the exception chaining. Since 5.3.0
  165.      * @since 5.1.0
  166.      */
  167.     public function __construct($message = "", $code = 0, Exception $previous = null) { }
  168. ...
Advertisement
Add Comment
Please, Sign In to add comment