Skip to content

Commit

Permalink
change const name
Browse files Browse the repository at this point in the history
  • Loading branch information
izharishaksa committed Jun 10, 2022
1 parent 9b38fb3 commit 2c20a08
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions order-service/internal/order/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import (
)

const (
OrderStatusPlaced = "placed"
OrderStatusCreated = "created"
OrderStatusRejected = "rejected"
OrderStatusPaid = "paid"
OrderStatusCanceled = "canceled"
Placed = "placed"
Created = "created"
Rejected = "rejected"
)

type Order struct {
Expand All @@ -29,13 +27,13 @@ type Item struct {
}

func (o *Order) Reject(message *string) error {
o.Status = OrderStatusRejected
o.Status = Rejected
o.Message = message
return nil
}

func (o *Order) CreatedAtPrice(price float64) error {
o.Status = OrderStatusCreated
o.Status = Created
o.TotalPrice = price
return nil
}
Expand All @@ -45,7 +43,7 @@ func PlaceOrder(customerId uuid.UUID, items []Item) (*Order, error) {
Id: uuid.New(),
CustomerId: customerId,
Items: items,
Status: OrderStatusPlaced,
Status: Placed,
TotalPrice: 0,
CreatedAt: time.Now(),
}
Expand Down

0 comments on commit 2c20a08

Please sign in to comment.