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

Support multi tiers new pricing structure - Part 1 #7178

Merged

Conversation

wordpressfan
Copy link
Contributor

@wordpressfan wordpressfan commented Dec 10, 2024

Description

Fixes #7176

This PR tries to accommodate the changes in the API, check the issue itself for more details about the data structure being passed to the view file (UI)

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

Here we start working on the API data level to prepare the data being passed to upgrade modal view file to show the upgrade items properly.

Technical description

Documentation

We will have from the API data like:

[
	{
	  "name": "Growth",
	  "type": "growth",
	  "saving": "x",
	  "upgrade_url": "x",
	  "regular_price": "x",
	  "websites": "x",
	  "stacked": false
	},
	{
	  "name": "Multi",
	  "type": "multi10",
	  "saving": "x",
	  "upgrade_url": "x",
	  "regular_price": "x",
	  "websites": "x",
	  "stacked": true
	},
	{
	  "name": "Multi",
	  "type": "multi50",
	  "saving": "x",
	  "upgrade_url": "x",
	  "regular_price": "x",
	  "websites": "x",
	  "stacked": true
	},
	{
	  "name": "Multi",
	  "type": "multi100",
	  "saving": "x",
	  "upgrade_url": "x",
	  "regular_price": "x",
	  "websites": "x",
	  "stacked": true
	},
	{
	  "name": "Multi",
	  "type": "multi500",
	  "saving": "x",
	  "upgrade_url": "x",
	  "regular_price": "x",
	  "websites": "x",
	  "stacked": true
	}
],

then we will group it to something like:

[
    'growth' => [
        'name' => 'Growth',
        'price' => '',
        'websites' => '',
        'upgrade_url' => '',
    ],
    'stacked' => [
        'multi10' => [
            'name' => 'Multi',
            'price' => '',
            'websites' => '',
            'upgrade_url' => '',
        ],
        'multi50' => [
            'name' => 'Multi',
            'price' => '',
            'websites' => '',
            'upgrade_url' => '',
        ],
        'multi100' => [
            'name' => 'Multi',
            'price' => '',
            'websites' => '',
            'upgrade_url' => '',
        ],
        'multi500' => [
            'name' => 'Multi',
            'price' => '',
            'websites' => '',
            'upgrade_url' => '',
        ],
    ]
]

New dependencies

Now we depend on the new API, so we need to make sure that we release the API to the production site one day before releasing this change in plugin because we save the user API for one day.

Risks

As mentioned above, we need to make sure that the upgrades array is there on the production user API before releasing this in plugin with 1 day.
This means that we don't need to clear this transient with release.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

N/A

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

@wordpressfan wordpressfan changed the title [POC] Support multi tiers new pricing structure Support multi tiers new pricing structure - Part 1 Dec 17, 2024
Copy link

codacy-production bot commented Dec 17, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for dd33f7b1 81.82% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (dd33f7b) Report Missing Report Missing Report Missing
Head commit (80873e7) 38205 16699 43.71%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7178) 22 18 81.82%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@wordpressfan wordpressfan self-assigned this Dec 17, 2024
@wordpressfan wordpressfan changed the base branch from develop to feature/multi-tiers-upgrade December 17, 2024 11:28
@wordpressfan wordpressfan marked this pull request as ready for review December 17, 2024 11:29
@wordpressfan wordpressfan requested a review from a team December 17, 2024 18:21
@wordpressfan
Copy link
Contributor Author

I'm going to merge this into the feature branch so we can do the QA once the three parts are merged all together.

@wordpressfan wordpressfan merged commit 5ac0171 into feature/multi-tiers-upgrade Dec 17, 2024
14 checks passed
@wordpressfan wordpressfan deleted the feature/support-multi-tiers-upgrade branch December 17, 2024 18:23
@Mai-Saad
Copy link
Contributor

execution done on #7197

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi Tiers upgrade new structure - part 1 - Business logic and API
2 participants