inakiabt / etsy-php

Etsy API wrapper for PHP
74 stars 59 forks source link

shipping_template_id validation type shouldn't be int #20

Closed xiaEngineer closed 7 years ago

xiaEngineer commented 7 years ago

shipping_template_id shouldn't be int. Because if someone create a shipping template he/she will id larger than 41269799259 and this is not integer this is double. This validation should be string or double. Thanks.

inakiabt commented 7 years ago

Seems fair, but we have to validate if it's Long, because Etsy's documentation says shipping_template_id type is int (https://www.etsy.com/developers/documentation/reference/listing#section_fields). I'll update this soon.

Thanks.

xiaEngineer commented 7 years ago

Thanks. As now everything is good but now the API says 500 error. Invalid auth/bad request (got a 500, expected HTTP/1.1 20X or a redirect): Array ( [quantity] => 1 [title] => 10KT White Gold 1.75ctw Amethyst & Diamond Cocktail Ring, 11.44gm. Size: 5.25 [description] => This brightly polished 10KT white gold ring contains one amethyst in the center, surrounded by single cut diamonds, all prong set in a raised basket style setting. A twisted rope design finishes the look, all set atop a five layer shank. [price] => 720 [shipping_template_id] => 41269799259 [state] => draft [category_id] => 2115 [who_made] => someone_else [is_supply] => 1 [when_made] => 1980s [taxonomy_id] => 2115 )

inakiabt commented 7 years ago

Below that you should have a detailed error. Could you double check?

xiaEngineer commented 7 years ago

I have double check everything couldn't found anything wrong. Here is the response array. Server ErrorArray ( [http_code] => 500 [content_type] => text/plain;charset=UTF-8 [url] => https://openapi.etsy.com/v2/private/listings?oauth_consumer_key=hladz5fxyi06jlxfai8gngxf&oauth_signature_method=HMAC-SHA1&oauth_nonce=1479658e681ffe62a71.251456572&oauth_timestamp=1491501567&oauth_version=1.0&oauth_token=e05dfe4db0c2cdg456dc01f4f50ba905a&oauth_signature=WQtkytbrZUPrrp3RtkxN9NitLeMk%3D [header_size] => 763 [request_size] => 1025 [filetime] => -1 [ssl_verify_result] => 20 [redirect_count] => 0 [total_time] => 3.719 [namelookup_time] => 1.531 [connect_time] => 2.047 [pretransfer_time] => 2.969 [size_upload] => 597 [size_download] => 12 [speed_download] => 3 [speed_upload] => 160 [download_content_length] => 12 [upload_content_length] => 597 [starttransfer_time] => 3.719 [redirect_time] => 0 [headers_recv] => HTTP/1.1 500 Internal Server Error Server: Apache X-Etsy-Request-Uuid: YJm-CPPT3QJ9ADku8btDFalO__o6 X-RateLimit-Limit: 10000 X-RateLimit-Remaining: 9938 X-Error-Detail: Server Error Cache-Control: private Content-Length: 12 Content-Type: text/plain;charset=UTF-8 Date: Thu, 06 Apr 2017 17:59:32 GMT Connection: close Set-Cookie: uaid=uaid%3D1HDoop6znvCLQ1AlY5wXtsIRl29k%26_now%3D1491501571%26_slt%3DJWykcbHa%26_kid%3D1%26_ver%3D1%26_mac%3DrmbNusSY_ww-nhrTB8B0l3o2T8LnNuQe8uBGoV4aioY.; expires=Mon, 07-May-2018 10:17:51 GMT; Max-Age=34186700; path=/; domain=.etsy.com; secure; HttpOnly Set-Cookie: user_prefs=3mWzJqGbNFciYKvAp0UDKawmeOxjZACCiGdNzDA6Oq80J0eHZCKWAQA.; expires=Fri, 06-Apr-2018 17:59:31 GMT; Max-Age=31536000; path=/; domain=.etsy.com

)

inakiabt commented 7 years ago

Let's move that to a new issue.

About shipping_template_id, I figured out that gettype, which is the php function I'm using to get the value type, will return double if the integer value is larger than 19 numbers, so I guess we're OK with that.