Commit c6fedf71 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Vincent A

[trainline] handle carrier_invoice as a purchase

carrier_invoice comes along with another "proof", a purchase, but the
CapDocument model doesn't exactly fit the trainline model. So we make it
a Bill, in order to be able to download the pdf.
parent 0ab82a57
......@@ -62,10 +62,14 @@ class DocumentsPage(LoggedPage, JsonPage):
'currency': pnr['currency'] or '', # because pnr['currency'] can be None
}
assert proof['type'] in ('purchase', 'refund'), proof['type']
if proof['type'] == 'purchase':
assert proof['type'] in ('purchase', 'refund', 'carrier_invoice'), proof['type']
if proof['type'] in ('purchase', 'carrier_invoice'):
# pnr['cents'] is 0 if this purchase has a refund, but there is nowhere to take it
# except make an addition, but we don't do that
# carrier_invoice comes along with a purchase
# typically when travel is in a foreign country
bill['price'] = pnr['cents']
bills.append(bill)
else: # proof['type'] == 'refund'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment