remove PAYMENT and PURCHASE_LIMITED (bug 943140)
This commit is contained in:
Родитель
ea7103772d
Коммит
b71a472ede
|
@ -0,0 +1,3 @@
|
|||
DELETE FROM waffle_flag_mkt_users WHERE flag_id = (SELECT id FROM waffle_flag_mkt WHERE name = 'override-app-purchase');
|
||||
DELETE FROM waffle_flag_mkt_groups WHERE flag_id = (SELECT id FROM waffle_flag_mkt WHERE name = 'override-app-purchase');
|
||||
DELETE FROM waffle_flag_mkt WHERE name = 'override-app-purchase';
|
|
@ -47,13 +47,13 @@
|
|||
</div>
|
||||
|
||||
<section id="submit-payment-type">
|
||||
{% if not payments_enabled and not is_paid %}
|
||||
{% if not is_paid %}
|
||||
<h2>{{ _('App Compatibility') }}</h2>
|
||||
{% endif %}
|
||||
|
||||
<div class="island hasappendix{{ ' tabbable ' if payments_enabled or is_paid }}">
|
||||
<div class="island hasappendix{{ ' tabbable ' if is_paid }}">
|
||||
<div class="free tab {{ 'active' if not is_paid }}">
|
||||
{% if payments_enabled or is_paid %}
|
||||
{% if is_paid %}
|
||||
<h2 id="free-tab-header"><a href="#">{{ _('Free') }}</a></h2>
|
||||
{% endif %}
|
||||
<div class="error">{{ form.errors.free_platforms }}</div>
|
||||
|
@ -72,7 +72,7 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if payments_enabled or is_paid %}
|
||||
{% if is_paid %}
|
||||
{% set paid_platforms = form.fields['paid_platforms'].choices %}
|
||||
{% set has_multiple_paid_platforms = paid_platforms|length > 1 %}
|
||||
<div class="paid tab {{ 'active' if is_paid }}">
|
||||
|
|
|
@ -143,9 +143,6 @@ def payments(request, addon_id, addon, webapp=False):
|
|||
'account_form': provider.forms['account'](),
|
||||
'bango_account_list_form': bango_account_list_form,
|
||||
# Waffles
|
||||
'payments_enabled':
|
||||
waffle.flag_is_active(request, 'allow-b2g-paid-submission') and
|
||||
not waffle.switch_is_active('disabled-payments'),
|
||||
'api_pricelist_url': reverse('price-list'),
|
||||
'payment_methods': {
|
||||
PAYMENT_METHOD_ALL: _('All'),
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
import amo
|
||||
import amo.tests
|
||||
|
||||
import waffle
|
||||
|
||||
from users.models import UserProfile
|
||||
|
||||
from mkt.purchase.utils import payments_enabled
|
||||
from mkt.site.fixtures import fixture
|
||||
|
||||
from test_utils import RequestFactory
|
||||
|
||||
|
||||
class TestUtils(amo.tests.TestCase):
|
||||
fixtures = fixture('user_2519')
|
||||
|
||||
def setUp(self):
|
||||
self.req = RequestFactory().get('/')
|
||||
|
||||
def test_settings(self):
|
||||
with self.settings(PAYMENT_LIMITED=False):
|
||||
assert payments_enabled(self.req)
|
||||
|
||||
def test_not_flag(self):
|
||||
with self.settings(PAYMENT_LIMITED=True):
|
||||
assert not payments_enabled(self.req)
|
||||
|
||||
def test_flag(self):
|
||||
profile = UserProfile.objects.get(pk=2519)
|
||||
|
||||
flag = waffle.models.Flag.objects.create(name='override-app-payments')
|
||||
flag.everyone = None
|
||||
flag.users.add(profile.user)
|
||||
flag.save()
|
||||
|
||||
self.req.user = profile.user
|
||||
with self.settings(PAYMENT_LIMITED=True):
|
||||
assert payments_enabled(self.req)
|
|
@ -1,14 +0,0 @@
|
|||
import waffle
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def payments_enabled(request):
|
||||
"""
|
||||
If payments are not limited, anyone can pay.
|
||||
If payments are limited, the override-app-payments flag is consulted.
|
||||
"""
|
||||
if not getattr(settings, 'PAYMENT_LIMITED', False):
|
||||
return True
|
||||
|
||||
return waffle.flag_is_active(request, 'override-app-payments')
|
|
@ -308,15 +308,6 @@ COMMONPLACE_REPOS = ['commbadge', 'fireplace', 'marketplace-stats',
|
|||
'rocketfuel']
|
||||
COMMONPLACE_REPOS_APPCACHED = ['fireplace']
|
||||
|
||||
# Limit payments to only people who are in a whitelist. This is useful for
|
||||
# dev and stage server where only developers and testers should be able to make
|
||||
# payments and not the general public.
|
||||
#
|
||||
# If you set this to True, then you will need to give people the waffle flag:
|
||||
# override-app-purchase
|
||||
# For them to be able purchase apps.
|
||||
PURCHASE_LIMITED = False
|
||||
|
||||
# A list of the payment providers supported by the marketplace. Currently there
|
||||
# can be only one value, however we expect this to change in the future.
|
||||
PAYMENT_PROVIDERS = ['bango']
|
||||
|
|
|
@ -31,7 +31,6 @@ from mkt.api.fields import (LargeTextField, ReverseChoiceField,
|
|||
from mkt.constants.features import FeatureProfile
|
||||
from mkt.developers import tasks
|
||||
from mkt.developers.forms import IARCGetAppInfoForm
|
||||
from mkt.purchase.utils import payments_enabled
|
||||
from mkt.regions import (ALL_REGIONS_WITH_CONTENT_RATINGS, get_region,
|
||||
REGIONS_DICT)
|
||||
from mkt.submit.forms import mark_for_rereview
|
||||
|
@ -178,14 +177,12 @@ class AppSerializer(serializers.ModelSerializer):
|
|||
|
||||
def get_price(self, app):
|
||||
region = self.context.get('region')
|
||||
if (region in app.get_price_region_ids() or
|
||||
payments_enabled(self.context['request'])):
|
||||
if region in app.get_price_region_ids():
|
||||
return app.get_price(region=region)
|
||||
|
||||
def get_price_locale(self, app):
|
||||
region = self.context.get('region')
|
||||
if (region in app.get_price_region_ids() or
|
||||
payments_enabled(self.context['request'])):
|
||||
if region in app.get_price_region_ids():
|
||||
return app.get_price_locale(region=region)
|
||||
|
||||
def get_ratings_aggregates(self, app):
|
||||
|
|
|
@ -239,34 +239,6 @@ class TestAppSerializerPrices(amo.tests.TestCase):
|
|||
eq_(res['price_locale'], None)
|
||||
eq_(res['payment_required'], True)
|
||||
|
||||
def test_waffle_fallback(self):
|
||||
self.make_premium(self.app, price='0.99')
|
||||
flag = waffle.models.Flag.objects.get(name='override-app-purchase')
|
||||
flag.everyone = None
|
||||
flag.users.add(self.profile.user)
|
||||
flag.save()
|
||||
|
||||
req = RequestFactory().get('/')
|
||||
req.user = self.profile.user
|
||||
with self.settings(PURCHASE_LIMITED=True):
|
||||
res = self.serialize(self.app, region=regions.US.id, request=req)
|
||||
eq_(res['price'], Decimal('0.99'))
|
||||
eq_(res['price_locale'], '$0.99')
|
||||
eq_(res['payment_required'], True)
|
||||
|
||||
def test_waffle_fallback_anon(self):
|
||||
flag = waffle.models.Flag.objects.get(name='override-app-purchase')
|
||||
flag.everyone = True
|
||||
flag.save()
|
||||
self.make_premium(self.app, price='0.99')
|
||||
req = RequestFactory().get('/')
|
||||
req.user = AnonymousUser()
|
||||
with self.settings(PURCHASE_LIMITED=True):
|
||||
res = self.serialize(self.app, region=regions.US.id, request=req)
|
||||
eq_(res['price'], Decimal('0.99'))
|
||||
eq_(res['price_locale'], '$0.99')
|
||||
eq_(res['payment_required'], True)
|
||||
|
||||
|
||||
@mock.patch('versions.models.Version.is_privileged', False)
|
||||
class TestESAppToDict(amo.tests.ESTestCase):
|
||||
|
|
|
@ -16,7 +16,6 @@ from market.models import Price
|
|||
from users.models import UserProfile
|
||||
|
||||
import mkt
|
||||
from mkt.purchase.utils import payments_enabled
|
||||
from mkt.regions import REGIONS_CHOICES_ID_DICT
|
||||
from mkt.regions.api import RegionResource
|
||||
|
||||
|
@ -158,7 +157,7 @@ def es_app_to_dict(obj, region=None, profile=None, request=None):
|
|||
price_tier = src.get('price_tier')
|
||||
if price_tier:
|
||||
price = Price.objects.get(name=price_tier)
|
||||
if (data['upsell'] or payments_enabled(request)):
|
||||
if data['upsell']:
|
||||
price_currency = price.get_price_currency(region=region)
|
||||
if price_currency and price_currency.paid:
|
||||
data['price'] = price.get_price(region=region)
|
||||
|
|
|
@ -29,7 +29,6 @@ from mkt.api.authorization import (AllowOwner, AllowReadOnly, AnyOf,
|
|||
from mkt.api.base import CORSMixin, MarketplaceView
|
||||
from mkt.api.exceptions import AlreadyPurchased
|
||||
from mkt.purchase.webpay import _prepare_pay, sign_webpay_jwt
|
||||
from mkt.purchase.utils import payments_enabled
|
||||
from mkt.webpay.forms import FailureForm, PrepareForm
|
||||
from mkt.webpay.models import ProductIcon
|
||||
from mkt.webpay.serializers import PriceSerializer, ProductIconSerializer
|
||||
|
@ -56,10 +55,8 @@ class PreparePayView(CORSMixin, MarketplaceView, GenericAPIView):
|
|||
if region and region.id not in app.get_price_region_ids():
|
||||
log.info('Region {0} is not in {1}'
|
||||
.format(region.id, app.get_price_region_ids()))
|
||||
if payments_enabled(request):
|
||||
log.info('Flag not active')
|
||||
return Response('Payments are limited and flag not enabled',
|
||||
status=status.HTTP_403_FORBIDDEN)
|
||||
return Response('Payments are limited and flag not enabled',
|
||||
status=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
try:
|
||||
data = _prepare_pay(request._request, app)
|
||||
|
|
|
@ -82,12 +82,6 @@ class TestPrepare(PurchaseTest, RestOAuth):
|
|||
eq_(res.status_code, 409)
|
||||
eq_(res.json, {"reason": "Already purchased app."})
|
||||
|
||||
def test_waffle_fallback(self):
|
||||
flag = self.create_flag('override-app-purchase', everyone=None)
|
||||
flag.users.add(self.user.user)
|
||||
with self.settings(PURCHASE_LIMITED=True):
|
||||
eq_(self._post().status_code, 201)
|
||||
|
||||
|
||||
class TestStatus(RestOAuth):
|
||||
fixtures = fixture('webapp_337141', 'user_2519')
|
||||
|
|
|
@ -138,8 +138,6 @@ GEOIP_DEFAULT_TIMEOUT = .2
|
|||
ES_DEFAULT_NUM_REPLICAS = 0
|
||||
ES_DEFAULT_NUM_SHARDS = 3
|
||||
|
||||
PAYMENT_LIMITED = False
|
||||
|
||||
IARC_MOCK = True
|
||||
|
||||
PAYMENT_PROVIDERS = ['bango']
|
||||
|
|
|
@ -205,8 +205,6 @@ POSTFIX_AUTH_TOKEN = private_mkt.POSTFIX_AUTH_TOKEN
|
|||
|
||||
POSTFIX_DOMAIN = 'marketplace-dev.allizom.org'
|
||||
|
||||
PURCHASE_LIMITED = True
|
||||
|
||||
MONOLITH_INDEX = 'mktdev-time_*'
|
||||
|
||||
# IARC content ratings.
|
||||
|
|
|
@ -180,8 +180,6 @@ NEWRELIC_INI = '/etc/newrelic.d/marketplace.allizom.org.ini'
|
|||
|
||||
ES_USE_PLUGINS = True
|
||||
|
||||
PURCHASE_LIMITED = True
|
||||
|
||||
BANGO_BASE_PORTAL_URL = 'https://mozilla.bango.com/login/al.aspx?'
|
||||
|
||||
MONOLITH_INDEX = 'mktstage-time_*'
|
||||
|
|
Загрузка…
Ссылка в новой задаче