Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return transaction after donate #810

Merged
merged 6 commits into from Mar 6, 2017
Merged

return transaction after donate #810

merged 6 commits into from Mar 6, 2017

Conversation

xdamman
Copy link
Contributor

@xdamman xdamman commented Feb 27, 2017

In progress.

Needed for #769

.then(subscription => models.Donation.create({
// create a new subscription
// (this needs to happen first, because of hook on Donation model)
.then(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in many places, your indentation is wrong @asood123. You should check your editor.
it makes it difficult to see in the diff what really changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing. Need to figure out how to reenable linting in editor.

@@ -46,7 +46,7 @@ const stripeDonation = (req, res, next) => {
interval
}
})
.then(() => res.send({success: true, user: req.user.info }))
.then((transaction) => res.send({success: true, user: req.user.info, transaction }))
Copy link
Member

@asood123 asood123 Feb 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put a comment above this explaining why we are returning transaction and a TODO that it needs to be reworked when we split the flow? Or add a test that will break if we split the flow.

Longer term, since this will be async, sending redirect link via email (that already goes out to confirm the donation) would be better.

@@ -94,37 +95,39 @@ export const createPayment = (payload) => {
PaymentMethodId: paymentMethod.id,
SubscriptionId: subscription && subscription.id,
ResponseId: response && response.id
}));
}))
.then(processPayment);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

processPayment needs two parameters, see afterCreate hook.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used to be processPayment(Sequelize, donation) but there is no need to pass the Sequelize object.

It doesn't seem that the stub cares about the number of arguments, so not sure where it's failing

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 80.931% when pulling 8364ead on returnTransaction into be19a1d on master.

@asood123 asood123 merged commit be745a5 into master Mar 6, 2017
@asood123 asood123 deleted the returnTransaction branch March 6, 2017 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants