remove PayPal from submission flow (bug 782366)
This commit is contained in:
Родитель
d316e5ee5b
Коммит
a42bf29fdc
|
@ -0,0 +1,2 @@
|
|||
insert into waffle_switch_mkt (name, active, note)
|
||||
values ('disabled-payments', 0, 'Enable this to disable payments.');
|
|
@ -130,7 +130,7 @@
|
|||
{% block site_js %}
|
||||
<script src="{{ static(url('jsi18n')) }}"></script>
|
||||
{{ js('mkt/devreg') }}
|
||||
{% if logged %}
|
||||
{% if logged and not waffle.switch('disable-payments') %}
|
||||
<script async defer src="{{ settings.PAYPAL_JS_URL }}"></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from jingo import register, env
|
||||
import jinja2
|
||||
import waffle
|
||||
|
||||
import mkt
|
||||
from mkt.submit.models import AppSubmissionChecklist
|
||||
|
@ -37,8 +38,11 @@ def progress(request, addon, step):
|
|||
if not completed and step and step != 'terms':
|
||||
completed = ['terms']
|
||||
|
||||
if waffle.switch_is_active('disable-payments'):
|
||||
steps = del_by_key(steps, 'payments')
|
||||
|
||||
# Payments step was skipped, so remove it.
|
||||
if step == 'done' and 'payments' not in completed:
|
||||
elif step == 'done' and 'payments' not in completed:
|
||||
steps = del_by_key(steps, 'payments')
|
||||
|
||||
c = dict(steps=steps, current=step, completed=completed)
|
||||
|
|
|
@ -43,6 +43,9 @@ class TestSubmit(amo.tests.TestCase):
|
|||
def get_user(self):
|
||||
return UserProfile.objects.get(username='regularuser')
|
||||
|
||||
def get_url(self, url):
|
||||
return reverse('submit.app.%s' % url, args=[self.webapp.app_slug])
|
||||
|
||||
def _test_anonymous(self):
|
||||
self.client.logout()
|
||||
r = self.client.get(self.url, follow=True)
|
||||
|
@ -448,12 +451,18 @@ class TestDetails(TestSubmit):
|
|||
def test_resume_later(self):
|
||||
self._step()
|
||||
self.webapp.appsubmissionchecklist.update(details=True, payments=True)
|
||||
self.webapp.update(status=amo.STATUS_NULL, paypal_id='',
|
||||
premium_type=amo.ADDON_PREMIUM)
|
||||
self.webapp.update(paypal_id='', premium_type=amo.ADDON_PREMIUM)
|
||||
res = self.client.get(reverse('submit.app.resume',
|
||||
args=[self.webapp.app_slug]))
|
||||
self.assert3xx(res, self.webapp.get_dev_url('paypal_setup'))
|
||||
|
||||
def test_disabled_payments_resume_later(self):
|
||||
self.create_switch(name='disable-payments')
|
||||
self._step()
|
||||
r = self.client.get(reverse('submit.app.resume',
|
||||
args=[self.webapp.app_slug]))
|
||||
assert r['Location'].endswith(self.url), 'Expected: %s' % self.url
|
||||
|
||||
def test_not_owner(self):
|
||||
self._step()
|
||||
assert self.client.login(username='clouserw@gmail.com',
|
||||
|
@ -534,8 +543,19 @@ class TestDetails(TestSubmit):
|
|||
# Post and be redirected.
|
||||
r = self.client.post(self.url, data)
|
||||
self.assertNoFormErrors(r)
|
||||
# TODO: Assert redirects when we go to next step.
|
||||
self.check_dict(data=data)
|
||||
self.webapp = self.get_webapp()
|
||||
self.assert3xx(r, self.get_url('payments'))
|
||||
|
||||
def test_disabled_payments_success(self):
|
||||
self.create_switch(name='disable-payments')
|
||||
self._step()
|
||||
data = self.get_dict()
|
||||
r = self.client.post(self.url, data)
|
||||
self.assertNoFormErrors(r)
|
||||
self.check_dict(data=data)
|
||||
self.webapp = self.get_webapp()
|
||||
self.assert3xx(r, self.get_url('done'))
|
||||
|
||||
def test_no_video_types(self):
|
||||
self._step()
|
||||
|
@ -851,9 +871,6 @@ class TestPayments(TestSubmit):
|
|||
self.price = Price.objects.create(price='1.00')
|
||||
self._step()
|
||||
|
||||
def get_url(self, url):
|
||||
return reverse('submit.app.%s' % url, args=[self.webapp.app_slug])
|
||||
|
||||
def get_webapp(self):
|
||||
return Webapp.objects.get(id=337141)
|
||||
|
||||
|
@ -1114,14 +1131,20 @@ class TestDone(TestSubmit):
|
|||
def get_webapp(self):
|
||||
return Webapp.objects.get(id=337141)
|
||||
|
||||
def _step(self):
|
||||
self.cl = AppSubmissionChecklist.objects.create(addon=self.webapp,
|
||||
terms=True, manifest=True, details=True, payments=True)
|
||||
def _step(self, **kw):
|
||||
data = dict(addon=self.webapp, terms=True, manifest=True,
|
||||
details=True, payments=True)
|
||||
data.update(kw)
|
||||
self.cl = AppSubmissionChecklist.objects.create(**data)
|
||||
AddonUser.objects.create(addon=self.webapp, user=self.user)
|
||||
|
||||
def test_anonymous(self):
|
||||
self._test_anonymous()
|
||||
|
||||
def test_progress_display(self):
|
||||
self._step()
|
||||
self._test_progress_display(['terms', 'manifest', 'details'], 'done')
|
||||
|
||||
def test_done(self):
|
||||
self._step()
|
||||
res = self.client.get(self.url)
|
||||
|
|
|
@ -188,8 +188,16 @@ def details(request, addon_id, addon):
|
|||
form_icon.save(addon)
|
||||
for preview in form_previews.forms:
|
||||
preview.save(addon)
|
||||
AppSubmissionChecklist.objects.get(addon=addon).update(details=True)
|
||||
return redirect('submit.app.payments', addon.app_slug)
|
||||
|
||||
checklist = AppSubmissionChecklist.objects.get(addon=addon)
|
||||
|
||||
if waffle.switch_is_active('disable-payments'):
|
||||
checklist.update(details=True, payments=True)
|
||||
addon.mark_done()
|
||||
return redirect('submit.app.done', addon.app_slug)
|
||||
else:
|
||||
checklist.update(details=True)
|
||||
return redirect('submit.app.payments', addon.app_slug)
|
||||
|
||||
ctx = {
|
||||
'step': 'details',
|
||||
|
|
Загрузка…
Ссылка в новой задаче