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

Creates StripeRefund event publishing #17

Conversation

clarissalimab
Copy link

Closes tix #2977

@clarissalimab
Copy link
Author

@wwahammy can you update your branch with houdini/main? I had to make mine even with it because I needed some things that were only there.

@clarissalimab clarissalimab force-pushed the feature/event-publisher/stripe-refund branch from 5c06c57 to 09362ec Compare June 21, 2021 19:05
@wwahammy wwahammy force-pushed the feature/event-publisher/stripe-refund branch from 2142704 to 21afcec Compare June 21, 2021 21:09
@wwahammy
Copy link
Owner

Rebased!

@wwahammy
Copy link
Owner

For this one, we need to also test InsertRefunds.with_stripe fires the proper events as well.

@clarissalimab clarissalimab force-pushed the feature/event-publisher/stripe-refund branch 2 times, most recently from 7271db8 to 675742c Compare June 23, 2021 14:51
# @refund_amount = 100
# @fees = CalculateFees.for_single_amount(100)
# end
describe InsertRefunds do
Copy link
Author

Choose a reason for hiding this comment

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

@wwahammy, when I started to work on the tests for the event publishing on InsertRefunds.with_stripe, I saw that those tests were pending for a long time, so I tried to update them a little to work with the current behavior. I think the calculations for the refund aren't right so I just "xit" the tests, but I can update the class to work properly since I'm already working on things here.

Copy link
Owner

Choose a reason for hiding this comment

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

@clarissalimab This is a good idea to get these tests working!

I'm not sure I understand exactly what you're saying. In particular:

  • What calculations aren't right?
  • When you say "I can update the class to work properly since I'm already working on things here" what does this all refer to?

Copy link
Author

Choose a reason for hiding this comment

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

What calculations aren't right?

I think the calculation for the refund isn't updated, actually I'm not sure if it isn't right, but I looked at the calculation in CC and it's different.

When you say "I can update the class to work properly since I'm already working on things here" what does this all refer to?

I had to add some code to it to make it work with transactions. I meant that if the calculation is wrong I can work on it to have it working as we want it to.

Copy link
Owner

Choose a reason for hiding this comment

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

Hmmm. I'm still not sure I understand what 'calculation for the refund' you're referring to.

Copy link
Author

Choose a reason for hiding this comment

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

Because when we do the refund, there is a calculation for the fee, I thought it could be outdated because the tests were pending (and failing) for a long time. I updated the tests to work with the current behavior, but I think the correct thing to do would be to understand how the calculations should be and write the tests with that in mind instead.

@wwahammy wwahammy force-pushed the feature/event-publisher/stripe-refund branch from 21afcec to 44fabbe Compare June 23, 2021 16:06
@wwahammy
Copy link
Owner

wwahammy commented Jul 6, 2021

@clarissalimab what's the status here?

@clarissalimab
Copy link
Author

@wwahammy I realized I forgot to update the tests as we discussed, I'm going to do it later and let you know.

@clarissalimab clarissalimab force-pushed the feature/event-publisher/stripe-refund branch 2 times, most recently from b93b881 to 4039b9f Compare July 8, 2021 21:14
@clarissalimab clarissalimab requested a review from wwahammy July 8, 2021 21:24
@clarissalimab clarissalimab marked this pull request as ready for review July 8, 2021 21:24
Copy link
Owner

@wwahammy wwahammy left a comment

Choose a reason for hiding this comment

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

Great work as always @clarissalimab

The tests are currently failing and there's a few things in the comments that need addressing. It's like 90% of the way there though I think.

.rubocop.yml Show resolved Hide resolved
app/models/stripe_charge.rb Show resolved Hide resolved
Comment on lines 16 to 18
delegated_type :paymentable,
types: %w[OfflineTransactionCharge OfflineTransactionDispute OfflineTransactionRefund StripeCharge
StripeRefund]
Copy link
Owner

Choose a reason for hiding this comment

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

Try to split the types onto separate lines so we don't end up with those weird spacing issues

lib/insert/insert_refunds.rb Show resolved Hide resolved

refund = Refund.find(refund_row['id'])
refund_payment = Payment.find(payment_row['id'])
refund_payment.update(refund: refund)
Copy link
Owner

Choose a reason for hiding this comment

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

What's this line for?

Copy link
Author

Choose a reason for hiding this comment

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

I forgot to remove it, just did it

lib/insert/insert_refunds.rb Show resolved Hide resolved
lib/insert/insert_refunds.rb Show resolved Hide resolved
@clarissalimab clarissalimab force-pushed the feature/event-publisher/stripe-refund branch from 4039b9f to d7b95a5 Compare July 9, 2021 19:42
@clarissalimab clarissalimab force-pushed the feature/event-publisher/stripe-refund branch from d7b95a5 to 022cf91 Compare July 9, 2021 21:28
@clarissalimab clarissalimab requested a review from wwahammy July 9, 2021 21:28
Copy link
Owner

@wwahammy wwahammy left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@wwahammy wwahammy merged this pull request into wwahammy:feature/event-publisher/stripe-refund Jul 12, 2021
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.

2 participants