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

Create invoice item #436

Open
wants to merge 24 commits into
base: original
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a03b657
ideal support; sry no tests yet!
Paul424 Apr 19, 2017
bae60ab
Extend webhooks required for ideal (source status) and add relevant f…
Paul424 Apr 20, 2017
c8acb98
Allow for source in update subscription
Paul424 Apr 21, 2017
c0acca1
Merge branch 'master' of github.com:Paul424/pinax-stripe
Paul424 May 29, 2017
3226b70
Merge branch 'master' of github.com:pinax/pinax-stripe
Paul424 May 29, 2017
8011951
Revert "Allow for source in update subscription"
Paul424 May 29, 2017
b9e56ed
Revert "Extend webhooks required for ideal (source status) and add re…
Paul424 May 29, 2017
810a066
Revert "ideal support; sry no tests yet!"
Paul424 May 29, 2017
4501b0d
Add action to create invoice item
Paul424 May 30, 2017
54bf5c1
Merge branch 'master' of github.com:pinax/pinax-stripe
Paul424 Oct 15, 2017
6c721ea
Merge branch 'master' into create-invoice-item
Paul424 Oct 15, 2017
95145cd
Support billing/due_date on subscription and invoice + support adding…
Paul424 Oct 19, 2017
9e472e9
Update after review
Paul424 Oct 26, 2017
9c1660c
Merge branch 'master' into create-invoice-item
Paul424 Oct 30, 2017
04a6d1c
Merge migrations
Paul424 Oct 30, 2017
3211821
Add tests
Paul424 Oct 31, 2017
975bb9b
Fix issue that subscription is not sync'ed when change made from Stri…
Paul424 Nov 6, 2017
e111401
Merge branch 'master' of github.com:pinax/pinax-stripe
Paul424 Nov 8, 2017
b586d3b
Merge branch 'master' of github.com:pinax/pinax-stripe
Paul424 Dec 5, 2017
027d1e1
Merge branch 'master' into create-invoice-item + fix migrations (0010…
Paul424 Dec 6, 2017
27bd049
Fix default in migration
Paul424 Dec 6, 2017
01c88b6
Fix new tests
Paul424 Dec 6, 2017
0c2ced3
Fix tests
Paul424 Dec 6, 2017
2e9b3ef
Revert fix migrations to enable delivery to master
Paul424 Dec 7, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Extend webhooks required for ideal (source status) and add re…
…levant fields to model"

This reverts commit bae60ab.
  • Loading branch information
Paul424 committed May 29, 2017
commit b9e56edbe09e90d5fa0e7f80b844f1a2a5c9af18
4 changes: 0 additions & 4 deletions docs/reference/webhooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ details on how to wire those up.
* `recipient.created` - Occurs whenever a recipient is created.
* `recipient.deleted` - Occurs whenever a recipient is deleted.
* `recipient.updated` - Occurs whenever a recipient is updated.
* `source.chargeable` - A Source object becomes chargeable after a customer has authenticated and verified a payment
* `source.canceled` - A Source object expired and cannot be used to create a charge
* `source.consumed` - A Source object that was single-use has already been charged
* `source.failed` - A Source object failed to become chargeable as your customer declined to authenticate the payment
* `sku.created` - Occurs whenever a SKU is created.
* `sku.updated` - Occurs whenever a SKU is updated.
* `transfer.created` - Occurs whenever a new transfer is created.
Expand Down
2 changes: 1 addition & 1 deletion pinax/stripe/actions/customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def set_default_source(customer, source):

def sync_customer(customer, cu=None):
"""
Synchronizes a local Customer object with details from the Stripe API
Syncronizes a local Customer object with details from the Stripe API

Args:
customer: a Customer object
Expand Down
8 changes: 3 additions & 5 deletions pinax/stripe/actions/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ def sync_ideal(customer, source):
"""
defaults = dict(
customer=customer,
status = source["status"] or "",
type = source["type"] or "",
usage = source["usage"] or "",
amount = utils.convert_amount_for_db(source["amount"], source["currency"]), # currency is in but in fact it's always eur
flow = source["flow"] or "",
livemode = source["livemode"],
Expand All @@ -136,6 +133,8 @@ def sync_ideal(customer, source):
redirect_return_url = source["redirect"]["return_url"] or "",
redirect_status = source["redirect"]["status"] or "",
redirect_url = source["redirect"]["url"] or "",
status = source["status"] or "",
usage =source["usage"] or "",
ideal_bank = source["ideal"]["bank"] or "",
)
o, created = models.Ideal.objects.get_or_create(
Expand All @@ -155,8 +154,7 @@ def sync_payment_source_from_stripe_data(customer, source):
"""
if source["id"].startswith("card_"):
return sync_card(customer, source)
elif source.get("type", None) == "ideal":
# ideal is created using Sources, only then will it have a type attribute
elif source["type"] == "ideal":
return sync_ideal(customer, source)
else:
return sync_bitcoin(customer, source)
Expand Down
7 changes: 3 additions & 4 deletions pinax/stripe/migrations/0008_ideal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-04-20 13:25
# Generated by Django 1.10 on 2017-04-19 14:32
from __future__ import unicode_literals

from django.db import migrations, models
Expand All @@ -20,9 +20,6 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('stripe_id', models.CharField(max_length=255, unique=True)),
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
('status', models.CharField(blank=True, max_length=32)),
('type', models.CharField(blank=True, max_length=32)),
('usage', models.CharField(blank=True, max_length=32)),
('amount', models.DecimalField(decimal_places=2, max_digits=9, null=True)),
('flow', models.CharField(max_length=32)),
('livemode', models.BooleanField(default=False)),
Expand All @@ -37,6 +34,8 @@ class Migration(migrations.Migration):
('redirect_return_url', models.URLField(max_length=1024)),
('redirect_status', models.TextField(blank=True)),
('redirect_url', models.URLField(max_length=1024)),
('status', models.TextField(blank=True)),
('usage', models.TextField(blank=True)),
('ideal_bank', models.TextField(blank=True)),
('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pinax_stripe.Customer')),
],
Expand Down
5 changes: 2 additions & 3 deletions pinax/stripe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ class BitcoinReceiver(StripeObject):
class Ideal(StripeObject):

customer = models.ForeignKey(Customer, on_delete=models.CASCADE)
status = models.CharField(max_length=32, blank=True)
type = models.CharField(max_length=32, blank=True)
usage = models.CharField(max_length=32, blank=True)
amount = models.DecimalField(decimal_places=2, max_digits=9, null=True)
flow = models.CharField(max_length=32)
livemode = models.BooleanField(default=False)
Expand All @@ -202,6 +199,8 @@ class Ideal(StripeObject):
redirect_return_url = models.URLField(max_length=1024)
redirect_status = models.TextField(blank=True)
redirect_url = models.URLField(max_length=1024)
status = models.TextField(blank=True)
usage = models.TextField(blank=True)
ideal_bank = models.TextField(blank=True)


Expand Down
29 changes: 0 additions & 29 deletions pinax/stripe/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,35 +447,6 @@ class SKUUpdatedWebhook(Webhook):
description = "Occurs whenever a SKU is updated."


class SourceWebhook(Webhook):

def process_webhook(self):
sources.sync_payment_source_from_stripe_data(
self.event.customer,
self.event.validated_message["data"]["object"]
)


class SourceChargeableWebhook(SourceWebhook):
name = "source.chargeable"
description = "A Source object becomes chargeable after a customer has authenticated and verified a payment."


class SourceCanceledWebhook(SourceWebhook):
name = "source.canceled"
description = "A Source object expired and cannot be used to create a charge."


class SourceConsumedWebhook(SourceWebhook):
name = "source.consumed"
description = "A Source object that was single-use has already been charged."


class SourceFailedWebhook(SourceWebhook):
name = "source.failed"
description = "A Source object failed to become chargeable as your customer declined to authenticate the payment."


class TransferWebhook(Webhook):

def process_webhook(self):
Expand Down