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

Commit

Permalink
Formatting and make check fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
darwinz committed Nov 13, 2020
1 parent aac36c9 commit c09790a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
52 changes: 26 additions & 26 deletions pkg/customers/customers.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,30 @@ func respondWithCustomer(logger log.Logger, w http.ResponseWriter, customerID, o
// TODO(adam): What GDPR implications does this information have? IIRC if any EU citizen uses
// this software we have to fully comply.
type customerRequest struct {
CustomerID string `json:"-"`
FirstName string `json:"firstName"`
MiddleName string `json:"middleName"`
LastName string `json:"lastName"`
NickName string `json:"nickName"`
Suffix string `json:"suffix"`
Type client.CustomerType `json:"type"`
BusinessName string `json:"businessName"`
DoingBusinessAs string `json:"doingBusinessAs"`
BusinessType client.BusinessType `json:"businessType"`
EIN string `json:"EIN"`
DUNS string `json:"DUNS"`
SICCode client.SicCode `json:"sicCode"`
NAICSCode client.NaicsCode `json:"naicsCode"`
BirthDate model.YYYYMMDD `json:"birthDate"`
Status client.CustomerStatus `json:"-"`
Email string `json:"email"`
Website string `json:"website"`
DateBusinessEstablished string `json:"dateBusinessEstablished"`
SSN string `json:"SSN"`
Phones []phone `json:"phones"`
Addresses []address `json:"addresses"`
Representatives []representative `json:"representatives"`
Metadata map[string]string `json:"metadata"`
CustomerID string `json:"-"`
FirstName string `json:"firstName"`
MiddleName string `json:"middleName"`
LastName string `json:"lastName"`
NickName string `json:"nickName"`
Suffix string `json:"suffix"`
Type client.CustomerType `json:"type"`
BusinessName string `json:"businessName"`
DoingBusinessAs string `json:"doingBusinessAs"`
BusinessType client.BusinessType `json:"businessType"`
EIN string `json:"EIN"`
DUNS string `json:"DUNS"`
SICCode client.SicCode `json:"sicCode"`
NAICSCode client.NaicsCode `json:"naicsCode"`
BirthDate model.YYYYMMDD `json:"birthDate"`
Status client.CustomerStatus `json:"-"`
Email string `json:"email"`
Website string `json:"website"`
DateBusinessEstablished string `json:"dateBusinessEstablished"`
SSN string `json:"SSN"`
Phones []phone `json:"phones"`
Addresses []address `json:"addresses"`
Representatives []representative `json:"representatives"`
Metadata map[string]string `json:"metadata"`
}

type phone struct {
Expand Down Expand Up @@ -203,8 +203,8 @@ 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
if isIndividualOrSoleProprietor && (req.FirstName == "" || req.LastName == ""){
return errors.New("invalid customer fields: empty name field(s)")
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 == "" {
return errors.New("invalid customer fields: empty business name")
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/customers/customers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,21 +453,21 @@ func TestCustomers__businessCustomerRequest(t *testing.T) {
}
req.Representatives = append(req.Representatives, representative{
FirstName: "John",
LastName: "Doe",
LastName: "Doe",
Phones: []phone{
{
Number: "123.456.7890",
Type: "mobile",
Type: "mobile",
},
},
Addresses: []address{
{
Address1: "123 Main St",
City: "some city",
State: "IL",
Address1: "123 Main St",
City: "some city",
State: "IL",
PostalCode: "60606",
Country: "US",
Type: "primary",
Country: "US",
Type: "primary",
},
},
})
Expand Down

0 comments on commit c09790a

Please sign in to comment.