Description
Step to reproduce:
Create checkout and synch with the server, The server will return Checkout object. This Checkout object is used in the checkout process
Apply gift card to the checkout using BuyClient.applyGiftCard(String code, Checkout checkout, Callback callback) method. The gift card is successfully added to the checkout and the server returns checkout object with List. Store the checkout for the next step.
Proceed to the checkout flow. When trying to update Checkout with BuyClient.updateCheckout(Checkout checkout, Callback callback) (ie. adding addresses, updating shipping option), the server throws Gift Card code is invalid error.
JSON response:
{"errors":{"checkout":{"email":[],"note":[],"payment_gateway":[],"line_items":[],"source_name":[],"reservation_time":[],"gift_cards":{"0":{"code":[{"code":"gift_card_code_invalid","message":"Code is invalid","options":{}}]}}}}}
Suspected Cause:
When syncing Gift Card with the server, the server successfully updates and returns Checkout Object with List. The GiftCards receive from the server has code == null. This may cause error if the next time BuyClient.updateCheckout method is called. The Checkout Object now has GiftCard with code == null causing the server to return Code is Invalid error.