importers.nbpy2017: Don't deal with refunds.
Only one refund was actually issued, so we can deal with that manually. But the code did its job of revealing those cases and checking we were handling them well.
This commit is contained in:
parent
9d9254b69a
commit
f56571219b
2 changed files with 6 additions and 35 deletions
|
@ -82,18 +82,16 @@ class Invoice2017:
|
|||
def _read_invoice_activity(self, table, first_row_text, rows_text):
|
||||
self.actions = []
|
||||
date_wordcount = self.DATE_FMT.count(' ') + 1
|
||||
for timestamp, action, amount in rows_text:
|
||||
if action.startswith('Paid '):
|
||||
last_stripe_id = action.rsplit(None, 1)[1]
|
||||
for timestamp, description, amount in rows_text:
|
||||
if description.startswith('Paid '):
|
||||
last_stripe_id = description.rsplit(None, 1)[1]
|
||||
action = {
|
||||
'multiplier': 1,
|
||||
'payment_id': last_stripe_id,
|
||||
}
|
||||
elif action.startswith('Generated credit note '):
|
||||
action = {
|
||||
'multiplier': -1,
|
||||
'payment_id': action.rsplit(None, 1)[1],
|
||||
}
|
||||
else:
|
||||
# Refund handling could go here, if we need it.
|
||||
continue
|
||||
# Trim extraneous text like the time/a.m./p.m.
|
||||
date_words = timestamp.split(' ', date_wordcount + 1)[:date_wordcount]
|
||||
action['date'] = util.strpdate(' '.join(date_words), self.DATE_FMT)
|
||||
|
@ -141,11 +139,3 @@ class Payment2017Importer(ImporterBase):
|
|||
|
||||
def _should_yield_entry(self, entry):
|
||||
return entry['amount'] > 0
|
||||
|
||||
|
||||
class Refund2017Importer(ImporterBase):
|
||||
TEMPLATE_KEY = 'template nbpy2017 refund'
|
||||
INVOICE_CLASS = Invoice2017
|
||||
|
||||
def _should_yield_entry(self, entry):
|
||||
return entry['amount'] < 0
|
||||
|
|
|
@ -126,22 +126,3 @@
|
|||
payment_id: ch_daer0ahwoh9oDeiqu2eimoD7
|
||||
stripe_id: ch_daer0ahwoh9oDeiqu2eimoD7
|
||||
invoice_id: "11"
|
||||
|
||||
- source: nbpy2017a.html
|
||||
importer: nbpy2017.Refund2017Importer
|
||||
expect: []
|
||||
|
||||
- source: nbpy2017c.html
|
||||
importer: nbpy2017.Refund2017Importer
|
||||
expect:
|
||||
- payee: Python Person C
|
||||
date: [2017, 10, 8]
|
||||
amount: "-55.00"
|
||||
tickets_sold: "-1.0"
|
||||
ticket_rate: "21.25"
|
||||
shirts_sold: "-1.0"
|
||||
shirt_rate: "25.50"
|
||||
currency: USD
|
||||
payment_id: "31"
|
||||
stripe_id: ch_daer0ahwoh9oDeiqu2eimoD7
|
||||
invoice_id: "11"
|
||||
|
|
Loading…
Reference in a new issue