Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Shorten enum names of business type, don't abbreviate corporation in …
Browse files Browse the repository at this point in the history
…models per PR reviews
  • Loading branch information
darwinz committed Nov 17, 2020
1 parent f9a03b3 commit e5495fd
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 63 deletions.
28 changes: 14 additions & 14 deletions api/client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1939,7 +1939,7 @@ components:
required:
- firstName
- lastName
CreateCustomerBusinessCorp:
CreateCustomerBusinessCorporation:
allOf:
- $ref: '#/components/schemas/CreateCustomer'
- type: object
Expand All @@ -1954,11 +1954,11 @@ components:
discriminator:
propertyName: businessType
mapping:
individual, sole proprietor, or single-member LLC: '#/components/schemas/CreateCustomerBusinessIndividual'
corporation: '#/components/schemas/CreateCustomerBusinessCorp'
non-profit organization: '#/components/schemas/CreateCustomerBusinessCorp'
partnership: '#/components/schemas/CreateCustomerBusinessCorp'
limited liability company: '#/components/schemas/CreateCustomerBusinessCorp'
sole-proprietor: '#/components/schemas/CreateCustomerBusinessIndividual'
corporation: '#/components/schemas/CreateCustomerBusinessCorporation'
non-profit: '#/components/schemas/CreateCustomerBusinessCorporation'
partnership: '#/components/schemas/CreateCustomerBusinessCorporation'
llc: '#/components/schemas/CreateCustomerBusinessCorporation'
Customer:
type: object
properties:
Expand Down Expand Up @@ -2103,7 +2103,7 @@ components:
required:
- firstName
- lastName
CustomerBusinessCorp:
CustomerBusinessCorporation:
allOf:
- $ref: '#/components/schemas/Customer'
- type: object
Expand Down Expand Up @@ -2139,10 +2139,10 @@ components:
propertyName: businessType
mapping:
individual, sole proprietor, or single-member LLC: '#/components/schemas/CustomerBusinessIndividual'
corporation: '#/components/schemas/CustomerBusinessCorp'
non-profit organization: '#/components/schemas/CustomerBusinessCorp'
partnership: '#/components/schemas/CustomerBusinessCorp'
limited liability company: '#/components/schemas/CustomerBusinessCorp'
corporation: '#/components/schemas/CustomerBusinessCorporation'
non-profit organization: '#/components/schemas/CustomerBusinessCorporation'
partnership: '#/components/schemas/CustomerBusinessCorporation'
limited liability company: '#/components/schemas/CustomerBusinessCorporation'
Customers:
type: array
items:
Expand All @@ -2157,11 +2157,11 @@ components:
type: string
description: The type of business for business customers
enum:
- individual, sole proprietor, or single-member LLC
- sole-proprietor
- corporation
- non-profit organization
- non-profit
- partnership
- limited liability company
- llc
OwnerType:
type: string
description: The type of individual owner of a resource, such as SSN, phone, or address
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ Class | Method | HTTP request | Description
- [CreateAddress](docs/CreateAddress.md)
- [CreateCustomer](docs/CreateCustomer.md)
- [CreateCustomerBusiness](docs/CreateCustomerBusiness.md)
- [CreateCustomerBusinessCorp](docs/CreateCustomerBusinessCorp.md)
- [CreateCustomerBusinessCorporation](docs/CreateCustomerBusinessCorporation.md)
- [CreateCustomerBusinessIndividual](docs/CreateCustomerBusinessIndividual.md)
- [CreateCustomerIndividual](docs/CreateCustomerIndividual.md)
- [CreatePhone](docs/CreatePhone.md)
- [CreateRepresentative](docs/CreateRepresentative.md)
- [Customer](docs/Customer.md)
- [CustomerBusiness](docs/CustomerBusiness.md)
- [CustomerBusinessAllOf](docs/CustomerBusinessAllOf.md)
- [CustomerBusinessCorp](docs/CustomerBusinessCorp.md)
- [CustomerBusinessCorpAllOf](docs/CustomerBusinessCorpAllOf.md)
- [CustomerBusinessCorporation](docs/CustomerBusinessCorporation.md)
- [CustomerBusinessCorporationAllOf](docs/CustomerBusinessCorporationAllOf.md)
- [CustomerBusinessIndividual](docs/CustomerBusinessIndividual.md)
- [CustomerIndividual](docs/CustomerIndividual.md)
- [CustomerIndividualAllOf](docs/CustomerIndividualAllOf.md)
Expand Down
32 changes: 16 additions & 16 deletions pkg/client/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2399,7 +2399,7 @@ components:
- firstName
- lastName
type: object
CreateCustomerBusinessCorp:
CreateCustomerBusinessCorporation:
allOf:
- $ref: '#/components/schemas/CreateCustomer'
- required:
Expand All @@ -2413,11 +2413,11 @@ components:
type: object
discriminator:
mapping:
individual, sole proprietor, or single-member LLC: '#/components/schemas/CreateCustomerBusinessIndividual'
corporation: '#/components/schemas/CreateCustomerBusinessCorp'
non-profit organization: '#/components/schemas/CreateCustomerBusinessCorp'
partnership: '#/components/schemas/CreateCustomerBusinessCorp'
limited liability company: '#/components/schemas/CreateCustomerBusinessCorp'
sole-proprietor: '#/components/schemas/CreateCustomerBusinessIndividual'
corporation: '#/components/schemas/CreateCustomerBusinessCorporation'
non-profit: '#/components/schemas/CreateCustomerBusinessCorporation'
partnership: '#/components/schemas/CreateCustomerBusinessCorporation'
llc: '#/components/schemas/CreateCustomerBusinessCorporation'
propertyName: businessType
Customer:
discriminator:
Expand Down Expand Up @@ -2645,21 +2645,21 @@ components:
allOf:
- $ref: '#/components/schemas/Customer'
- $ref: '#/components/schemas/CustomerIndividual_allOf'
CustomerBusinessCorp:
CustomerBusinessCorporation:
allOf:
- $ref: '#/components/schemas/Customer'
- $ref: '#/components/schemas/CustomerBusinessCorp_allOf'
- $ref: '#/components/schemas/CustomerBusinessCorporation_allOf'
CustomerBusiness:
allOf:
- $ref: '#/components/schemas/Customer'
- $ref: '#/components/schemas/CustomerBusiness_allOf'
discriminator:
mapping:
individual, sole proprietor, or single-member LLC: '#/components/schemas/CustomerBusinessIndividual'
corporation: '#/components/schemas/CustomerBusinessCorp'
non-profit organization: '#/components/schemas/CustomerBusinessCorp'
partnership: '#/components/schemas/CustomerBusinessCorp'
limited liability company: '#/components/schemas/CustomerBusinessCorp'
corporation: '#/components/schemas/CustomerBusinessCorporation'
non-profit organization: '#/components/schemas/CustomerBusinessCorporation'
partnership: '#/components/schemas/CustomerBusinessCorporation'
limited liability company: '#/components/schemas/CustomerBusinessCorporation'
propertyName: businessType
Customers:
items:
Expand All @@ -2674,11 +2674,11 @@ components:
BusinessType:
description: The type of business for business customers
enum:
- individual, sole proprietor, or single-member LLC
- sole-proprietor
- corporation
- non-profit organization
- non-profit
- partnership
- limited liability company
- llc
type: string
OwnerType:
description: The type of individual owner of a resource, such as SSN, phone,
Expand Down Expand Up @@ -3926,7 +3926,7 @@ components:
required:
- firstName
- lastName
CustomerBusinessCorp_allOf:
CustomerBusinessCorporation_allOf:
properties:
createdAt:
example: 2016-08-29T09:12:33.001Z
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CreateCustomerBusinessCorp
# CreateCustomerBusinessCorporation

