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

View File

@@ -158,7 +158,7 @@ api.createGroupPlan = {
let headers = req.headers;
let coupon = req.query.coupon;
await payments.payWithStripe([
await payments.payWithStripe({
token,
user,
gift,
@@ -167,7 +167,7 @@ api.createGroupPlan = {
email,
headers,
coupon,
]);
});
} else if (req.body.paymentType === 'Amazon') {
let billingAgreementId = req.body.billingAgreementId;
let sub = req.body.subscription ? shared.content.subscriptionBlocks[req.body.subscription] : false;
@@ -175,14 +175,14 @@ api.createGroupPlan = {
let groupId = savedGroup._id;
let headers = req.headers;
await payments.subscribeWithAmazon([
await payments.subscribeWithAmazon({
billingAgreementId,
sub,
coupon,
user,
groupId,
headers,
]);
});
}
// 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
*/
api.payWithStripe = async function payWithStripe (options, stripeInc) {
let [
let {
token,
user,
gift,
@@ -406,7 +406,7 @@ api.payWithStripe = async function payWithStripe (options, stripeInc) {
email,
headers,
coupon,
] = options;
} = options;
let response;
let subscriptionId;
// @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
*/
api.subscribeWithAmazon = async function subscribeWithAmazon (options) {
let [
let {
billingAgreementId,
sub,
coupon,
user,
groupId,
headers,
] = options;
} = options;
if (!sub) throw new BadRequest(shared.i18n.t('missingSubscriptionCode'));
if (!billingAgreementId) throw new BadRequest('Missing req.body.billingAgreementId');