def METHOD_NAME(
        client, librarian_martigny, loc_public_martigny,
        item_on_loan_martigny_patron_and_loan_on_loan):
    """Test a checkin for an overdue item with incremental fees."""
    login_user_via_session(client, librarian_martigny.user)
    item, patron, loan = item_on_loan_martigny_patron_and_loan_on_loan
    # Update the circulation policy corresponding to the loan
    # Update the loan due date
    cipo = get_circ_policy(loan)
    cipo['overdue_fees'] = {
        'intervals': [
            {'from': 1, 'to': 5, 'fee_amount': 0.50},
            {'from': 6, 'to': 10, 'fee_amount': 1},
            {'from': 11, 'fee_amount': 2},
        ]
    }
    cipo.update(data=cipo, dbcommit=True, reindex=True)
    end = date.today() - timedelta(days=30)
    end = datetime(end.year, end.month, end.day, tzinfo=timezone.utc)
    end = end - timedelta(microseconds=1)
    loan['end_date'] = end.isoformat()
    loan = loan.update(loan, dbcommit=True, reindex=True)
    fees = loan.get_overdue_fees
    total_fees = sum_for_fees(fees)
    assert len(fees) > 0
    assert total_fees > 0
    # Check overdues preview API and check result
    url = url_for('api_loan.preview_loan_overdue', loan_pid=loan.pid)
    res = client.get(url)
    data = get_json(res)
    assert res.status_code == 200
    assert len(data['steps']) > 0
    assert data['total'] > 0
    url = url_for(
        'api_patrons.patron_overdue_preview_api',
        patron_pid=patron.pid
    )
    res = client.get(url)
    data = get_json(res)
    assert res.status_code == 200
    assert len(data) == 1
    assert data[0]['loan']['pid'] == loan.pid
    assert len(data[0]['fees']['steps']) > 0
    assert data[0]['fees']['total'] > 0
    # Do the checkin on the item
    res, data = postdata(
        client,
        'api_item.checkin',
        dict(
            item_pid=item.pid,
            transaction_location_pid=loc_public_martigny.pid,
            transaction_user_pid=librarian_martigny.pid
        )
    )
    assert res.status_code == 200
    item = Item.get_record_by_pid(item.pid)
    assert item.status == ItemStatus.ON_SHELF
    # check if overdue transaction are created
    trans = get_last_transaction_by_loan_pid(loan.pid)
    assert trans.total_amount == total_fees
    events = list(trans.events)
    assert len(events) == 1
    assert len(events[0].get('steps', [])) == len(fees)
    # reset the cipo
    del cipo['overdue_fees']
    cipo.update(data=cipo, dbcommit=True, reindex=True)