django-payments
django-payments copied to clipboard
Add base Subscribtion/recurring payments support
Changes of Payment model, that are required to implement PayU backend and recurring payments.
I could implement these changes through some mixin mandatory only for PayU backend, but I think, that those methods might be common to more backends and it would be highly usefull to have same implementation for all backends. I am willing to rewrite them bit more general shape, if requested.
Codecov Report
Attention: Patch coverage is 75.00000%
with 7 lines
in your changes are missing coverage. Please review.
Project coverage is 78.37%. Comparing base (
8303e09
) to head (20bdcf2
). Report is 2 commits behind head on main.
:exclamation: Current head 20bdcf2 differs from pull request most recent head 4f9df42. Consider uploading reports for the commit 4f9df42 to get more accurate results
Files | Patch % | Lines |
---|---|---|
payments/models.py | 73.07% | 7 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #217 +/- ##
==========================================
- Coverage 78.42% 78.37% -0.05%
==========================================
Files 29 29
Lines 1979 2007 +28
Branches 244 244
==========================================
+ Hits 1552 1573 +21
- Misses 310 317 +7
Partials 117 117
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi @patrys, I rebased this to current master, and the methods are throwing NotImplementedError
, if they can't figure out the variables from user.
Can you please give a new review? I think, it would be handy to unify these methods among providers.
Here is sample implementation of the methods that connects django-payments
to django-plans
: https://github.com/PetrDlouhy/django-plans-payments/blob/feature/recurring-payments/plans_payments/models.py
@WhyNotHugo @patrys Recently I was exploring PayPal subscription, which has completely different workflow (PayU payments are initiated from server, PayPal from the provider side).
I have reworked this completely based on your comments and also I tried to make this compatible with the provider initiated subscription, so it could be used for providers like PayPal.
This is still more proposal than done think, so I am open to suggestions how to make the whole recurring interface better.
I have rebased this PR and fixed testing. I also added the requested JSONField
.
@WhyNotHugo @patrys Could you please take a look? What needs to be done to make this merged?