Skip to content

Conversation

@rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented May 22, 2023

Closes: #9793

Description

This PR fixes a decoding error for stores using the Gift Cards extension, if the gift card in an order has an amount that is a non-integer. This is because the amount property for OrderGiftCard was mistakenly given an Int64 type, so it couldn't handle gift card amounts with decimal values. This is resolved by updating the amount to use a Double type to handle those non-integer amounts.

Changes

  • Updates the amount property in OrderGiftCard in the Networking layer to use Double type.
  • Updates the amount attribute in the OrderGiftCard entity in the Storage layer use Double type. This includes a new Core Data model and migration test for the change.

Testing instructions

Prerequisites

  1. Install and activate the Gift Cards extension.
  2. Create a gift card product.
  3. Create an order for a gift card product, to create a working gift card with a code you can apply to an order.
  4. Create an order with a non-integer order total, and apply the gift card to pay for the order.

To test

  1. Build and run the app.
  2. Open the Orders tab and confirm the order list loads.
  3. Select the order from step 4 above and confirm the order details Payment and Gift Card sections show a gift card with non-integer amount applied to the order.

Screenshots

Before After - Order list After - Order details
Simulator Screenshot - iPhone 14 Pro - 2023-05-22 at 23 41 48 Simulator Screenshot - iPhone 14 Pro - 2023-05-22 at 23 42 12 Simulator Screenshot - iPhone 14 Pro - 2023-05-22 at 23 42 28

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@rachelmcr rachelmcr added category: woo extensions Related to WC extensions or plugins. feature: woo express support Related to Woo Express support labels May 22, 2023
@rachelmcr rachelmcr added this to the 13.8 milestone May 22, 2023
@rachelmcr rachelmcr marked this pull request as ready for review May 22, 2023 22:55
@rachelmcr rachelmcr requested review from Ecarrion and ThomazFB May 22, 2023 22:55
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 22, 2023

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr9795-1b0c8b1 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@Ecarrion Ecarrion self-assigned this May 23, 2023
@peril-woocommerce
Copy link

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@rachelmcr rachelmcr enabled auto-merge May 23, 2023 14:04
@rachelmcr rachelmcr merged commit eac462a into trunk May 23, 2023
@rachelmcr rachelmcr deleted the issue/9793-gift-card-amount branch May 23, 2023 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: woo extensions Related to WC extensions or plugins. feature: woo express support Related to Woo Express support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Gift Cards] Decoding error if gift card amount has non-integer value.

4 participants