Fee class

class almapiwrapper.users.Fee(fee_id: str | None = None, primary_id: str | None = None, zone: str | None = None, env: Literal['P', 'S'] | None = 'P', user: User | None = None, data: JsonData | None = None, create_fee: bool | None = False)

Bases: Record

Class representing a Users fee

Variables:
  • api_base_url_users – url of the user api

  • fee_id – id of the fee

  • zone – initial value: zone of the fee

  • env – initial value: environment of the entity: ‘P’ for production and ‘S’ for sandbox

  • useralmapiwrapper.users.User either primary_id of the user or the user itself must be provided

  • dataalmapiwrapper.record.JsonData with fee data

static api_call(method: Literal['get', 'put', 'post', 'delete'], *args, **kwargs) Response | None

Static method to handle http errors. Quit the program after 3 failed tries

Parameters:

method – ‘get’, ‘put’, ‘post’ or ‘delete’ according to the api method call

static build_headers(data_format: Literal['json', 'xml'], zone: str, area: str, rights: Literal['R', 'RW'] = 'RW', env: Literal['P', 'S'] | None = 'P') Dict

Build the headers for the API calls.

Parameters:
  • data_format – “json” or “xml”

  • zone – optional, if indicated allow to make the query in an other IZ

  • area – area of the record, bibs, users for example

  • rights – “R” for read only or “RW” for write and read rights

  • env – environment of the api call: ‘P’ for production, ‘S’ for sandbox

Returns:

dict with the headers

property data: Dict | Element | DataFrame | None

Property that get xml data with API call. If not available, make an api call

Returns:

xml data, dictionary or pandas dataframe

property fee_id: str

Property returning the fee ID

It fetches it in a private attribute if not available in the data property.

operate(op: Literal['pay', 'waive', 'dispute', 'restore'], amount: float | None = None, comment: str | None = None, method: Literal['CREDIT_CARD', 'ONLINE', 'CASH'] = None, reason: str | None = None, external_transaction_id: str | None = None)

Operate on a fee

Parameters:
  • op – can be ‘pay’, ‘waive’, ‘dispute’, ‘restore’

  • amount – optional amount. For pay and waive, it will be the balance as default value

  • comment – free text associated to the operation

  • method – for pay or waive operations, can be: ‘CREDIT_CARD’, ‘ONLINE’, ‘CASH’

  • reason – a value of FineFeeTransactionReason table. Required only for waiving fee

  • external_transaction_id – external id of the bursar system

Returns:

object almapiwrapper.users.Fee

static parse_data(data: JsonData | XmlData | Dict | str) JsonData | XmlData | None

Parse the data and return a parsed data object or None if an error occurs

Parameters:

data – data to be parsed

Returns:

parsed data object or None if an error occurs

save() Fee

Save a user fee record in the ‘records’ folder

When saved, a suffix is added to the file path with the version. Example: records/<primary_id>/fee_<IZ>_<fee_id>_<version>.xml

Returns:

object almapiwrapper.users.Fee