Initial stripe playground

This commit is contained in:
fnux 2020-03-02 22:26:40 +01:00
commit 4ad737ed90
7 changed files with 124 additions and 3 deletions

View file

@ -143,10 +143,13 @@ class PaymentMethod(models.Model):
description = models.TextField()
primary = models.BooleanField(default=True)
# Only used for "Stripe" source
stripe_card_id = models.CharField(max_length=32, blank=True, null=True)
def charge(self, amount):
if amount > 0: # Make sure we don't charge negative amount by errors...
if self.source == 'stripe':
# TODO: wire to strip, see meooow-payv1/strip_utils.py
# TODO: wire to stripe, see meooow-payv1/strip_utils.py
payment = Payment(owner=self.owner, source=self.source, amount=amount)
payment.save() # TODO: Check return status