baibaratsky / php-webmoney

WebMoney API PHP Library
Other
73 stars 32 forks source link

баг с интерфейсом X11 #69

Closed mitalcoi closed 9 years ago

mitalcoi commented 9 years ago

Пытаюсь воспользоваться интерфейсом X11, получаю ошибку:

1) AppBundle\Tests\Service\SecurityCheckerTest::testWmAdvcashCredentialsOk
Argument 1 passed to baibaratsky\WebMoney\Api\X\X11\Response::dirtyXmlToArray() must be an instance of SimpleXMLElement, null given, called in /var/www/vendor/baibaratsky/php-webmoney/Api/X/X11/Response.php on line 60 and defined

/var/www/vendor/baibaratsky/php-webmoney/Api/X/X11/Response.php:195
/var/www/vendor/baibaratsky/php-webmoney/Api/X/X11/Response.php:60

Причина в том, что разбор ожидаемого xml слишком чувствительный, а некоторых параметров в xml может и не быть. Response от этого ломаться не должен. Вот пример ответа от WM, отсутствует поле certifno/directory, а библиотека ожидает что он будет:

<?xml version="1.0" encoding="windows-1251"?>
<response retval="0">
    <fullaccess>0</fullaccess>
    <certinfo wmid="WMID">
        <attestat>
            <row cid="1742959" regcid="10" tid="110" locked="1" admlocked="0" recalled="0"
                 datecrt="2009-01-02T22:34:20.547" dateupd="2014-08-21T21:01:21.833" datediff="2328"
                 regnickname="WM Passport Service /Центр аттестации/" regwmid="WMID" status="11" notary=""/>
        </attestat>
        <wmids>
            <row wmid="WMID" info="" nickname="Chizdrel" datereg="2009-01-02T22:25:51.217" yearreg="2009"
                 monthreg="1" dayreg="2" timereg="22:25:51" ctype="1" companyname="" companyid="" phone="" email=""
                 phone-check-lock="11" email-check-lock="11"/>
        </wmids>
        <userinfo>
            <value>
                <row ctype="1" jstatus="1" osnovainfo="" locked="0" nickname="Chizdrel" infoopen="" city="" region=""
                     citid="" countryid="" country="" zipcode="" adres="" fname="" iname="" oname="" pnomer="" pdate=""
                     pday="" pmonth="" pyear="" pdateMMDDYYYY="" pcountryid="" pcountry="" pcity="" pcitid="" pbywhom=""
                     pdateend="" pcode="" ncountryid="" ncountry="" ntype="1" rcountryid="" rcountry="" rcity=""
                     rcitid="" radres="" bplace="" bday="" bmonth="" byear="" name="" dirfio="" buhfio="" inn="" okpo=""
                     okonx="" jadres="" jcountry="" jcountryid="" jcity="" jzipcode="" bankname="" bik="" ks="" rs=""
                     phonehome="" phonemobile="" icq="" fax="" phone="" email="" web="" cap_owner="0           "
                     pasdoc="0" inndoc="0" regdoc="0" photoid="0" fm="0" jabberid="" sex="1"
                     permis="111101011000000000111011101101100011000000110000001110110010"
                     regcheck="010100000000000000000000000000000000000000000000000000000000"/>
            </value>
            <check-lock>
                <row ctype="00" jstatus="00" osnovainfo="00" nickname="00" infoopen="01" city="01" region="01"
                     country="01" adres="01" zipcode="01" fname="01" iname="01" oname="01" pnomer="01" pdate="01"
                     pbywhom="01" pdateend="00" pcode="01" pcountry="01" pcity="01" ncountryid="01" ncountry="01"
                     rcountry="01" rcity="01" radres="01" bplace="01" bday="01" inn="01" name="00" dirfio="00"
                     buhfio="00" okpo="00" okonx="00" jadres="00" jcountry="00" jcity="00" jzipcode="00" bankname="00"
                     bik="00" ks="00" rs="00" fax="01" email="11" web="01" phone="11" phonehome="01" phonemobile="01"
                     icq="01" jabberid="01" sex="00"/>
            </check-lock>
            <weblist></weblist>
            <extendeddata></extendeddata>
        </userinfo>
    </certinfo>
</response>
mitalcoi commented 9 years ago

этот фаст-фикс - https://github.com/baibaratsky/php-webmoney/issues/70 уже дает работающий интерфейс

chuprik commented 9 years ago

Закрываю т.к. есть соответствующий pull request (дублирование).