Documentation
¶
Overview ¶
Package invoice contains request and response models for the MoneyForward Cloud Invoice API v3.
Field names and JSON tags are derived from the committed iv_openapi.yaml (see repo root). The package is kept separate from the accounting model package because resources of the same name (Partner, Department, Item) carry different shapes between the two APIs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Billing ¶
type Billing struct {
ID string `json:"id"`
PdfURL string `json:"pdf_url,omitempty"`
OperatorID string `json:"operator_id,omitempty"`
DepartmentID string `json:"department_id,omitempty"`
MemberID string `json:"member_id,omitempty"`
MemberName string `json:"member_name,omitempty"`
PartnerID string `json:"partner_id,omitempty"`
PartnerName string `json:"partner_name,omitempty"`
OfficeID string `json:"office_id,omitempty"`
OfficeName string `json:"office_name,omitempty"`
OfficeDetail string `json:"office_detail,omitempty"`
Title string `json:"title,omitempty"`
Memo string `json:"memo,omitempty"`
PaymentCondition string `json:"payment_condition,omitempty"`
BillingDate string `json:"billing_date,omitempty"`
DueDate string `json:"due_date,omitempty"`
SalesDate string `json:"sales_date,omitempty"`
BillingNumber string `json:"billing_number,omitempty"`
Note string `json:"note,omitempty"`
DocumentName string `json:"document_name,omitempty"`
PaymentStatus string `json:"payment_status,omitempty"`
EmailStatus string `json:"email_status,omitempty"`
PostingStatus string `json:"posting_status,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
IsDownloaded bool `json:"is_downloaded,omitempty"`
IsLocked bool `json:"is_locked,omitempty"`
DeductPrice string `json:"deduct_price,omitempty"`
TagNames []string `json:"tag_names,omitempty"`
Items []BillingItem `json:"items,omitempty"`
ExcisePrice string `json:"excise_price,omitempty"`
ExcisePriceOfUntaxable string `json:"excise_price_of_untaxable,omitempty"`
ExcisePriceOfNonTaxable string `json:"excise_price_of_non_taxable,omitempty"`
ExcisePriceOfTaxExemption string `json:"excise_price_of_tax_exemption,omitempty"`
ExcisePriceOfFivePercent string `json:"excise_price_of_five_percent,omitempty"`
ExcisePriceOfEightPercent string `json:"excise_price_of_eight_percent,omitempty"`
ExcisePriceOfEightPercentAsReducedTaxRate string `json:"excise_price_of_eight_percent_as_reduced_tax_rate,omitempty"`
ExcisePriceOfTenPercent string `json:"excise_price_of_ten_percent,omitempty"`
SubtotalPrice string `json:"subtotal_price,omitempty"`
SubtotalOfUntaxableExcise string `json:"subtotal_of_untaxable_excise,omitempty"`
SubtotalOfNonTaxableExcise string `json:"subtotal_of_non_taxable_excise,omitempty"`
SubtotalOfTaxExemptionExcise string `json:"subtotal_of_tax_exemption_excise,omitempty"`
SubtotalOfFivePercentExcise string `json:"subtotal_of_five_percent_excise,omitempty"`
SubtotalOfEightPercentExcise string `json:"subtotal_of_eight_percent_excise,omitempty"`
SubtotalOfEightPercentAsReducedTaxRateExcise string `json:"subtotal_of_eight_percent_as_reduced_tax_rate_excise,omitempty"`
SubtotalOfTenPercentExcise string `json:"subtotal_of_ten_percent_excise,omitempty"`
SubtotalWithTaxOfUntaxableExcise string `json:"subtotal_with_tax_of_untaxable_excise,omitempty"`
SubtotalWithTaxOfNonTaxableExcise string `json:"subtotal_with_tax_of_non_taxable_excise,omitempty"`
SubtotalWithTaxOfTaxExemptionExcise string `json:"subtotal_with_tax_of_tax_exemption_excise,omitempty"`
SubtotalWithTaxOfFivePercentExcise string `json:"subtotal_with_tax_of_five_percent_excise,omitempty"`
SubtotalWithTaxOfEightPercentExcise string `json:"subtotal_with_tax_of_eight_percent_excise,omitempty"`
SubtotalWithTaxOfEightPercentAsReducedTaxRateExcise string `json:"subtotal_with_tax_of_eight_percent_as_reduced_tax_rate_excise,omitempty"`
SubtotalWithTaxOfTenPercentExcise string `json:"subtotal_with_tax_of_ten_percent_excise,omitempty"`
TotalPrice string `json:"total_price,omitempty"`
RegistrationCode string `json:"registration_code,omitempty"`
UseInvoiceTemplate bool `json:"use_invoice_template,omitempty"`
}
Billing mirrors `components.schemas.Billing` from iv_openapi.yaml. Numeric fields like Price and TotalPrice are returned as strings by the Invoice API to preserve decimal precision; we keep them typed as string on the read side.
type BillingItem ¶
type BillingItem struct {
ID string `json:"id,omitempty"`
ItemID string `json:"item_id,omitempty"`
Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"`
Detail string `json:"detail,omitempty"`
Unit string `json:"unit,omitempty"`
Price string `json:"price,omitempty"`
Quantity string `json:"quantity,omitempty"`
IsDeductWithholdingTax *bool `json:"is_deduct_withholding_tax,omitempty"`
Excise string `json:"excise,omitempty"`
DeliveryNumber string `json:"delivery_number,omitempty"`
DeliveryDate string `json:"delivery_date,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
BillingItem mirrors `components.schemas.BillingItem`. Read-side numeric fields (Price, Quantity) are strings per the Invoice API schema, matching Billing.
type CreateBillingItem ¶
type CreateBillingItem struct {
ItemID *string `json:"item_id,omitempty"`
Name *string `json:"name,omitempty"`
Detail *string `json:"detail,omitempty"`
Unit *string `json:"unit,omitempty"`
Price *json.Number `json:"price,omitempty"`
Quantity *json.Number `json:"quantity,omitempty"`
IsDeductWithholdingTax *bool `json:"is_deduct_withholding_tax,omitempty"`
Excise *string `json:"excise,omitempty"`
DeliveryNumber *string `json:"delivery_number,omitempty"`
DeliveryDate *string `json:"delivery_date,omitempty"`
}
CreateBillingItem matches an entry in `items[]` of the invoice_template_billings request. Numeric fields are typed as json.Number so callers can preserve the exact lexical form of values like "0.10" or "10000.25" without float64 round-tripping.
type CreateBillingRequest ¶
type CreateBillingRequest struct {
DepartmentID string `json:"department_id"`
BillingDate string `json:"billing_date"`
Title *string `json:"title,omitempty"`
Memo *string `json:"memo,omitempty"`
PaymentCondition *string `json:"payment_condition,omitempty"`
DueDate *string `json:"due_date,omitempty"`
SalesDate *string `json:"sales_date,omitempty"`
BillingNumber *string `json:"billing_number,omitempty"`
Note *string `json:"note,omitempty"`
DocumentName *string `json:"document_name,omitempty"`
TagNames *[]string `json:"tag_names,omitempty"`
Items []CreateBillingItem `json:"items,omitempty"`
}
CreateBillingRequest matches the body of `POST /api/v3/invoice_template_billings`. department_id and billing_date are required by the spec; everything else is optional and uses pointer fields so unset values are omitted from the JSON.
TagNames is `*[]string` rather than `[]string` so callers can distinguish "tag_names not supplied" (nil → omit from payload) from "tag_names explicitly empty" (`*[]string{}` → emit `[]`). With a plain slice, `omitempty` would erase the empty case.
type Department ¶
type Department struct {
ID string `json:"id"`
Zip string `json:"zip,omitempty"`
Tel string `json:"tel,omitempty"`
Prefecture string `json:"prefecture,omitempty"`
Address1 string `json:"address1,omitempty"`
Address2 string `json:"address2,omitempty"`
PersonName string `json:"person_name,omitempty"`
PersonTitle string `json:"person_title,omitempty"`
PersonDept string `json:"person_dept,omitempty"`
Email string `json:"email,omitempty"`
CcEmails string `json:"cc_emails,omitempty"`
PeppolID string `json:"peppol_id,omitempty"`
OfficeMemberID string `json:"office_member_id,omitempty"`
OfficeMemberName string `json:"office_member_name,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
Department mirrors `components.schemas.Department`. Only `id` is guaranteed by the spec; everything else is optional.
type Item ¶
type Item struct {
ID string `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Detail string `json:"detail,omitempty"`
Unit string `json:"unit,omitempty"`
Price string `json:"price,omitempty"`
Quantity string `json:"quantity,omitempty"`
IsDeductWithholdingTax *bool `json:"is_deduct_withholding_tax,omitempty"`
Excise string `json:"excise,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
Item mirrors `components.schemas.Item`. price and quantity are strings on the API response (decimal-preserving).
type ListBillingsResponse ¶
type ListBillingsResponse struct {
Data []Billing `json:"data"`
Pagination Pagination `json:"pagination"`
}
ListBillingsResponse wraps the paginated `GET /billings` response.
type ListDepartmentsResponse ¶
type ListDepartmentsResponse struct {
Data []Department `json:"data"`
Pagination Pagination `json:"pagination"`
}
ListDepartmentsResponse wraps the paginated `GET /partners/{partner_id}/departments` response.
type ListItemsResponse ¶
type ListItemsResponse struct {
Data []Item `json:"data"`
Pagination Pagination `json:"pagination"`
}
ListItemsResponse wraps the paginated `GET /items` response.
type ListPartnersResponse ¶
type ListPartnersResponse struct {
Data []Partner `json:"data"`
Pagination Pagination `json:"pagination"`
}
ListPartnersResponse wraps the paginated `GET /partners` response.
type Pagination ¶
type Pagination struct {
TotalCount int `json:"total_count"`
TotalPages int `json:"total_pages"`
PerPage int `json:"per_page"`
CurrentPage int `json:"current_page"`
}
Pagination mirrors `components.schemas.PaginationData` from iv_openapi.yaml. The Invoice API uses this pagination wrapper for every list response.
type Partner ¶
type Partner struct {
ID string `json:"id"`
Code string `json:"code,omitempty"`
Name string `json:"name"`
NameKana string `json:"name_kana,omitempty"`
NameSuffix string `json:"name_suffix,omitempty"`
Memo string `json:"memo,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Departments []Department `json:"departments"`
PaymentDeadlineSetting *PaymentDeadlineSetting `json:"payment_deadline_setting,omitempty"`
}
Partner mirrors `components.schemas.Partner`. payment_deadline_setting is nullable in the spec so it is held as a pointer.
type PaymentDeadlineSetting ¶
type PaymentDeadlineSetting struct {
DueMonth string `json:"due_month"`
DueDate int `json:"due_date"`
ContingencyDay string `json:"contingency_day"`
}
PaymentDeadlineSetting mirrors `components.schemas.PaymentDeadlineSetting`.
type UpdateBillingRequest ¶
type UpdateBillingRequest struct {
DepartmentID *string `json:"department_id,omitempty"`
BillingDate *string `json:"billing_date,omitempty"`
Title *string `json:"title,omitempty"`
Memo *string `json:"memo,omitempty"`
PaymentCondition *string `json:"payment_condition,omitempty"`
DueDate *string `json:"due_date,omitempty"`
SalesDate *string `json:"sales_date,omitempty"`
BillingNumber *string `json:"billing_number,omitempty"`
Note *string `json:"note,omitempty"`
DocumentName *string `json:"document_name,omitempty"`
// TagNames is *[]string for the same reason as
// CreateBillingRequest.TagNames: callers can distinguish
// "leave tags untouched" (nil) from "clear tags" (empty slice).
TagNames *[]string `json:"tag_names,omitempty"`
}
UpdateBillingRequest mirrors the body of `PUT /api/v3/billings/{id}`. All top-level fields are optional; the spec accepts a partial update.
Note: the spec does NOT accept an `items` field for update. Line items are managed via the dedicated `POST/DELETE /api/v3/billings/{id}/items` endpoints (out of scope for the current PR). Including `items` here would produce a 400 at the API.