Struct gusto_api::payroll::Payroll

source ·
pub struct Payroll {
    pub client: Client,
}

Fields§

§client: Client

Implementations§

source§

impl Payroll

source

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
source

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.

source

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.
source

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 ).
source

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.

source

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 – with include, shows the tax, and/or benefit, and/or deduction details for a calculated, unprocessed payroll. .
source

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.

source

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.

source

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

source

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.

source

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.

source

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.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more