Skip to content

Commit

Permalink
Merge pull request #204 from getlago/feat-skip-zero-invoices
Browse files Browse the repository at this point in the history
Feat(invoice): Feat add skip zero invoices
  • Loading branch information
brunomiguelpinto authored Sep 6, 2024
2 parents 6674b1e + 9bc889d commit 0c2a6b0
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 79 deletions.
98 changes: 54 additions & 44 deletions customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ const (
PaymentProviderGocardless CustomerPaymentProvider = "gocardless"
)

type FinalizeZeroAmountInvoice string

const (
FinalizeInvoice FinalizeZeroAmountInvoice = "finalize"
SkipInvoice FinalizeZeroAmountInvoice = "skip"
InheritInvoice FinalizeZeroAmountInvoice = "inherit"
)

type IntegrationType string

const (
Expand Down Expand Up @@ -68,28 +76,29 @@ type MetadataResponse struct {
}

type CustomerInput struct {
ExternalID string `json:"external_id,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
LegalName string `json:"legal_name,omitempty"`
LegalNumber string `json:"legal_number,omitempty"`
NetPaymentTerm int `json:"net_payment_term,omitempty"`
TaxIdentificationNumber string `json:"tax_identification_number,omitempty"`
Phone string `json:"phone,omitempty"`
URL string `json:"url,omitempty"`
Currency Currency `json:"currency,omitempty"`
Timezone string `json:"timezone,omitempty"`
Metadata []CustomerMetadataInput `json:"metadata,omitempty"`
BillingConfiguration CustomerBillingConfigurationInput `json:"billing_configuration,omitempty"`
ShippingAddress Address `json:"shipping_address,omitempty"`
IntegrationCustomers []IntegrationCustomer `json:"integration_customers,omitempty"`
TaxCodes []string `json:"tax_codes,omitempty"`
ExternalID string `json:"external_id,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
LegalName string `json:"legal_name,omitempty"`
LegalNumber string `json:"legal_number,omitempty"`
NetPaymentTerm int `json:"net_payment_term,omitempty"`
TaxIdentificationNumber string `json:"tax_identification_number,omitempty"`
Phone string `json:"phone,omitempty"`
URL string `json:"url,omitempty"`
Currency Currency `json:"currency,omitempty"`
Timezone string `json:"timezone,omitempty"`
Metadata []CustomerMetadataInput `json:"metadata,omitempty"`
BillingConfiguration CustomerBillingConfigurationInput `json:"billing_configuration,omitempty"`
ShippingAddress Address `json:"shipping_address,omitempty"`
IntegrationCustomers []IntegrationCustomer `json:"integration_customers,omitempty"`
TaxCodes []string `json:"tax_codes,omitempty"`
FinalizeZeroAmountInvoice FinalizeZeroAmountInvoice `json:"finalize_zero_amount_invoice,omitempty"`
}

type CustomerListInput struct {
Expand Down Expand Up @@ -208,28 +217,29 @@ type Customer struct {
ExternalID string `json:"external_id,omitempty"`
Slug string `json:"slug,omitempty"`

Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
Country string `json:"country,omitempty"`
LegalName string `json:"legal_name,omitempty"`
LegalNumber string `json:"legal_number,omitempty"`
NetPaymentTerm int `json:"net_payment_term,omitempty"`
TaxIdentificationNumber string `json:"tax_identification_number,omitempty"`
LogoURL string `json:"logo_url,omitempty"`
Phone string `json:"phone,omitempty"`
URL string `json:"url,omitempty"`
BillingConfiguration CustomerBillingConfiguration `json:"billing_configuration,omitempty"`
ShippingAddress Address `json:"shipping_address,omitempty"`
IntegrationCustomers []IntegrationCustomersResponse `json:"integration_customers,omitempty"`
Metadata []MetadataResponse `json:"metadata,omitempty"`
Currency Currency `json:"currency,omitempty"`
Timezone string `json:"timezone,omitempty"`
ApplicableTimezone string `json:"applicable_timezone,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
Country string `json:"country,omitempty"`
LegalName string `json:"legal_name,omitempty"`
LegalNumber string `json:"legal_number,omitempty"`
NetPaymentTerm int `json:"net_payment_term,omitempty"`
TaxIdentificationNumber string `json:"tax_identification_number,omitempty"`
LogoURL string `json:"logo_url,omitempty"`
Phone string `json:"phone,omitempty"`
URL string `json:"url,omitempty"`
FinalizeZeroAmountInvoice FinalizeZeroAmountInvoice `json:"finalize_zero_amount_invoice,omitempty"`
BillingConfiguration CustomerBillingConfiguration `json:"billing_configuration,omitempty"`
ShippingAddress Address `json:"shipping_address,omitempty"`
IntegrationCustomers []IntegrationCustomersResponse `json:"integration_customers,omitempty"`
Metadata []MetadataResponse `json:"metadata,omitempty"`
Currency Currency `json:"currency,omitempty"`
Timezone string `json:"timezone,omitempty"`
ApplicableTimezone string `json:"applicable_timezone,omitempty"`

Taxes []Tax `json:"taxes,omitempty"`

Expand Down
73 changes: 38 additions & 35 deletions organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,24 @@ type OrganizationBillingConfiguration struct {
type OrganizationInput struct {
Name string `json:"name,omitempty"`

Email string `json:"email,omitempty"`
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
DefaultCurrency Currency `json:"default_currency,omitempty"`
LegalName string `json:"legal_name,omitempty"`
LegalNumber string `json:"legal_number,omitempty"`
DocumentNumbering OrganizationDocumentNumbering `json:"document_numbering,omitempty"`
DocumentNumberPrefix string `json:"document_number_prefix,omitempty"`
NetPaymentTerm int `json:"net_payment_term,omitempty"`
TaxIdentificationNumber string `json:"tax_identification_number,omitempty"`
WebhookURL string `json:"webhook_url,omitempty"`
Timezone string `json:"timezone,omitempty"`
EmailSettings []string `json:"email_settings,omitempty"`
Email string `json:"email,omitempty"`
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
DefaultCurrency Currency `json:"default_currency,omitempty"`
LegalName string `json:"legal_name,omitempty"`
LegalNumber string `json:"legal_number,omitempty"`
DocumentNumbering OrganizationDocumentNumbering `json:"document_numbering,omitempty"`
DocumentNumberPrefix string `json:"document_number_prefix,omitempty"`
NetPaymentTerm int `json:"net_payment_term,omitempty"`
TaxIdentificationNumber string `json:"tax_identification_number,omitempty"`
WebhookURL string `json:"webhook_url,omitempty"`
Timezone string `json:"timezone,omitempty"`
EmailSettings []string `json:"email_settings,omitempty"`
FinalizeZeroAmountInvoice bool `json:"finalize_zero_amount_invoice,omitempty"`

BillingConfiguration OrganizationBillingConfigurationInput `json:"billing_configuration,omitempty"`
}
Expand All @@ -63,24 +64,26 @@ type OrganizationResult struct {
type Organization struct {
Name string `json:"name,omitempty"`

Email string `json:"email,omitempty"`
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
DefaultCurrency Currency `json:"default_currency,omitempty"`
LegalName string `json:"legal_name,omitempty"`
LegalNumber string `json:"legal_number,omitempty"`
DocumentNumbering OrganizationDocumentNumbering `json:"document_numbering,omitempty"`
DocumentNumberPrefix string `json:"document_number_prefix,omitempty"`
NetPaymentTerm int `json:"net_payment_term,omitempty"`
TaxIdentificationNumber string `json:"tax_identification_number,omitempty"`
WebhookURL string `json:"webhook_url,omitempty"`
WebhookURLs []string `json:"webhook_urls,omitempty"`
Timezone string `json:"timezone,omitempty"`
EmailSettings []string `json:"email_settings,omitempty"`
Email string `json:"email,omitempty"`
AddressLine1 string `json:"address_line1,omitempty"`
AddressLine2 string `json:"address_line2,omitempty"`
City string `json:"city,omitempty"`
Zipcode string `json:"zipcode,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
DefaultCurrency Currency `json:"default_currency,omitempty"`
LegalName string `json:"legal_name,omitempty"`
LegalNumber string `json:"legal_number,omitempty"`
DocumentNumbering OrganizationDocumentNumbering `json:"document_numbering,omitempty"`
DocumentNumberPrefix string `json:"document_number_prefix,omitempty"`
NetPaymentTerm int `json:"net_payment_term,omitempty"`
TaxIdentificationNumber string `json:"tax_identification_number,omitempty"`
WebhookURL string `json:"webhook_url,omitempty"`
WebhookURLs []string `json:"webhook_urls,omitempty"`
Timezone string `json:"timezone,omitempty"`
EmailSettings []string `json:"email_settings,omitempty"`
FinalizeZeroAmountInvoice bool `json:"finalize_zero_amount_invoice,omitempty"`


BillingConfiguration OrganizationBillingConfiguration `json:"billing_configuration,omitempty"`

Expand Down

0 comments on commit 0c2a6b0

Please sign in to comment.