only show thanks for premium (bug 692369)
This commit is contained in:
Родитель
cc785c4d07
Коммит
fdff9bafff
|
@ -22,8 +22,10 @@
|
|||
<h4>{{ _('Payment cancelled') }}</h4>
|
||||
{% else %}
|
||||
<h4>{{ _('Payment completed') }}</h4>
|
||||
<a href="{{ url('addons.purchase.thanks', addon.slug) }}?realurl={{ realurl }}"
|
||||
id="paypal-thanks">{{ _('Thank you for purchasing your add-on') }}</a>
|
||||
{% if addon.is_premium() %}
|
||||
<a href="{{ url('addons.purchase.thanks', addon.slug)|urlparams(realurl=realurl) }}"
|
||||
id="paypal-thanks">{{ _('Thank you for purchasing the add-on') }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<p><a id="paypal-result" target="_top" href="{{ url('addons.detail', addon.slug) }}">{{ _('Return to the addon.') }}</a></p>
|
||||
{% endblock %}
|
||||
|
|
|
@ -225,6 +225,11 @@ class TestContributeEmbedded(amo.tests.TestCase):
|
|||
'result_type=json'))
|
||||
assert not json.loads(res.content)['paykey']
|
||||
|
||||
def test_result_page(self):
|
||||
url = reverse('addons.paypal', args=[self.addon.slug, 'complete'])
|
||||
doc = pq(self.client.get(url).content)
|
||||
eq_(len(doc('#paypal-thanks')), 0)
|
||||
|
||||
|
||||
class TestPurchaseEmbedded(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_592', 'base/users', 'prices']
|
||||
|
@ -357,6 +362,17 @@ class TestPurchaseEmbedded(amo.tests.TestCase):
|
|||
eq_(res.status_code, 200)
|
||||
eq_(pq(res.content)('a.trigger_download').attr('href'), '/foo')
|
||||
|
||||
@patch('paypal.check_purchase')
|
||||
def test_result_page(self, check_purchase):
|
||||
check_purchase.return_value = 'COMPLETED'
|
||||
Contribution.objects.create(addon=self.addon, uuid='1',
|
||||
user=self.user, paykey='sdf',
|
||||
type=amo.CONTRIB_PENDING)
|
||||
url = reverse('addons.purchase.finished',
|
||||
args=[self.addon.slug, 'complete'])
|
||||
doc = pq(self.client.get('%s?uuid=1' % url).content)
|
||||
eq_(len(doc('#paypal-thanks')), 1)
|
||||
|
||||
|
||||
class TestDeveloperPages(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615', 'base/addon_592',
|
||||
|
|
Загрузка…
Ссылка в новой задаче