Skip to content

Commit

Permalink
schemas: fix patron transaction events schema
Browse files Browse the repository at this point in the history
* Fixes `patron_transaction_events` schema.
* Fixes `patron_transaction_events` ES mapping.
* Fixes loan cli according to schema updates.
* Fixes unit test/fixture

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
zannkukai committed May 13, 2020
1 parent 85448e9 commit edf5070
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion rero_ils/modules/loans/cli.py
Original file line number Diff line number Diff line change
@@ -457,7 +457,6 @@ def create_payment_record(patron_transaction, user_pid, user_library):
}
data['type'] = 'payment'
data['subtype'] = 'cash'
data['status'] = 'open'
data['amount'] = patron_transaction.get('total_amount')
data['creation_date'] = datetime.now(timezone.utc).isoformat()
return data
2 changes: 1 addition & 1 deletion rero_ils/modules/patron_transaction_events/api.py
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ def create_event_from_patron_transaction(
data['subtype'] = 'overdue'
elif patron_transaction.get('type') == 'subscription':
data['subtype'] = 'other'
data['data'] = _('Initial charge')
data['note'] = _('Initial charge')
record = cls.create(
data,
dbcommit=dbcommit,
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
"type": "object",
"title": "Patron transaction event",
"description": "JSON schema for patron transaction event.",
"additionalProperties": false,
"required": [
"$schema",
"pid",
Original file line number Diff line number Diff line change
@@ -59,6 +59,13 @@
}
}
},
"organisation": {
"properties": {
"pid": {
"type": "keyword"
}
}
},
"_created": {
"type": "date"
},
3 changes: 1 addition & 2 deletions tests/data/data.json
Original file line number Diff line number Diff line change
@@ -2404,7 +2404,6 @@
},
"operator": {
"$ref": "https://ils.rero.ch/api/patrons/ptrn1"
},
"status": "open"
}
}
}

0 comments on commit edf5070

Please sign in to comment.