diff --git a/apiserver/apiserver/api/serializers.py b/apiserver/apiserver/api/serializers.py index 2dbbf85..12550bf 100644 --- a/apiserver/apiserver/api/serializers.py +++ b/apiserver/apiserver/api/serializers.py @@ -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 diff --git a/apiserver/apiserver/api/tests.py b/apiserver/apiserver/api/tests.py index 76ad405..ffc5644 100644 --- a/apiserver/apiserver/api/tests.py +++ b/apiserver/apiserver/api/tests.py @@ -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' diff --git a/apiserver/apiserver/api/utils_paypal.py b/apiserver/apiserver/api/utils_paypal.py index 1a6d426..990379e 100644 --- a/apiserver/apiserver/api/utils_paypal.py +++ b/apiserver/apiserver/api/utils_paypal.py @@ -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: diff --git a/apiserver/docs/source/api.rst b/apiserver/docs/source/api.rst index c98b822..b016cd9 100644 --- a/apiserver/docs/source/api.rst +++ b/apiserver/docs/source/api.rst @@ -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. diff --git a/apiserver/import_old_portal.py b/apiserver/import_old_portal.py index 734c80d..5d5bc29 100755 --- a/apiserver/import_old_portal.py +++ b/apiserver/import_old_portal.py @@ -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(