Skip to content

Conversation

@iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Jul 1, 2025

Closes WOOMOB-701

Only 1 review is needed.

Description

This PR hooks the usage of created_via through Networking - Yosemite - Storage to finally display the appropriate value in the UI, for this we:

  • Add the property to NetworkingCore.Order model and generate copy/fakes
  • Update Order+ReadOnlyConvertible to account for this property
  • Update the remote to pass created_via as field when we fetch all orders from the API
  • Update the cell's view model to only render the badge when the feature flag is enabled and the value is exactly pos-rest-api

Testing information

  • Switch .pointOfSaleOrdersi1 flag to true
  • Create orders in both POS and app side, go back to the order list and observe that only POS order show the POS badge (you might need to pull-to-refresh). There is no backfilling, so only freshly created orders will be affected.

Simulator Screenshot - iPad mini (A17 Pro) - US store - 2025-07-01 at 12 04 13

@iamgabrielma iamgabrielma added type: task An internally driven task. feature: order details Related to order details. feature: POS labels Jul 1, 2025
@iamgabrielma iamgabrielma added this to the 22.8 milestone Jul 1, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 1, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Number30901
VersionPR #15847
Bundle IDcom.automattic.alpha.woocommerce
Commit26c1e1f
Installation URL4dmgdjj9464ho
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@iamgabrielma iamgabrielma changed the title [POS Orders] Add createdVia to NetworkingCore Order model [POS Orders] Hook createdVia from networking to business layer Jul 1, 2025
@iamgabrielma iamgabrielma marked this pull request as ready for review July 1, 2025 05:15
@iamgabrielma iamgabrielma requested review from jaclync and staskus July 1, 2025 05:15
@staskus staskus self-assigned this Jul 1, 2025
Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on a few stores, made orders on IPP, web, and POS. The badge shows up when we would expect. 🚀

let paymentMethodTitle = try container.decode(String.self, forKey: .paymentMethodTitle)

// "payment_url" is only available on stores stores with version >= 6.4
// "payment_url" is only available on stores with version >= 6.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👁️

Comment on lines +81 to +91
var salesChannel: String? {
guard let createdVia = order.createdVia else {
return nil
}

switch createdVia {
case "pos-rest-api":
return "POS"
default:
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the sales channel implementation detail could live in Yosemite, like an extension of Order, so that the app layer doesn't have to know about this "created_via" property and the sales channel can be reused for other order use cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense 🤔 , I'll go ahead and merge this one for now, then take a spin to your suggestion in #15848

@iamgabrielma iamgabrielma merged commit bf9a4c0 into trunk Jul 2, 2025
17 checks passed
@iamgabrielma iamgabrielma deleted the task/WOOMOB-701-update-networking-model-to-use-createdvia-prop branch July 2, 2025 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: order details Related to order details. feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants