Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Invalid response received. Check response data for errors and warnings #27

Closed
kironet opened this issue Mar 5, 2017 · 1 comment
Closed

Comments

@kironet
Copy link

kironet commented Mar 5, 2017

Dobrý den,

nedaří se mi zprovoznit vaší knihovnu.

      $crypto = new CryptographyService($this->get('kernel')->getRootDir().'/Certificates/private.key', $this->get('kernel')->getRootDir().'/Certificates/public.pub', 'password');
       $configuration = new Configuration(
           'DIC',
           21,
           1,
           EvidenceEnvironment::get(EvidenceEnvironment::PLAYGROUND), // nebo EvidenceEnvironment::get(EvidenceEnvironment::PRODUCTION) pro komunikaci s produkčním systémem
           false // zda zasílat účtenky v ověřovacím módu
       );
       $client = new Client($crypto, $configuration, new GuzzleSoapClientDriver(new \GuzzleHttp\Client()));

       $receipt = new Receipt(
           true,
           'CZ683555118',
           1234,
           new \DateTimeImmutable('2016-11-01 00:30:12'),
           3411300
       );


       try {
           $response = $client->send($receipt);
           $fik =  $response->getFik();
           $bkp = $response->getBkp();
           echo '<br />FIK:'.$fik;
           echo '<br />BKP:'.$bkp;
       } catch (\SlevomatEET\FailedRequestException $e) {
           $pkb =  $e->getRequest()->getPkpCode(); // if request fails you need to print the PKP and BKP codes to receipt
       } catch (\SlevomatEET\InvalidResponseReceivedException $e) {
           echo $e->getMessage();
           $pkb =  $e->getResponse()->getRequest()->getPkpCode(); // on invalid response you need to print the PKP and BKP too
       }

Skočí to na poslední catch.

$e->getMessage();

Invalid response received. Check response data for errors and warnings

var_dump($client);

