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

View File

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

View File

@ -21,7 +21,7 @@ else:
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.
Stolen from:

View File

@ -117,7 +117,7 @@ Full User
"transactions": [
{
"id": 31783,
"account_type": "Paypal",
"account_type": "PayPal",
"info_source": "PayPal IPN",
"member_name": "Tanner Collin",
"date": "2019-12-22",
@ -127,7 +127,7 @@ Full User
"memo": "text",
"number_of_membership_months": null,
"payment_method": null,
"category": "Memberships:Paypal Payments",
"category": "Memberships:PayPal Payments",
"user": 113,
"recorder": null
}
@ -537,10 +537,10 @@ Create Transaction
:json date: YYYY-MM-DD
:json int member_id: Which member the transaction belongs to.
: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``
: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``
:json number_of_membership_months: Used when calculating member status and
expire date, optional.

View File

@ -118,7 +118,7 @@ for o in old:
new = {}
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)
print('Imported transaction #{} - {} {}'.format(