Skip to content
This repository was archived by the owner on Jan 25, 2018. It is now read-only.

Commit 675eded

Browse files
committed
Merge pull request #221 from davidbgk/833445-removing-issuer-notice
Removing Issuer and Notice models (bug 833445)
2 parents 4974641 + af391ff commit 675eded

File tree

12 files changed

+18
-195
lines changed

12 files changed

+18
-195
lines changed

lib/solitude/api.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from ..utils import SlumberWrapper
1010
from .constants import ACCESS_PURCHASE
1111
from .errors import ERROR_STRINGS
12-
from webpay.pay.models import Issuer
1312

1413

1514
log = logging.getLogger('w.solitude')
@@ -273,10 +272,6 @@ def get_transaction(self, uuid):
273272
notes = transaction['notes']
274273
if notes:
275274
transaction['notes'] = json.loads(notes)
276-
issuer = transaction['notes'].get('issuer')
277-
if issuer:
278-
# If there's an issuer there, get it.
279-
transaction['notes']['issuer'] = Issuer.objects.get(pk=issuer)
280275
return transaction
281276

282277

lib/solitude/tests.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from lib.solitude.api import client, SellerNotConfigured
1212
from lib.solitude.errors import ERROR_STRINGS
13-
from webpay.pay.models import Issuer
1413

1514

1615
class SolitudeAPITest(TestCase):
@@ -234,11 +233,3 @@ def test_notes_transactions(self, slumber):
234233
}
235234
trans = client.get_transaction('x')
236235
eq_(trans['notes'], {'foo': 'bar'})
237-
238-
def test_notes_issuer_transactions(self, slumber):
239-
iss = Issuer.objects.create()
240-
slumber.generic.transaction.get_object.return_value = {
241-
'notes': json.dumps({'issuer': iss.pk})
242-
}
243-
trans = client.get_transaction('x')
244-
eq_(trans['notes']['issuer'], iss)

migrations/012-drop-notices.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE `notices`;

migrations/013-drop-issuers.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE `issuers`;

webpay/pay/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
NOT_SIMULATED = 0
2+
SIMULATED_POSTBACK = 1
3+
SIMULATED_CHARGEBACK = 2

webpay/pay/fields.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from django.db import models
2+
3+
4+
class BlobField(models.Field):
5+
"""
6+
MySQL blob column.
7+
"""
8+
description = "blob"
9+
10+
def db_type(self, **kw):
11+
return 'blob'

webpay/pay/models.py

Lines changed: 0 additions & 121 deletions
This file was deleted.

webpay/pay/tasks.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
from webpay.base.helpers import absolutify
2222
from webpay.constants import TYP_CHARGEBACK, TYP_POSTBACK
23-
from .models import (Notice, NOT_SIMULATED, SIMULATED_POSTBACK,
24-
SIMULATED_CHARGEBACK)
23+
from .constants import NOT_SIMULATED, SIMULATED_POSTBACK, SIMULATED_CHARGEBACK
2524
from .utils import send_pay_notice, trans_id
2625

2726
log = logging.getLogger('w.pay.tasks')
@@ -361,13 +360,6 @@ def _notify(notifier_task, trans, extra_response=None, simulated=NOT_SIMULATED,
361360
success, last_error = send_pay_notice(url, trans['type'], signed_notice,
362361
trans['uuid'], notifier_task,
363362
task_args, simulated=simulated)
364-
s = Notice._meta.get_field_by_name('last_error')[0].max_length
365-
last_error = last_error[:s] # truncate to fit
366-
Notice.objects.create(transaction_uuid=trans['uuid'],
367-
success=success,
368-
url=url,
369-
simulated=simulated,
370-
last_error=last_error)
371363

372364

373365
def _prepare_notice(trans):

webpay/pay/tests/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from lib.solitude import constants
77

88
from webpay.base.tests import BasicSessionCase
9-
from webpay.pay.models import Issuer, ISSUER_ACTIVE
109
from webpay.pay.samples import JWTtester
1110

1211
sample = os.path.join(os.path.dirname(__file__), 'sample.key')
@@ -19,7 +18,6 @@ def setUp(self):
1918
self.url = reverse('pay.lobby')
2019
self.key = 'public.key'
2120
self.secret = 'private.secret'
22-
self.create()
2321

2422
def get(self, payload):
2523
return self.client.get('%s?req=%s' % (self.url, payload))
@@ -35,14 +33,6 @@ def request(self, **kw):
3533
kw.setdefault('app_secret', settings.SECRET)
3634
return super(Base, self).request(**kw)
3735

38-
def create(self, key=None, secret=None):
39-
key = key or self.key
40-
secret = secret or self.secret
41-
self.iss = Issuer.objects.create(issuer_key=key,
42-
status=ISSUER_ACTIVE)
43-
with self.settings(INAPP_KEY_PATHS={None: sample}, DEBUG=True):
44-
self.iss.set_private_key(secret)
45-
4636
def set_secret(self, get_active_product):
4737
get_active_product.return_value = {
4838
'secret': self.secret,

webpay/pay/tests/test_forms.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from nose.tools import eq_
1010

1111
from webpay.pay.forms import VerifyForm
12-
from webpay.pay.models import ISSUER_INACTIVE
1312

1413
from . import Base, sample
1514

@@ -89,8 +88,6 @@ def test_not_public(self):
8988
# an active status in solitude.
9089
raise SkipTest
9190

92-
self.iss.status = ISSUER_INACTIVE
93-
self.iss.save()
9491
payload = self.request(iss=self.key, app_secret=self.secret)
9592
with self.settings(INAPP_KEY_PATHS={None: sample}, DEBUG=True):
9693
form = VerifyForm({'req': payload})

0 commit comments

Comments
 (0)