aimeos / ai-client-jsonapi

Aimeos frontend JSON API
GNU Lesser General Public License v3.0
28 stars 6 forks source link

When updating the customer address in the client api deletes the address #22

Open msiddiq1400 opened 1 month ago

msiddiq1400 commented 1 month ago

I am facing an issue right now related to customer addresses, the patch request is deleting the addresses on update. previously I used 2024.04.01 for all packages but was facing context and auth issues for supplier users (admin group), yesterday the 2024.07.x-dev was live so updated all packages to 2024.07.1 and for aimeos/aimeos-laravel used the 2024.07.x-dev, now addresses are removed on patch request

this POST request is creating the address https://local.droppe.com/jsonapi/default/customer?id=4058&related=address Body: {"data":[{"attributes":{"customer.address.address1":"address 1","customer.address.postal":"postal 1","customer.address.city":"city1","customer.address.countryid":"fi","customer.address.addressdetails":"","customer.address.deliverynotes":"notes1","customer.address.company":"","customer.address.vatid":"","customer.address.email":"","customer.address.telephone":"+3582323223","customer.address.position":0}}]}

when i try to update the same address returned from the post request via PATCH it just removes it https://local.droppe.com/jsonapi/default/customer?id=4058&related=address&relatedid=6124 Body: {"data":{"attributes":{"customer.address.address1":"address 11","customer.address.postal":"postal 11","customer.address.city":"city 11","customer.address.countryid":"fi","customer.address.addressdetails":"","customer.address.deliverynotes":"notes11","customer.address.telephone":"+35823232323"}}}

aimeos commented 1 month ago

We've tested that ourselves but can't reproduce the issue. Our requests:

  1. GET customer
  2. POST customer/address
  3. PATCH customer/address
  4. GET customer

The patched customer address is still there

msiddiq1400 commented 1 month ago

This is the post call, for a user with no address (no delivery or billing, saveAddressItems is called 3 times, no deleted keys array $item->getAddressItemsDeleted()->keys()->toArray() returns [] for all 3 calls in this single request) image

The patch request is removing it, the request is patch image

aimeos commented 1 month ago

According to your screenshots, it seems you've overwritten some code with your own implentation. Maybe the problem is located there?

msiddiq1400 commented 1 month ago

I have extended the saveItemAddress function in the customermanager, even If I remove it the behavior does not change

can you tell me the versions you are using for all packages for aimeos ?

aimeos commented 1 month ago

Like said, we are not able to reproduce the behavior. Can you please post vanilla JS code which we can use to see the behavior in our environment too?

msiddiq1400 commented 1 month ago

I don't understand, do you want me to share the php files for the extended code (override files) ? some specific extended managers or what ?

aimeos commented 1 month ago

No, we need the Javascript code which reproduces the problem

msiddiq1400 commented 1 month ago

where can i get the file, is it from the source in browser ?

I triggered these apis from postman, and getting the issue