Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plans in Site Creation: Create functionality to add domain with a plan to a cart #21667

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Oct 2, 2023

Fixes #21636
Related WordPress Kit PR: wordpress-mobile/WordPressKit-iOS#628

Description

  1. Update Podfile to use updated cart methods Created functionality to add domain with a plan to a cart WordPressKit-iOS#628
  2. Replace deprecated createTemporaryDomainShoppingCart and createPersistentDomainShoppingCart methods with a new createShoppingCart method
  3. Create ShoppingCartService to use the new API
  4. Rename DomainPurchasing... to SiteCreationPurchasing...
  5. Introduce planId into the flow and into SiteCreator

In the future PRs, will be able to set planId: Int value of SiteCreator after the user selects the plan and the changes made here will allow the flow to finish with the checkout.

To test:

Checkout opens if plan selected

Before testing:

  • Manually set planId: Int? value to 1009 in SiteCreator.swift
  1. Enable Plans in Site Creation feature flag
  2. Select Site Picker
  3. Create new WordPress.com site
  4. Select a free or paid domain
  5. Finish creating a site
  6. Confirm that plan exists in the cart

Video - paid domain

Plan.Purchase.with.Paid.Domain.mp4

Video - free domain

Plan.Purchase.with.Free.Domain.mp4

Regression

  1. Disable Plans in Site Creation & Domain Purchasing in Site Creation (if still exists) feature flags
  2. Select Site Picker
  3. Create new WordPress.com site
  4. Select a domain
  5. Finish creating a site
  6. Confirm that checkout doesn't open

Regression Notes

  1. Potential unintended areas of impact

Breaking current Site Creation flow

  1. What I did to test those areas of impact (or what existing automated tests I relied on)

Manual testing

  1. What automated tests I added (or what prevented me from doing so)

None

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

- Rename DomainPurchasing to SiteCreationPurchasing
- Replace RegisterDomainDetailsServiceProxyProtocol with ShoppingCartServiceProtocol
- planId can now be set during SiteCreation flow
- Show checkout if planId exists
@staskus
Copy link
Contributor Author

staskus commented Oct 2, 2023

cc @irfano @ravishanker

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 2, 2023

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr21667-1012ac4
Version23.4
Bundle IDorg.wordpress.alpha
Commit1012ac4
App Center BuildWPiOS - One-Offs #7265
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 2, 2023

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr21667-1012ac4
Version23.4
Bundle IDcom.jetpack.alpha
Commit1012ac4
App Center Buildjetpack-installable-builds #6305
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

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

Tested and working great:

  • ✅ Checkout opens if plan selected
  • ✅ Regression test

I left some non-blocking comments.

Regarding the "Checkout opens if plan selected" test:

  • When a paid domain is chosen: I see the domain & the hard-coded plan (1009) in the cart as expected.
  • When a free domain is chosen: Before testing, I removed the hard-coded plan. The app correctly skipped checkout and went to site assembly. My understanding is that we'll still show plans (in a later PR) when a user chooses a free domain, to give them the choice between a free and paid plan. I presume the above video, "Video - free domain", was taken with a hard-coded plan because otherwise, it shouldn't open the checkout.

import Foundation

protocol ShoppingCartServiceProtocol {
func createSiteCreationShoppingCart(
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 repeated word "creation" makes this less readable. Maybe makeSiteCreationShoppingCart would be more readable.

Comment on lines 153 to 154
/// The site must be created before attempting domain and plan bundle purchasing.
private func attemptPlanAndDomainPurchasing(domain: DomainSuggestion, planId: Int, site: Blog) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Is this checkout web view shown to users who choose a free domain (e.g. xyz.wordpress.com`) and a paid plan? If so, it might be more descriptive to not mention "plan and domain" here since it could be a plan and domain bundle OR just a plan.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. Yes, it will be shown to users who choose a free domain and paid plan. I will try to make it clearer.

@staskus
Copy link
Contributor Author

staskus commented Oct 4, 2023

When a free domain is chosen: Before testing, I removed the hard-coded plan. The app correctly skipped checkout and went to site assembly. My understanding is that we'll still show plans (in a later PR) when a user chooses a free domain, to give them the choice between a free and paid plan. I presume the above video, "Video - free domain", was taken with a hard-coded plan because otherwise, it shouldn't open the checkout.

@guarani correct. Both cases had a plan hardcoded, therefore both cases had Checkout opened. 👍

@staskus staskus enabled auto-merge October 4, 2023 09:55
@staskus staskus merged commit 401211b into trunk Oct 4, 2023
@staskus staskus deleted the task/21636-create-functionality-to-add-domain-with-a-plan-to-a-cart branch October 4, 2023 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plans in Site Creation: Create functionality to add domain with a plan to a cart
3 participants