Notes
![]() ![]() Notes - notes.io |
/* istanbul ignore next */
const logger = require('../../lib/common/log').logger;
const EMPLOYMENT_ITEM_TYPE = require('../../lib/common/constants').employmentItemTypes;
const Controller = require('../../lib/controller');
const PuppeteerHelper = require('../../lib/helper/puppeteer.helper');
const ItemIterator = require('../../lib/iterator/item-iterator');
const EmploymentNavigator = require('../employment.navigator');
const CustomHandler = require('../mfa/emp_1pLRK6LNrrK7ySmF24GRMByzI7y.custom.handler');
const EmploymentHelper = require('../../lib/helper/employment.helper');
/**
* Insperity
*/
class Emp_1pLRK6LNrrK7ySmF24GRMByzI7y extends EmploymentNavigator {
async has_mfa(page) {
return await new CustomHandler(this.session_id).has_mfa(page);
}
async navigate_to_employment_profile(page) {
logger.info('Emp_1pLRK6LNrrK7ySmF24GRMByzI7y -> navigate_to_employment_profile - started');
this.ph = new PuppeteerHelper(page);
const profile_url = 'https://portalapps.insperity.com/MyProfile/';
const profile_elements = ['//*[text()="Personal Information"] | //*[text()="Preferred First Name"] | //*[text()="Date Of Birth"]'];
await this.ph.goto(profile_url, page, ['load'], 20000);
//Wait for Profile Elements
await this.ph.waitForXPath(profile_elements[0], page, {
visible: true,
timeout: 15000
});
return page;
}
async navigate_to_paystub_file(page) {
const paystub_url = 'https://portalapps.insperity.com/WebFocusReport/report_payhistory.aspx';
const paystub_elements = ['//*[text()="Pay History Report"]'];
await this.ph.goto(paystub_url, page, ['load'], 20000);
//Wait for Paystub Elements
await this.ph.waitForXPath(paystub_elements[0], page, {
visible: true,
timeout: 15000
});
return page;
}
async get_iterator(page, type) {
if (type === EMPLOYMENT_ITEM_TYPE.paystub_file) {
return new Emp_1pLRK6LNrrK7ySmF24GRMByzI7y_Paystub_Iterator(page, this.session_id);
}
return await super.get_iterator(page, type);
}
}
class Emp_1pLRK6LNrrK7ySmF24GRMByzI7y_Paystub_Iterator extends ItemIterator {
constructor(page, session_id) {
super(page);
this.session_id = session_id;
this.session = global.session_mgr.get_session(session_id);
this.elements = ['#company .table-checkbox', '//*[contains(text(),"Earnings")] | //*[contains(text(),"Deductions")] | //*[contains(text(),"Employee ID")]'];
}
async init() {
this.paystub_urls = await this.getPaystubUrls(this.page);
if (this.paystub_urls.length === 0) {
throw Controller.getError('general', 'notAvailable', EMPLOYMENT_ITEM_TYPE.paystub_file);
}
logger.info(`Paystub Links => ${JSON.stringify(this.paystub_urls)}`);
this.num_of_items = this.paystub_urls.length;
logger.info(`Total pages => ${this.num_of_items}`);
}
async next() {
await this.ph.goto(this.paystub_elements[this.index], this.page, ['load'], 30000);
await this.ph.waitForXPath(this.elements[1], this.page, {
timeout: 15000
});
this.index++;
return this.page;
}
async getPaystubUrls(page) {
const {
start_date,
end_date
} = new EmploymentHelper().get_paystub_range(10, 'mm/dd/yyyy');
logger.info(`Insperity -> paystub_date_range -> start_date - ${start_date}, end_date - ${end_date}`);
return await page.evaluate((selector, start_date, end_date) => {
return Array.from(document.querySelectorAll(selector)).map((el) => {
return `https://portalapps.insperity.com/epaystub/epaystub_report.aspx?rptfrmt=HTML&cpny_id=${el.getAttribute('value')}&from_date=${start_date}&to_date=${end_date}`;
});
}, this.elements[0], start_date, end_date);
}
}
module.exports = Emp_1pLRK6LNrrK7ySmF24GRMByzI7y;
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team