From 0ca2f9034fa28418dd743d4a3b65ba6f799e15f1 Mon Sep 17 00:00:00 2001 From: SabreCat Date: Fri, 12 Jan 2018 21:15:42 +0000 Subject: [PATCH] Revert "WIP: Buy-1-Get-1 Gift Subs (#9719)" This reverts commit dc3d694d0e02343171b650c30d08d2ec83fe2934, with the exception of locale strings that need not be purged. --- test/api/v3/unit/libs/payments.test.js | 73 +--------------- .../components/payments/sendGemsModal.vue | 16 ++-- .../components/settings/subscription.vue | 5 -- website/common/locales/en/limited.json | 4 +- website/server/libs/payments.js | 87 +++++++------------ website/server/libs/slack.js | 2 +- 6 files changed, 40 insertions(+), 147 deletions(-) diff --git a/test/api/v3/unit/libs/payments.test.js b/test/api/v3/unit/libs/payments.test.js index 17b6870db0..7cb136698d 100644 --- a/test/api/v3/unit/libs/payments.test.js +++ b/test/api/v3/unit/libs/payments.test.js @@ -209,7 +209,7 @@ describe('payments/index', () => { await api.createSubscription(data); let msg = '\`Hello recipient, sender has sent you 3 months of subscription!\`'; - expect(user.sendMessage).to.be.calledTwice; + expect(user.sendMessage).to.be.calledOnce; expect(user.sendMessage).to.be.calledWith(recipient, { receiverMsg: msg, senderMsg: msg }); }); @@ -247,77 +247,6 @@ describe('payments/index', () => { }, }); }); - - context('Winter 2017-18 Gift-1-Get-1 Promotion', async () => { - it('creates a gift subscription for purchaser and recipient if none exist', async () => { - await api.createSubscription(data); - - expect(user.items.pets['Jackalope-RoyalPurple']).to.eql(5); - expect(user.purchased.plan.customerId).to.eql('Gift'); - expect(user.purchased.plan.dateTerminated).to.exist; - expect(user.purchased.plan.dateUpdated).to.exist; - expect(user.purchased.plan.dateCreated).to.exist; - - expect(recipient.items.pets['Jackalope-RoyalPurple']).to.eql(5); - expect(recipient.purchased.plan.customerId).to.eql('Gift'); - expect(recipient.purchased.plan.dateTerminated).to.exist; - expect(recipient.purchased.plan.dateUpdated).to.exist; - expect(recipient.purchased.plan.dateCreated).to.exist; - }); - - it('adds extraMonths to existing subscription for purchaser and creates a gift subscription for recipient without sub', async () => { - user.purchased.plan = plan; - - expect(user.purchased.plan.extraMonths).to.eql(0); - - await api.createSubscription(data); - - expect(user.purchased.plan.extraMonths).to.eql(3); - - expect(recipient.items.pets['Jackalope-RoyalPurple']).to.eql(5); - expect(recipient.purchased.plan.customerId).to.eql('Gift'); - expect(recipient.purchased.plan.dateTerminated).to.exist; - expect(recipient.purchased.plan.dateUpdated).to.exist; - expect(recipient.purchased.plan.dateCreated).to.exist; - }); - - it('adds extraMonths to existing subscription for recipient and creates a gift subscription for purchaser without sub', async () => { - recipient.purchased.plan = plan; - - expect(recipient.purchased.plan.extraMonths).to.eql(0); - - await api.createSubscription(data); - - expect(recipient.purchased.plan.extraMonths).to.eql(3); - - expect(user.items.pets['Jackalope-RoyalPurple']).to.eql(5); - expect(user.purchased.plan.customerId).to.eql('Gift'); - expect(user.purchased.plan.dateTerminated).to.exist; - expect(user.purchased.plan.dateUpdated).to.exist; - expect(user.purchased.plan.dateCreated).to.exist; - }); - - it('adds extraMonths to existing subscriptions for purchaser and recipient', async () => { - user.purchased.plan = plan; - recipient.purchased.plan = plan; - - expect(user.purchased.plan.extraMonths).to.eql(0); - expect(recipient.purchased.plan.extraMonths).to.eql(0); - - await api.createSubscription(data); - - expect(user.purchased.plan.extraMonths).to.eql(3); - expect(recipient.purchased.plan.extraMonths).to.eql(3); - }); - - it('sends a private message about the promotion', async () => { - await api.createSubscription(data); - let msg = '\`Hello sender, you received 3 months of subscription as part of our holiday gift-giving promotion!\`'; - - expect(user.sendMessage).to.be.calledTwice; - expect(user.sendMessage).to.be.calledWith(user, { senderMsg: msg }); - }); - }); }); context('Purchasing a subscription for self', () => { diff --git a/website/client/components/payments/sendGemsModal.vue b/website/client/components/payments/sendGemsModal.vue index fe227d2440..c1b10acf98 100644 --- a/website/client/components/payments/sendGemsModal.vue +++ b/website/client/components/payments/sendGemsModal.vue @@ -31,17 +31,11 @@ b-modal#send-gems(:title="title", :hide-footer="true", size='lg') ) h3.panel-heading {{ $t('subscription') }} .panel-body - .row - .col-md-4 - .form-group - .radio(v-for='block in subscriptionBlocks', v-if="block.target !== 'group' && block.canSubscribe === true") - label - input(type="radio", name="subRadio", :value="block.key", v-model='gift.subscription.key') - | {{ $t('sendGiftSubscription', {price: block.price, months: block.months}) }} - .col-md-8 - h4 {{ $t('winterPromoGiftHeader') }} - p {{ $t('winterPromoGiftDetails1') }} - p {{ $t('winterPromoGiftDetails2') }} + .form-group + .radio(v-for='block in subscriptionBlocks', v-if="block.target !== 'group' && block.canSubscribe === true") + label + input(type="radio", name="subRadio", :value="block.key", v-model='gift.subscription.key') + | {{ $t('sendGiftSubscription', {price: block.price, months: block.months}) }} textarea.form-control(rows='3', v-model='gift.message', :placeholder="$t('sendGiftMessagePlaceholder')") //include ../formatting-help diff --git a/website/client/components/settings/subscription.vue b/website/client/components/settings/subscription.vue index 7146df024b..b0723561cd 100644 --- a/website/client/components/settings/subscription.vue +++ b/website/client/components/settings/subscription.vue @@ -90,11 +90,6 @@ li {{ $t('giftSubscriptionText2') }} li {{ $t('giftSubscriptionText3') }} h4 {{ $t('giftSubscriptionText4') }} - .col-6 - h2 {{ $t('winterPromoGiftHeader') }} - p {{ $t('winterPromoGiftDetails1') }} - p {{ $t('winterPromoGiftDetails2') }} -