Enforce correct capitalization of PayPal

This commit is contained in:
Tanner Collin 2020-02-01 07:39:02 +00:00
parent beb9072291
commit 5a6e7914c9
5 changed files with 8 additions and 10 deletions

View File

@ -14,7 +14,6 @@ class TransactionSerializer(serializers.ModelSerializer):
account_type = serializers.ChoiceField([ account_type = serializers.ChoiceField([
'Interac', 'Interac',
'TD Chequing', 'TD Chequing',
'Paypal',
'Dream Pmt', 'Dream Pmt',
'PayPal', 'PayPal',
'Square Pmt', 'Square Pmt',
@ -28,7 +27,6 @@ class TransactionSerializer(serializers.ModelSerializer):
'System', 'System',
'Receipt or Stmt', 'Receipt or Stmt',
'Quicken Import', 'Quicken Import',
'Paypal IPN',
'PayPal IPN', 'PayPal IPN',
'Auto', 'Auto',
'Nexus DB Bulk', 'Nexus DB Bulk',
@ -44,7 +42,7 @@ class TransactionSerializer(serializers.ModelSerializer):
'Unmatched Member', 'Unmatched Member',
'Unmatched Purchase', 'Unmatched Purchase',
'User Flagged', 'User Flagged',
], allow_null=True) ], allow_null=True, required=False)
class Meta: class Meta:
model = models.Transaction model = models.Transaction

View File

@ -350,7 +350,7 @@ class TestTallyMembership(TestCase):
self.assertEqual(result, False) self.assertEqual(result, False)
class TestParsePaypalDate(TestCase): class TestParsePayPalDate(TestCase):
def test_parse(self): def test_parse(self):
string = '20:12:59 Jan 13, 2009 PST' string = '20:12:59 Jan 13, 2009 PST'

View File

@ -21,7 +21,7 @@ else:
def parse_paypal_date(string): def parse_paypal_date(string):
''' '''
Convert paypal date string into python datetime. Paypal's a bunch of idiots. Convert paypal date string into python datetime. PayPal's a bunch of idiots.
Their API returns dates in some custom format, so we have to parse it. Their API returns dates in some custom format, so we have to parse it.
Stolen from: Stolen from:

View File

@ -117,7 +117,7 @@ Full User
"transactions": [ "transactions": [
{ {
"id": 31783, "id": 31783,
"account_type": "Paypal", "account_type": "PayPal",
"info_source": "PayPal IPN", "info_source": "PayPal IPN",
"member_name": "Tanner Collin", "member_name": "Tanner Collin",
"date": "2019-12-22", "date": "2019-12-22",
@ -127,7 +127,7 @@ Full User
"memo": "text", "memo": "text",
"number_of_membership_months": null, "number_of_membership_months": null,
"payment_method": null, "payment_method": null,
"category": "Memberships:Paypal Payments", "category": "Memberships:PayPal Payments",
"user": 113, "user": 113,
"recorder": null "recorder": null
} }
@ -537,10 +537,10 @@ Create Transaction
:json date: YYYY-MM-DD :json date: YYYY-MM-DD
:json int member_id: Which member the transaction belongs to. :json int member_id: Which member the transaction belongs to.
:json decimal amount: Positive is money going to Protospace, XX.XX. :json decimal amount: Positive is money going to Protospace, XX.XX.
:json account_type: One of: ``Interac``, ``TD Chequing``, ``Paypal``, ``Dream Pmt``, :json account_type: One of: ``Interac``, ``TD Chequing``, ``Dream Pmt``,
``PayPal``, ``Square Pmt``, ``Member``, ``Clearing``, ``Cash`` ``PayPal``, ``Square Pmt``, ``Member``, ``Clearing``, ``Cash``
:json info_source: One of: ``Web``, ``DB Edit``, ``System``, ``Receipt or Stmt``, ``Quicken :json info_source: One of: ``Web``, ``DB Edit``, ``System``, ``Receipt or Stmt``, ``Quicken
Import``, ``Paypal IPN``, ``PayPal IPN``, ``Auto``, ``Nexus DB Bulk``, ``IPN Trigger``, Import``, ``PayPal IPN``, ``Auto``, ``Nexus DB Bulk``, ``IPN Trigger``,
``Intranet Receipt``, ``Automatic``, ``Manual`` ``Intranet Receipt``, ``Automatic``, ``Manual``
:json number_of_membership_months: Used when calculating member status and :json number_of_membership_months: Used when calculating member status and
expire date, optional. expire date, optional.

View File

@ -118,7 +118,7 @@ for o in old:
new = {} new = {}
for f in TRANSACTION_FIELDS: for f in TRANSACTION_FIELDS:
new[f] = o.__dict__.get(f, None) new[f] = o.__dict__.get(f, None).replace('Paypal', 'PayPal')
models.Transaction.objects.create(**new) models.Transaction.objects.create(**new)
print('Imported transaction #{} - {} {}'.format( print('Imported transaction #{} - {} {}'.format(