## Properties

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CustomerBusinessCorp
# CustomerBusinessCorporation

## Properties

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CustomerBusinessCorpAllOf
# CustomerBusinessCorporationAllOf

## Properties

Expand Down
10 changes: 5 additions & 5 deletions pkg/client/model_business_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ type BusinessType string

// List of BusinessType
const (
BUSINESSTYPE_INDIVIDUAL_SOLE_PROPRIETOR_OR_SINGLE_MEMBER_LLC BusinessType = "individual, sole proprietor, or single-member LLC"
BUSINESSTYPE_CORPORATION BusinessType = "corporation"
BUSINESSTYPE_NON_PROFIT_ORGANIZATION BusinessType = "non-profit organization"
BUSINESSTYPE_PARTNERSHIP BusinessType = "partnership"
BUSINESSTYPE_LIMITED_LIABILITY_COMPANY BusinessType = "limited liability company"
BUSINESSTYPE_SOLE_PROPRIETOR BusinessType = "sole-proprietor"
BUSINESSTYPE_CORPORATION BusinessType = "corporation"
BUSINESSTYPE_NON_PROFIT BusinessType = "non-profit"
BUSINESSTYPE_PARTNERSHIP BusinessType = "partnership"
BUSINESSTYPE_LLC BusinessType = "llc"
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

package client

// CreateCustomerBusinessCorp struct for CreateCustomerBusinessCorp
type CreateCustomerBusinessCorp struct {
// CreateCustomerBusinessCorporation struct for CreateCustomerBusinessCorporation
type CreateCustomerBusinessCorporation struct {
// Given Name or First Name
FirstName string `json:"firstName,omitempty"`
// Middle Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"time"
)

// CustomerBusinessCorp struct for CustomerBusinessCorp
type CustomerBusinessCorp struct {
// CustomerBusinessCorporation struct for CustomerBusinessCorporation
type CustomerBusinessCorporation struct {
// The unique identifier for the customer who owns the account
CustomerID string `json:"customerID"`
// Given Name or First Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"time"
)

// CustomerBusinessCorpAllOf struct for CustomerBusinessCorpAllOf
type CustomerBusinessCorpAllOf struct {
// CustomerBusinessCorporationAllOf struct for CustomerBusinessCorporationAllOf
type CustomerBusinessCorporationAllOf struct {
CreatedAt time.Time `json:"createdAt,omitempty"`
// Last time the object was modified
LastModified time.Time `json:"lastModified,omitempty"`
Expand Down
24 changes: 12 additions & 12 deletions pkg/customers/address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ func TestCustomers__addRepresentativeAddress(t *testing.T) {

representativeRequest := customerRepresentativeRequest{
FirstName: "Jane",
LastName: "Doe",
JobTitle: "CEO",
LastName: "Doe",
JobTitle: "CEO",
}
rep, _, _ := representativeRequest.asRepresentative(testCustomerSSNStorage(t))
err = repo.CreateRepresentative(rep, cust.CustomerID)
Expand Down Expand Up @@ -443,7 +443,7 @@ func TestCustomers__updateRepresentativeAddress(t *testing.T) {

customerRequest := customerRequest{
BusinessName: "Jane's Business",
BusinessType: client.BUSINESSTYPE_INDIVIDUAL_SOLE_PROPRIETOR_OR_SINGLE_MEMBER_LLC,
BusinessType: client.BUSINESSTYPE_SOLE_PROPRIETOR,
}
cust, _, _ := customerRequest.asCustomer(testCustomerSSNStorage(t))
organization := "organization"
Expand All @@ -452,8 +452,8 @@ func TestCustomers__updateRepresentativeAddress(t *testing.T) {

representativeRequest := customerRepresentativeRequest{
FirstName: "Jane",
LastName: "Doe",
JobTitle: "CEO",
LastName: "Doe",
JobTitle: "CEO",
}
rep, _, _ := representativeRequest.asRepresentative(testCustomerSSNStorage(t))
err = repo.CreateRepresentative(rep, cust.CustomerID)
Expand Down Expand Up @@ -570,7 +570,7 @@ func TestCustomers__deleteRepresentativeAddress(t *testing.T) {

customerRequest := customerRequest{
BusinessName: "Jane's Business",
BusinessType: client.BUSINESSTYPE_LIMITED_LIABILITY_COMPANY,
BusinessType: client.BUSINESSTYPE_LLC,
}
cust, _, _ := customerRequest.asCustomer(testCustomerSSNStorage(t))
organization := "organization"
Expand All @@ -579,8 +579,8 @@ func TestCustomers__deleteRepresentativeAddress(t *testing.T) {

representativeRequest := customerRepresentativeRequest{
FirstName: "Jane",
LastName: "Doe",
JobTitle: "CEO",
LastName: "Doe",
JobTitle: "CEO",
}
rep, _, _ := representativeRequest.asRepresentative(testCustomerSSNStorage(t))
err = repo.CreateRepresentative(rep, cust.CustomerID)
Expand Down Expand Up @@ -656,8 +656,8 @@ func TestCustomerRepository__updateRepresentativeAddress(t *testing.T) {

representativeRequest := customerRepresentativeRequest{
FirstName: "Jane",
LastName: "Doe",
JobTitle: "CEO",
LastName: "Doe",
JobTitle: "CEO",
}
rep, _, _ := representativeRequest.asRepresentative(testCustomerSSNStorage(t))
err = repo.CreateRepresentative(rep, cust.CustomerID)
Expand Down Expand Up @@ -726,8 +726,8 @@ func TestCustomerRepository__deleteRepresentativeAddress(t *testing.T) {

representativeRequest := customerRepresentativeRequest{
FirstName: "Jane",
LastName: "Doe",
JobTitle: "CEO",
LastName: "Doe",
JobTitle: "CEO",
}
rep, _, _ := representativeRequest.asRepresentative(testCustomerSSNStorage(t))
err = repo.CreateRepresentative(rep, cust.CustomerID)
Expand Down
2 changes: 1 addition & 1 deletion pkg/customers/customer_representatives_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func TestCustomers__updateCustomerWithRepresentatives(t *testing.T) {
w := httptest.NewRecorder()

updateReq := *createReq
updateReq.BusinessType = client.BUSINESSTYPE_LIMITED_LIABILITY_COMPANY
updateReq.BusinessType = client.BUSINESSTYPE_LLC
updateReq.Email = "[email protected]"
updateReq.Phones = []phone{
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/customers/customers.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func (rep *representative) validate() error {
}

func (req customerRequest) validate() error {
isIndividualOrSoleProprietor := req.Type == client.CUSTOMERTYPE_INDIVIDUAL || req.BusinessType == client.BUSINESSTYPE_INDIVIDUAL_SOLE_PROPRIETOR_OR_SINGLE_MEMBER_LLC
isIndividualOrSoleProprietor := req.Type == client.CUSTOMERTYPE_INDIVIDUAL || req.BusinessType == client.BUSINESSTYPE_SOLE_PROPRIETOR
if isIndividualOrSoleProprietor && (req.FirstName == "" || req.LastName == "") {
return errors.New("invalid customer fields: empty name field(s)")
} else if req.Type == client.CUSTOMERTYPE_BUSINESS && req.BusinessName == "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/customers/customers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ func TestCustomers__customerRequest(t *testing.T) {
func TestCustomers__soleProprietorCustomerRequest(t *testing.T) {
req := &customerRequest{
Type: client.CUSTOMERTYPE_BUSINESS,
BusinessType: client.BUSINESSTYPE_INDIVIDUAL_SOLE_PROPRIETOR_OR_SINGLE_MEMBER_LLC,
BusinessType: client.BUSINESSTYPE_SOLE_PROPRIETOR,
}
if err := req.validate(); err == nil {
t.Error("expected error")
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
package customers

// Version number
const Version = "v0.6.0-dev5"
const Version = "v0.6.0-dev6"

0 comments on commit e5495fd

Please sign in to comment.