Store ipp_channel from intent metadata and suppress IPP receipt for POS orders#11362
Open
Store ipp_channel from intent metadata and suppress IPP receipt for POS orders#11362
Conversation
Contributor
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Contributor
|
Size Change: 0 B Total Size: 956 kB ℹ️ View Unchanged
|
3d96afd to
b83bdb2
Compare
7d90529 to
dd63bf1
Compare
Move _wcpay_ipp_channel saving before update_order_status_from_intent() so the POS flag is available when transactional emails fire during status transitions.
- Add $this->get_order() call to set_ipp_channel_for_order() to match all other setters in WC_Payments_Order_Service - Whitelist allowed ipp_channel values (mobile_pos, mobile_store_management) instead of storing arbitrary client-set Stripe metadata - Pass explicit true to get_meta() in IPP receipt email for consistency - Remove unnecessary comments in controller
Ensures the webhook path also persists ipp_channel before update_order_status_from_intent() and send_customer_ipp_receipt_email(), closing the race condition where webhook could fire before the REST endpoint stores the meta.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of woocommerce/woocommerce#63322
Changes proposed in this Pull Request
This PR stores the
ipp_channelvalue from Stripe PaymentIntent metadata as WooCommerce order meta and uses it to suppress WCPay's IPP receipt email for POS orders.Context:
The mobile apps already send
ipp_channelin Stripe PaymentIntent metadata with values:mobile_pos: payment made from the POS mode in the mobile appmobile_store_management: payment made from store management part of the mobile appThis metadata was previously only passed to Stripe, but not stored on the WooCommerce order. Storing it enables server-side identification of POS vs non-POS terminal payments.
Changes:
_wcpay_ipp_channelmeta key inWC_Payments_Order_Servicewithset_ipp_channel_for_order()andget_ipp_channel_for_order()methods.capture_terminal_payment()— after intent metadata is retrieved and beforemark_terminal_payment_completed(), the ipp_channel value from the intent metadata is stored on the order. This keepsmark_terminal_payment_completed()unchanged and stores the value only when the actual intent metadata is available.WC_Payments_Email_IPP_Receipt::trigger()now returns early when_wcpay_ipp_channelismobile_pos. POS orders are handled by the mobile app which manages its own receipt delivery. Orders withmobile_store_managementor no ipp_channel still receive the IPP receipt email.Note: Standard WooCommerce transactional email suppression (customer_completed_order, etc.) for POS is handled by WooCommerce core's
PointOfSaleEmailHandler, not by this PR.Testing instructions
_wcpay_ipp_channel = mobile_posmetanpm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge