Skip to content

Commit ac7e445

Browse files
feat(api): api update
1 parent 83ce8ad commit ac7e445

File tree

3 files changed

+227
-5
lines changed

3 files changed

+227
-5
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-033643979990e894363554df06218fabe4493feaa569a013dbdf9a72aa21c45f.yml
3-
openapi_spec_hash: dd9d320ad178bafa06f1eac2977e2ca7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-7936e3f73bbe1d59d27fd7a8a226985927b38fdec1c936c77577381699fb6140.yml
3+
openapi_spec_hash: 1d3f9ed5fbdb0e40d56d6acd9d1736e2
44
config_hash: e6db17547fe854b1c240407cf4c6dc9e

customer.go

Lines changed: 205 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,10 @@ type Customer struct {
454454
AccountingSyncConfiguration CustomerAccountingSyncConfiguration `json:"accounting_sync_configuration,nullable"`
455455
// Whether automatic tax calculation is enabled for this customer. This field is
456456
// nullable for backwards compatibility but will always return a boolean value.
457-
AutomaticTaxEnabled bool `json:"automatic_tax_enabled,nullable"`
457+
AutomaticTaxEnabled bool `json:"automatic_tax_enabled,nullable"`
458+
// Payment configuration for the customer, applicable when using Orb Invoicing with
459+
// a supported payment provider such as Stripe.
460+
PaymentConfiguration CustomerPaymentConfiguration `json:"payment_configuration,nullable"`
458461
ReportingConfiguration CustomerReportingConfiguration `json:"reporting_configuration,nullable"`
459462
JSON customerJSON `json:"-"`
460463
}
@@ -484,6 +487,7 @@ type customerJSON struct {
484487
Timezone apijson.Field
485488
AccountingSyncConfiguration apijson.Field
486489
AutomaticTaxEnabled apijson.Field
490+
PaymentConfiguration apijson.Field
487491
ReportingConfiguration apijson.Field
488492
raw string
489493
ExtraFields map[string]apijson.Field
@@ -603,6 +607,74 @@ func (r CustomerAccountingSyncConfigurationAccountingProvidersProviderType) IsKn
603607
return false
604608
}
605609

