From 6c945e220d92220dc639ef81bcc7ca84fe5b2c2e Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Wed, 4 Sep 2024 16:31:49 +0100 Subject: [PATCH 1/3] feas: add metadata to wallet transactions --- customer.go | 98 +++++++++++++++++++++++++++---------------------- organization.go | 73 ++++++++++++++++++------------------ 2 files changed, 92 insertions(+), 79 deletions(-) diff --git a/customer.go b/customer.go index 93991d0..69a52e5 100644 --- a/customer.go +++ b/customer.go @@ -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 ( @@ -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 { @@ -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"` diff --git a/organization.go b/organization.go index fb02c8d..1a365e4 100644 --- a/organization.go +++ b/organization.go @@ -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"` // Added field BillingConfiguration OrganizationBillingConfigurationInput `json:"billing_configuration,omitempty"` } @@ -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"` // Added field + BillingConfiguration OrganizationBillingConfiguration `json:"billing_configuration,omitempty"` From c19ccd684e4906faf7279e4d8bd9e32500792356 Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Wed, 4 Sep 2024 16:57:03 +0100 Subject: [PATCH 2/3] feat: add zeroAmountInvoice to org and customer --- organization.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/organization.go b/organization.go index 1a365e4..d87e88f 100644 --- a/organization.go +++ b/organization.go @@ -52,7 +52,7 @@ type OrganizationInput struct { 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"` // Added field + FinalizeZeroAmountInvoice bool `json:"finalize_zero_amount_invoice,omitempty"` BillingConfiguration OrganizationBillingConfigurationInput `json:"billing_configuration,omitempty"` } @@ -82,7 +82,7 @@ type Organization struct { 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"` // Added field + FinalizeZeroAmountInvoice bool `json:"finalize_zero_amount_invoice,omitempty"` BillingConfiguration OrganizationBillingConfiguration `json:"billing_configuration,omitempty"` From 9bc889dd51564a79ba51f82d924e35251866a84f Mon Sep 17 00:00:00 2001 From: Miguel Pinto Date: Fri, 6 Sep 2024 10:55:14 +0100 Subject: [PATCH 3/3] feat: fix indentation --- organization.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/organization.go b/organization.go index d87e88f..d348746 100644 --- a/organization.go +++ b/organization.go @@ -82,7 +82,7 @@ type Organization struct { 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"` + FinalizeZeroAmountInvoice bool `json:"finalize_zero_amount_invoice,omitempty"` BillingConfiguration OrganizationBillingConfiguration `json:"billing_configuration,omitempty"`