object(SlevomatEET\Client)#481 (4) {
  ["cryptographyService":"SlevomatEET\Client":private]=>
  object(SlevomatEET\Cryptography\CryptographyService)#488 (3) {
    ["privateKeyFile":"SlevomatEET\Cryptography\CryptographyService":private]=>
    string(65) "/var/www/vhosts/x.cz/httpdocs/app/Certificates/private.key"
    ["privateKeyPassword":"SlevomatEET\Cryptography\CryptographyService":private]=>
    string(11) "password"
    ["publicKeyFile":"SlevomatEET\Cryptography\CryptographyService":private]=>
    string(64) "/var/www/vhosts/x.cz/httpdocs/app/Certificates/public.pub"
  }
  ["configuration":"SlevomatEET\Client":private]=>
  object(SlevomatEET\Configuration)#483 (6) {
    ["vatId":"SlevomatEET\Configuration":private]=>
    string(12) "DIC"
    ["premiseId":"SlevomatEET\Configuration":private]=>
    string(2) "21"
    ["cashRegisterId":"SlevomatEET\Configuration":private]=>
    string(1) "1"
    ["verificationMode":"SlevomatEET\Configuration":private]=>
    bool(false)
    ["evidenceMode":"SlevomatEET\Configuration":private]=>
    object(SlevomatEET\EvidenceMode)#485 (1) {
      ["value":"Consistence\Enum\Enum":private]=>
      int(0)
    }
    ["evidenceEnvironment":"SlevomatEET\Configuration":private]=>
    object(SlevomatEET\EvidenceEnvironment)#484 (1) {
      ["value":"Consistence\Enum\Enum":private]=>
      string(10) "playground"
    }
  }
  ["soapClient":"SlevomatEET\Client":private]=>
  NULL
  ["soapClientDriver":"SlevomatEET\Client":private]=>
  object(SlevomatEET\Driver\GuzzleSoapClientDriver)#482 (3) {
    ["httpClient":"SlevomatEET\Driver\GuzzleSoapClientDriver":private]=>
    object(GuzzleHttp\Client)#480 (1) {
      ["config":"GuzzleHttp\Client":private]=>
      array(7) {
        ["handler"]=>
        object(GuzzleHttp\HandlerStack)#477 (3) {
          ["handler":"GuzzleHttp\HandlerStack":private]=>
          object(Closure)#472 (2) {
            ["static"]=>
            array(2) {
              ["default"]=>
              object(Closure)#476 (2) {
                ["static"]=>
                array(2) {
                  ["default"]=>
                  object(GuzzleHttp\Handler\CurlMultiHandler)#478 (5) {
                    ["factory":"GuzzleHttp\Handler\CurlMultiHandler":private]=>
                    object(GuzzleHttp\Handler\CurlFactory)#479 (2) {
                      ["handles":"GuzzleHttp\Handler\CurlFactory":private]=>
                      NULL
                      ["maxHandles":"GuzzleHttp\Handler\CurlFactory":private]=>
                      int(50)
                    }
                    ["selectTimeout":"GuzzleHttp\Handler\CurlMultiHandler":private]=>
                    int(1)
                    ["active":"GuzzleHttp\Handler\CurlMultiHandler":private]=>
                    NULL
                    ["handles":"GuzzleHttp\Handler\CurlMultiHandler":private]=>
                    array(0) {
                    }
                    ["delays":"GuzzleHttp\Handler\CurlMultiHandler":private]=>
                    array(0) {
                    }
                  }
                  ["sync"]=>
                  object(GuzzleHttp\Handler\CurlHandler)#474 (1) {
                    ["factory":"GuzzleHttp\Handler\CurlHandler":private]=>
                    object(GuzzleHttp\Handler\CurlFactory)#475 (2) {
                      ["handles":"GuzzleHttp\Handler\CurlFactory":private]=>
                      NULL
                      ["maxHandles":"GuzzleHttp\Handler\CurlFactory":private]=>
                      int(3)
                    }
                  }
                }
                ["parameter"]=>
                array(2) {
                  ["$request"]=>
                  string(10) "<required>"
                  ["$options"]=>
                  string(10) "<required>"
                }
              }
              ["streaming"]=>
              object(GuzzleHttp\Handler\StreamHandler)#471 (1) {
                ["lastHeaders":"GuzzleHttp\Handler\StreamHandler":private]=>
                array(0) {
                }
              }
            }
            ["parameter"]=>
            array(2) {
              ["$request"]=>
              string(10) "<required>"
              ["$options"]=>
              string(10) "<required>"
            }
          }
          ["stack":"GuzzleHttp\HandlerStack":private]=>
          array(4) {
            [0]=>
            array(2) {
              [0]=>
              object(Closure)#473 (1) {
                ["parameter"]=>
                array(1) {
                  ["$handler"]=>
                  string(10) "<required>"
                }
              }
              [1]=>
              string(11) "http_errors"
            }
            [1]=>
            array(2) {
              [0]=>
              object(Closure)#468 (1) {
                ["parameter"]=>
                array(1) {
                  ["$handler"]=>
                  string(10) "<required>"
                }
              }
              [1]=>
              string(15) "allow_redirects"
            }
            [2]=>
            array(2) {
              [0]=>
              object(Closure)#469 (1) {
                ["parameter"]=>
                array(1) {
                  ["$handler"]=>
                  string(10) "<required>"
                }
              }
              [1]=>
              string(7) "cookies"
            }
            [3]=>
            array(2) {
              [0]=>
              object(Closure)#470 (1) {
                ["parameter"]=>
                array(1) {
                  ["$handler"]=>
                  string(10) "<required>"
                }
              }
              [1]=>
              string(12) "prepare_body"
            }
          }
          ["cached":"GuzzleHttp\HandlerStack":private]=>
          NULL
        }
        ["allow_redirects"]=>
        array(5) {
          ["max"]=>
          int(5)
          ["protocols"]=>
          array(2) {
            [0]=>
            string(4) "http"
            [1]=>
            string(5) "https"
          }
          ["strict"]=>
          bool(false)
          ["referer"]=>
          bool(false)
          ["track_redirects"]=>
          bool(false)
        }
        ["http_errors"]=>
        bool(true)
        ["decode_content"]=>
        bool(true)
        ["verify"]=>
        bool(true)
        ["cookies"]=>
        bool(false)
        ["headers"]=>
        array(1) {
          ["User-Agent"]=>
          string(38) "GuzzleHttp/6.2.1 curl/7.29.0 PHP/7.1.2"
        }
      }
    }
    ["connectionTimeout":"SlevomatEET\Driver\GuzzleSoapClientDriver":private]=>
    float(2.5)
    ["requestTimeout":"SlevomatEET\Driver\GuzzleSoapClientDriver":private]=>
    float(2.5)
  }
}