610+
// Payment configuration for the customer, applicable when using Orb Invoicing with
611+
// a supported payment provider such as Stripe.
612+
type CustomerPaymentConfiguration struct {
613+
// Provider-specific payment configuration.
614+
PaymentProviders []CustomerPaymentConfigurationPaymentProvider `json:"payment_providers"`
615+
JSON customerPaymentConfigurationJSON `json:"-"`
616+
}
617+
618+
// customerPaymentConfigurationJSON contains the JSON metadata for the struct
619+
// [CustomerPaymentConfiguration]
620+
type customerPaymentConfigurationJSON struct {
621+
PaymentProviders apijson.Field
622+
raw string
623+
ExtraFields map[string]apijson.Field
624+
}
625+
626+
func (r *CustomerPaymentConfiguration) UnmarshalJSON(data []byte) (err error) {
627+
return apijson.UnmarshalRoot(data, r)
628+
}
629+
630+
func (r customerPaymentConfigurationJSON) RawJSON() string {
631+
return r.raw
632+
}
633+
634+
type CustomerPaymentConfigurationPaymentProvider struct {
635+
// The payment provider to configure.
636+
ProviderType CustomerPaymentConfigurationPaymentProvidersProviderType `json:"provider_type,required"`
637+
// List of Stripe payment method types to exclude for this customer. Excluded
638+
// payment methods will not be available for the customer to select during payment,
639+
// and will not be used for auto-collection. If a customer's default payment method
640+
// becomes excluded, Orb will attempt to use the next available compatible payment
641+
// method for auto-collection.
642+
ExcludedPaymentMethodTypes []string `json:"excluded_payment_method_types"`
643+
JSON customerPaymentConfigurationPaymentProviderJSON `json:"-"`
644+
}
645+
646+
// customerPaymentConfigurationPaymentProviderJSON contains the JSON metadata for
647+
// the struct [CustomerPaymentConfigurationPaymentProvider]
648+
type customerPaymentConfigurationPaymentProviderJSON struct {
649+
ProviderType apijson.Field
650+
ExcludedPaymentMethodTypes apijson.Field
651+
raw string
652+
ExtraFields map[string]apijson.Field
653+
}
654+
655+
func (r *CustomerPaymentConfigurationPaymentProvider) UnmarshalJSON(data []byte) (err error) {
656+
return apijson.UnmarshalRoot(data, r)
657+
}
658+
659+
func (r customerPaymentConfigurationPaymentProviderJSON) RawJSON() string {
660+
return r.raw
661+
}
662+
663+
// The payment provider to configure.
664+
type CustomerPaymentConfigurationPaymentProvidersProviderType string
665+
666+
const (
667+
CustomerPaymentConfigurationPaymentProvidersProviderTypeStripe CustomerPaymentConfigurationPaymentProvidersProviderType = "stripe"
668+
)
669+
670+
func (r CustomerPaymentConfigurationPaymentProvidersProviderType) IsKnown() bool {
671+
switch r {
672+
case CustomerPaymentConfigurationPaymentProvidersProviderTypeStripe:
673+
return true
674+
}
675+
return false
676+
}
677+
606678
type CustomerReportingConfiguration struct {
607679
Exempt bool `json:"exempt,required"`
608680
JSON customerReportingConfigurationJSON `json:"-"`
@@ -790,6 +862,9 @@ type CustomerNewParams struct {
790862
// by setting the value to `null`, and the entire metadata mapping can be cleared
791863
// by setting `metadata` to `null`.
792864
Metadata param.Field[map[string]string] `json:"metadata"`
865+
// Payment configuration for the customer, applicable when using Orb Invoicing with
866+
// a supported payment provider such as Stripe.
867+
PaymentConfiguration param.Field[CustomerNewParamsPaymentConfiguration] `json:"payment_configuration"`
793868
// This is used for creating charges or invoices in an external system via Orb.
794869
// When not in test mode, the connection must first be configured in the Orb
795870
// webapp.
@@ -955,6 +1030,47 @@ func (r CustomerNewParams) MarshalJSON() (data []byte, err error) {
9551030
return apijson.MarshalRoot(r)
9561031
}
9571032

1033+
// Payment configuration for the customer, applicable when using Orb Invoicing with
1034+
// a supported payment provider such as Stripe.
1035+
type CustomerNewParamsPaymentConfiguration struct {
1036+
// Provider-specific payment configuration.
1037+
PaymentProviders param.Field[[]CustomerNewParamsPaymentConfigurationPaymentProvider] `json:"payment_providers"`
1038+
}
1039+
1040+
func (r CustomerNewParamsPaymentConfiguration) MarshalJSON() (data []byte, err error) {
1041+
return apijson.MarshalRoot(r)
1042+
}
1043+
1044+
type CustomerNewParamsPaymentConfigurationPaymentProvider struct {
1045+
// The payment provider to configure.
1046+
ProviderType param.Field[CustomerNewParamsPaymentConfigurationPaymentProvidersProviderType] `json:"provider_type,required"`
1047+
// List of Stripe payment method types to exclude for this customer. Excluded
1048+
// payment methods will not be available for the customer to select during payment,
1049+
// and will not be used for auto-collection. If a customer's default payment method
1050+
// becomes excluded, Orb will attempt to use the next available compatible payment
1051+
// method for auto-collection.
1052+
ExcludedPaymentMethodTypes param.Field[[]string] `json:"excluded_payment_method_types"`
1053+
}
1054+
1055+
func (r CustomerNewParamsPaymentConfigurationPaymentProvider) MarshalJSON() (data []byte, err error) {
1056+
return apijson.MarshalRoot(r)
1057+
}
1058+
1059+
// The payment provider to configure.
1060+
type CustomerNewParamsPaymentConfigurationPaymentProvidersProviderType string
1061+
1062+
const (
1063+
CustomerNewParamsPaymentConfigurationPaymentProvidersProviderTypeStripe CustomerNewParamsPaymentConfigurationPaymentProvidersProviderType = "stripe"
1064+
)
1065+
1066+
func (r CustomerNewParamsPaymentConfigurationPaymentProvidersProviderType) IsKnown() bool {
1067+
switch r {
1068+
case CustomerNewParamsPaymentConfigurationPaymentProvidersProviderTypeStripe:
1069+
return true
1070+
}
1071+
return false
1072+
}
1073+
9581074
// This is used for creating charges or invoices in an external system via Orb.
9591075
// When not in test mode, the connection must first be configured in the Orb
9601076
// webapp.
@@ -1143,6 +1259,9 @@ type CustomerUpdateParams struct {
11431259
Metadata param.Field[map[string]string] `json:"metadata"`
11441260
// The full name of the customer
11451261
Name param.Field[string] `json:"name"`
1262+
// Payment configuration for the customer, applicable when using Orb Invoicing with
1263+
// a supported payment provider such as Stripe.
1264+
PaymentConfiguration param.Field[CustomerUpdateParamsPaymentConfiguration] `json:"payment_configuration"`
11461265
// This is used for creating charges or invoices in an external system via Orb.
11471266
// When not in test mode:
11481267
//
@@ -1308,6 +1427,47 @@ func (r CustomerUpdateParams) MarshalJSON() (data []byte, err error) {
13081427
return apijson.MarshalRoot(r)
13091428
}
13101429

1430+
// Payment configuration for the customer, applicable when using Orb Invoicing with
1431+
// a supported payment provider such as Stripe.
1432+
type CustomerUpdateParamsPaymentConfiguration struct {
1433+
// Provider-specific payment configuration.
1434+
PaymentProviders param.Field[[]CustomerUpdateParamsPaymentConfigurationPaymentProvider] `json:"payment_providers"`
1435+
}
1436+
1437+
func (r CustomerUpdateParamsPaymentConfiguration) MarshalJSON() (data []byte, err error) {
1438+
return apijson.MarshalRoot(r)
1439+
}
1440+
1441+
type CustomerUpdateParamsPaymentConfigurationPaymentProvider struct {
1442+
// The payment provider to configure.
1443+
ProviderType param.Field[CustomerUpdateParamsPaymentConfigurationPaymentProvidersProviderType] `json:"provider_type,required"`
1444+
// List of Stripe payment method types to exclude for this customer. Excluded
1445+
// payment methods will not be available for the customer to select during payment,
1446+
// and will not be used for auto-collection. If a customer's default payment method
1447+
// becomes excluded, Orb will attempt to use the next available compatible payment
1448+
// method for auto-collection.
1449+
ExcludedPaymentMethodTypes param.Field[[]string] `json:"excluded_payment_method_types"`
1450+
}
1451+
1452+
func (r CustomerUpdateParamsPaymentConfigurationPaymentProvider) MarshalJSON() (data []byte, err error) {
1453+
return apijson.MarshalRoot(r)
1454+
}
1455+
1456+
// The payment provider to configure.
1457+
type CustomerUpdateParamsPaymentConfigurationPaymentProvidersProviderType string
1458+
1459+
const (
1460+
CustomerUpdateParamsPaymentConfigurationPaymentProvidersProviderTypeStripe CustomerUpdateParamsPaymentConfigurationPaymentProvidersProviderType = "stripe"
1461+
)
1462+
1463+
func (r CustomerUpdateParamsPaymentConfigurationPaymentProvidersProviderType) IsKnown() bool {
1464+
switch r {
1465+
case CustomerUpdateParamsPaymentConfigurationPaymentProvidersProviderTypeStripe:
1466+
return true
1467+
}
1468+
return false
1469+
}
1470+
13111471
// This is used for creating charges or invoices in an external system via Orb.
13121472
// When not in test mode:
13131473
//
@@ -1520,6 +1680,9 @@ type CustomerUpdateByExternalIDParams struct {
15201680
Metadata param.Field[map[string]string] `json:"metadata"`
15211681
// The full name of the customer
15221682
Name param.Field[string] `json:"name"`
1683+
// Payment configuration for the customer, applicable when using Orb Invoicing with
1684+
// a supported payment provider such as Stripe.
1685+
PaymentConfiguration param.Field[CustomerUpdateByExternalIDParamsPaymentConfiguration] `json:"payment_configuration"`
15231686
// This is used for creating charges or invoices in an external system via Orb.
15241687
// When not in test mode:
15251688
//
@@ -1685,6 +1848,47 @@ func (r CustomerUpdateByExternalIDParams) MarshalJSON() (data []byte, err error)
16851848
return apijson.MarshalRoot(r)
16861849
}
16871850

1851+
// Payment configuration for the customer, applicable when using Orb Invoicing with
1852+
// a supported payment provider such as Stripe.
1853+
type CustomerUpdateByExternalIDParamsPaymentConfiguration struct {
1854+
// Provider-specific payment configuration.
1855+
PaymentProviders param.Field[[]CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvider] `json:"payment_providers"`
1856+
}
1857+
1858+
func (r CustomerUpdateByExternalIDParamsPaymentConfiguration) MarshalJSON() (data []byte, err error) {
1859+
return apijson.MarshalRoot(r)
1860+
}
1861+
1862+
type CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvider struct {
1863+
// The payment provider to configure.
1864+
ProviderType param.Field[CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvidersProviderType] `json:"provider_type,required"`
1865+
// List of Stripe payment method types to exclude for this customer. Excluded
1866+
// payment methods will not be available for the customer to select during payment,
1867+
// and will not be used for auto-collection. If a customer's default payment method
1868+
// becomes excluded, Orb will attempt to use the next available compatible payment
1869+
// method for auto-collection.
1870+
ExcludedPaymentMethodTypes param.Field[[]string] `json:"excluded_payment_method_types"`
1871+
}
1872+
1873+
func (r CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvider) MarshalJSON() (data []byte, err error) {
1874+
return apijson.MarshalRoot(r)
1875+
}
1876+
1877+
// The payment provider to configure.
1878+
type CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvidersProviderType string
1879+
1880+
const (
1881+
CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvidersProviderTypeStripe CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvidersProviderType = "stripe"
1882+
)
1883+
1884+
func (r CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvidersProviderType) IsKnown() bool {
1885+
switch r {
1886+
case CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvidersProviderTypeStripe:
1887+
return true
1888+
}
1889+
return false
1890+
}
1891+
16881892
// This is used for creating charges or invoices in an external system via Orb.
16891893
// When not in test mode:
16901894
//

customer_test.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ func TestCustomerNewWithOptionalParams(t *testing.T) {
5858
Metadata: orb.F(map[string]string{
5959
"foo": "string",
6060
}),
61+
PaymentConfiguration: orb.F(orb.CustomerNewParamsPaymentConfiguration{
62+
PaymentProviders: orb.F([]orb.CustomerNewParamsPaymentConfigurationPaymentProvider{{
63+
ProviderType: orb.F(orb.CustomerNewParamsPaymentConfigurationPaymentProvidersProviderTypeStripe),
64+
ExcludedPaymentMethodTypes: orb.F([]string{"string"}),
65+
}}),
66+
}),
6167
PaymentProvider: orb.F(orb.CustomerNewParamsPaymentProviderQuickbooks),
6268
PaymentProviderID: orb.F("payment_provider_id"),
6369
ReportingConfiguration: orb.F(orb.NewReportingConfigurationParam{
@@ -138,7 +144,13 @@ func TestCustomerUpdateWithOptionalParams(t *testing.T) {
138144
Metadata: orb.F(map[string]string{
139145
"foo": "string",
140146
}),
141-
Name: orb.F("name"),
147+
Name: orb.F("name"),
148+
PaymentConfiguration: orb.F(orb.CustomerUpdateParamsPaymentConfiguration{
149+
PaymentProviders: orb.F([]orb.CustomerUpdateParamsPaymentConfigurationPaymentProvider{{
150+
ProviderType: orb.F(orb.CustomerUpdateParamsPaymentConfigurationPaymentProvidersProviderTypeStripe),
151+
ExcludedPaymentMethodTypes: orb.F([]string{"string"}),
152+
}}),
153+
}),
142154
PaymentProvider: orb.F(orb.CustomerUpdateParamsPaymentProviderQuickbooks),
143155
PaymentProviderID: orb.F("payment_provider_id"),
144156
ReportingConfiguration: orb.F(orb.NewReportingConfigurationParam{
@@ -358,7 +370,13 @@ func TestCustomerUpdateByExternalIDWithOptionalParams(t *testing.T) {
358370
Metadata: orb.F(map[string]string{
359371
"foo": "string",
360372
}),
361-
Name: orb.F("name"),
373+
Name: orb.F("name"),
374+
PaymentConfiguration: orb.F(orb.CustomerUpdateByExternalIDParamsPaymentConfiguration{
375+
PaymentProviders: orb.F([]orb.CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvider{{
376+
ProviderType: orb.F(orb.CustomerUpdateByExternalIDParamsPaymentConfigurationPaymentProvidersProviderTypeStripe),
377+
ExcludedPaymentMethodTypes: orb.F([]string{"string"}),
378+
}}),
379+
}),
362380
PaymentProvider: orb.F(orb.CustomerUpdateByExternalIDParamsPaymentProviderQuickbooks),
363381
PaymentProviderID: orb.F("payment_provider_id"),
364382
ReportingConfiguration: orb.F(orb.NewReportingConfigurationParam{

0 commit comments

Comments
 (0)