Skip to content

Commit 108982f

Browse files
authored
fetching fines, fees summary and elective & subject choice endpoint added (#9)
1 parent 3b637eb commit 108982f

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

src/wrapper.js

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,55 @@ export class WebPortal {
507507
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
508508
return resp["response"];
509509
}
510+
511+
/**
512+
* Gets pending miscellaneous charges/fines for the logged-in student
513+
* @returns {Promise<Object>} The raw 'response' dict from the API.
514+
* If there are no pending payments, the API returns
515+
* status: Failure with error "NO APPROVED REQUEST FOUND".
516+
* @throws {APIError} On any non-Success responseStatus
517+
*/
518+
async get_fines_msc_charges() {
519+
const ENDPOINT = "/collectionpendingpayments/getpendingpaymentsdata";
520+
const payload = await serialize_payload({
521+
instituteid: this.session.instituteid,
522+
studentid: this.session.memberid,
523+
});
524+
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
525+
return resp["response"];
526+
}
527+
528+
/**
529+
* Gets the fee summary for the logged-in student
530+
* @returns {Promise<Object>} The raw 'response' dict from the API
531+
* @throws {APIError} On any non-Success responseStatus
532+
*/
533+
async get_fee_summary() {
534+
const ENDPOINT = "/studentfeeledger/loadfeesummary";
535+
const payload = {
536+
instituteid: this.session.instituteid,
537+
};
538+
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
539+
return resp["response"];
540+
}
541+
542+
/**
543+
* Gets subject choices for a semester
544+
* @param {Semester} semester - A Semester object
545+
* @returns {Promise<Object>} A dictionary with subject choices data
546+
* @throws {APIError} Raised for generic API error
547+
*/
548+
async get_subject_choices(semester) {
549+
const ENDPOINT = "/studentchoiceprint/getsubjectpreference";
550+
const payload = {
551+
instituteid: this.session.instituteid,
552+
studentid: this.session.memberid,
553+
registrationid: semester.registration_id,
554+
};
555+
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
556+
return resp["response"];
557+
}
558+
510559
async get_hostel_details() {
511560
const ENDPOINT = "/myhostelallocationdetail/gethostelallocationdetail";
512561
const payload = {
@@ -658,7 +707,10 @@ const authenticatedMethods = [
658707
"get_grade_card",
659708
"__get_semester_number",
660709
"get_sgpa_cgpa",
661-
"get_hostel_details", // NEWLY ADDED
710+
"get_hostel_details",
711+
"get_fines_msc_charges",
712+
"get_fee_summary",
713+
"get_subject_choices",
662714
];
663715

664716
authenticatedMethods.forEach((methodName) => {

0 commit comments

Comments
 (0)