pub struct Payroll {
pub client: Client,
}
Fields§
§client: Client
Implementations§
source§impl Payroll
impl Payroll
sourcepub async fn get_company_pay_periods(
&self,
company_id_or_uuid: &str,
start_date: &str,
end_date: &str
) -> Result<Response<Vec<PayPeriod>>, ClientError>
pub async fn get_company_pay_periods( &self, company_id_or_uuid: &str, start_date: &str, end_date: &str ) -> Result<Response<Vec<PayPeriod>>, ClientError>
Get pay periods for a company.
This function performs a GET
to the /v1/companies/{company_id_or_uuid}/pay_periods
endpoint.
Pay periods are the foundation of payroll. Compensation, time & attendance, taxes, and expense reports all rely on when they happened. To begin submitting information for a given payroll, we need to agree on the time period.
By default, this endpoint returns every current and past pay period for a company. Since companies can process payroll as often as every week, there can be up to 53 pay periods a year. If a company has been running payroll with Gusto for five years, this endpoint could return up to 265 pay periods. Use the start_date
and end_date
parameters to reduce the scope of the response.
Parameters:
start_date: &str
end_date: &str
sourcepub async fn get_all_company_pay_periods(
&self,
company_id_or_uuid: &str,
start_date: &str,
end_date: &str
) -> Result<Response<Vec<PayPeriod>>, ClientError>
pub async fn get_all_company_pay_periods( &self, company_id_or_uuid: &str, start_date: &str, end_date: &str ) -> Result<Response<Vec<PayPeriod>>, ClientError>
Get pay periods for a company.
This function performs a GET
to the /v1/companies/{company_id_or_uuid}/pay_periods
endpoint.
As opposed to get_company_pay_periods
, this function returns all the pages of the request at once.
Pay periods are the foundation of payroll. Compensation, time & attendance, taxes, and expense reports all rely on when they happened. To begin submitting information for a given payroll, we need to agree on the time period.
By default, this endpoint returns every current and past pay period for a company. Since companies can process payroll as often as every week, there can be up to 53 pay periods a year. If a company has been running payroll with Gusto for five years, this endpoint could return up to 265 pay periods. Use the start_date
and end_date
parameters to reduce the scope of the response.
sourcepub async fn get_company(
&self,
company_id_or_uuid: &str,
processed: bool,
include_off_cycle: bool,
include: &[String],
start_date: &str,
end_date: &str
) -> Result<Response<Vec<PayrollData>>, ClientError>
pub async fn get_company( &self, company_id_or_uuid: &str, processed: bool, include_off_cycle: bool, include: &[String], start_date: &str, end_date: &str ) -> Result<Response<Vec<PayrollData>>, ClientError>
Get all payrolls for a company.
This function performs a GET
to the /v1/companies/{company_id_or_uuid}/payrolls
endpoint.
Returns all payrolls, current and past for a company.
Notes:
- Hour and dollar amounts are returned as string representations of numeric decimals.
- Hours are represented to the thousands place; dollar amounts are represented to the cent.
- Every eligible compensation is returned for each employee. If no data has yet be inserted for a given field, it defaults to “0.00” (for fixed amounts) or “0.000” (for hours ).
Parameters:
processed: bool
– Whether to return processed or unprocessed payrolls.include_off_cycle: bool
– Whether to include off cycle payrolls in the response.include: &[String]
– Include the requested attribute in the employee_compensations attribute in the response.start_date: &str
– Return payrolls whose pay period is after the start date.end_date: &str
– Return payrolls whose pay period is before the end date.
sourcepub async fn get_all_company(
&self,
company_id_or_uuid: &str,
processed: bool,
include_off_cycle: bool,
include: &[String],
start_date: &str,
end_date: &str
) -> Result<Response<Vec<PayrollData>>, ClientError>
pub async fn get_all_company( &self, company_id_or_uuid: &str, processed: bool, include_off_cycle: bool, include: &[String], start_date: &str, end_date: &str ) -> Result<Response<Vec<PayrollData>>, ClientError>
Get all payrolls for a company.
This function performs a GET
to the /v1/companies/{company_id_or_uuid}/payrolls
endpoint.
As opposed to get_company
, this function returns all the pages of the request at once.
Returns all payrolls, current and past for a company.
Notes:
- Hour and dollar amounts are returned as string representations of numeric decimals.
- Hours are represented to the thousands place; dollar amounts are represented to the cent.
- Every eligible compensation is returned for each employee. If no data has yet be inserted for a given field, it defaults to “0.00” (for fixed amounts) or “0.000” (for hours ).
sourcepub async fn post_company(
&self,
company_id_or_uuid: &str,
body: &PostCompanyPayrollsRequest
) -> Result<Response<PayrollData>, ClientError>
pub async fn post_company( &self, company_id_or_uuid: &str, body: &PostCompanyPayrollsRequest ) -> Result<Response<PayrollData>, ClientError>
Create an Off-Cycle Payroll (Beta).
This function performs a POST
to the /v1/companies/{company_id_or_uuid}/payrolls
endpoint.
This endpoint is in beta and intended for Gusto Embedded Payroll customers. Please apply for early access if you’d like to learn more and use it for production. Note, this endpoint will require you to enter a different agreement with Gusto.
Creates a new, unprocessed, off-cycle payroll.
sourcepub async fn get_company_payroll(
&self,
company_id_or_uuid: &str,
payroll_id_or_uuid: &str,
include: GetCompanyPayrollsInclude,
show_calculation: &str
) -> Result<Response<PayrollData>, ClientError>
pub async fn get_company_payroll( &self, company_id_or_uuid: &str, payroll_id_or_uuid: &str, include: GetCompanyPayrollsInclude, show_calculation: &str ) -> Result<Response<PayrollData>, ClientError>
Get a single payroll.
This function performs a GET
to the /v1/companies/{company_id_or_uuid}/payrolls/{payroll_id_or_uuid}
endpoint.
Returns a payroll.
Notes:
- Hour and dollar amounts are returned as string representations of numeric decimals.
- Hours are represented to the thousands place; dollar amounts are represented to the cent.
- Every eligible compensation is returned for each employee. If no data has yet be inserted for a given field, it defaults to “0.00” (for fixed amounts) or “0.000” (for hours ).
Parameters:
include: crate::types::GetCompanyPayrollsInclude
– Include the requested attribute in the employee_compensations attribute in the response.show_calculation: &str
– withinclude
, shows the tax, and/or benefit, and/or deduction details for a calculated, unprocessed payroll. .
sourcepub async fn put_company(
&self,
company_id_or_uuid: &str,
payroll_id_or_uuid: &str,
body: &PutCompanyPayrollsRequest
) -> Result<Response<PayrollData>, ClientError>
pub async fn put_company( &self, company_id_or_uuid: &str, payroll_id_or_uuid: &str, body: &PutCompanyPayrollsRequest ) -> Result<Response<PayrollData>, ClientError>
Update a payroll by ID.
This function performs a PUT
to the /v1/companies/{company_id_or_uuid}/payrolls/{payroll_id_or_uuid}
endpoint.
This endpoint allows you to update information for one or more employees for a specific unprocessed payroll.
sourcepub async fn put_company_pay_period_start_date_end(
&self,
company_id_or_uuid: &str,
pay_period_start_date: &str,
pay_period_end_date: &str,
body: &PutCompanyPayrollsRequest
) -> Result<Response<PayrollData>, ClientError>
pub async fn put_company_pay_period_start_date_end( &self, company_id_or_uuid: &str, pay_period_start_date: &str, pay_period_end_date: &str, body: &PutCompanyPayrollsRequest ) -> Result<Response<PayrollData>, ClientError>
Update a payroll.
This function performs a PUT
to the /v1/companies/{company_id_or_uuid}/payrolls/{pay_period_start_date}/{pay_period_end_date}
endpoint.
This endpoint allows you to update information for one or more employees for a specific unprocessed payroll.
The payrolls are identified by their pay periods’ start_date and end_date. Both are required and must correspond with an existing, unprocessed payroll. If the dates do not match, the entire request will be rejected. This was an explicit design decision to remove any assumptions around the timespan for data sent.
sourcepub async fn put_company_calculate(
&self,
company_id: &str,
payroll_id: &str
) -> Result<Response<()>, ClientError>
pub async fn put_company_calculate( &self, company_id: &str, payroll_id: &str ) -> Result<Response<()>, ClientError>
Calculate a Payroll (Beta).
This function performs a PUT
to the /v1/companies/{company_id}/payrolls/{payroll_id}/calculate
endpoint.
This endpoint is in beta and intended for Gusto Embedded Payroll customers. Please apply for early access if you’d like to learn more and use it for production. Note, this endpoint will require you to enter a different agreement with Gusto.
Performs calculations for taxes, benefits, and deductions for an unprocessed payroll. The calculated payroll details provide a preview of the actual values that will be used when the payroll is run.
This endpoint is asynchronous and responds with only a 202 HTTP status. To view the details of the calculated payroll, use the GET /v1/companies/{company_id}/payrolls/{payroll_id} endpoint with the show_calculation=true and include=taxes,benefits,deductions params
sourcepub async fn put_company_submit(
&self,
company_id: &str,
payroll_id: &str
) -> Result<Response<()>, ClientError>
pub async fn put_company_submit( &self, company_id: &str, payroll_id: &str ) -> Result<Response<()>, ClientError>
Submit Payroll (Beta).
This function performs a PUT
to the /v1/companies/{company_id}/payrolls/{payroll_Id}/submit
endpoint.
This endpoint is in beta and intended for Gusto Embedded Payroll customers. Please apply for early access if you’d like to learn more and use it for production. Note, this endpoint will require you to enter a different agreement with Gusto.
Submits an unprocessed payroll to be calculated and run. Upon success, transitions the payroll to the processed
state.
sourcepub async fn put_company_cancel(
&self,
company_id: &str,
payroll_id: &str
) -> Result<Response<PayrollData>, ClientError>
pub async fn put_company_cancel( &self, company_id: &str, payroll_id: &str ) -> Result<Response<PayrollData>, ClientError>
Cancel a Payroll (Beta).
This function performs a PUT
to the /v1/companies/{company_id}/payrolls/{payroll_id}/cancel
endpoint.
This endpoint is in beta and intended for Gusto Embedded Payroll customers. Please apply for early access if you’d like to learn more and use it for production. Note, this endpoint will require you to enter a different agreement with Gusto.
Transitions a processed
payroll back to the unprocessed
state. A payroll cannot be canceled once it has entered the funded
state.
sourcepub async fn get_company_or_reversals(
&self,
company_id_or_uuid: &str
) -> Result<Response<GetCompanyPayrollReversalsResponse>, ClientError>
pub async fn get_company_or_reversals( &self, company_id_or_uuid: &str ) -> Result<Response<GetCompanyPayrollReversalsResponse>, ClientError>
Get approved Payroll Reversals.
This function performs a GET
to the /v1/companies/{company_id_or_uuid}/payroll_reversals
endpoint.
Returns all approved Payroll Reversals for a Company.