mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
3361 lines
116 KiB
Go
3361 lines
116 KiB
Go
/*
|
|
Hanzo Cloud API
|
|
|
|
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
|
|
API version: v1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hanzoai
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
// TaxAPIService TaxAPI service
|
|
type TaxAPIService service
|
|
|
|
type TaxAPIGetTaxFilingsRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
}
|
|
|
|
func (r TaxAPIGetTaxFilingsRequest) Execute() (*TaxFilingList, *http.Response, error) {
|
|
return r.ApiService.GetTaxFilingsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxFilings Lists the caller org's IRS return exports and where each stands, without their files.
|
|
|
|
Lists the caller org's IRS return exports and where each stands, without their
|
|
files. Org admins only.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIGetTaxFilingsRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxFilings(ctx context.Context) TaxAPIGetTaxFilingsRequest {
|
|
return TaxAPIGetTaxFilingsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxFilingList
|
|
func (a *TaxAPIService) GetTaxFilingsExecute(r TaxAPIGetTaxFilingsRequest) (*TaxFilingList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxFilingList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxFilings")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/filings"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxFilingsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIGetTaxFilingsByIdRequest) Execute() (*TaxFiling, *http.Response, error) {
|
|
return r.ApiService.GetTaxFilingsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxFilingsById Reads one IRS return export WITH its files, rebuilt from the sealed forms and proven identical to what was exported.
|
|
|
|
Reads one IRS return export WITH its files, rebuilt from the sealed forms and
|
|
proven identical to what was exported. The files carry full TINs: org admins of
|
|
the payer only — a SuperAdmin is refused — and every read is on the audit trail.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the filing id, \"iris_\"-prefixed.
|
|
@return TaxAPIGetTaxFilingsByIdRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxFilingsById(ctx context.Context, id string) TaxAPIGetTaxFilingsByIdRequest {
|
|
return TaxAPIGetTaxFilingsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxFiling
|
|
func (a *TaxAPIService) GetTaxFilingsByIdExecute(r TaxAPIGetTaxFilingsByIdRequest) (*TaxFiling, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxFiling
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxFilingsById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/filings/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxFormsRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
year *int64
|
|
}
|
|
|
|
// Year narrows the list to one tax year; absent lists every year.
|
|
func (r TaxAPIGetTaxFormsRequest) Year(year int64) TaxAPIGetTaxFormsRequest {
|
|
r.year = &year
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIGetTaxFormsRequest) Execute() (*TaxFormList, *http.Response, error) {
|
|
return r.ApiService.GetTaxFormsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxForms Lists the 1099s the caller org prepared as payer, oldest first, voided and superseded ones included — a return that was furnished stays on the record.
|
|
|
|
Lists the 1099s the caller org prepared as payer, oldest first, voided and
|
|
superseded ones included — a return that was furnished stays on the record.
|
|
Org admins only.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIGetTaxFormsRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxForms(ctx context.Context) TaxAPIGetTaxFormsRequest {
|
|
return TaxAPIGetTaxFormsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxFormList
|
|
func (a *TaxAPIService) GetTaxFormsExecute(r TaxAPIGetTaxFormsRequest) (*TaxFormList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxFormList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxForms")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.year != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "year", r.year, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxFormsByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIGetTaxFormsByIdRequest) Execute() (*TaxForm, *http.Response, error) {
|
|
return r.ApiService.GetTaxFormsByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxFormsById Reads one 1099 the caller org prepared as payer, every box and both parties, TINs masked.
|
|
|
|
Reads one 1099 the caller org prepared as payer, every box and both parties,
|
|
TINs masked. Org admins only; another org's form is not found.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the form id, \"f1099_\"-prefixed.
|
|
@return TaxAPIGetTaxFormsByIdRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxFormsById(ctx context.Context, id string) TaxAPIGetTaxFormsByIdRequest {
|
|
return TaxAPIGetTaxFormsByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxForm
|
|
func (a *TaxAPIService) GetTaxFormsByIdExecute(r TaxAPIGetTaxFormsByIdRequest) (*TaxForm, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxForm
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxFormsById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxFormsByIdPdfRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIGetTaxFormsByIdPdfRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetTaxFormsByIdPdfExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxFormsByIdPdf Download a 1099 the org prepared, as a PDF
|
|
|
|
Answers one 1099 the caller org prepared as payer as a one-page PDF — `application/pdf` under a Content-Disposition naming the form — rendered from the form's own content: the payer's copy by default, or Copy B (For Recipient) with `?copy=B` for a statement owed on paper. The recipient's TIN is truncated; the payer's prints in full, as the law requires on every form.
|
|
|
|
The render is a pure function of the form, so the same form renders the same bytes every time. Org admins only; another org's form is not found. It files nothing and mails nothing.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@return TaxAPIGetTaxFormsByIdPdfRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxFormsByIdPdf(ctx context.Context, id string) TaxAPIGetTaxFormsByIdPdfRequest {
|
|
return TaxAPIGetTaxFormsByIdPdfRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TaxAPIService) GetTaxFormsByIdPdfExecute(r TaxAPIGetTaxFormsByIdPdfRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxFormsByIdPdf")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms/{id}/pdf"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxInboxRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
year *int64
|
|
}
|
|
|
|
// Year narrows the list to one tax year; absent lists every year.
|
|
func (r TaxAPIGetTaxInboxRequest) Year(year int64) TaxAPIGetTaxInboxRequest {
|
|
r.year = &year
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIGetTaxInboxRequest) Execute() (*TaxStatementList, *http.Response, error) {
|
|
return r.ApiService.GetTaxInboxExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxInbox Lists the Copy B statements furnished to the caller org — every 1099 a payer on Hanzo delivered to it electronically, corrected ones beside the ones they supersede.
|
|
|
|
Lists the Copy B statements furnished to the caller org — every 1099 a payer on
|
|
Hanzo delivered to it electronically, corrected ones beside the ones they
|
|
supersede. Any member may read it; nothing here can be changed or removed.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIGetTaxInboxRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxInbox(ctx context.Context) TaxAPIGetTaxInboxRequest {
|
|
return TaxAPIGetTaxInboxRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxStatementList
|
|
func (a *TaxAPIService) GetTaxInboxExecute(r TaxAPIGetTaxInboxRequest) (*TaxStatementList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxStatementList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxInbox")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/inbox"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.year != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "year", r.year, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxInboxByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIGetTaxInboxByIdRequest) Execute() (*TaxStatement, *http.Response, error) {
|
|
return r.ApiService.GetTaxInboxByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxInboxById Reads one Copy B furnished to the caller org.
|
|
|
|
Reads one Copy B furnished to the caller org. Any member may read it; another
|
|
org's statement is not found.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the form id, \"f1099_\"-prefixed.
|
|
@return TaxAPIGetTaxInboxByIdRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxInboxById(ctx context.Context, id string) TaxAPIGetTaxInboxByIdRequest {
|
|
return TaxAPIGetTaxInboxByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxStatement
|
|
func (a *TaxAPIService) GetTaxInboxByIdExecute(r TaxAPIGetTaxInboxByIdRequest) (*TaxStatement, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxStatement
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxInboxById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/inbox/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxInboxByIdPdfRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIGetTaxInboxByIdPdfRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetTaxInboxByIdPdfExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxInboxByIdPdf Download a Copy B furnished to the org, as a PDF
|
|
|
|
Answers one Copy B furnished to the caller org as a one-page PDF — `application/pdf` under a Content-Disposition naming the form — rendered from the statement exactly as it was furnished, which can never change. The recipient's own TIN is truncated; the payer's prints in full.
|
|
|
|
Any member of the recipient org may download it; another org's statement is not found.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id
|
|
@return TaxAPIGetTaxInboxByIdPdfRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxInboxByIdPdf(ctx context.Context, id string) TaxAPIGetTaxInboxByIdPdfRequest {
|
|
return TaxAPIGetTaxInboxByIdPdfRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TaxAPIService) GetTaxInboxByIdPdfExecute(r TaxAPIGetTaxInboxByIdPdfRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxInboxByIdPdf")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/inbox/{id}/pdf"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxPaymentsRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
year *int64
|
|
}
|
|
|
|
// Year is the calendar year the payments were made in, e.g. 2026.
|
|
func (r TaxAPIGetTaxPaymentsRequest) Year(year int64) TaxAPIGetTaxPaymentsRequest {
|
|
r.year = &year
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIGetTaxPaymentsRequest) Execute() (*TaxLedger, *http.Response, error) {
|
|
return r.ApiService.GetTaxPaymentsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxPayments Returns the caller org's tax year as a PAYER: every payment it made to another org in that calendar year, on any rail, as the event plane records it, each classified — reportable or not, in which 1099 box, and the rule that decided it, with its source — and each payee's totals tested against the year's threshold.
|
|
|
|
Returns the caller org's tax year as a PAYER: every payment it made to another
|
|
org in that calendar year, on any rail, as the event plane records it, each
|
|
classified — reportable or not, in which 1099 box, and the rule that decided it,
|
|
with its source — and each payee's totals tested against the year's threshold.
|
|
|
|
The rules applied: a payment settled by a card or a third-party settlement
|
|
network is reported on Form 1099-K by the settlement entity, not here; a payment
|
|
for merchandise is not reported; a payment to a corporation is generally not
|
|
reported, except for legal services; a payment in a digital asset is reported at
|
|
its fair market value on the date paid; a box is reported only at or above the
|
|
year's threshold — $600 through 2025, $2,000 for 2026 under P.L. 119-21, and not
|
|
guessed for a year the IRS has not yet published. A payee's classification comes
|
|
only from a W-9 it granted the caller; without one, nothing establishes an
|
|
exemption.
|
|
|
|
Org admins only. It reads; it prepares nothing and files nothing.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIGetTaxPaymentsRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxPayments(ctx context.Context) TaxAPIGetTaxPaymentsRequest {
|
|
return TaxAPIGetTaxPaymentsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxLedger
|
|
func (a *TaxAPIService) GetTaxPaymentsExecute(r TaxAPIGetTaxPaymentsRequest) (*TaxLedger, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxLedger
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxPayments")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/payments"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.year != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "year", r.year, "form", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxProfileRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
}
|
|
|
|
func (r TaxAPIGetTaxProfileRequest) Execute() (*TaxProfile, *http.Response, error) {
|
|
return r.ApiService.GetTaxProfileExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxProfile Returns the caller org's own tax profile — every line of its Form W-9, W-8BEN or W-8BEN-E, every number masked to its last four characters, where the certification stands, whether a W-8 is valid and when it expires, and whether the org consents to receive its 1099s electronically.
|
|
|
|
Returns the caller org's own tax profile — every line of its Form W-9, W-8BEN or
|
|
W-8BEN-E, every number masked to its last four characters, where the
|
|
certification stands, whether a W-8 is valid and when it expires, and whether
|
|
the org consents to receive its 1099s electronically.
|
|
|
|
Any member may read it. 404 until an admin writes one. No full number is ever in
|
|
this answer.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIGetTaxProfileRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxProfile(ctx context.Context) TaxAPIGetTaxProfileRequest {
|
|
return TaxAPIGetTaxProfileRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxProfile
|
|
func (a *TaxAPIService) GetTaxProfileExecute(r TaxAPIGetTaxProfileRequest) (*TaxProfile, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxProfile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxProfile")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/profile"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxW9Request struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
}
|
|
|
|
func (r TaxAPIGetTaxW9Request) Execute() (*TaxW9List, *http.Response, error) {
|
|
return r.ApiService.GetTaxW9Execute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxW9 Lists the caller org's W-9 relationships on both sides: the W-9s it asked its payees for, with where each stands, and the requests other orgs made for its own W-9.
|
|
|
|
Lists the caller org's W-9 relationships on both sides: the W-9s it asked its
|
|
payees for, with where each stands, and the requests other orgs made for its
|
|
own W-9. Org admins only. No W-9 content is in the list; read one to see it.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIGetTaxW9Request
|
|
*/
|
|
func (a *TaxAPIService) GetTaxW9(ctx context.Context) TaxAPIGetTaxW9Request {
|
|
return TaxAPIGetTaxW9Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxW9List
|
|
func (a *TaxAPIService) GetTaxW9Execute(r TaxAPIGetTaxW9Request) (*TaxW9List, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxW9List
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxW9")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/w9"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxW9ByIdRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIGetTaxW9ByIdRequest) Execute() (*TaxW9, *http.Response, error) {
|
|
return r.ApiService.GetTaxW9ByIdExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxW9ById Reads one W-9 relationship from the caller's side.
|
|
|
|
Reads one W-9 relationship from the caller's side. Org admins only.
|
|
|
|
As the PAYER, the answer carries the payee's W-9 — every line, the TIN masked
|
|
to its last four digits, and whether it is certified — but only while the
|
|
payee's grant is live; before it is granted, and after it is declined or
|
|
revoked, there is no W-9 in the answer. As the PAYEE, it is the request and
|
|
where it stands.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the relationship's id, \"w9_\"-prefixed.
|
|
@return TaxAPIGetTaxW9ByIdRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxW9ById(ctx context.Context, id string) TaxAPIGetTaxW9ByIdRequest {
|
|
return TaxAPIGetTaxW9ByIdRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxW9
|
|
func (a *TaxAPIService) GetTaxW9ByIdExecute(r TaxAPIGetTaxW9ByIdRequest) (*TaxW9, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxW9
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxW9ById")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/w9/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIGetTaxW9ByIdTinRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIGetTaxW9ByIdTinRequest) Execute() (*TaxTinOut, *http.Response, error) {
|
|
return r.ApiService.GetTaxW9ByIdTinExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTaxW9ByIdTin Reads a payee's TIN in full — and, for a payee on a W-8, its foreign TIN, which the payer's Form 1042-S carries.
|
|
|
|
Reads a payee's TIN in full — and, for a payee on a W-8, its foreign TIN, which
|
|
the payer's Form 1042-S carries. Only an org admin of the PAYER, only while the
|
|
payee's grant is live, and every read is on the audit trail before a number is
|
|
answered — a read the trail cannot record is refused.
|
|
|
|
This is the one place a TIN leaves the platform in full, apart from the IRS
|
|
filing export. SuperAdmin is not admitted: platform authority is not a reason
|
|
to read a company's TIN.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the relationship's id, \"w9_\"-prefixed.
|
|
@return TaxAPIGetTaxW9ByIdTinRequest
|
|
*/
|
|
func (a *TaxAPIService) GetTaxW9ByIdTin(ctx context.Context, id string) TaxAPIGetTaxW9ByIdTinRequest {
|
|
return TaxAPIGetTaxW9ByIdTinRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxTinOut
|
|
func (a *TaxAPIService) GetTaxW9ByIdTinExecute(r TaxAPIGetTaxW9ByIdTinRequest) (*TaxTinOut, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxTinOut
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.GetTaxW9ByIdTin")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/w9/{id}/tin"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxFilingsRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
taxExportIn *TaxExportIn
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFilingsRequest) TaxExportIn(taxExportIn TaxExportIn) TaxAPIPostTaxFilingsRequest {
|
|
r.taxExportIn = &taxExportIn
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFilingsRequest) Execute() (*TaxFiling, *http.Response, error) {
|
|
return r.ApiService.PostTaxFilingsExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxFilings Exports the caller org's return for a tax year and form, as the files the IRIS Taxpayer Portal takes, and records the export.
|
|
|
|
Exports the caller org's return for a tax year and form, as the files the IRIS
|
|
Taxpayer Portal takes, and records the export. Org admins of the payer only: the
|
|
files carry TINs in full, so a SuperAdmin acting inside the org is refused here
|
|
exactly as at the TIN read.
|
|
|
|
It carries every furnished (or owed) form of that year and kind not already in
|
|
an earlier export that IRIS did not reject — a rejected submission filed
|
|
nothing, so its forms go out again as originals. Originals are in one set of
|
|
files and corrections of forms already exported in another, at most 250 records
|
|
a file, each written to every rule Pub 5717 §3.5 sets and checked against them
|
|
before it is answered. The files carry full TINs: the export is on the audit
|
|
trail and the files are not stored, only rebuilt from the sealed forms when read
|
|
again.
|
|
|
|
It DOES NOT FILE WITH THE IRS. Submitting through IRIS needs the payer's own
|
|
Transmitter Control Code and a person at the portal; the answer lists those
|
|
steps, and POST /v1/tax/filings/{id}/receipt records what IRIS answered.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIPostTaxFilingsRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxFilings(ctx context.Context) TaxAPIPostTaxFilingsRequest {
|
|
return TaxAPIPostTaxFilingsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxFiling
|
|
func (a *TaxAPIService) PostTaxFilingsExecute(r TaxAPIPostTaxFilingsRequest) (*TaxFiling, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxFiling
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxFilings")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/filings"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.taxExportIn == nil {
|
|
return localVarReturnValue, nil, reportError("taxExportIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.taxExportIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxFilingsByIdReceiptRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
taxReceiptIn *TaxReceiptIn
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFilingsByIdReceiptRequest) TaxReceiptIn(taxReceiptIn TaxReceiptIn) TaxAPIPostTaxFilingsByIdReceiptRequest {
|
|
r.taxReceiptIn = &taxReceiptIn
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFilingsByIdReceiptRequest) Execute() (*TaxFiling, *http.Response, error) {
|
|
return r.ApiService.PostTaxFilingsByIdReceiptExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxFilingsByIdReceipt Records what IRIS answered for an exported return — the Receipt ID on submission, then the acknowledgment.
|
|
|
|
Records what IRIS answered for an exported return — the Receipt ID on
|
|
submission, then the acknowledgment. Org admins only.
|
|
|
|
This is the payer's report of its own act at the IRIS portal, made under its
|
|
own Transmitter Control Code; nothing here reaches IRIS, and a status is only
|
|
ever what the payer recorded. Moves: exported → submitted (with the Receipt ID
|
|
and TCC) → accepted, accepted_with_errors or rejected.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the filing, from the path.
|
|
@return TaxAPIPostTaxFilingsByIdReceiptRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxFilingsByIdReceipt(ctx context.Context, id string) TaxAPIPostTaxFilingsByIdReceiptRequest {
|
|
return TaxAPIPostTaxFilingsByIdReceiptRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxFiling
|
|
func (a *TaxAPIService) PostTaxFilingsByIdReceiptExecute(r TaxAPIPostTaxFilingsByIdReceiptRequest) (*TaxFiling, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxFiling
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxFilingsByIdReceipt")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/filings/{id}/receipt"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.taxReceiptIn == nil {
|
|
return localVarReturnValue, nil, reportError("taxReceiptIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.taxReceiptIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxFormsRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
taxPrepareIn *TaxPrepareIn
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFormsRequest) TaxPrepareIn(taxPrepareIn TaxPrepareIn) TaxAPIPostTaxFormsRequest {
|
|
r.taxPrepareIn = &taxPrepareIn
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFormsRequest) Execute() (*TaxPrepared, *http.Response, error) {
|
|
return r.ApiService.PostTaxFormsExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxForms Prepares the caller org's 1099 drafts for a tax year, as the PAYER: one 1099-NEC and/or 1099-MISC per payee whose reportable payments on Hanzo's rails reach the year's threshold, from the same derivation GET /v1/tax/payments answers.
|
|
|
|
Prepares the caller org's 1099 drafts for a tax year, as the PAYER: one
|
|
1099-NEC and/or 1099-MISC per payee whose reportable payments on Hanzo's rails
|
|
reach the year's threshold, from the same derivation GET /v1/tax/payments
|
|
answers. Org admins only.
|
|
|
|
Each draft carries the payee as its W-9 names it — under a live grant, and
|
|
otherwise only its org id — its boxes, box 4, the due dates, the payments it
|
|
sums, and backup withholding at 24% when the payer holds no TIN for the payee
|
|
(IRC §3406(a)(1)(A)) — an uncertified W-9 is stated as a warning, not a
|
|
withholding, because these payments do not require the certification. Preparing
|
|
again refreshes a draft or reviewed form in place (a reviewed one goes back to
|
|
draft, to be reviewed again); one payee has at most one live form per kind and
|
|
year, so a second preparation racing the first is refused, never doubled. A form
|
|
already furnished is left alone and named in skipped — change it by correcting
|
|
it. Nothing is furnished to anyone and nothing is filed with the IRS.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIPostTaxFormsRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxForms(ctx context.Context) TaxAPIPostTaxFormsRequest {
|
|
return TaxAPIPostTaxFormsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxPrepared
|
|
func (a *TaxAPIService) PostTaxFormsExecute(r TaxAPIPostTaxFormsRequest) (*TaxPrepared, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxPrepared
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxForms")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.taxPrepareIn == nil {
|
|
return localVarReturnValue, nil, reportError("taxPrepareIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.taxPrepareIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxFormsByIdCorrectRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
taxCorrectIn *TaxCorrectIn
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFormsByIdCorrectRequest) TaxCorrectIn(taxCorrectIn TaxCorrectIn) TaxAPIPostTaxFormsByIdCorrectRequest {
|
|
r.taxCorrectIn = &taxCorrectIn
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFormsByIdCorrectRequest) Execute() (*TaxForm, *http.Response, error) {
|
|
return r.ApiService.PostTaxFormsByIdCorrectExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxFormsByIdCorrect Corrects a furnished (or owed) 1099 with a NEW form that supersedes it.
|
|
|
|
Corrects a furnished (or owed) 1099 with a NEW form that supersedes it. Org
|
|
admins only.
|
|
|
|
The furnished form is never changed: the correction is a second form, marked
|
|
CORRECTED, carrying the original's account number and naming the form it
|
|
supersedes, and it goes through review and furnishing like any other. State the
|
|
corrected boxes, or omit them to derive the year again from the payments and the
|
|
payee's current W-9. A form already superseded is corrected by correcting its
|
|
successor. It files nothing with the IRS.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the furnished form to correct, from the path.
|
|
@return TaxAPIPostTaxFormsByIdCorrectRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxFormsByIdCorrect(ctx context.Context, id string) TaxAPIPostTaxFormsByIdCorrectRequest {
|
|
return TaxAPIPostTaxFormsByIdCorrectRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxForm
|
|
func (a *TaxAPIService) PostTaxFormsByIdCorrectExecute(r TaxAPIPostTaxFormsByIdCorrectRequest) (*TaxForm, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxForm
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxFormsByIdCorrect")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms/{id}/correct"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.taxCorrectIn == nil {
|
|
return localVarReturnValue, nil, reportError("taxCorrectIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.taxCorrectIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxFormsByIdFurnishRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFormsByIdFurnishRequest) Execute() (*TaxForm, *http.Response, error) {
|
|
return r.ApiService.PostTaxFormsByIdFurnishExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxFormsByIdFurnish Furnishes Copy B of a reviewed 1099 to its payee.
|
|
|
|
Furnishes Copy B of a reviewed 1099 to its payee. Org admins only.
|
|
|
|
When the payee's tax profile consents to electronic delivery, Copy B is
|
|
delivered into the payee's /v1/tax/inbox and the form is furnished. Otherwise it
|
|
is OWED on paper at the payee's address: mailing it is the payer's, and
|
|
POST /v1/tax/forms/{id}/mailed records it. Either way the statement is final
|
|
from this call — the form can no longer change, only be corrected. Calling it
|
|
again on a form furnished electronically re-delivers Copy B if the inbox lacks
|
|
it, and changes nothing else.
|
|
|
|
It does not file anything with the IRS, and it does not send the notice of
|
|
posting Pub 1099 Part M asks a furnisher to give an electronic recipient; the
|
|
statement is in the recipient's inbox, and telling them so is the payer's.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the form id, \"f1099_\"-prefixed.
|
|
@return TaxAPIPostTaxFormsByIdFurnishRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxFormsByIdFurnish(ctx context.Context, id string) TaxAPIPostTaxFormsByIdFurnishRequest {
|
|
return TaxAPIPostTaxFormsByIdFurnishRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxForm
|
|
func (a *TaxAPIService) PostTaxFormsByIdFurnishExecute(r TaxAPIPostTaxFormsByIdFurnishRequest) (*TaxForm, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxForm
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxFormsByIdFurnish")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms/{id}/furnish"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxFormsByIdMailedRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFormsByIdMailedRequest) Execute() (*TaxForm, *http.Response, error) {
|
|
return r.ApiService.PostTaxFormsByIdMailedExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxFormsByIdMailed Records that the payer mailed a paper Copy B it owed.
|
|
|
|
Records that the payer mailed a paper Copy B it owed. Org admins only.
|
|
|
|
Mailing is the payer's act, done outside Hanzo; this is the record of it, made
|
|
by the person who did it and kept on the audit trail. Nothing here mails
|
|
anything.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the form id, \"f1099_\"-prefixed.
|
|
@return TaxAPIPostTaxFormsByIdMailedRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxFormsByIdMailed(ctx context.Context, id string) TaxAPIPostTaxFormsByIdMailedRequest {
|
|
return TaxAPIPostTaxFormsByIdMailedRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxForm
|
|
func (a *TaxAPIService) PostTaxFormsByIdMailedExecute(r TaxAPIPostTaxFormsByIdMailedRequest) (*TaxForm, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxForm
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxFormsByIdMailed")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms/{id}/mailed"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxFormsByIdReviewRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFormsByIdReviewRequest) Execute() (*TaxForm, *http.Response, error) {
|
|
return r.ApiService.PostTaxFormsByIdReviewExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxFormsByIdReview Marks a draft 1099 reviewed — a person has checked it.
|
|
|
|
Marks a draft 1099 reviewed — a person has checked it. Only a reviewed form can
|
|
be furnished. Org admins only.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the form id, \"f1099_\"-prefixed.
|
|
@return TaxAPIPostTaxFormsByIdReviewRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxFormsByIdReview(ctx context.Context, id string) TaxAPIPostTaxFormsByIdReviewRequest {
|
|
return TaxAPIPostTaxFormsByIdReviewRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxForm
|
|
func (a *TaxAPIService) PostTaxFormsByIdReviewExecute(r TaxAPIPostTaxFormsByIdReviewRequest) (*TaxForm, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxForm
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxFormsByIdReview")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms/{id}/review"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxFormsByIdVoidRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIPostTaxFormsByIdVoidRequest) Execute() (*TaxForm, *http.Response, error) {
|
|
return r.ApiService.PostTaxFormsByIdVoidExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxFormsByIdVoid Voids a draft or reviewed 1099, which is then never furnished or filed.
|
|
|
|
Voids a draft or reviewed 1099, which is then never furnished or filed. A form
|
|
already furnished cannot be voided: it is corrected, and a correction to zero
|
|
is how a furnished return is withdrawn (Pub 1099 Part H). Org admins only.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the form id, \"f1099_\"-prefixed.
|
|
@return TaxAPIPostTaxFormsByIdVoidRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxFormsByIdVoid(ctx context.Context, id string) TaxAPIPostTaxFormsByIdVoidRequest {
|
|
return TaxAPIPostTaxFormsByIdVoidRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxForm
|
|
func (a *TaxAPIService) PostTaxFormsByIdVoidExecute(r TaxAPIPostTaxFormsByIdVoidRequest) (*TaxForm, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxForm
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxFormsByIdVoid")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/forms/{id}/void"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxProfileCertifyRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
}
|
|
|
|
func (r TaxAPIPostTaxProfileCertifyRequest) Execute() (*TaxProfile, *http.Response, error) {
|
|
return r.ApiService.PostTaxProfileCertifyExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxProfileCertify Signs the caller org's certification — Form W-9 Part II, Form W-8BEN Part III or Form W-8BEN-E Part XXX — through /v1/legal's e-signature.
|
|
|
|
Signs the caller org's certification — Form W-9 Part II, Form W-8BEN Part III or
|
|
Form W-8BEN-E Part XXX — through /v1/legal's e-signature. The org's own admins
|
|
only, and the admin is the signer: a SuperAdmin acting inside the org is not a
|
|
person who can certify for it.
|
|
|
|
The first call renders the certification — the IRS's own certification text over
|
|
this profile's facts, every number truncated — as a /v1/legal document and opens
|
|
its signature request with the calling admin as signer; the answer is `pending` with
|
|
the document id. The signer completes it where every /v1/legal signature is
|
|
completed (POST /v1/legal/documents/{id}/sign/complete). Calling this again then
|
|
asks legal whether the document is signed and by whom: signed by the signer, the
|
|
profile is recorded certified; not yet signed, it answers `pending` again; signed
|
|
by anyone else — another member, a key — or voided, it is not the signer's
|
|
certification, and a fresh request is opened in its place.
|
|
|
|
A certification covers one profile version: writing any fact on the form
|
|
afterwards voids it. A certified W-8 is valid through the last day of the third
|
|
calendar year after the year it was signed (Instructions for Form W-8BEN and
|
|
W-8BEN-E, Rev. 10-2021); certifying it again after that renews it. It is not a
|
|
statement that a TIN matches IRS records — that is IRS TIN Matching, which only
|
|
a payer enrolled in IRS e-Services can run.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIPostTaxProfileCertifyRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxProfileCertify(ctx context.Context) TaxAPIPostTaxProfileCertifyRequest {
|
|
return TaxAPIPostTaxProfileCertifyRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxProfile
|
|
func (a *TaxAPIService) PostTaxProfileCertifyExecute(r TaxAPIPostTaxProfileCertifyRequest) (*TaxProfile, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxProfile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxProfileCertify")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/profile/certify"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxW9Request struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
taxW9Request *TaxW9Request
|
|
}
|
|
|
|
func (r TaxAPIPostTaxW9Request) TaxW9Request(taxW9Request TaxW9Request) TaxAPIPostTaxW9Request {
|
|
r.taxW9Request = &taxW9Request
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIPostTaxW9Request) Execute() (*TaxW9, *http.Response, error) {
|
|
return r.ApiService.PostTaxW9Execute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxW9 Asks another org for its W-9, as the org that pays it.
|
|
|
|
Asks another org for its W-9, as the org that pays it. Org admins only.
|
|
|
|
A request is refused unless the caller has paid that org on Hanzo's rails, or
|
|
has asked /v1/principal whether it may — a W-9 is asked for by a payer, of a payee,
|
|
and the payments, or a payment the caller is about to make, are what say which
|
|
companies those are. The form is needed BEFORE the first payment: withholding
|
|
is decided when a payment is made, not when it is reported. The request lands with the payee, whose admin grants or
|
|
declines it; until it is granted the caller sees its status and nothing of the
|
|
payee's W-9. Asking again updates the category, and re-opens a request the
|
|
payee declined or revoked.
|
|
|
|
Category is the caller's statement of what it pays this payee for, and decides
|
|
the 1099 box: services and attorney go to 1099-NEC box 1a, rents, royalties
|
|
and other to 1099-MISC boxes 1, 2 and 3; merchandise is not reported.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIPostTaxW9Request
|
|
*/
|
|
func (a *TaxAPIService) PostTaxW9(ctx context.Context) TaxAPIPostTaxW9Request {
|
|
return TaxAPIPostTaxW9Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxW9
|
|
func (a *TaxAPIService) PostTaxW9Execute(r TaxAPIPostTaxW9Request) (*TaxW9, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxW9
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxW9")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/w9"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.taxW9Request == nil {
|
|
return localVarReturnValue, nil, reportError("taxW9Request is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.taxW9Request
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxW9ByIdDeclineRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIPostTaxW9ByIdDeclineRequest) Execute() (*TaxW9, *http.Response, error) {
|
|
return r.ApiService.PostTaxW9ByIdDeclineExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxW9ByIdDecline Declines a request for this org's W-9.
|
|
|
|
Declines a request for this org's W-9. The payer keeps seeing only the status.
|
|
Org admins of the payee only.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the relationship's id, \"w9_\"-prefixed.
|
|
@return TaxAPIPostTaxW9ByIdDeclineRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxW9ByIdDecline(ctx context.Context, id string) TaxAPIPostTaxW9ByIdDeclineRequest {
|
|
return TaxAPIPostTaxW9ByIdDeclineRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxW9
|
|
func (a *TaxAPIService) PostTaxW9ByIdDeclineExecute(r TaxAPIPostTaxW9ByIdDeclineRequest) (*TaxW9, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxW9
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxW9ByIdDecline")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/w9/{id}/decline"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxW9ByIdGrantRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIPostTaxW9ByIdGrantRequest) Execute() (*TaxW9, *http.Response, error) {
|
|
return r.ApiService.PostTaxW9ByIdGrantExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxW9ByIdGrant Grants the payer that asked a live read of this org's W-9 — every line, the TIN masked, and the full TIN to that payer's org admins alone, each read audited.
|
|
|
|
Grants the payer that asked a live read of this org's W-9 — every line, the TIN
|
|
masked, and the full TIN to that payer's org admins alone, each read audited.
|
|
Org admins of the payee only. Needs a tax profile to grant.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the relationship's id, \"w9_\"-prefixed.
|
|
@return TaxAPIPostTaxW9ByIdGrantRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxW9ByIdGrant(ctx context.Context, id string) TaxAPIPostTaxW9ByIdGrantRequest {
|
|
return TaxAPIPostTaxW9ByIdGrantRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxW9
|
|
func (a *TaxAPIService) PostTaxW9ByIdGrantExecute(r TaxAPIPostTaxW9ByIdGrantRequest) (*TaxW9, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxW9
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxW9ByIdGrant")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/w9/{id}/grant"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxW9ByIdMatchRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
taxMatchIn *TaxMatchIn
|
|
}
|
|
|
|
func (r TaxAPIPostTaxW9ByIdMatchRequest) TaxMatchIn(taxMatchIn TaxMatchIn) TaxAPIPostTaxW9ByIdMatchRequest {
|
|
r.taxMatchIn = &taxMatchIn
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIPostTaxW9ByIdMatchRequest) Execute() (*TaxW9, *http.Response, error) {
|
|
return r.ApiService.PostTaxW9ByIdMatchExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxW9ByIdMatch Records the result of IRS TIN Matching for a payee, as the payer.
|
|
|
|
Records the result of IRS TIN Matching for a payee, as the payer. Org admins of
|
|
the payer only, on a live grant.
|
|
|
|
It does not run TIN Matching. That is an IRS e-Services program a payer enrolls
|
|
in and runs itself, on the name and TIN it holds; this records what the IRS
|
|
answered so it sits beside the W-9 and on the audit trail. Nothing here ever
|
|
records a match the payer did not report.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the relationship, from the path.
|
|
@return TaxAPIPostTaxW9ByIdMatchRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxW9ByIdMatch(ctx context.Context, id string) TaxAPIPostTaxW9ByIdMatchRequest {
|
|
return TaxAPIPostTaxW9ByIdMatchRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxW9
|
|
func (a *TaxAPIService) PostTaxW9ByIdMatchExecute(r TaxAPIPostTaxW9ByIdMatchRequest) (*TaxW9, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxW9
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxW9ByIdMatch")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/w9/{id}/match"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.taxMatchIn == nil {
|
|
return localVarReturnValue, nil, reportError("taxMatchIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.taxMatchIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPostTaxW9ByIdRevokeRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
id string
|
|
}
|
|
|
|
func (r TaxAPIPostTaxW9ByIdRevokeRequest) Execute() (*TaxW9, *http.Response, error) {
|
|
return r.ApiService.PostTaxW9ByIdRevokeExecute(r)
|
|
}
|
|
|
|
/*
|
|
PostTaxW9ByIdRevoke Revokes a W-9 this org granted.
|
|
|
|
Revokes a W-9 this org granted. From the moment it is revoked the payer reads
|
|
nothing of the W-9 and no full TIN. A 1099 the payer already prepared keeps the
|
|
TIN it was prepared with — the payer must keep it to file — and that TIN is
|
|
never answered in full outside the payer's IRS filing export. Org admins of the
|
|
payee only.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id ID is the relationship's id, \"w9_\"-prefixed.
|
|
@return TaxAPIPostTaxW9ByIdRevokeRequest
|
|
*/
|
|
func (a *TaxAPIService) PostTaxW9ByIdRevoke(ctx context.Context, id string) TaxAPIPostTaxW9ByIdRevokeRequest {
|
|
return TaxAPIPostTaxW9ByIdRevokeRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxW9
|
|
func (a *TaxAPIService) PostTaxW9ByIdRevokeExecute(r TaxAPIPostTaxW9ByIdRevokeRequest) (*TaxW9, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxW9
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PostTaxW9ByIdRevoke")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/w9/{id}/revoke"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
type TaxAPIPutTaxProfileRequest struct {
|
|
ctx context.Context
|
|
ApiService *TaxAPIService
|
|
taxProfileIn *TaxProfileIn
|
|
}
|
|
|
|
func (r TaxAPIPutTaxProfileRequest) TaxProfileIn(taxProfileIn TaxProfileIn) TaxAPIPutTaxProfileRequest {
|
|
r.taxProfileIn = &taxProfileIn
|
|
return r
|
|
}
|
|
|
|
func (r TaxAPIPutTaxProfileRequest) Execute() (*TaxProfile, *http.Response, error) {
|
|
return r.ApiService.PutTaxProfileExecute(r)
|
|
}
|
|
|
|
/*
|
|
PutTaxProfile Writes the caller org's tax profile — its Form W-9, or its Form W-8BEN or W-8BEN-E when it is a foreign person — and answers it, every number masked.
|
|
|
|
Writes the caller org's tax profile — its Form W-9, or its Form W-8BEN or
|
|
W-8BEN-E when it is a foreign person — and answers it, every number masked. Org
|
|
admins only.
|
|
|
|
A U.S. TIN is validated before it is kept — nine digits; an EIN's prefix must be
|
|
one the IRS assigns; an SSN never begins 000, 666 or 9xx and has no zero group
|
|
or serial; an ITIN's middle digits are in the IRS ranges. A foreign TIN is the
|
|
issuing jurisdiction's and is checked only for its characters. Every number is
|
|
sealed under this org's own data key before it is written. Validating the
|
|
FORMAT is all this does: whether the IRS has the number on file under this name
|
|
is IRS TIN Matching, which a payer runs through IRS e-Services.
|
|
|
|
A W-8 is refused where the form itself says it is the wrong one: a U.S. citizen,
|
|
a U.S. permanent residence or an entity organized in the United States is a U.S.
|
|
person and files a W-9. A treaty claim needs a U.S. or foreign TIN on the form
|
|
(Instructions for Form W-8BEN, line 5; for Form W-8BEN-E, line 8), and names the
|
|
country of the permanent residence address.
|
|
|
|
Changing any fact on the form makes a new version, and the certification no
|
|
longer covers it: certify again. For a W-8 that is the "change in circumstances"
|
|
the instructions end its validity on. Changing only the consent does not.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return TaxAPIPutTaxProfileRequest
|
|
*/
|
|
func (a *TaxAPIService) PutTaxProfile(ctx context.Context) TaxAPIPutTaxProfileRequest {
|
|
return TaxAPIPutTaxProfileRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
//
|
|
// @return TaxProfile
|
|
func (a *TaxAPIService) PutTaxProfileExecute(r TaxAPIPutTaxProfileRequest) (*TaxProfile, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TaxProfile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TaxAPIService.PutTaxProfile")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v1/tax/profile"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.taxProfileIn == nil {
|
|
return localVarReturnValue, nil, reportError("taxProfileIn is required and must be specified")
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
localVarPostBody = r.taxProfileIn
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
var v ProblemDetails
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|