Replaced array deconstruction with object (#8300)

This commit is contained in:
Keith Holliday
2016-12-21 18:09:45 -06:00
committed by GitHub
parent a69b9e6705
commit afacd3e1cf
3 changed files with 13 additions and 14 deletions

View File

@@ -856,7 +856,7 @@ describe('payments/index', () => {
let headers = {}; let headers = {};
let coupon; let coupon;
await api.payWithStripe([ await api.payWithStripe({
token, token,
user, user,
gift, gift,
@@ -865,7 +865,7 @@ describe('payments/index', () => {
email, email,
headers, headers,
coupon, coupon,
], stripe); }, stripe);
expect(stripeCreateCustomerSpy.calledOnce).to.be.true; expect(stripeCreateCustomerSpy.calledOnce).to.be.true;
expect(createSubSpy.calledOnce).to.be.true; expect(createSubSpy.calledOnce).to.be.true;
@@ -899,22 +899,21 @@ describe('payments/index', () => {
api.createSubscription.restore(); api.createSubscription.restore();
}); });
it('subscribes with stripe', async () => { it('subscribes with amazon', async () => {
let billingAgreementId = 'billingAgreementId'; let billingAgreementId = 'billingAgreementId';
let sub = data.sub; let sub = data.sub;
let coupon; let coupon;
let groupId = group._id; let groupId = group._id;
let headers = {}; let headers = {};
await api.subscribeWithAmazon([ await api.subscribeWithAmazon({
billingAgreementId, billingAgreementId,
sub, sub,
coupon, coupon,
sub,
user, user,
groupId, groupId,
headers, headers,
]); });
expect(amazonSetBillingAgreementDetailsSpy.calledOnce).to.be.true; expect(amazonSetBillingAgreementDetailsSpy.calledOnce).to.be.true;
expect(amazonConfirmBillingAgreementSpy.calledOnce).to.be.true; expect(amazonConfirmBillingAgreementSpy.calledOnce).to.be.true;

View File

@@ -158,7 +158,7 @@ api.createGroupPlan = {
let headers = req.headers; let headers = req.headers;
let coupon = req.query.coupon; let coupon = req.query.coupon;
await payments.payWithStripe([ await payments.payWithStripe({
token, token,
user, user,
gift, gift,
@@ -167,7 +167,7 @@ api.createGroupPlan = {
email, email,
headers, headers,
coupon, coupon,
]); });
} else if (req.body.paymentType === 'Amazon') { } else if (req.body.paymentType === 'Amazon') {
let billingAgreementId = req.body.billingAgreementId; let billingAgreementId = req.body.billingAgreementId;
let sub = req.body.subscription ? shared.content.subscriptionBlocks[req.body.subscription] : false; let sub = req.body.subscription ? shared.content.subscriptionBlocks[req.body.subscription] : false;
@@ -175,14 +175,14 @@ api.createGroupPlan = {
let groupId = savedGroup._id; let groupId = savedGroup._id;
let headers = req.headers; let headers = req.headers;
await payments.subscribeWithAmazon([ await payments.subscribeWithAmazon({
billingAgreementId, billingAgreementId,
sub, sub,
coupon, coupon,
user, user,
groupId, groupId,
headers, headers,
]); });
} }
// Instead of populate we make a find call manually because of https://github.com/Automattic/mongoose/issues/3833 // Instead of populate we make a find call manually because of https://github.com/Automattic/mongoose/issues/3833

View File

@@ -397,7 +397,7 @@ api.buyGems = async function buyGems (data) {
* @return undefined * @return undefined
*/ */
api.payWithStripe = async function payWithStripe (options, stripeInc) { api.payWithStripe = async function payWithStripe (options, stripeInc) {
let [ let {
token, token,
user, user,
gift, gift,
@@ -406,7 +406,7 @@ api.payWithStripe = async function payWithStripe (options, stripeInc) {
email, email,
headers, headers,
coupon, coupon,
] = options; } = options;
let response; let response;
let subscriptionId; let subscriptionId;
// @TODO: We need to mock this, but curently we don't have correct Dependency Injection // @TODO: We need to mock this, but curently we don't have correct Dependency Injection
@@ -498,14 +498,14 @@ api.payWithStripe = async function payWithStripe (options, stripeInc) {
* @return undefined * @return undefined
*/ */
api.subscribeWithAmazon = async function subscribeWithAmazon (options) { api.subscribeWithAmazon = async function subscribeWithAmazon (options) {
let [ let {
billingAgreementId, billingAgreementId,
sub, sub,
coupon, coupon,
user, user,
groupId, groupId,
headers, headers,
] = options; } = options;
if (!sub) throw new BadRequest(shared.i18n.t('missingSubscriptionCode')); if (!sub) throw new BadRequest(shared.i18n.t('missingSubscriptionCode'));
if (!billingAgreementId) throw new BadRequest('Missing req.body.billingAgreementId'); if (!billingAgreementId) throw new BadRequest('Missing req.body.billingAgreementId');