saleor/saleor

Bug: Mutation CheckoutCustomerAttach should not throw error when reattaching the same user

Open

#12,037 创建于 2023年2月15日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Python (19,887 star) (5,278 fork)batch import
buggood first issuegraphql

描述

What are you trying to achieve?

Currently, mutation CheckoutCustomerAttach throws an error when checkout.customer is already attached and we're trying to attach the same authenticated customer. (This flow is not the same as for e.g shipping address, that can be overwritten with the same data with a success returned from the api). On top of that, the error is a graphql permission denied error, unlike what's presented in playground (screens below). It'd make stuff much easier for frontend if:

  • the mutation would return success if we're trying to reattach the same customer
  • in case of trying to attach a different customer returned error would be a checkout error with error code so frontend can handle it nicely

Here are some screenshots:

Steps to reproduce the problem

  1. Create a checkout
  2. Obtain user access token
  3. Attach customer to checkout using CheckoutCustomerAttach mutation
  4. Try to repeat step 3 - api throws error

What did you expect to happen?

For the mutation to return a success

Logs

No response

Environment

Saleor version: currently master staging OS and version: macOS Monterey 12.06

贡献者指南