Skip to content

Commit

Permalink
feat(api): add 'payment frequencies' and 'pay group ids' to payment m…
Browse files Browse the repository at this point in the history
…odel (#220)
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jul 26, 2024
1 parent 919eae7 commit 81dfe50
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 36
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-15385b754979d87bd7e583f618870246e79d1430a761e5bcd653db78cfab4789.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-60f88b9ae0cedc03dd888b63ca8dec25658c87e6cc3493170114144ca9e070c9.yml
52 changes: 40 additions & 12 deletions hrispayment.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,31 @@ type Payment struct {
IndividualIDs []string `json:"individual_ids,nullable"`
NetPay Money `json:"net_pay,nullable"`
PayDate string `json:"pay_date,nullable"`
// List of pay frequencies associated with this payment.
PayFrequencies []PaymentPayFrequency `json:"pay_frequencies,nullable"`
// Array of the Finch id (uuidv4) of every pay group associated with this payment.
PayGroupIDs []string `json:"pay_group_ids,nullable"`
// The pay period object.
PayPeriod PaymentPayPeriod `json:"pay_period,nullable"`
JSON paymentJSON `json:"-"`
}

// paymentJSON contains the JSON metadata for the struct [Payment]
type paymentJSON struct {
ID apijson.Field
CompanyDebit apijson.Field
DebitDate apijson.Field
EmployeeTaxes apijson.Field
EmployerTaxes apijson.Field
GrossPay apijson.Field
IndividualIDs apijson.Field
NetPay apijson.Field
PayDate apijson.Field
PayPeriod apijson.Field
raw string
ExtraFields map[string]apijson.Field
ID apijson.Field
CompanyDebit apijson.Field
DebitDate apijson.Field
EmployeeTaxes apijson.Field
EmployerTaxes apijson.Field
GrossPay apijson.Field
IndividualIDs apijson.Field
NetPay apijson.Field
PayDate apijson.Field
PayFrequencies apijson.Field
PayGroupIDs apijson.Field
PayPeriod apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *Payment) UnmarshalJSON(data []byte) (err error) {
Expand All @@ -99,6 +105,28 @@ func (r paymentJSON) RawJSON() string {
return r.raw
}

type PaymentPayFrequency string

const (
PaymentPayFrequencyAnnually PaymentPayFrequency = "annually"
PaymentPayFrequencySemiAnnually PaymentPayFrequency = "semi_annually"
PaymentPayFrequencyQuarterly PaymentPayFrequency = "quarterly"
PaymentPayFrequencyMonthly PaymentPayFrequency = "monthly"
PaymentPayFrequencySemiMonthly PaymentPayFrequency = "semi_monthly"
PaymentPayFrequencyBiWeekly PaymentPayFrequency = "bi_weekly"
PaymentPayFrequencyWeekly PaymentPayFrequency = "weekly"
PaymentPayFrequencyDaily PaymentPayFrequency = "daily"
PaymentPayFrequencyOther PaymentPayFrequency = "other"
)

func (r PaymentPayFrequency) IsKnown() bool {
switch r {
case PaymentPayFrequencyAnnually, PaymentPayFrequencySemiAnnually, PaymentPayFrequencyQuarterly, PaymentPayFrequencyMonthly, PaymentPayFrequencySemiMonthly, PaymentPayFrequencyBiWeekly, PaymentPayFrequencyWeekly, PaymentPayFrequencyDaily, PaymentPayFrequencyOther:
return true
}
return false
}

// The pay period object.
type PaymentPayPeriod struct {
EndDate string `json:"end_date,nullable"`
Expand Down
2 changes: 1 addition & 1 deletion payrollpaygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (r PayrollPayGroupGetResponsePayFrequency) IsKnown() bool {

type PayrollPayGroupListResponse struct {
// Finch id (uuidv4) for the pay group
ID string `json:"id" format:"uuid"`
ID string `json:"id"`
// Name of the pay group
Name string `json:"name"`
// List of pay frequencies associated with this pay group
Expand Down
50 changes: 27 additions & 23 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,34 +972,38 @@ func (r providerAuthenticationMethodsSupportedFieldsPayStatementPayStatementsTax
}

type ProviderAuthenticationMethodsSupportedFieldsPayment struct {
ID bool `json:"id"`
CompanyDebit bool `json:"company_debit"`
DebitDate bool `json:"debit_date"`
EmployeeTaxes bool `json:"employee_taxes"`
EmployerTaxes bool `json:"employer_taxes"`
GrossPay bool `json:"gross_pay"`
IndividualIDs bool `json:"individual_ids"`
NetPay bool `json:"net_pay"`
PayDate bool `json:"pay_date"`
PayPeriod ProviderAuthenticationMethodsSupportedFieldsPaymentPayPeriod `json:"pay_period"`
JSON providerAuthenticationMethodsSupportedFieldsPaymentJSON `json:"-"`
ID bool `json:"id"`
CompanyDebit bool `json:"company_debit"`
DebitDate bool `json:"debit_date"`
EmployeeTaxes bool `json:"employee_taxes"`
EmployerTaxes bool `json:"employer_taxes"`
GrossPay bool `json:"gross_pay"`
IndividualIDs bool `json:"individual_ids"`
NetPay bool `json:"net_pay"`
PayDate bool `json:"pay_date"`
PayFrequencies bool `json:"pay_frequencies"`
PayGroupIDs bool `json:"pay_group_ids"`
PayPeriod ProviderAuthenticationMethodsSupportedFieldsPaymentPayPeriod `json:"pay_period"`
JSON providerAuthenticationMethodsSupportedFieldsPaymentJSON `json:"-"`
}

// providerAuthenticationMethodsSupportedFieldsPaymentJSON contains the JSON
// metadata for the struct [ProviderAuthenticationMethodsSupportedFieldsPayment]
type providerAuthenticationMethodsSupportedFieldsPaymentJSON struct {
ID apijson.Field
CompanyDebit apijson.Field
DebitDate apijson.Field
EmployeeTaxes apijson.Field
EmployerTaxes apijson.Field
GrossPay apijson.Field
IndividualIDs apijson.Field
NetPay apijson.Field
PayDate apijson.Field
PayPeriod apijson.Field
raw string
ExtraFields map[string]apijson.Field
ID apijson.Field
CompanyDebit apijson.Field
DebitDate apijson.Field
EmployeeTaxes apijson.Field
EmployerTaxes apijson.Field
GrossPay apijson.Field
IndividualIDs apijson.Field
NetPay apijson.Field
PayDate apijson.Field
PayFrequencies apijson.Field
PayGroupIDs apijson.Field
PayPeriod apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *ProviderAuthenticationMethodsSupportedFieldsPayment) UnmarshalJSON(data []byte) (err error) {
Expand Down
50 changes: 27 additions & 23 deletions webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,35 +1038,39 @@ func (r accountUpdateEventDataAuthenticationMethodSupportedFieldsPayStatementPay
}

type AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayment struct {
ID bool `json:"id"`
CompanyDebit bool `json:"company_debit"`
DebitDate bool `json:"debit_date"`
EmployeeTaxes bool `json:"employee_taxes"`
EmployerTaxes bool `json:"employer_taxes"`
GrossPay bool `json:"gross_pay"`
IndividualIDs bool `json:"individual_ids"`
NetPay bool `json:"net_pay"`
PayDate bool `json:"pay_date"`
PayPeriod AccountUpdateEventDataAuthenticationMethodSupportedFieldsPaymentPayPeriod `json:"pay_period"`
JSON accountUpdateEventDataAuthenticationMethodSupportedFieldsPaymentJSON `json:"-"`
ID bool `json:"id"`
CompanyDebit bool `json:"company_debit"`
DebitDate bool `json:"debit_date"`
EmployeeTaxes bool `json:"employee_taxes"`
EmployerTaxes bool `json:"employer_taxes"`
GrossPay bool `json:"gross_pay"`
IndividualIDs bool `json:"individual_ids"`
NetPay bool `json:"net_pay"`
PayDate bool `json:"pay_date"`
PayFrequencies bool `json:"pay_frequencies"`
PayGroupIDs bool `json:"pay_group_ids"`
PayPeriod AccountUpdateEventDataAuthenticationMethodSupportedFieldsPaymentPayPeriod `json:"pay_period"`
JSON accountUpdateEventDataAuthenticationMethodSupportedFieldsPaymentJSON `json:"-"`
}

// accountUpdateEventDataAuthenticationMethodSupportedFieldsPaymentJSON contains
// the JSON metadata for the struct
// [AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayment]
type accountUpdateEventDataAuthenticationMethodSupportedFieldsPaymentJSON struct {
ID apijson.Field
CompanyDebit apijson.Field
DebitDate apijson.Field
EmployeeTaxes apijson.Field
EmployerTaxes apijson.Field
GrossPay apijson.Field
IndividualIDs apijson.Field
NetPay apijson.Field
PayDate apijson.Field
PayPeriod apijson.Field
raw string
ExtraFields map[string]apijson.Field
ID apijson.Field
CompanyDebit apijson.Field
DebitDate apijson.Field
EmployeeTaxes apijson.Field
EmployerTaxes apijson.Field
GrossPay apijson.Field
IndividualIDs apijson.Field
NetPay apijson.Field
PayDate apijson.Field
PayFrequencies apijson.Field
PayGroupIDs apijson.Field
PayPeriod apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *AccountUpdateEventDataAuthenticationMethodSupportedFieldsPayment) UnmarshalJSON(data []byte) (err error) {
Expand Down

0 comments on commit 81dfe50

Please sign in to comment.