netflie / whatsapp-cloud-api

The first PHP API to send and receive messages using a cloud-hosted version of the WhatsApp Business Platform
https://netflie.es/portfolio/whatsapp-business-cloud-api-php-sdk/
MIT License
449 stars 163 forks source link

Fix Error 500, because the Order payload does not contains the text #83

Closed donmbelembe closed 1 year ago

donmbelembe commented 1 year ago

You are trying to retrieve the text inside the order payload.

Here is what I receive:

array:5 [
  "from" => "243904902349"
  "id" => "wamid.HBgMMjQzOTA0MDk0MDUxFQIAEhgUM0FDQkVDQTM5RUZDQkFFQjA3NDkA"
  "timestamp" => "1675284371"
  "type" => "order"
  "order" => array:2 [
    "catalog_id" => "547570977294794"
    "product_items" => array:2 [
      0 => array:4 [
        "product_retailer_id" => "ITEM001-1"
        "quantity" => 1
        "item_price" => 13
        "currency" => "USD"
      ]
      1 => array:4 [
        "product_retailer_id" => "ITEM001-3"
        "quantity" => 2
        "item_price" => 50
        "currency" => "USD"
      ]
    ]
  ]
]
donmbelembe commented 1 year ago

I see but first, the UI doesn't let you write text when placing an order, secondly, I've dumped and shared what returns. So I guess the issue is at facebook, but for now, the code is breaking. Maybe I should update it to be nullable ?

aalbarca commented 1 year ago

I see but first, the UI doesn't let you write text when placing an order, secondly, I've dumped and shared what returns. So I guess the issue is at facebook, but for now, the code is breaking. Maybe I should update it to be nullable ?

Can you update your PR with my suggestion? If text is not coming we have to set the value to empty string. Nullable value will break the API contract and I would have to release a major version.

Thanks!

donmbelembe commented 1 year ago

Sur at first i didn't understand that you asked for a change, let me do it now