In MAILPOET-5203 we changed text on button for refreshing subscribers limits
from "I’ve upgraded my subscription, refresh subscriber limit'" to
"Refresh subscriber limit".
This commit does similar change for the button for refreshing email limit.
We changed that because it makes sense to refresh the limits not only
after after the upgrade but also when user deletes subscribers or it is already a day
after the period for monthly email limit.
[MAILPOET-5191]
I noticed that the access restriction error message doesn't disappear
when the key becomes valid.
This commit fixes it by reseting the state before each check.
It also adds check for premium key. Plans that offers only the premium
may return the error only on the premium key check.
[MAILPOET-5191]
The API key that is underprivileged for MSS and Premium
is still considered as valid because the API can still authenticate the key
and the key can be used reporting subscriber stats etc.
I've check places where we use the property and in all cases we use
to distinguish if the plugin uses a subscription plan (free or paid) or no plan.
[MAILPOET-5191]
In case the user uses an API key that has restricted access to MSS
due email volume limit on a fresh site. The site has no cached data about
the limits. We need a variant of the message also for the case.
[MAILPOET-5191]
The values we have in key state might be missing or outdated.
We need to check also if the key check on MSS returned error
about access being restricted due email volume limit.
[MAILPOET-5191]
The limit is stored in and read from MSS key state and now we preserve
state data even when the key becomes underprivileged.
We don't need to refresh anything and also the checking underprivileged key
would return 403 and no data about limits.
[MAILPOET-5191]
Currently the starter plan has no access to premium so the plugin is
not able to fetch email volume limit using premium key endpoint.
Also the data are related to sending so it makes more sense to read those
from MSS key state.
[MAILPOET-5191]
When the shop blocked access for an API key due subscriber limit it used
to set the error as "Insufficient privileges," and that was in the plugin
interpreted same as "Subscribers limit reached".
The SHOP-1228 changes the error message will be set to "Subscribers limit reached".
This commit updates the error mapper to be able to process the new error message.
It also keeps the old approach for previously blocked keys.
[MAILPOET-5191]
The state data contain info about plan limits etc. we don't want
to lose the info when key becomes underprivileged so that we can
show the limits in notifications.
[MAILPOET-5191]
Bridge is a low level service that processes requests and responses to/from Bridge API.
This change is needed so that we can remove dependency on MailPoet\Util\License\Features\Subscribers
service from the Bridge. The dependecy is a higher level service and may easily cause a circular dependency issue.
The SettingsChangeHandler is service for handling side effects
when saving settings. This feels as a better place to put the functionality.
[MAILPOET-5191]
Bridge is a low level service that processes requests and responses to/from Bridge API.
This change is needed so that we can remove dependency on MailPoet\Util\License\Features\Subscribers
service from the Bridge. The dependecy is a higher level service and may easily cause a circular dependency issue.
[MAILPOET-5191]
This is the olny staically called method from the service. In this commit I refactored it to non-static so that it works properly with injected services.
[MAILPOET-5191]