var_dump($receipt);

object(SlevomatEET\Receipt)#465 (19) {
  ["uuid":"SlevomatEET\Receipt":private]=>
  object(Ramsey\Uuid\Uuid)#462 (3) {
    ["codec":protected]=>
    object(Ramsey\Uuid\Codec\StringCodec)#459 (1) {
      ["builder":"Ramsey\Uuid\Codec\StringCodec":private]=>
      object(Ramsey\Uuid\Builder\DefaultUuidBuilder)#464 (1) {
        ["converter":"Ramsey\Uuid\Builder\DefaultUuidBuilder":private]=>
        object(Ramsey\Uuid\Converter\Number\DegradedNumberConverter)#463 (0) {
        }
      }
    }
    ["fields":protected]=>
    array(6) {
      ["time_low"]=>
      string(8) "aa52d74a"
      ["time_mid"]=>
      string(4) "0811"
      ["time_hi_and_version"]=>
      string(4) "4263"
      ["clock_seq_hi_and_reserved"]=>
      string(2) "89"
      ["clock_seq_low"]=>
      string(2) "09"
      ["node"]=>
      string(12) "95d89383f3ee"
    }
    ["converter":protected]=>
    object(Ramsey\Uuid\Converter\Number\DegradedNumberConverter)#463 (0) {
    }
  }
  ["firstSend":"SlevomatEET\Receipt":private]=>
  bool(true)
  ["delegatedVatId":"SlevomatEET\Receipt":private]=>
  NULL
  ["receiptNumber":"SlevomatEET\Receipt":private]=>
  string(17) "production_test_1"
  ["receiptTime":"SlevomatEET\Receipt":private]=>
  object(DateTimeImmutable)#466 (3) {
    ["date"]=>
    string(26) "2017-11-01 00:30:12.000000"
    ["timezone_type"]=>
    int(3)
    ["timezone"]=>
    string(3) "UTC"
  }
  ["totalPrice":"SlevomatEET\Receipt":private]=>
  int(0)
  ["priceZeroVat":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceStandardVat":"SlevomatEET\Receipt":private]=>
  NULL
  ["vatStandard":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceFirstReducedVat":"SlevomatEET\Receipt":private]=>
  NULL
  ["vatFirstReduced":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceSecondReducedVat":"SlevomatEET\Receipt":private]=>
  NULL
  ["vatSecondReduced":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceTravelService":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceUsedGoodsStandardVat":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceUsedGoodsFirstReducedVat":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceUsedGoodsSecondReducedVat":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceForSubsequentSettlement":"SlevomatEET\Receipt":private]=>
  NULL
  ["priceUsedSubsequentSettlement":"SlevomatEET\Receipt":private]=>
  NULL
}

Vypadá v pohodě.

@kironet kironet changed the title Could not find package slevomat/eet-client at any version matching your PHP version 5.5.9.0 Invalid response received. Check response data for errors and warnings Mar 5, 2017
@kironet
Copy link
Author

kironet commented Mar 5, 2017

Chyba byla v čase ...

@kironet kironet closed this as completed Mar 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant