Closed Bark-fa closed 3 months ago
I see the CI has failed but for some reason, I cannot see why, it shows a generic "blocked" message, is it some geo-restriction?
I managed to access it with a VPN, all style issues have been fixed
Can you remove all of your idea settings from this PR? Thanks!
Ah yes, sorry about that I thought they'd be in the .gitignore!
done @driesvints
@driesvints Do you need me to delete them from the previous commit history too?
@Bark-fa no that's okay. This PR will get squashed anyway.
Hello @driesvints, I'm reaching out because I noticed the PR is still in draft, I know you must be very busy, so if the PR needs any more work or if I missed anything in the docs please let me know and I'll gladly take it off your hands, I've got plenty of time this week.
Thanks!
@Bark-fa sorry, needed a bit to have a thorough look here. I completely refactored all of this to be on a new trait on the billable. It's not needed for usage based billing to live closely to a subscription or subscription item. I've revised the API's and simplified things.
The downside of this is that the written tests aren't applicable anymore. Could you rewrite those into a new UsageBasedBillingTest.php
file? Then I believe this PR will be ready for review.
Done, I refactored the new tests into UsageBasedBillingTest.php
and removed them from the old file.
Let me know if anything else comes up, thank you so much!
And regarding the new trait, I agree it's a better approach, I didn't allow myself the freedom to create new files though so I just wrote the functions where the old (now deprecated) code was 😅
Done. Thanks a bunch for this one @Bark-fa. Would also highly appreciate a PR to the docs!
Hello @driesvints, you're very much welcome, I just submitted a PR for the docs
@Bark-fa did you try these tests? Because they're failing atm.
Hello @driesvints, what tests specifically? I tried all the tests I wrote, and the old ones as well, and all ran with success, which ones are failing?
I just checked, I think the problem was caused by this line:
$startTime = $options['start_time'] ?? $this->created_at->timestamp;
This used to be in the Subscription class, so the logic was that if the user did not provide a start time, we'd set it to the date the subscription was created, but when it was moved to a trait, $this references the User model, this should fix it:
$startTime = $options['start_time'] ?? 1;
I pushed it to my fork
Can you send in a PR? Thanks!
Of course, on it
Hello! This PR adds support for the new event meters by stripe for tracking usage in usage-based subscriptions, this is my first time contributing to cashier, and I've made every effort to maintain the style and naming conventions, and everything is fully typed, please let me know if I missed something either in the code itself or the tests.
Thank you so much for your time and effort.