slince / shopify-api-php

:rocket: Shopify API Client for PHP
MIT License
128 stars 48 forks source link

Error in serialize #107

Open f0cusX opened 2 years ago

f0cusX commented 2 years ago

Hello, I am getting an error when receiving an order: Can't use incorrect type PriceSet for collection in Model\Orders\Common\ShippingLine:priceSet

My shipping line in the order looks like this: "shipping_lines":[ { "id":3651492741275, "carrier_identifier":null, "code":"test-delivery", "delivery_category":null, "discounted_price":"0.00", "discounted_price_set":{ "shop_money":{ "amount":"0.00", "currency_code":"RUB" }, "presentment_money":{ "amount":"0.00", "currency_code":"RUB" } }, "phone":null, "price":"0.00", "price_set":{ "shop_money":{ "amount":"0.00", "currency_code":"RUB" }, "presentment_money":{ "amount":"0.00", "currency_code":"RUB" } }, "requested_fulfillment_service_id":null, "source":"shopify", "title":test-delivery", "tax_lines":{ }, "discount_allocations":{ } } ]

How i can fix this?

slince commented 2 years ago
"shipping_lines":[ { "id":3651492741275, "carrier_identifier":null, "code":"test-delivery", "delivery_category":null, "discounted_price":"0.00", "discounted_price_set":{ "shop_money":{ "amount":"0.00", "currency_code":"RUB" }, "presentment_money":{ "amount":"0.00", "currency_code":"RUB" } }, "phone":null, "price":"0.00", "price_set":{ "shop_money":{ "amount":"0.00", "currency_code":"RUB" }, "presentment_money":{ "amount":"0.00", "currency_code":"RUB" } }, "requested_fulfillment_service_id":null, "source":"shopify", "title":test-delivery", "tax_lines":{ }, "discount_allocations":{ } } ]

Hello, this look like not a valid json string

f0cusX commented 2 years ago

This is the order json part where the error is according to the serializer. Maybe I didn't specify " when I removed my data from the example "shipping_lines":[ { "id":3651492741275, "carrier_identifier":null, "code":"test-delivery", "delivery_category":null, "discounted_price":"0.00", "discounted_price_set":{ "shop_money":{ "amount":"0.00", "currency_code":"RUB" }, "presentment_money":{ "amount":"0.00", "currency_code":"RUB" } }, "phone":null, "price":"0.00", "price_set":{ "shop_money":{ "amount":"0.00", "currency_code":"RUB" }, "presentment_money":{ "amount":"0.00", "currency_code":"RUB" } }, "requested_fulfillment_service_id":null, "source":"shopify", "title":"test-delivery", "tax_lines":{ }, "discount_allocations":{ } } ]

slince commented 2 years ago

Can you post the complete order json for debug?

f0cusX commented 2 years ago

{"request":{"id":4353712095387,"admin_graphql_api_id":"gid://shopify/Order/4353712095387","app_id":580111,"browser_ip":"79.111.141.45","buyer_accepts_marketing":false,"cancel_reason":null,"cancelled_at":null,"cart_token":null,"checkout_id":23074632335515,"checkout_token":"f70257c97f5b7b27ea3e5fc38392810b","client_details":{"accept_language":"en,ru;q=0.9,ru-RU;q=0.8,en-US;q=0.7,de;q=0.6,fr;q=0.5","browser_height":1367,"browser_ip":"79.111.141.45","browser_width":2560,"session_hash":null,"user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"},"closed_at":null,"confirmed":true,"contact_email":"te21st211ew1wqe211w@test.com","created_at":"2022-02-18T14:14:58+03:00","currency":"RUB","current_subtotal_price":"1.00","current_subtotal_price_set":{"shop_money":{"amount":"1.00","currency_code":"RUB"},"presentment_money":{"amount":"1.00","currency_code":"RUB"}},"current_total_discounts":"0.00","current_total_discounts_set":{"shop_money":{"amount":"0.00","currency_code":"RUB"},"presentment_money":{"amount":"0.00","currency_code":"RUB"}},"current_total_duties_set":null,"current_total_price":"1.18","current_total_price_set":{"shop_money":{"amount":"1.18","currency_code":"RUB"},"presentment_money":{"amount":"1.18","currency_code":"RUB"}},"current_total_tax":"0.18","current_total_tax_set":{"shop_money":{"amount":"0.18","currency_code":"RUB"},"presentment_money":{"amount":"0.18","currency_code":"RUB"}},"customer_locale":"ru","device_id":null,"discount_codes":[],"email":"te21st211ew1wqe211w@test.com","financial_status":"paid","fulfillment_status":null,"gateway":"bogus","landing_site":"/wallets/checkouts.json","landing_site_ref":null,"location_id":null,"name":"#1047","note":null,"note_attributes":[],"number":47,"order_number":1047,"order_status_url":"https://retailcrm-store-test.myshopify.com/57885327515/orders/b60fd97dd1e8558de159b5739b6764dc/authenticate?key=def8ed587c491922c76af72aa3a96a58","original_total_duties_set":null,"payment_gateway_names":["bogus"],"phone":null,"presentment_currency":"RUB","processed_at":"2022-02-18T14:14:55+03:00","processing_method":"direct","reference":null,"referring_site":"https://retailcrm-store-test.myshopify.com/products/test1test2","source_identifier":null,"source_name":"web","source_url":null,"subtotal_price":"1.00","subtotal_price_set":{"shop_money":{"amount":"1.00","currency_code":"RUB"},"presentment_money":{"amount":"1.00","currency_code":"RUB"}},"tags":null,"tax_lines":[{"price":"0.18","rate":0.18,"title":"VAT","price_set":{"shop_money":{"amount":"0.18","currency_code":"RUB"},"presentment_money":{"amount":"0.18","currency_code":"RUB"}}}],"taxes_included":false,"test":true,"token":"b60fd97dd1e8558de159b5739b6764dc","total_discounts":"0.00","total_discounts_set":{"shop_money":{"amount":"0.00","currency_code":"RUB"},"presentment_money":{"amount":"0.00","currency_code":"RUB"}},"total_line_items_price":"1.00","total_line_items_price_set":{"shop_money":{"amount":"1.00","currency_code":"RUB"},"presentment_money":{"amount":"1.00","currency_code":"RUB"}},"total_outstanding":"0.00","total_price":"1.18","total_price_set":{"shop_money":{"amount":"1.18","currency_code":"RUB"},"presentment_money":{"amount":"1.18","currency_code":"RUB"}},"total_price_usd":"0.02","total_shipping_price_set":{"shop_money":{"amount":"0.00","currency_code":"RUB"},"presentment_money":{"amount":"0.00","currency_code":"RUB"}},"total_tax":"0.18","total_tax_set":{"shop_money":{"amount":"0.18","currency_code":"RUB"},"presentment_money":{"amount":"0.18","currency_code":"RUB"}},"total_tip_received":"0.00","total_weight":0,"updated_at":"2022-02-18T14:14:59+03:00","user_id":null,"billing_address":{"first_name":null,"address1":"Tver","phone":null,"city":"Tver","zip":"170042","province":"Tver Oblast","country":"Russia","last_name":"Tver","address2":"Tver","company":null,"latitude":56.873959,"longitude":35.8845613,"name":"Tver","country_code":"RU","province_code":"TVE"},"customer":{"id":5631156977819,"email":"te21st211ew1wqe211w@st-lt.ru","accepts_marketing":false,"created_at":"2021-10-04T15:42:18+03:00","updated_at":"2022-02-18T14:14:58+03:00","first_name":"Вооот","last_name":"Taaak","orders_count":11,"state":"disabled","total_spent":"12.62","last_order_id":4353312030875,"note":null,"verified_email":true,"multipass_identifier":null,"tax_exempt":false,"phone":null,"tags":null,"last_order_name":"2461C","currency":"RUB","accepts_marketing_updated_at":"2021-10-08T16:43:26+03:00","marketing_opt_in_level":null,"tax_exemptions":[],"admin_graphql_api_id":"gid://shopify/Customer/5631156977819","default_address":{"id":7162605895835,"customer_id":5631156977819,"first_name":null,"last_name":"Tver","company":null,"address1":"Tver","address2":"Tver","city":"Tver","province":"Tver Oblast","country":"Russia","zip":"170042","phone":null,"name":"Tver","province_code":"TVE","country_code":"RU","country_name":"Russia","default":true}},"discount_applications":[],"fulfillments":[],"line_items":[{"id":10903509139611,"admin_graphql_api_id":"gid://shopify/LineItem/10903509139611","fulfillable_quantity":1,"fulfillment_service":"manual","fulfillment_status":null,"gift_card":false,"grams":0,"name":"Test1Test2","origin_location":{"id":3304283046043,"country_code":"RU","province_code":"TVE","name":"RETAILCRM_STORE_TEST","address1":"Ozernya","address2":null,"city":"Tver","zip":"170008"},"price":"1.00","price_set":{"shop_money":{"amount":"1.00","currency_code":"RUB"},"presentment_money":{"amount":"1.00","currency_code":"RUB"}},"product_exists":true,"product_id":6897913823387,"properties":[],"quantity":1,"requires_shipping":true,"sku":"123","taxable":true,"title":"Test1Test2","total_discount":"0.00","total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"RUB"},"presentment_money":{"amount":"0.00","currency_code":"RUB"}},"variant_id":40469659517083,"variant_inventory_management":"shopify","variant_title":null,"vendor":"RETAILCRM_STORE_TEST","tax_lines":[{"price":"0.18","price_set":{"shop_money":{"amount":"0.18","currency_code":"RUB"},"presentment_money":{"amount":"0.18","currency_code":"RUB"}},"rate":0.18,"title":"VAT"}],"duties":[],"discount_allocations":[]}],"payment_details":{"credit_card_bin":"1","avs_result_code":null,"cvv_result_code":null,"credit_card_number":"•••• •••• •••• 1","credit_card_company":"Bogus"},"refunds":[],"shipping_address":{"first_name":null,"address1":"Tver","phone":null,"city":"Tver","zip":"170042","province":"Tver Oblast","country":"Russia","last_name":"Tver","address2":"Tver","company":null,"latitude":56.873959,"longitude":35.8845613,"name":"Tver","country_code":"RU","province_code":"TVE"},"shipping_lines":[{"id":3651351511195,"carrier_identifier":null,"code":"Standard","delivery_category":null,"discounted_price":"0.00","discounted_price_set":{"shop_money":{"amount":"0.00","currency_code":"RUB"},"presentment_money":{"amount":"0.00","currency_code":"RUB"}},"phone":null,"price":"0.00","price_set":{"shop_money":{"amount":"0.00","currency_code":"RUB"},"presentment_money":{"amount":"0.00","currency_code":"RUB"}},"requested_fulfillment_service_id":null,"source":"shopify","title":"Standard","tax_lines":[],"discount_allocations":[]}]},"response":{"statusCode":200,"content":""}}