Merge remote-tracking branch 'origin' into createCartService

This commit is contained in:
Simon Zeltser 2018-06-27 22:30:06 -07:00
commit 4373f02025
44 changed files with 2136 additions and 4084 deletions

View file

@ -63,7 +63,7 @@ message Product {
string name = 2;
string description = 3;
string picture = 4;
MoneyAmount price_usd = 5;
Money price_usd = 5;
}
message ListProductsResponse {
@ -95,7 +95,7 @@ message GetQuoteRequest {
}
message GetQuoteResponse {
MoneyAmount cost_usd = 1;
Money cost_usd = 1;
}
message ShipOrderRequest {
@ -108,9 +108,9 @@ message ShipOrderResponse {
}
message Address {
string street_address_1 = 1;
string street_address_2 = 2;
string city= 3;
string street_address = 1;
string city = 2;
string state = 3;
string country = 4;
int32 zip_code = 5;
}
@ -122,18 +122,22 @@ service CurrencyService {
rpc Convert(CurrencyConversionRequest) returns (Money) {}
}
// Describes a money amount without currency. For example, decimal=2 and
// fractional=500 (or fractional=5) makes up 2.5 units.
message MoneyAmount {
uint32 decimal = 1;
uint32 fractional = 2;
}
// Represents an amount of money with its currency type.
message Money {
// The 3-letter currency code defined in ISO 4217.
string currency_code = 1;
MoneyAmount amount = 2;
// The whole units of the amount.
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
int64 units = 2;
// Number of nano (10^-9) units of the amount.
// The value must be between -999,999,999 and +999,999,999 inclusive.
// If `units` is positive, `nanos` must be positive or zero.
// If `units` is zero, `nanos` can be positive, zero, or negative.
// If `units` is negative, `nanos` must be negative or zero.
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
int32 nanos = 3;
}
message GetSupportedCurrenciesResponse {

View file

@ -1,13 +1,12 @@
FROM golang:1.10-alpine as builder
RUN apk add --no-cache ca-certificates git
WORKDIR /src/microservices-demo/catalogservice
WORKDIR /go/src/checkoutservice
COPY . .
RUN go get -d ./...
RUN go build -o /catalogservice .
RUN go build -o /checkoutservice .
FROM alpine as release
RUN apk add --no-cache \
ca-certificates
COPY --from=builder /catalogservice /catalogservice
RUN apk add --no-cache ca-certificates
COPY --from=builder /checkoutservice /checkoutservice
EXPOSE 5050
ENTRYPOINT ["/catalogservice"]
ENTRYPOINT ["/checkoutservice"]

View file

@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} }
func (m *CartItem) String() string { return proto.CompactTextString(m) }
func (*CartItem) ProtoMessage() {}
func (*CartItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{0}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{0}
}
func (m *CartItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CartItem.Unmarshal(m, b)
@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} }
func (m *AddItemRequest) String() string { return proto.CompactTextString(m) }
func (*AddItemRequest) ProtoMessage() {}
func (*AddItemRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{1}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{1}
}
func (m *AddItemRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddItemRequest.Unmarshal(m, b)
@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} }
func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) }
func (*EmptyCartRequest) ProtoMessage() {}
func (*EmptyCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{2}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{2}
}
func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b)
@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} }
func (m *GetCartRequest) String() string { return proto.CompactTextString(m) }
func (*GetCartRequest) ProtoMessage() {}
func (*GetCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{3}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{3}
}
func (m *GetCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetCartRequest.Unmarshal(m, b)
@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} }
func (m *Cart) String() string { return proto.CompactTextString(m) }
func (*Cart) ProtoMessage() {}
func (*Cart) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{4}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{4}
}
func (m *Cart) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Cart.Unmarshal(m, b)
@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{5}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{5}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Empty.Unmarshal(m, b)
@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR
func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsRequest) ProtoMessage() {}
func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{6}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{6}
}
func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b)
@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations
func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsResponse) ProtoMessage() {}
func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{7}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{7}
}
func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b)
@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string {
}
type Product struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Product) Reset() { *m = Product{} }
func (m *Product) String() string { return proto.CompactTextString(m) }
func (*Product) ProtoMessage() {}
func (*Product) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{8}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{8}
}
func (m *Product) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Product.Unmarshal(m, b)
@ -414,7 +414,7 @@ func (m *Product) GetPicture() string {
return ""
}
func (m *Product) GetPriceUsd() *MoneyAmount {
func (m *Product) GetPriceUsd() *Money {
if m != nil {
return m.PriceUsd
}
@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} }
func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) }
func (*ListProductsResponse) ProtoMessage() {}
func (*ListProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{9}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{9}
}
func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b)
@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} }
func (m *GetProductRequest) String() string { return proto.CompactTextString(m) }
func (*GetProductRequest) ProtoMessage() {}
func (*GetProductRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{10}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{10}
}
func (m *GetProductRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetProductRequest.Unmarshal(m, b)
@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} }
func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) }
func (*SearchProductsRequest) ProtoMessage() {}
func (*SearchProductsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{11}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{11}
}
func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b)
@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{}
func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) }
func (*SearchProductsResponse) ProtoMessage() {}
func (*SearchProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{12}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{12}
}
func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b)
@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} }
func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) }
func (*GetQuoteRequest) ProtoMessage() {}
func (*GetQuoteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{13}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{13}
}
func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b)
@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem {
}
type GetQuoteResponse struct {
CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} }
func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) }
func (*GetQuoteResponse) ProtoMessage() {}
func (*GetQuoteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{14}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{14}
}
func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b)
@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo
func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount {
func (m *GetQuoteResponse) GetCostUsd() *Money {
if m != nil {
return m.CostUsd
}
@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} }
func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) }
func (*ShipOrderRequest) ProtoMessage() {}
func (*ShipOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{15}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{15}
}
func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b)
@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} }
func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) }
func (*ShipOrderResponse) ProtoMessage() {}
func (*ShipOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{16}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{16}
}
func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b)
@ -742,9 +742,9 @@ func (m *ShipOrderResponse) GetTrackingId() string {
}
type Address struct {
StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"`
StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"`
City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"`
StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress" json:"street_address,omitempty"`
City string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"`
State string `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"`
Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"`
ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} }
func (m *Address) String() string { return proto.CompactTextString(m) }
func (*Address) ProtoMessage() {}
func (*Address) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{17}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{17}
}
func (m *Address) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Address.Unmarshal(m, b)
@ -776,16 +776,9 @@ func (m *Address) XXX_DiscardUnknown() {
var xxx_messageInfo_Address proto.InternalMessageInfo
func (m *Address) GetStreetAddress_1() string {
func (m *Address) GetStreetAddress() string {
if m != nil {
return m.StreetAddress_1
}
return ""
}
func (m *Address) GetStreetAddress_2() string {
if m != nil {
return m.StreetAddress_2
return m.StreetAddress
}
return ""
}
@ -797,6 +790,13 @@ func (m *Address) GetCity() string {
return ""
}
func (m *Address) GetState() string {
if m != nil {
return m.State
}
return ""
}
func (m *Address) GetCountry() string {
if m != nil {
return m.Country
@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 {
return 0
}
// Describes a money amount without currency. For example, decimal=2 and
// fractional=500 (or fractional=5) makes up 2.5 units.
type MoneyAmount struct {
Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"`
Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"`
// Represents an amount of money with its currency type.
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
// The whole units of the amount.
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"`
// Number of nano (10^-9) units of the amount.
// The value must be between -999,999,999 and +999,999,999 inclusive.
// If `units` is positive, `nanos` must be positive or zero.
// If `units` is zero, `nanos` can be positive, zero, or negative.
// If `units` is negative, `nanos` must be negative or zero.
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MoneyAmount) Reset() { *m = MoneyAmount{} }
func (m *MoneyAmount) String() string { return proto.CompactTextString(m) }
func (*MoneyAmount) ProtoMessage() {}
func (*MoneyAmount) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{18}
}
func (m *MoneyAmount) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MoneyAmount.Unmarshal(m, b)
}
func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic)
}
func (dst *MoneyAmount) XXX_Merge(src proto.Message) {
xxx_messageInfo_MoneyAmount.Merge(dst, src)
}
func (m *MoneyAmount) XXX_Size() int {
return xxx_messageInfo_MoneyAmount.Size(m)
}
func (m *MoneyAmount) XXX_DiscardUnknown() {
xxx_messageInfo_MoneyAmount.DiscardUnknown(m)
}
var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo
func (m *MoneyAmount) GetDecimal() uint32 {
if m != nil {
return m.Decimal
}
return 0
}
func (m *MoneyAmount) GetFractional() uint32 {
if m != nil {
return m.Fractional
}
return 0
}
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Money) Reset() { *m = Money{} }
func (m *Money) String() string { return proto.CompactTextString(m) }
func (*Money) ProtoMessage() {}
func (*Money) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{19}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{18}
}
func (m *Money) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Money.Unmarshal(m, b)
@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string {
return ""
}
func (m *Money) GetAmount() *MoneyAmount {
func (m *Money) GetUnits() int64 {
if m != nil {
return m.Amount
return m.Units
}
return nil
return 0
}
func (m *Money) GetNanos() int32 {
if m != nil {
return m.Nanos
}
return 0
}
type GetSupportedCurrenciesResponse struct {
@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr
func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) }
func (*GetSupportedCurrenciesResponse) ProtoMessage() {}
func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{20}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{19}
}
func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b)
@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq
func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) }
func (*CurrencyConversionRequest) ProtoMessage() {}
func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{21}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{20}
}
func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b)
@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} }
func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) }
func (*CreditCardInfo) ProtoMessage() {}
func (*CreditCardInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{22}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{21}
}
func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b)
@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} }
func (m *ChargeRequest) String() string { return proto.CompactTextString(m) }
func (*ChargeRequest) ProtoMessage() {}
func (*ChargeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{23}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{22}
}
func (m *ChargeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeRequest.Unmarshal(m, b)
@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} }
func (m *ChargeResponse) String() string { return proto.CompactTextString(m) }
func (*ChargeResponse) ProtoMessage() {}
func (*ChargeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{24}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{23}
}
func (m *ChargeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeResponse.Unmarshal(m, b)
@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} }
func (m *OrderItem) String() string { return proto.CompactTextString(m) }
func (*OrderItem) ProtoMessage() {}
func (*OrderItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{25}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{24}
}
func (m *OrderItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderItem.Unmarshal(m, b)
@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} }
func (m *OrderResult) String() string { return proto.CompactTextString(m) }
func (*OrderResult) ProtoMessage() {}
func (*OrderResult) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{26}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{25}
}
func (m *OrderResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderResult.Unmarshal(m, b)
@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat
func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) }
func (*SendOrderConfirmationRequest) ProtoMessage() {}
func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{27}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{26}
}
func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b)
@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} }
func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) }
func (*CreateOrderRequest) ProtoMessage() {}
func (*CreateOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{28}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{27}
}
func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b)
@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} }
func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) }
func (*CreateOrderResponse) ProtoMessage() {}
func (*CreateOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{29}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{28}
}
func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b)
@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} }
func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderRequest) ProtoMessage() {}
func (*PlaceOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{30}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{29}
}
func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b)
@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} }
func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderResponse) ProtoMessage() {}
func (*PlaceOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{31}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{30}
}
func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b)
@ -1527,7 +1496,6 @@ func init() {
proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest")
proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse")
proto.RegisterType((*Address)(nil), "hipstershop.Address")
proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount")
proto.RegisterType((*Money)(nil), "hipstershop.Money")
proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse")
proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest")
@ -2294,100 +2262,98 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{
Metadata: "demo.proto",
}
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) }
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) }
var fileDescriptor_demo_40506d781b7ed975 = []byte{
// 1466 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6,
0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66,
0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa,
0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a,
0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xb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0xb8, 0xed, 0x23, 0x3d, 0x2f, 0x39, 0x3b, 0x86, 0xe8, 0x5b,
0xa5, 0x67, 0x89, 0x41, 0x26, 0xb0, 0x72, 0xc0, 0x6b, 0x94, 0x12, 0xfa, 0x2d, 0xff, 0x02, 0x2b,
0xe9, 0x56, 0xe8, 0x6a, 0x21, 0x1a, 0xaa, 0x3b, 0x5a, 0x45, 0xce, 0xfe, 0xce, 0x4d, 0x3f, 0x21,
0xd6, 0x6b, 0x3f, 0x4a, 0x9e, 0x60, 0x40, 0x3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4,
0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e,
0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00,
0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00,
var fileDescriptor_demo_bbfc9458084e7e4b = []byte{
// 1435 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46,
0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40,
0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81,
0x0e, 0x1d, 0x3a, 0xf5, 0x08, 0x69, 0xc1, 0x2a, 0x91, 0x56, 0xd9, 0x5d, 0x65, 0x6a, 0xa6, 0x57,
0xf4, 0x01, 0x7a, 0xdf, 0x47, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0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 0x87, 0x34, 0xfd,
0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58,
0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6,
0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00,
0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00,
}

View file

@ -12,7 +12,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
pb "./genproto"
pb "checkoutservice/genproto"
money "checkoutservice/money"
)
const (
@ -67,16 +68,13 @@ func (cs *checkoutService) CreateOrder(ctx context.Context, req *pb.CreateOrderR
log.Printf("[CreateOrder] user_id=%q user_currency=%q", req.UserId, req.UserCurrency)
resp := new(pb.CreateOrderResponse)
shippingQuoteUSD, err := cs.quoteShipping(ctx, req.Address, nil) // TODO(ahmetb): query CartService for items
prep, err := cs.prepareOrderItemsAndShippingQuoteFromCart(ctx, req.UserId, req.UserCurrency, req.Address)
if err != nil {
return nil, status.Errorf(codes.Internal, "shipping quote failure: %+v", err)
return nil, status.Errorf(codes.Internal, err.Error())
}
resp.ShippingCost = &pb.Money{
Amount: shippingQuoteUSD,
CurrencyCode: "USD",
}
// TODO(ahmetb) convert to req.UserCurrency
// TODO(ahmetb) calculate resp.OrderItem with req.UserCurrency
resp.Items = prep.orderItems
resp.ShippingCost = prep.shippingCostLocalized
return resp, nil
}
@ -88,40 +86,26 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq
return nil, status.Errorf(codes.Internal, "failed to generate order uuid")
}
cartItems, err := cs.getUserCart(ctx, req.UserId)
prep, err := cs.prepareOrderItemsAndShippingQuoteFromCart(ctx, req.UserId, req.UserCurrency, req.Address)
if err != nil {
return nil, status.Errorf(codes.Internal, "cart failure: %+v", err)
return nil, status.Errorf(codes.Internal, err.Error())
}
orderItems, err := cs.prepOrderItems(ctx, cartItems, req.UserCurrency)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to prepare order: %+v", err)
total := pb.Money{CurrencyCode: req.UserCurrency,
Units: 0,
Nanos: 0}
total = money.Must(money.Sum(total, *prep.shippingCostLocalized))
for _, it := range prep.orderItems {
total = money.Must(money.Sum(total, *it.Cost))
}
shippingUsd, err := cs.quoteShipping(ctx, req.Address, cartItems) // TODO(ahmetb): query CartService for items
if err != nil {
return nil, status.Errorf(codes.Internal, "shipping quote failure: %+v", err)
}
shippingPrice, err := cs.convertCurrency(ctx, &pb.Money{
Amount: shippingUsd,
CurrencyCode: usdCurrency}, req.UserCurrency)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to convert shipping cost to currency: %+v", err)
}
var totalPrice pb.Money
totalPrice = sumMoney(totalPrice, *shippingPrice)
for _, it := range orderItems {
totalPrice = sumMoney(totalPrice, *it.Cost)
}
txID, err := cs.chargeCard(ctx, &totalPrice, req.CreditCard)
txID, err := cs.chargeCard(ctx, &total, req.CreditCard)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to charge card: %+v", err)
}
log.Printf("payment went through (transaction_id: %s)", txID)
shippingTrackingID, err := cs.shipOrder(ctx, req.Address, cartItems)
shippingTrackingID, err := cs.shipOrder(ctx, req.Address, prep.cartItems)
if err != nil {
return nil, status.Errorf(codes.Unavailable, "shipping error: %+v", err)
}
@ -129,9 +113,9 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq
orderResult := &pb.OrderResult{
OrderId: orderID.String(),
ShippingTrackingId: shippingTrackingID,
ShippingCost: shippingPrice,
ShippingCost: prep.shippingCostLocalized,
ShippingAddress: req.Address,
Items: orderItems,
Items: prep.orderItems,
}
if err := cs.sendOrderConfirmation(ctx, req.Email, orderResult); err != nil {
@ -143,7 +127,38 @@ func (cs *checkoutService) PlaceOrder(ctx context.Context, req *pb.PlaceOrderReq
return resp, nil
}
func (cs *checkoutService) quoteShipping(ctx context.Context, address *pb.Address, items []*pb.CartItem) (*pb.MoneyAmount, error) {
type orderPrep struct {
orderItems []*pb.OrderItem
cartItems []*pb.CartItem
shippingCostLocalized *pb.Money
}
func (cs *checkoutService) prepareOrderItemsAndShippingQuoteFromCart(ctx context.Context, userID, userCurrency string, address *pb.Address) (orderPrep, error) {
var out orderPrep
cartItems, err := cs.getUserCart(ctx, userID)
if err != nil {
return out, fmt.Errorf("cart failure: %+v", err)
}
orderItems, err := cs.prepOrderItems(ctx, cartItems, userCurrency)
if err != nil {
return out, fmt.Errorf("failed to prepare order: %+v", err)
}
shippingUSD, err := cs.quoteShipping(ctx, address, cartItems)
if err != nil {
return out, fmt.Errorf("shipping quote failure: %+v", err)
}
shippingPrice, err := cs.convertCurrency(ctx, shippingUSD, userCurrency)
if err != nil {
return out, fmt.Errorf("failed to convert shipping cost to currency: %+v", err)
}
out.shippingCostLocalized = shippingPrice
out.cartItems = cartItems
out.orderItems = orderItems
return out, nil
}
func (cs *checkoutService) quoteShipping(ctx context.Context, address *pb.Address, items []*pb.CartItem) (*pb.Money, error) {
conn, err := grpc.DialContext(ctx, cs.shippingSvcAddr, grpc.WithInsecure())
if err != nil {
return nil, fmt.Errorf("could not connect shipping service: %+v", err)
@ -189,10 +204,7 @@ func (cs *checkoutService) prepOrderItems(ctx context.Context, items []*pb.CartI
if err != nil {
return nil, fmt.Errorf("failed to get product #%q", item.GetProductId())
}
usdPrice := &pb.Money{
Amount: product.GetPriceUsd(),
CurrencyCode: usdCurrency}
price, err := cs.convertCurrency(ctx, usdPrice, userCurrency)
price, err := cs.convertCurrency(ctx, product.GetPriceUsd(), userCurrency)
if err != nil {
return nil, fmt.Errorf("failed to convert price of %q to %s", item.GetProductId(), userCurrency)
}

View file

@ -1,44 +0,0 @@
package main
import (
"math"
pb "./genproto"
)
func sum(m1, m2 pb.MoneyAmount) pb.MoneyAmount {
f1, f2 := float64(m1.Fractional), float64(m2.Fractional)
lg1 := math.Max(1, math.Ceil(math.Log10(f1)))
if f1 == math.Pow(10, lg1) {
lg1++
}
lg2 := math.Max(1, math.Ceil(math.Log10(f2)))
if f2 == math.Pow(10, lg2) {
lg2++
}
lgMax := math.Max(lg1, lg2)
dSum := m1.Decimal + m2.Decimal
o1 := f1 * math.Pow(10, lgMax-lg1)
o2 := f2 * math.Pow(10, lgMax-lg2)
fSum := o1 + o2
if fSum >= math.Pow(10, lgMax) {
fSum -= math.Pow(10, lgMax)
dSum++
}
for int(fSum)%10 == 0 && fSum != 0 {
fSum = float64(int(fSum) / 10)
}
return pb.MoneyAmount{
Decimal: dSum,
Fractional: uint32(fSum)}
}
func sumMoney(m1, m2 pb.Money) pb.Money {
s := sum(*m1.Amount, *m2.Amount)
return pb.Money{
Amount: &s,
CurrencyCode: m1.CurrencyCode}
}

View file

@ -0,0 +1,118 @@
package money
import (
"errors"
pb "checkoutservice/genproto"
)
const (
nanosMin = -999999999
nanosMax = +999999999
nanosMod = 1000000000
)
var (
ErrInvalidValue = errors.New("one of the specified money values is invalid")
ErrMismatchingCurrency = errors.New("mismatching currency codes")
)
// IsValid checks if specified value has a valid units/nanos signs and ranges.
func IsValid(m pb.Money) bool {
return signMatches(m) && validNanos(m.GetNanos())
}
func signMatches(m pb.Money) bool {
return m.GetNanos() == 0 || m.GetUnits() == 0 || (m.GetNanos() < 0) == (m.GetUnits() < 0)
}
func validNanos(nanos int32) bool { return nanosMin <= nanos && nanos <= nanosMax }
// IsZero returns true if the specified money value is equal to zero.
func IsZero(m pb.Money) bool { return m.GetUnits() == 0 && m.GetNanos() == 0 }
// IsPositive returns true if the specified money value is valid and is
// positive.
func IsPositive(m pb.Money) bool {
return IsValid(m) && m.GetUnits() > 0 || (m.GetUnits() == 0 && m.GetNanos() > 0)
}
// IsNegative returns true if the specified money value is valid and is
// negative.
func IsNegative(m pb.Money) bool {
return IsValid(m) && m.GetUnits() < 0 || (m.GetUnits() == 0 && m.GetNanos() < 0)
}
// AreSameCurrency returns true if values l and r have a currency code and
// they are the same values.
func AreSameCurrency(l, r pb.Money) bool {
return l.GetCurrencyCode() == r.GetCurrencyCode() && l.GetCurrencyCode() != ""
}
// AreEquals returns true if values l and r are the equal, including the
// currency. This does not check validity of the provided values.
func AreEquals(l, r pb.Money) bool {
return l.GetCurrencyCode() == r.GetCurrencyCode() &&
l.GetUnits() == r.GetUnits() && l.GetNanos() == r.GetNanos()
}
// Negate returns the same amount with the sign negated.
func Negate(m pb.Money) pb.Money {
return pb.Money{
Units: -m.GetUnits(),
Nanos: -m.GetNanos(),
CurrencyCode: m.GetCurrencyCode()}
}
// Must panics if the given error is not nil. This can be used with other
// functions like: "m := Must(Sum(a,b))".
func Must(v pb.Money, err error) pb.Money {
if err != nil {
panic(err)
}
return v
}
// Sum adds two values. Returns an error if one of the values are invalid or
// currency codes are not matching (unless currency code is unspecified for
// both).
func Sum(l, r pb.Money) (pb.Money, error) {
if !IsValid(l) || !IsValid(r) {
return pb.Money{}, ErrInvalidValue
} else if l.GetCurrencyCode() != r.GetCurrencyCode() {
return pb.Money{}, ErrMismatchingCurrency
}
units := l.GetUnits() + r.GetUnits()
nanos := l.GetNanos() + r.GetNanos()
if (units == 0 && nanos == 0) || (units > 0 && nanos >= 0) || (units < 0 && nanos <= 0) {
// same sign <units, nanos>
units += int64(nanos / nanosMod)
nanos = nanos % nanosMod
} else {
// different sign. nanos guaranteed to not to go over the limit
if units > 0 {
units--
nanos += nanosMod
} else {
units++
nanos -= nanosMod
}
}
return pb.Money{
Units: units,
Nanos: nanos,
CurrencyCode: l.GetCurrencyCode()}, nil
}
// MultiplySlow is a slow multiplication operation done through adding the value
// to itself n-1 times.
func MultiplySlow(m pb.Money, n uint32) pb.Money {
out := m
for n > 1 {
out = Must(Sum(out, m))
n--
}
return out
}

View file

@ -0,0 +1,231 @@
package money
import (
"fmt"
"reflect"
"testing"
pb "checkoutservice/genproto"
)
func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} }
func mm(u int64, n int32) pb.Money { return mmc(u, n, "") }
func TestIsValid(t *testing.T) {
tests := []struct {
name string
in pb.Money
want bool
}{
{"valid -/-", mm(-981273891273, -999999999), true},
{"invalid -/+", mm(-981273891273, +999999999), false},
{"valid +/+", mm(981273891273, 999999999), true},
{"invalid +/-", mm(981273891273, -999999999), false},
{"invalid +/+overflow", mm(3, 1000000000), false},
{"invalid +/-overflow", mm(3, -1000000000), false},
{"invalid -/+overflow", mm(-3, 1000000000), false},
{"invalid -/-overflow", mm(-3, -1000000000), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsValid(tt.in); got != tt.want {
t.Errorf("IsValid(%v) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestIsZero(t *testing.T) {
tests := []struct {
name string
in pb.Money
want bool
}{
{"zero", mm(0, 0), true},
{"not-zero (-/+)", mm(-1, +1), false},
{"not-zero (-/-)", mm(-1, -1), false},
{"not-zero (+/+)", mm(+1, +1), false},
{"not-zero (+/-)", mm(+1, -1), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsZero(tt.in); got != tt.want {
t.Errorf("IsZero(%v) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestIsPositive(t *testing.T) {
tests := []struct {
name string
in pb.Money
want bool
}{
{"zero", mm(0, 0), false},
{"positive (+/+)", mm(+1, +1), true},
{"invalid (-/+)", mm(-1, +1), false},
{"negative (-/-)", mm(-1, -1), false},
{"invalid (+/-)", mm(+1, -1), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsPositive(tt.in); got != tt.want {
t.Errorf("IsPositive(%v) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestIsNegative(t *testing.T) {
tests := []struct {
name string
in pb.Money
want bool
}{
{"zero", mm(0, 0), false},
{"positive (+/+)", mm(+1, +1), false},
{"invalid (-/+)", mm(-1, +1), false},
{"negative (-/-)", mm(-1, -1), true},
{"invalid (+/-)", mm(+1, -1), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsNegative(tt.in); got != tt.want {
t.Errorf("IsNegative(%v) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestAreSameCurrency(t *testing.T) {
type args struct {
l pb.Money
r pb.Money
}
tests := []struct {
name string
args args
want bool
}{
{"both empty currency", args{mmc(1, 0, ""), mmc(2, 0, "")}, false},
{"left empty currency", args{mmc(1, 0, ""), mmc(2, 0, "USD")}, false},
{"right empty currency", args{mmc(1, 0, "USD"), mmc(2, 0, "")}, false},
{"mismatching", args{mmc(1, 0, "USD"), mmc(2, 0, "CAD")}, false},
{"matching", args{mmc(1, 0, "USD"), mmc(2, 0, "USD")}, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := AreSameCurrency(tt.args.l, tt.args.r); got != tt.want {
t.Errorf("AreSameCurrency([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want)
}
})
}
}
func TestAreEquals(t *testing.T) {
type args struct {
l pb.Money
r pb.Money
}
tests := []struct {
name string
args args
want bool
}{
{"equals", args{mmc(1, 2, "USD"), mmc(1, 2, "USD")}, true},
{"mismatching currency", args{mmc(1, 2, "USD"), mmc(1, 2, "CAD")}, false},
{"mismatching units", args{mmc(10, 20, "USD"), mmc(1, 20, "USD")}, false},
{"mismatching nanos", args{mmc(1, 2, "USD"), mmc(1, 20, "USD")}, false},
{"negated", args{mmc(1, 2, "USD"), mmc(-1, -2, "USD")}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := AreEquals(tt.args.l, tt.args.r); got != tt.want {
t.Errorf("AreEquals([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want)
}
})
}
}
func TestNegate(t *testing.T) {
tests := []struct {
name string
in pb.Money
want pb.Money
}{
{"zero", mm(0, 0), mm(0, 0)},
{"negative", mm(-1, -200), mm(1, 200)},
{"positive", mm(1, 200), mm(-1, -200)},
{"carries currency code", mmc(0, 0, "XXX"), mmc(0, 0, "XXX")},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Negate(tt.in); !AreEquals(got, tt.want) {
t.Errorf("Negate([%v]) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestMust_pass(t *testing.T) {
v := Must(mm(2, 3), nil)
if !AreEquals(v, mm(2, 3)) {
t.Errorf("returned the wrong value: %v", v)
}
}
func TestMust_panic(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Logf("panic captured: %v", r)
}
}()
Must(mm(2, 3), fmt.Errorf("some error"))
t.Fatal("this should not have executed due to the panic above")
}
func TestSum(t *testing.T) {
type args struct {
l pb.Money
r pb.Money
}
tests := []struct {
name string
args args
want pb.Money
wantErr error
}{
{"0+0=0", args{mm(0, 0), mm(0, 0)}, mm(0, 0), nil},
{"Error: currency code on left", args{mmc(0, 0, "XXX"), mm(0, 0)}, mm(0, 0), ErrMismatchingCurrency},
{"Error: currency code on right", args{mm(0, 0), mmc(0, 0, "YYY")}, mm(0, 0), ErrMismatchingCurrency},
{"Error: currency code mismatch", args{mmc(0, 0, "AAA"), mmc(0, 0, "BBB")}, mm(0, 0), ErrMismatchingCurrency},
{"Error: invalid +/-", args{mm(+1, -1), mm(0, 0)}, mm(0, 0), ErrInvalidValue},
{"Error: invalid -/+", args{mm(0, 0), mm(-1, +2)}, mm(0, 0), ErrInvalidValue},
{"Error: invalid nanos", args{mm(0, 1000000000), mm(1, 0)}, mm(0, 0), ErrInvalidValue},
{"both positive (no carry)", args{mm(2, 200000000), mm(2, 200000000)}, mm(4, 400000000), nil},
{"both positive (nanos=max)", args{mm(2, 111111111), mm(2, 888888888)}, mm(4, 999999999), nil},
{"both positive (carry)", args{mm(2, 200000000), mm(2, 900000000)}, mm(5, 100000000), nil},
{"both negative (no carry)", args{mm(-2, -200000000), mm(-2, -200000000)}, mm(-4, -400000000), nil},
{"both negative (carry)", args{mm(-2, -200000000), mm(-2, -900000000)}, mm(-5, -100000000), nil},
{"mixed (larger positive, just decimals)", args{mm(11, 0), mm(-2, 0)}, mm(9, 0), nil},
{"mixed (larger negative, just decimals)", args{mm(-11, 0), mm(2, 0)}, mm(-9, 0), nil},
{"mixed (larger positive, no borrow)", args{mm(11, 100000000), mm(-2, -100000000)}, mm(9, 0), nil},
{"mixed (larger positive, with borrow)", args{mm(11, 100000000), mm(-2, -9000000 /*.09*/)}, mm(9, 91000000 /*.091*/), nil},
{"mixed (larger negative, no borrow)", args{mm(-11, -100000000), mm(2, 100000000)}, mm(-9, 0), nil},
{"mixed (larger negative, with borrow)", args{mm(-11, -100000000), mm(2, 9000000 /*.09*/)}, mm(-9, -91000000 /*.091*/), nil},
{"0+negative", args{mm(0, 0), mm(-2, -100000000)}, mm(-2, -100000000), nil},
{"negative+0", args{mm(-2, -100000000), mm(0, 0)}, mm(-2, -100000000), nil},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Sum(tt.args.l, tt.args.r)
if err != tt.wantErr {
t.Errorf("Sum([%v],[%v]): expected err=\"%v\" got=\"%v\"", tt.args.l, tt.args.r, tt.wantErr, err)
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Sum([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want)
}
})
}
}

View file

@ -1,53 +0,0 @@
package main
import (
"reflect"
"testing"
pb "./genproto"
)
func Test_sum(t *testing.T) {
type args struct {
m1 pb.MoneyAmount
m2 pb.MoneyAmount
}
tests := []struct {
name string
args args
want pb.MoneyAmount
}{
{
name: "no fractions",
args: args{pb.MoneyAmount{Decimal: 10}, pb.MoneyAmount{Decimal: 100}},
want: pb.MoneyAmount{Decimal: 110},
},
{
name: "same fraction digits",
args: args{pb.MoneyAmount{Decimal: 1, Fractional: 23}, pb.MoneyAmount{Decimal: 1, Fractional: 44}},
want: pb.MoneyAmount{Decimal: 2, Fractional: 67},
},
{
name: "different fraction digits",
args: args{pb.MoneyAmount{Decimal: 1, Fractional: 351}, pb.MoneyAmount{Decimal: 1, Fractional: 1}},
want: pb.MoneyAmount{Decimal: 2, Fractional: 451},
},
{
name: "redundant trailing zeroes are removed from fraction",
args: args{pb.MoneyAmount{Decimal: 1, Fractional: 351}, pb.MoneyAmount{Decimal: 1, Fractional: 349}},
want: pb.MoneyAmount{Decimal: 2, Fractional: 7},
},
{
name: "carry",
args: args{pb.MoneyAmount{Decimal: 1, Fractional: 5}, pb.MoneyAmount{Decimal: 1, Fractional: 5000000}},
want: pb.MoneyAmount{Decimal: 3},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := sum(tt.args.m1, tt.args.m2); !reflect.DeepEqual(got, tt.want) {
t.Errorf("sum(%v+%v) = %v, want=%v", tt.args.m1, tt.args.m2, got, tt.want)
}
})
}
}

View file

@ -18,6 +18,7 @@
const path = require('path');
const grpc = require('grpc');
const leftPad = require('left-pad');
const PROTO_PATH = path.join(__dirname, './proto/demo.proto');
const PORT = 31337;
@ -28,17 +29,15 @@ const client = new shopProto.CurrencyService(`localhost:${PORT}`,
const request = {
from: {
currency_code: 'USD',
amount: {
decimal: 300,
fractional: 0
}
currency_code: 'CHF',
units: 300,
nanos: 0
},
to_code: 'CHF'
to_code: 'EUR'
};
function _moneyToString (m) {
return `${m.amount.decimal}.${m.amount.fractional} ${m.currency_code}`;
return `${m.units}.${leftPad(m.nanos, 9, '0')} ${m.currency_code}`;
}
client.getSupportedCurrencies({}, (err, response) => {

0
src/currencyservice/genproto.sh Normal file → Executable file
View file

View file

@ -8,6 +8,7 @@
"async": "^1.5.2",
"google-protobuf": "^3.0.0",
"grpc": "^1.0.0",
"left-pad": "^1.3.0",
"request": "^2.87.0",
"xml2js": "^0.4.19"
}

View file

@ -63,7 +63,7 @@ message Product {
string name = 2;
string description = 3;
string picture = 4;
MoneyAmount price_usd = 5;
Money price_usd = 5;
}
message ListProductsResponse {
@ -95,7 +95,7 @@ message GetQuoteRequest {
}
message GetQuoteResponse {
MoneyAmount cost_usd = 1;
Money cost_usd = 1;
}
message ShipOrderRequest {
@ -122,18 +122,22 @@ service CurrencyService {
rpc Convert(CurrencyConversionRequest) returns (Money) {}
}
// Describes a money amount without currency. For example, decimal=2 and
// fractional=500 (or fractional=5) makes up 2.5 units.
message MoneyAmount {
uint32 decimal = 1;
uint32 fractional = 2;
}
// Represents an amount of money with its currency type.
message Money {
// The 3-letter currency code defined in ISO 4217.
string currency_code = 1;
MoneyAmount amount = 2;
// The whole units of the amount.
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
int64 units = 2;
// Number of nano (10^-9) units of the amount.
// The value must be between -999,999,999 and +999,999,999 inclusive.
// If `units` is positive, `nanos` must be positive or zero.
// If `units` is zero, `nanos` can be positive, zero, or negative.
// If `units` is negative, `nanos` must be negative or zero.
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
int32 nanos = 3;
}
message GetSupportedCurrenciesResponse {

View file

@ -31,7 +31,7 @@ const shopProto = grpc.load(PROTO_PATH).hipstershop;
let _data;
function _getCurrencyData (callback) {
if (!_data) {
console.log('Fetching currency data...')
console.log('Fetching currency data...');
request(DATA_URL, (err, res) => {
if (err) {
throw new Error(`Error getting data: ${err}`);
@ -53,7 +53,7 @@ function _getCurrencyData (callback) {
});
});
} else {
console.log('Using cached currency data...')
console.log('Using cached currency data...');
callback(_data);
}
}
@ -62,9 +62,10 @@ function _getCurrencyData (callback) {
* Helper function that handles decimal/fractional carrying
*/
function _carry (amount) {
amount.fractional += (amount.decimal % 1) * 100;
amount.decimal = Math.floor(amount.decimal) + Math.floor(amount.fractional / 100);
amount.fractional = amount.fractional % 100;
const fractionSize = Math.pow(10, 9);
amount.nanos += (amount.units % 1) * fractionSize;
amount.units = Math.floor(amount.units) + Math.floor(amount.nanos / fractionSize);
amount.nanos = amount.nanos % fractionSize;
return amount;
}
@ -72,7 +73,7 @@ function _carry (amount) {
* Lists the supported currencies
*/
function getSupportedCurrencies (call, callback) {
console.log('Getting supported currencies...')
console.log('Getting supported currencies...');
_getCurrencyData((data) => {
callback(null, {currency_codes: Object.keys(data)});
});
@ -82,7 +83,7 @@ function getSupportedCurrencies (call, callback) {
* Converts between currencies
*/
function convert (call, callback) {
console.log('Starting conversion request...')
console.log('Starting conversion request...');
try {
_getCurrencyData((data) => {
const request = call.request;
@ -90,22 +91,28 @@ function convert (call, callback) {
// Convert: from_currency --> EUR
const from = request.from;
const euros = _carry({
decimal: from.amount.decimal / data[from.currency_code],
fractional: from.amount.fractional / data[from.currency_code]
units: from.units / data[from.currency_code],
nanos: from.nanos / data[from.currency_code]
});
euros.nanos = Math.round(euros.nanos);
// Convert: EUR --> to_currency
const target = _carry({
decimal: euros.decimal * data[request.to_code],
fractional: euros.fractional * data[request.to_code]
const result = _carry({
units: euros.units * data[request.to_code],
nanos: euros.nanos * data[request.to_code]
});
target.fractional = Math.round(target.fractional);
console.log('Conversion request successful.')
callback(null, {currency_code: request.to_code, amount: target});
result.units = Math.floor(result.units)
result.nanos = Math.floor(result.nanos)
result.currency_code = request.to_code;
console.log(`Conversion request successful ${result.nanos}..${result.nanos}`);
callback(null, result);
});
} catch (err) {
console.error('Conversion request failed.')
console.error('Conversion request failed.');
console.error(err);
callback(err.message);
}
}

View file

@ -1,13 +0,0 @@
FROM golang:1.10-alpine as builder
RUN apk add --no-cache ca-certificates git
WORKDIR /src/microservices-demo/currencyservice
COPY . .
RUN go get -d ./...
RUN go build -o /currencyservice .
FROM alpine as release
RUN apk add --no-cache \
ca-certificates
COPY --from=builder /currencyservice /currencyservice
EXPOSE 7000
ENTRYPOINT ["/currencyservice"]

File diff suppressed because it is too large Load diff

View file

@ -1,77 +0,0 @@
package main
import (
"context"
"fmt"
"log"
"net"
"os"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/grpc"
pb "./genproto"
)
const (
listenPort = "7000"
)
type currencyServer struct {
currencies []string
conversionRates map[[2]string]float64
}
func main() {
port := listenPort
if os.Getenv("PORT") != "" {
port = os.Getenv("PORT")
}
svc := &currencyServer{
currencies: []string{"USD", "EUR", "CAD"},
conversionRates: map[[2]string]float64{
{"USD", "EUR"}: 0.86,
{"EUR", "USD"}: 1 / 0.86,
{"USD", "CAD"}: 1.33,
{"CAD", "USD"}: 1 / 1.33,
{"EUR", "CAD"}: 1.54,
{"CAD", "EUR"}: 1 / 1.54,
},
}
lis, err := net.Listen("tcp", fmt.Sprintf(":%s", port))
if err != nil {
log.Fatal(err)
}
srv := grpc.NewServer()
pb.RegisterCurrencyServiceServer(srv, svc)
log.Printf("starting to listen on tcp: %q", lis.Addr().String())
log.Fatal(srv.Serve(lis))
}
func (cs *currencyServer) GetSupportedCurrencies(_ context.Context, _ *pb.Empty) (*pb.GetSupportedCurrenciesResponse, error) {
log.Printf("requesting supported currencies (%d)", len(cs.currencies))
return &pb.GetSupportedCurrenciesResponse{CurrencyCodes: cs.currencies}, nil
}
func (cs *currencyServer) Convert(_ context.Context, req *pb.CurrencyConversionRequest) (*pb.Money, error) {
log.Printf("requesting currency conversion [%+v] --> %s", req.From, req.ToCode)
conv := [2]string{req.GetFrom().GetCurrencyCode(), req.GetToCode()}
rate, ok := cs.conversionRates[conv]
if !ok {
return nil, status.Errorf(codes.InvalidArgument, "conversion %v not supported", conv)
}
if req.From == nil {
return nil, status.Errorf(codes.InvalidArgument, "no money amount provided")
}
amount := convert(*req.From.Amount, rate)
return &pb.Money{
CurrencyCode: req.GetToCode(),
Amount: &amount}, nil
}

View file

@ -1,29 +0,0 @@
package main
import (
"fmt"
"math"
"strconv"
"strings"
pb "./genproto"
)
func convert(m pb.MoneyAmount, rate float64) pb.MoneyAmount {
d, f := m.Decimal, m.Fractional
lg := int(math.Max(1, math.Ceil(math.Log10(float64(f)))))
ff, _ := strconv.ParseFloat(fmt.Sprintf("%d.%d", d, f), 64)
res := ff * rate
resTxt := fmt.Sprintf("%."+strconv.Itoa(lg)+"f", res)
p := strings.Split(resTxt, ".")
ds, fs := p[0], p[1]
fs = strings.TrimSuffix(fs, "0")
if fs == "" {
fs = "0"
}
dn, _ := strconv.Atoi(ds)
fn, _ := strconv.Atoi(fs)
return pb.MoneyAmount{Decimal: uint32(dn), Fractional: uint32(fn)}
}

View file

@ -1,46 +0,0 @@
package main
import (
"reflect"
"testing"
pb "./genproto"
)
func Test_convert(t *testing.T) {
type args struct {
m pb.MoneyAmount
rate float64
}
tests := []struct {
name string
args args
want pb.MoneyAmount
}{
{
"0.33*3", args{pb.MoneyAmount{Decimal: 0, Fractional: 330}, 3}, pb.MoneyAmount{Decimal: 0, Fractional: 99},
},
{
"10.00*0.5", args{pb.MoneyAmount{Decimal: 10}, 0.5}, pb.MoneyAmount{Decimal: 5},
},
{
"10.00*1.5", args{pb.MoneyAmount{Decimal: 10}, 1.5}, pb.MoneyAmount{Decimal: 15},
},
{
"10.00*1/3", args{pb.MoneyAmount{Decimal: 10}, 1.0 / 3}, pb.MoneyAmount{Decimal: 3, Fractional: 3},
},
{
"32.320*0.5 (trailing zero removed)", args{pb.MoneyAmount{Decimal: 32, Fractional: 32}, 0.5}, pb.MoneyAmount{Decimal: 16, Fractional: 16},
},
{
"33.33*(1/3) (trailing zero removed)", args{pb.MoneyAmount{Decimal: 33, Fractional: 33}, 1.0 / 3}, pb.MoneyAmount{Decimal: 11, Fractional: 11},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := convert(tt.args.m, tt.args.rate); !reflect.DeepEqual(got, tt.want) {
t.Errorf("convert([%v]*%f) = %v, want=[%v]", tt.args.m, tt.args.rate, got, tt.want)
}
})
}
}

View file

@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} }
func (m *CartItem) String() string { return proto.CompactTextString(m) }
func (*CartItem) ProtoMessage() {}
func (*CartItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{0}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{0}
}
func (m *CartItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CartItem.Unmarshal(m, b)
@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} }
func (m *AddItemRequest) String() string { return proto.CompactTextString(m) }
func (*AddItemRequest) ProtoMessage() {}
func (*AddItemRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{1}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{1}
}
func (m *AddItemRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddItemRequest.Unmarshal(m, b)
@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} }
func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) }
func (*EmptyCartRequest) ProtoMessage() {}
func (*EmptyCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{2}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{2}
}
func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b)
@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} }
func (m *GetCartRequest) String() string { return proto.CompactTextString(m) }
func (*GetCartRequest) ProtoMessage() {}
func (*GetCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{3}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{3}
}
func (m *GetCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetCartRequest.Unmarshal(m, b)
@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} }
func (m *Cart) String() string { return proto.CompactTextString(m) }
func (*Cart) ProtoMessage() {}
func (*Cart) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{4}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{4}
}
func (m *Cart) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Cart.Unmarshal(m, b)
@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{5}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{5}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Empty.Unmarshal(m, b)
@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR
func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsRequest) ProtoMessage() {}
func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{6}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{6}
}
func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b)
@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations
func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsResponse) ProtoMessage() {}
func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{7}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{7}
}
func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b)
@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string {
}
type Product struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Product) Reset() { *m = Product{} }
func (m *Product) String() string { return proto.CompactTextString(m) }
func (*Product) ProtoMessage() {}
func (*Product) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{8}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{8}
}
func (m *Product) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Product.Unmarshal(m, b)
@ -414,7 +414,7 @@ func (m *Product) GetPicture() string {
return ""
}
func (m *Product) GetPriceUsd() *MoneyAmount {
func (m *Product) GetPriceUsd() *Money {
if m != nil {
return m.PriceUsd
}
@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} }
func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) }
func (*ListProductsResponse) ProtoMessage() {}
func (*ListProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{9}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{9}
}
func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b)
@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} }
func (m *GetProductRequest) String() string { return proto.CompactTextString(m) }
func (*GetProductRequest) ProtoMessage() {}
func (*GetProductRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{10}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{10}
}
func (m *GetProductRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetProductRequest.Unmarshal(m, b)
@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} }
func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) }
func (*SearchProductsRequest) ProtoMessage() {}
func (*SearchProductsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{11}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{11}
}
func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b)
@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{}
func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) }
func (*SearchProductsResponse) ProtoMessage() {}
func (*SearchProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{12}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{12}
}
func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b)
@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} }
func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) }
func (*GetQuoteRequest) ProtoMessage() {}
func (*GetQuoteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{13}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{13}
}
func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b)
@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem {
}
type GetQuoteResponse struct {
CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} }
func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) }
func (*GetQuoteResponse) ProtoMessage() {}
func (*GetQuoteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{14}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{14}
}
func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b)
@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo
func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount {
func (m *GetQuoteResponse) GetCostUsd() *Money {
if m != nil {
return m.CostUsd
}
@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} }
func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) }
func (*ShipOrderRequest) ProtoMessage() {}
func (*ShipOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{15}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{15}
}
func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b)
@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} }
func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) }
func (*ShipOrderResponse) ProtoMessage() {}
func (*ShipOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{16}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{16}
}
func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b)
@ -742,9 +742,9 @@ func (m *ShipOrderResponse) GetTrackingId() string {
}
type Address struct {
StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"`
StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"`
City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"`
StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress" json:"street_address,omitempty"`
City string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"`
State string `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"`
Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"`
ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} }
func (m *Address) String() string { return proto.CompactTextString(m) }
func (*Address) ProtoMessage() {}
func (*Address) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{17}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{17}
}
func (m *Address) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Address.Unmarshal(m, b)
@ -776,16 +776,9 @@ func (m *Address) XXX_DiscardUnknown() {
var xxx_messageInfo_Address proto.InternalMessageInfo
func (m *Address) GetStreetAddress_1() string {
func (m *Address) GetStreetAddress() string {
if m != nil {
return m.StreetAddress_1
}
return ""
}
func (m *Address) GetStreetAddress_2() string {
if m != nil {
return m.StreetAddress_2
return m.StreetAddress
}
return ""
}
@ -797,6 +790,13 @@ func (m *Address) GetCity() string {
return ""
}
func (m *Address) GetState() string {
if m != nil {
return m.State
}
return ""
}
func (m *Address) GetCountry() string {
if m != nil {
return m.Country
@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 {
return 0
}
// Describes a money amount without currency. For example, decimal=2 and
// fractional=500 (or fractional=5) makes up 2.5 units.
type MoneyAmount struct {
Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"`
Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"`
// Represents an amount of money with its currency type.
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
// The whole units of the amount.
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"`
// Number of nano (10^-9) units of the amount.
// The value must be between -999,999,999 and +999,999,999 inclusive.
// If `units` is positive, `nanos` must be positive or zero.
// If `units` is zero, `nanos` can be positive, zero, or negative.
// If `units` is negative, `nanos` must be negative or zero.
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MoneyAmount) Reset() { *m = MoneyAmount{} }
func (m *MoneyAmount) String() string { return proto.CompactTextString(m) }
func (*MoneyAmount) ProtoMessage() {}
func (*MoneyAmount) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{18}
}
func (m *MoneyAmount) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MoneyAmount.Unmarshal(m, b)
}
func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic)
}
func (dst *MoneyAmount) XXX_Merge(src proto.Message) {
xxx_messageInfo_MoneyAmount.Merge(dst, src)
}
func (m *MoneyAmount) XXX_Size() int {
return xxx_messageInfo_MoneyAmount.Size(m)
}
func (m *MoneyAmount) XXX_DiscardUnknown() {
xxx_messageInfo_MoneyAmount.DiscardUnknown(m)
}
var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo
func (m *MoneyAmount) GetDecimal() uint32 {
if m != nil {
return m.Decimal
}
return 0
}
func (m *MoneyAmount) GetFractional() uint32 {
if m != nil {
return m.Fractional
}
return 0
}
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Money) Reset() { *m = Money{} }
func (m *Money) String() string { return proto.CompactTextString(m) }
func (*Money) ProtoMessage() {}
func (*Money) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{19}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{18}
}
func (m *Money) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Money.Unmarshal(m, b)
@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string {
return ""
}
func (m *Money) GetAmount() *MoneyAmount {
func (m *Money) GetUnits() int64 {
if m != nil {
return m.Amount
return m.Units
}
return nil
return 0
}
func (m *Money) GetNanos() int32 {
if m != nil {
return m.Nanos
}
return 0
}
type GetSupportedCurrenciesResponse struct {
@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr
func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) }
func (*GetSupportedCurrenciesResponse) ProtoMessage() {}
func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{20}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{19}
}
func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b)
@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq
func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) }
func (*CurrencyConversionRequest) ProtoMessage() {}
func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{21}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{20}
}
func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b)
@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} }
func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) }
func (*CreditCardInfo) ProtoMessage() {}
func (*CreditCardInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{22}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{21}
}
func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b)
@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} }
func (m *ChargeRequest) String() string { return proto.CompactTextString(m) }
func (*ChargeRequest) ProtoMessage() {}
func (*ChargeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{23}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{22}
}
func (m *ChargeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeRequest.Unmarshal(m, b)
@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} }
func (m *ChargeResponse) String() string { return proto.CompactTextString(m) }
func (*ChargeResponse) ProtoMessage() {}
func (*ChargeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{24}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{23}
}
func (m *ChargeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeResponse.Unmarshal(m, b)
@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} }
func (m *OrderItem) String() string { return proto.CompactTextString(m) }
func (*OrderItem) ProtoMessage() {}
func (*OrderItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{25}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{24}
}
func (m *OrderItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderItem.Unmarshal(m, b)
@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} }
func (m *OrderResult) String() string { return proto.CompactTextString(m) }
func (*OrderResult) ProtoMessage() {}
func (*OrderResult) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{26}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{25}
}
func (m *OrderResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderResult.Unmarshal(m, b)
@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat
func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) }
func (*SendOrderConfirmationRequest) ProtoMessage() {}
func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{27}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{26}
}
func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b)
@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} }
func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) }
func (*CreateOrderRequest) ProtoMessage() {}
func (*CreateOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{28}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{27}
}
func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b)
@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} }
func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) }
func (*CreateOrderResponse) ProtoMessage() {}
func (*CreateOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{29}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{28}
}
func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b)
@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} }
func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderRequest) ProtoMessage() {}
func (*PlaceOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{30}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{29}
}
func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b)
@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} }
func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderResponse) ProtoMessage() {}
func (*PlaceOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{31}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{30}
}
func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b)
@ -1527,7 +1496,6 @@ func init() {
proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest")
proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse")
proto.RegisterType((*Address)(nil), "hipstershop.Address")
proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount")
proto.RegisterType((*Money)(nil), "hipstershop.Money")
proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse")
proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest")
@ -2294,100 +2262,98 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{
Metadata: "demo.proto",
}
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) }
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) }
var fileDescriptor_demo_40506d781b7ed975 = []byte{
// 1466 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6,
0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66,
0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa,
0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a,
0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3,
0xab, 0x5d, 0x7d, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xe7, 0xdd, 0xfd, 0xed, 0x39, 0xbf, 0x3d, 0xdf,
0x32, 0x80, 0x4d, 0x5c, 0x7f, 0x3f, 0xa0, 0x3e, 0xf3, 0x51, 0x7b, 0xe2, 0x04, 0x21, 0x23, 0x34,
0x9c, 0xf8, 0x01, 0x3e, 0x80, 0xe6, 0xc0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0x3f, 0x4a, 0x9e, 0x60, 0x40, 0x3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4,
0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e,
0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00,
0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00,
var fileDescriptor_demo_bbfc9458084e7e4b = []byte{
// 1435 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46,
0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40,
0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81,
0x0e, 0x1d, 0x3a, 0xf5, 0x08, 0x69, 0xc1, 0x2a, 0x91, 0x56, 0xd9, 0x5d, 0x65, 0x6a, 0xa6, 0x57,
0xf4, 0x01, 0x7a, 0xdf, 0x47, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3,
0x2b, 0xad, 0xfe, 0x6c, 0x25, 0xe1, 0xa6, 0xbd, 0xd3, 0xee, 0x7e, 0x7b, 0xce, 0xb7, 0xe7, 0xdf,
0x06, 0x70, 0x89, 0x4f, 0x77, 0x42, 0x46, 0x05, 0x45, 0x9d, 0x89, 0x17, 0x72, 0x41, 0x18, 0x9f,
0xd0, 0x10, 0xef, 0x41, 0x6b, 0x60, 0x33, 0x31, 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 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00,
0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00,
}

View file

@ -3,6 +3,7 @@ package main
import (
"context"
"fmt"
"frontend/money"
"html/template"
"log"
"net/http"
@ -16,7 +17,10 @@ import (
)
var (
templates = template.Must(template.ParseGlob("templates/*.html"))
templates = template.Must(template.New("").
Funcs(template.FuncMap{
"renderMoney": renderMoney,
}).ParseGlob("templates/*.html"))
)
func ensureSessionID(next http.HandlerFunc) http.HandlerFunc {
@ -44,7 +48,7 @@ func ensureSessionID(next http.HandlerFunc) http.HandlerFunc {
}
func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("[home] session_id=%+v currency=%s", sessionID(r), currentCurrency(r))
log.Printf("[home] session_id=%s currency=%s", sessionID(r), currentCurrency(r))
currencies, err := fe.getCurrencies(r.Context())
if err != nil {
http.Error(w, fmt.Sprintf("could not retrieve currencies: %+v", err), http.StatusInternalServerError)
@ -67,10 +71,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
}
ps := make([]productView, len(products))
for i, p := range products {
price, err := fe.convertCurrency(r.Context(), &pb.Money{
Amount: p.PriceUsd,
CurrencyCode: defaultCurrency,
}, currentCurrency(r))
price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r))
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@ -113,9 +114,7 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request)
return
}
price, err := fe.convertCurrency(r.Context(), &pb.Money{
Amount: p.GetPriceUsd(),
CurrencyCode: defaultCurrency}, currentCurrency(r))
price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r))
if err != nil {
http.Error(w, fmt.Sprintf("failed to convert currency: %+v", err), http.StatusInternalServerError)
return
@ -126,7 +125,6 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request)
http.Error(w, fmt.Sprintf("failed to get product recommendations: %+v", err), http.StatusInternalServerError)
return
}
log.Printf("cart size=%d", len(cart))
product := struct {
Item *pb.Product
@ -152,7 +150,7 @@ func (fe *frontendServer) addToCartHandler(w http.ResponseWriter, r *http.Reques
http.Error(w, "invalid form input", http.StatusBadRequest)
return
}
log.Printf("[addToCart] product_id=%s qty=%d session_id=%+v", productID, quantity, sessionID(r))
log.Printf("[addToCart] product_id=%s qty=%d session_id=%s", productID, quantity, sessionID(r))
p, err := fe.getProduct(r.Context(), productID)
if err != nil {
@ -169,7 +167,7 @@ func (fe *frontendServer) addToCartHandler(w http.ResponseWriter, r *http.Reques
}
func (fe *frontendServer) emptyCartHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("[emptyCart] session_id=%+v", sessionID(r))
log.Printf("[emptyCart] session_id=%s", sessionID(r))
if err := fe.emptyCart(r.Context(), sessionID(r)); err != nil {
http.Error(w, fmt.Sprintf("failed to empty cart: %+v", err), http.StatusInternalServerError)
@ -180,7 +178,7 @@ func (fe *frontendServer) emptyCartHandler(w http.ResponseWriter, r *http.Reques
}
func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("[viewCart] session_id=%+v", sessionID(r))
log.Printf("[viewCart] session_id=%s", sessionID(r))
currencies, err := fe.getCurrencies(r.Context())
if err != nil {
http.Error(w, fmt.Sprintf("could not retrieve currencies: %+v", err), http.StatusInternalServerError)
@ -198,47 +196,132 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
return
}
shippingCost, err := fe.getShippingQuote(r.Context(), cart, currentCurrency(r))
if err != nil {
http.Error(w, fmt.Sprintf("failed to get shipping quote: %+v", err), http.StatusInternalServerError)
return
}
type cartItemView struct {
Item *pb.Product
Quantity int32
Price *pb.Money
}
items := make([]cartItemView, len(cart))
totalPrice := pb.Money{CurrencyCode: currentCurrency(r)}
for i, item := range cart {
p, err := fe.getProduct(r.Context(), item.GetProductId())
if err != nil {
http.Error(w, fmt.Sprintf("could not retrieve product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError)
return
}
price, err := fe.convertCurrency(r.Context(), &pb.Money{
Amount: p.GetPriceUsd(),
CurrencyCode: defaultCurrency}, currentCurrency(r))
price, err := fe.convertCurrency(r.Context(), p.GetPriceUsd(), currentCurrency(r))
if err != nil {
http.Error(w, fmt.Sprintf("could not convert currency for product #%s: %+v", item.GetProductId(), err), http.StatusInternalServerError)
return
}
multPrice := multMoney(*price.GetAmount(), uint32(item.GetQuantity()))
multPrice := money.MultiplySlow(*price, uint32(item.GetQuantity()))
items[i] = cartItemView{
Item: p,
Quantity: item.GetQuantity(),
Price: &pb.Money{Amount: &multPrice, CurrencyCode: price.GetCurrencyCode()}}
Price: &multPrice}
totalPrice = money.Must(money.Sum(totalPrice, multPrice))
}
totalPrice = money.Must(money.Sum(totalPrice, *shippingCost))
year := time.Now().Year()
if err := templates.ExecuteTemplate(w, "cart", map[string]interface{}{
"user_currency": currentCurrency(r),
"currencies": currencies,
"session_id": sessionID(r),
"recommendations": recommendations,
"cart_size": len(cart),
"items": items,
"user_currency": currentCurrency(r),
"currencies": currencies,
"session_id": sessionID(r),
"recommendations": recommendations,
"cart_size": len(cart),
"shipping_cost": shippingCost,
"total_cost": totalPrice,
"items": items,
"expiration_years": []int{year, year + 1, year + 2, year + 3, year + 4},
}); err != nil {
log.Println(err)
}
}
func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("[checkout] session_id=%s", sessionID(r))
var (
email = r.FormValue("email")
streetAddress = r.FormValue("street_address")
zipCode, _ = strconv.ParseInt(r.FormValue("zip_code"), 10, 32)
city = r.FormValue("city")
state = r.FormValue("state")
country = r.FormValue("country")
ccNumber = r.FormValue("credit_card_number")
ccMonth, _ = strconv.ParseInt(r.FormValue("credit_card_expiration_month"), 10, 32)
ccYear, _ = strconv.ParseInt(r.FormValue("credit_card_expiration_year"), 10, 32)
ccCVV, _ = strconv.ParseInt(r.FormValue("credit_card_cvv"), 10, 32)
)
order, err := pb.NewCheckoutServiceClient(fe.checkoutSvcConn).
PlaceOrder(r.Context(), &pb.PlaceOrderRequest{
Email: email,
CreditCard: &pb.CreditCardInfo{
CreditCardNumber: ccNumber,
CreditCardExpirationMonth: int32(ccMonth),
CreditCardExpirationYear: int32(ccYear),
CreditCardCvv: int32(ccCVV)},
UserId: sessionID(r),
UserCurrency: currentCurrency(r),
Address: &pb.Address{
StreetAddress: streetAddress,
City: city,
State: state,
ZipCode: int32(zipCode),
Country: country},
})
if err != nil {
http.Error(w, fmt.Sprintf("failed to complete the order: %+v", err), http.StatusInternalServerError)
return
}
log.Printf("order #%s completed", order.GetOrder().GetOrderId())
order.GetOrder().GetItems()
recommendations, _ := fe.getRecommendations(r.Context(), sessionID(r), nil)
if err := templates.ExecuteTemplate(w, "order", map[string]interface{}{
"session_id": sessionID(r),
"user_currency": currentCurrency(r),
"order": order.GetOrder(),
"recommendations": recommendations,
}); err != nil {
log.Println(err)
}
}
func (fe *frontendServer) prepareCheckoutHandler(w http.ResponseWriter, r *http.Request) {
streetAddress := r.FormValue("street_address")
city := r.FormValue("city")
state := r.FormValue("state")
country := r.FormValue("country")
zipCode, _ := strconv.ParseInt(r.FormValue("country"), 10, 32)
log.Printf("[prepareCheckout] session_id=%+v", sessionID(r))
_, _ = pb.NewCheckoutServiceClient(fe.checkoutSvcConn).CreateOrder(r.Context(),
&pb.CreateOrderRequest{
UserId: sessionID(r),
UserCurrency: currentCurrency(r),
Address: &pb.Address{
StreetAddress: streetAddress,
City: city,
State: state,
ZipCode: int32(zipCode),
Country: country,
},
})
}
func (fe *frontendServer) logoutHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("[home] session_id=%+v", sessionID(r))
log.Printf("[logout] session_id=%s", sessionID(r))
for _, c := range r.Cookies() {
c.Expires = time.Now().Add(-time.Hour * 24 * 365)
c.MaxAge = -1
@ -250,7 +333,7 @@ func (fe *frontendServer) logoutHandler(w http.ResponseWriter, r *http.Request)
func (fe *frontendServer) setCurrencyHandler(w http.ResponseWriter, r *http.Request) {
cur := r.FormValue("currency_code")
log.Printf("[setCurrency] session_id=%+v code=%s", sessionID(r), cur)
log.Printf("[setCurrency] session_id=%s code=%s", sessionID(r), cur)
if cur != "" {
http.SetCookie(w, &http.Cookie{
Name: cookieCurrency,
@ -289,3 +372,7 @@ func cartIDs(c []*pb.CartItem) []string {
}
return out
}
func renderMoney(money pb.Money) string {
return fmt.Sprintf("%s %d.%02d", money.GetCurrencyCode(), money.GetUnits(), money.GetNanos()/10000000)
}

View file

@ -40,6 +40,12 @@ type frontendServer struct {
recommendationSvcAddr string
recommendationSvcConn *grpc.ClientConn
checkoutSvcAddr string
checkoutSvcConn *grpc.ClientConn
shippingSvcAddr string
shippingSvcConn *grpc.ClientConn
}
func main() {
@ -55,6 +61,8 @@ func main() {
mustMapEnv(&svc.currencySvcAddr, "CURRENCY_SERVICE_ADDR")
mustMapEnv(&svc.cartSvcAddr, "CART_SERVICE_ADDR")
mustMapEnv(&svc.recommendationSvcAddr, "RECOMMENDATION_SERVICE_ADDR")
mustMapEnv(&svc.checkoutSvcAddr, "CHECKOUT_SERVICE_ADDR")
mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_SERVICE_ADDR")
var err error
svc.currencySvcConn, err = grpc.DialContext(ctx, svc.currencySvcAddr, grpc.WithInsecure())
@ -71,7 +79,15 @@ func main() {
}
svc.recommendationSvcConn, err = grpc.DialContext(ctx, svc.recommendationSvcAddr, grpc.WithInsecure())
if err != nil {
log.Fatalf("failed to connect recommendation service at %s: %+v", svc.recommendationSvcConn, err)
log.Fatalf("failed to connect recommendation service at %s: %+v", svc.recommendationSvcAddr, err)
}
svc.shippingSvcConn, err = grpc.DialContext(ctx, svc.shippingSvcAddr, grpc.WithInsecure())
if err != nil {
log.Fatalf("failed to connect shipping service at %s: %+v", svc.shippingSvcAddr, err)
}
svc.checkoutSvcConn, err = grpc.DialContext(ctx, svc.checkoutSvcAddr, grpc.WithInsecure())
if err != nil {
log.Fatalf("failed to connect checkout service at %s: %+v", svc.checkoutSvcAddr, err)
}
r := mux.NewRouter()
@ -82,6 +98,7 @@ func main() {
r.HandleFunc("/cart/empty", ensureSessionID(svc.emptyCartHandler)).Methods(http.MethodPost)
r.HandleFunc("/setCurrency", ensureSessionID(svc.setCurrencyHandler)).Methods(http.MethodPost)
r.HandleFunc("/logout", svc.logoutHandler).Methods(http.MethodGet)
r.HandleFunc("/cart/checkout", ensureSessionID(svc.placeOrderHandler)).Methods(http.MethodPost)
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
log.Printf("starting server on :" + srvPort)
log.Fatal(http.ListenAndServe("localhost:"+srvPort, r))

View file

@ -1,50 +0,0 @@
package main
import (
"math"
pb "frontend/genproto"
)
// TODO(ahmetb): any logic below is flawed because I just realized we have no
// way of representing amounts like 17.07 because Fractional cannot store 07.
func multMoney(m pb.MoneyAmount, n uint32) pb.MoneyAmount {
out := m
for n > 1 {
out = sum(out, m)
n--
}
return out
}
func sum(m1, m2 pb.MoneyAmount) pb.MoneyAmount {
// TODO(ahmetb) this is copied from ./checkoutservice/money.go, find a
// better mult function.
f1, f2 := float64(m1.Fractional), float64(m2.Fractional)
lg1 := math.Max(1, math.Ceil(math.Log10(f1)))
if f1 == math.Pow(10, lg1) {
lg1++
}
lg2 := math.Max(1, math.Ceil(math.Log10(f2)))
if f2 == math.Pow(10, lg2) {
lg2++
}
lgMax := math.Max(lg1, lg2)
dSum := m1.Decimal + m2.Decimal
o1 := f1 * math.Pow(10, lgMax-lg1)
o2 := f2 * math.Pow(10, lgMax-lg2)
fSum := o1 + o2
if fSum >= math.Pow(10, lgMax) {
fSum -= math.Pow(10, lgMax)
dSum++
}
for int(fSum)%10 == 0 && fSum != 0 {
fSum = float64(int(fSum) / 10)
}
return pb.MoneyAmount{
Decimal: dSum,
Fractional: uint32(fSum)}
}

117
src/frontend/money/money.go Normal file
View file

@ -0,0 +1,117 @@
package money
import (
"errors"
pb "frontend/genproto"
)
const (
nanosMin = -999999999
nanosMax = +999999999
nanosMod = 1000000000
)
var (
ErrInvalidValue = errors.New("one of the specified money values is invalid")
ErrMismatchingCurrency = errors.New("mismatching currency codes")
)
// IsValid checks if specified value has a valid units/nanos signs and ranges.
func IsValid(m pb.Money) bool {
return signMatches(m) && validNanos(m.GetNanos())
}
func signMatches(m pb.Money) bool {
return m.GetNanos() == 0 || m.GetUnits() == 0 || (m.GetNanos() < 0) == (m.GetUnits() < 0)
}
func validNanos(nanos int32) bool { return nanosMin <= nanos && nanos <= nanosMax }
// IsZero returns true if the specified money value is equal to zero.
func IsZero(m pb.Money) bool { return m.GetUnits() == 0 && m.GetNanos() == 0 }
// IsPositive returns true if the specified money value is valid and is
// positive.
func IsPositive(m pb.Money) bool {
return IsValid(m) && m.GetUnits() > 0 || (m.GetUnits() == 0 && m.GetNanos() > 0)
}
// IsNegative returns true if the specified money value is valid and is
// negative.
func IsNegative(m pb.Money) bool {
return IsValid(m) && m.GetUnits() < 0 || (m.GetUnits() == 0 && m.GetNanos() < 0)
}
// AreSameCurrency returns true if values l and r have a currency code and
// they are the same values.
func AreSameCurrency(l, r pb.Money) bool {
return l.GetCurrencyCode() == r.GetCurrencyCode() && l.GetCurrencyCode() != ""
}
// AreEquals returns true if values l and r are the equal, including the
// currency. This does not check validity of the provided values.
func AreEquals(l, r pb.Money) bool {
return l.GetCurrencyCode() == r.GetCurrencyCode() &&
l.GetUnits() == r.GetUnits() && l.GetNanos() == r.GetNanos()
}
// Negate returns the same amount with the sign negated.
func Negate(m pb.Money) pb.Money {
return pb.Money{
Units: -m.GetUnits(),
Nanos: -m.GetNanos(),
CurrencyCode: m.GetCurrencyCode()}
}
// Must panics if the given error is not nil. This can be used with other
// functions like: "m := Must(Sum(a,b))".
func Must(v pb.Money, err error) pb.Money {
if err != nil {
panic(err)
}
return v
}
// Sum adds two values. Returns an error if one of the values are invalid or
// currency codes are not matching (unless currency code is unspecified for
// both).
func Sum(l, r pb.Money) (pb.Money, error) {
if !IsValid(l) || !IsValid(r) {
return pb.Money{}, ErrInvalidValue
} else if l.GetCurrencyCode() != r.GetCurrencyCode() {
return pb.Money{}, ErrMismatchingCurrency
}
units := l.GetUnits() + r.GetUnits()
nanos := l.GetNanos() + r.GetNanos()
if (units == 0 && nanos == 0) || (units > 0 && nanos >= 0) || (units < 0 && nanos <= 0) {
// same sign <units, nanos>
units += int64(nanos / nanosMod)
nanos = nanos % nanosMod
} else {
// different sign. nanos guaranteed to not to go over the limit
if units > 0 {
units--
nanos += nanosMod
} else {
units++
nanos -= nanosMod
}
}
return pb.Money{
Units: units,
Nanos: nanos,
CurrencyCode: l.GetCurrencyCode()}, nil
}
// MultiplySlow is a slow multiplication operation done through adding the value
// to itself n-1 times.
func MultiplySlow(m pb.Money, n uint32) pb.Money {
out := m
for n > 1 {
out = Must(Sum(out, m))
n--
}
return out
}

View file

@ -0,0 +1,231 @@
package money
import (
"fmt"
"reflect"
"testing"
pb "frontend/genproto"
)
func mmc(u int64, n int32, c string) pb.Money { return pb.Money{Units: u, Nanos: n, CurrencyCode: c} }
func mm(u int64, n int32) pb.Money { return mmc(u, n, "") }
func TestIsValid(t *testing.T) {
tests := []struct {
name string
in pb.Money
want bool
}{
{"valid -/-", mm(-981273891273, -999999999), true},
{"invalid -/+", mm(-981273891273, +999999999), false},
{"valid +/+", mm(981273891273, 999999999), true},
{"invalid +/-", mm(981273891273, -999999999), false},
{"invalid +/+overflow", mm(3, 1000000000), false},
{"invalid +/-overflow", mm(3, -1000000000), false},
{"invalid -/+overflow", mm(-3, 1000000000), false},
{"invalid -/-overflow", mm(-3, -1000000000), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsValid(tt.in); got != tt.want {
t.Errorf("IsValid(%v) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestIsZero(t *testing.T) {
tests := []struct {
name string
in pb.Money
want bool
}{
{"zero", mm(0, 0), true},
{"not-zero (-/+)", mm(-1, +1), false},
{"not-zero (-/-)", mm(-1, -1), false},
{"not-zero (+/+)", mm(+1, +1), false},
{"not-zero (+/-)", mm(+1, -1), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsZero(tt.in); got != tt.want {
t.Errorf("IsZero(%v) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestIsPositive(t *testing.T) {
tests := []struct {
name string
in pb.Money
want bool
}{
{"zero", mm(0, 0), false},
{"positive (+/+)", mm(+1, +1), true},
{"invalid (-/+)", mm(-1, +1), false},
{"negative (-/-)", mm(-1, -1), false},
{"invalid (+/-)", mm(+1, -1), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsPositive(tt.in); got != tt.want {
t.Errorf("IsPositive(%v) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestIsNegative(t *testing.T) {
tests := []struct {
name string
in pb.Money
want bool
}{
{"zero", mm(0, 0), false},
{"positive (+/+)", mm(+1, +1), false},
{"invalid (-/+)", mm(-1, +1), false},
{"negative (-/-)", mm(-1, -1), true},
{"invalid (+/-)", mm(+1, -1), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsNegative(tt.in); got != tt.want {
t.Errorf("IsNegative(%v) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestAreSameCurrency(t *testing.T) {
type args struct {
l pb.Money
r pb.Money
}
tests := []struct {
name string
args args
want bool
}{
{"both empty currency", args{mmc(1, 0, ""), mmc(2, 0, "")}, false},
{"left empty currency", args{mmc(1, 0, ""), mmc(2, 0, "USD")}, false},
{"right empty currency", args{mmc(1, 0, "USD"), mmc(2, 0, "")}, false},
{"mismatching", args{mmc(1, 0, "USD"), mmc(2, 0, "CAD")}, false},
{"matching", args{mmc(1, 0, "USD"), mmc(2, 0, "USD")}, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := AreSameCurrency(tt.args.l, tt.args.r); got != tt.want {
t.Errorf("AreSameCurrency([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want)
}
})
}
}
func TestAreEquals(t *testing.T) {
type args struct {
l pb.Money
r pb.Money
}
tests := []struct {
name string
args args
want bool
}{
{"equals", args{mmc(1, 2, "USD"), mmc(1, 2, "USD")}, true},
{"mismatching currency", args{mmc(1, 2, "USD"), mmc(1, 2, "CAD")}, false},
{"mismatching units", args{mmc(10, 20, "USD"), mmc(1, 20, "USD")}, false},
{"mismatching nanos", args{mmc(1, 2, "USD"), mmc(1, 20, "USD")}, false},
{"negated", args{mmc(1, 2, "USD"), mmc(-1, -2, "USD")}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := AreEquals(tt.args.l, tt.args.r); got != tt.want {
t.Errorf("AreEquals([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want)
}
})
}
}
func TestNegate(t *testing.T) {
tests := []struct {
name string
in pb.Money
want pb.Money
}{
{"zero", mm(0, 0), mm(0, 0)},
{"negative", mm(-1, -200), mm(1, 200)},
{"positive", mm(1, 200), mm(-1, -200)},
{"carries currency code", mmc(0, 0, "XXX"), mmc(0, 0, "XXX")},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Negate(tt.in); !AreEquals(got, tt.want) {
t.Errorf("Negate([%v]) = %v, want %v", tt.in, got, tt.want)
}
})
}
}
func TestMust_pass(t *testing.T) {
v := Must(mm(2, 3), nil)
if !AreEquals(v, mm(2, 3)) {
t.Errorf("returned the wrong value: %v", v)
}
}
func TestMust_panic(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Logf("panic captured: %v", r)
}
}()
Must(mm(2, 3), fmt.Errorf("some error"))
t.Fatal("this should not have executed due to the panic above")
}
func TestSum(t *testing.T) {
type args struct {
l pb.Money
r pb.Money
}
tests := []struct {
name string
args args
want pb.Money
wantErr error
}{
{"0+0=0", args{mm(0, 0), mm(0, 0)}, mm(0, 0), nil},
{"Error: currency code on left", args{mmc(0, 0, "XXX"), mm(0, 0)}, mm(0, 0), ErrMismatchingCurrency},
{"Error: currency code on right", args{mm(0, 0), mmc(0, 0, "YYY")}, mm(0, 0), ErrMismatchingCurrency},
{"Error: currency code mismatch", args{mmc(0, 0, "AAA"), mmc(0, 0, "BBB")}, mm(0, 0), ErrMismatchingCurrency},
{"Error: invalid +/-", args{mm(+1, -1), mm(0, 0)}, mm(0, 0), ErrInvalidValue},
{"Error: invalid -/+", args{mm(0, 0), mm(-1, +2)}, mm(0, 0), ErrInvalidValue},
{"Error: invalid nanos", args{mm(0, 1000000000), mm(1, 0)}, mm(0, 0), ErrInvalidValue},
{"both positive (no carry)", args{mm(2, 200000000), mm(2, 200000000)}, mm(4, 400000000), nil},
{"both positive (nanos=max)", args{mm(2, 111111111), mm(2, 888888888)}, mm(4, 999999999), nil},
{"both positive (carry)", args{mm(2, 200000000), mm(2, 900000000)}, mm(5, 100000000), nil},
{"both negative (no carry)", args{mm(-2, -200000000), mm(-2, -200000000)}, mm(-4, -400000000), nil},
{"both negative (carry)", args{mm(-2, -200000000), mm(-2, -900000000)}, mm(-5, -100000000), nil},
{"mixed (larger positive, just decimals)", args{mm(11, 0), mm(-2, 0)}, mm(9, 0), nil},
{"mixed (larger negative, just decimals)", args{mm(-11, 0), mm(2, 0)}, mm(-9, 0), nil},
{"mixed (larger positive, no borrow)", args{mm(11, 100000000), mm(-2, -100000000)}, mm(9, 0), nil},
{"mixed (larger positive, with borrow)", args{mm(11, 100000000), mm(-2, -9000000 /*.09*/)}, mm(9, 91000000 /*.091*/), nil},
{"mixed (larger negative, no borrow)", args{mm(-11, -100000000), mm(2, 100000000)}, mm(-9, 0), nil},
{"mixed (larger negative, with borrow)", args{mm(-11, -100000000), mm(2, 9000000 /*.09*/)}, mm(-9, -91000000 /*.091*/), nil},
{"0+negative", args{mm(0, 0), mm(-2, -100000000)}, mm(-2, -100000000), nil},
{"negative+0", args{mm(-2, -100000000), mm(0, 0)}, mm(-2, -100000000), nil},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Sum(tt.args.l, tt.args.r)
if err != tt.wantErr {
t.Errorf("Sum([%v],[%v]): expected err=\"%v\" got=\"%v\"", tt.args.l, tt.args.r, tt.wantErr, err)
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Sum([%v],[%v]) = %v, want %v", tt.args.l, tt.args.r, got, tt.want)
}
})
}
}

View file

@ -0,0 +1,13 @@
#!/bin/bash
set -ex
kubectl port-forward $(kubectl get pods -l app=currencyservice -o=name | head -n 1) 7000:31337 &
kubectl port-forward $(kubectl get pods -l app=recommendationservice -o=name | head -n 1) 8081:8080 &
kubectl port-forward $(kubectl get pods -l app=cartservice -o=name | head -n 1) 7070:7070 &
kubectl port-forward $(kubectl get pods -l app=productcatalogservice -o=name | head -n 1) 3550:3550 &
kubectl port-forward $(kubectl get pods -l app=checkoutservice -o=name | head -n 1) 5050:5050 &
set +x
trap "exit" INT TERM ERR
trap "kill 0" EXIT
wait

View file

@ -76,6 +76,21 @@ func (fe *frontendServer) convertCurrency(ctx context.Context, money *pb.Money,
ToCode: currency})
}
func (fe *frontendServer) getShippingQuote(ctx context.Context, items []*pb.CartItem, currency string) (*pb.Money, error) {
quote, err := pb.NewShippingServiceClient(fe.currencySvcConn).GetQuote(ctx,
&pb.GetQuoteRequest{
Address: nil,
Items: items})
if err != nil {
return nil, err
}
localized, err := fe.convertCurrency(ctx, quote.GetCostUsd(), currency)
if err != nil {
return nil, fmt.Errorf("failed to convert currency for shipping cost: %+v", err)
}
return localized, nil
}
func (fe *frontendServer) getRecommendations(ctx context.Context, userID string, productIDs []string) ([]*pb.Product, error) {
resp, err := pb.NewRecommendationServiceClient(fe.recommendationSvcConn).ListRecommendations(ctx,
&pb.ListRecommendationsRequest{UserId: userID, ProductIds: productIDs})

View file

@ -4,46 +4,141 @@
<main role="main">
<div class="py-5">
<div class="container bg-light py-3 px-lg-5 py-lg-5">
<h1>Shopping Cart</h1>
{{ if eq (len $.items) 0 }}
<p>Your shopping cart is empty.</p>
<a class="btn btn-primary" href="/" role="button">Browse Products</a>
{{ end }}
<h3>Your shopping cart is empty!</h3>
<p>Items you add to your shopping cart will appear here.</p>
<a class="btn btn-primary" href="/" role="button">Browse Products &rarr; </a>
{{ else }}
{{ range $.items }}
<div class="row pt-2 mb-2">
<div class="col text-right">
<a href="/product/{{.Item.Id}}"><img class="img-fluid" style="width: auto; max-height: 60px;"
src="{{.Item.Picture}}" /></a>
</div>
<div class="col align-middle">
<strong>{{.Item.Name}}</strong><br/>
<small class="text-muted">SKU: #{{.Item.Id}}</small>
</div>
<div class="col text-left">
Qty: {{.Quantity}}<br/>
<strong>
{{.Price.CurrencyCode}}
{{.Price.Amount.Decimal}}.
{{- .Price.Amount.Fractional}}{{- if lt .Price.Amount.Fractional 10}}0{{end}}
</strong>
</div>
</div>
{{ end }}
{{ if $.items }}
<div class="row mt-5">
<div class="col-8 offset-2">
<div class="d-flex justify-content-between align-items-center">
<form method="POST" action="/cart/empty">
<button class="btn btn-secondary" type="submit">Empty Cart</button>
</form>
<a class="btn btn-primary" href="/checkout" role="button">Proceed to Checkout</a>
<div class="row mb-3 py-2">
<div class="col">
<h3>{{ len $.items }} item
{{- if gt (len $.items) 1}}s{{end}}
in your Shopping Cart</h3>
</div>
<div class="col text-right">
<form method="POST" action="/cart/empty">
<button class="btn btn-secondary" type="submit">Empty cart</button>
<a class="btn btn-info" href="/" role="button">Browse more products &rarr; </a>
</form>
</div>
</div>
</div>
{{ end }}
<hr>
{{ range $.items }}
<div class="row pt-2 mb-2">
<div class="col text-right">
<a href="/product/{{.Item.Id}}"><img class="img-fluid" style="width: auto; max-height: 60px;"
src="{{.Item.Picture}}" /></a>
</div>
<div class="col align-middle">
<strong>{{.Item.Name}}</strong><br/>
<small class="text-muted">SKU: #{{.Item.Id}}</small>
</div>
<div class="col text-left">
Qty: {{.Quantity}}<br/>
<strong>
{{ renderMoney .Price}}
</strong>
</div>
</div>
{{ end }} <!-- range $.items-->
<div class="row pt-2 my-3">
<div class="col text-center">
<p class="text-muted my-0">Shipping Cost: <strong>{{ renderMoney .shipping_cost }}</strong></p>
Total Cost: <strong>{{ renderMoney .total_cost }}</strong>
</div>
</div>
<hr/>
<div class="row py-3 my-2">
<div class="col-12 col-lg-8 offset-lg-2">
<h3>Checkout</h3>
<form action="/cart/checkout" method="POST">
<div class="form-row">
<div class="col-md-5 mb-4">
<label for="email">E-mail Address</label>
<input type="email" class="form-control" id="email"
name="email" value="someone@example.com" required>
</div>
<div class="col-md-5 mb-4">
<label for="street_address">Street Address</label>
<input type="text" class="form-control" name="street_address"
id="street_address" value="1600 Amphitheatre Parkway" required>
</div>
<div class="col-md-2 mb-4">
<label for="zip_code">Zip Code</label>
<input type="text" class="form-control"
name="zip_code" id="zip_code" value="94043" required pattern="\d{4,5}">
</div>
</div>
<div class="form-row">
<div class="col-md-5 mb-3">
<label for="city">City</label>
<input type="text" class="form-control" name="city" id="city"
value="Mountain View" required>
</div>
<div class="col-md-2 mb-3">
<label for="state">State</label>
<input type="text" class="form-control" name="state" id="state"
value="CA" required>
</div>
<div class="col-md-5 mb-3">
<label for="country">Country</label>
<input type="text" class="form-control" id="country"
placeholder="Country Name"
name="country" value="United States" required>
</div>
</div>
<div class="form-row">
<div class="col-md-6 mb-3">
<label for="credit_card_number">Credit Card Number</label>
<input type="text" class="form-control" id="credit_card_number"
name="credit_card_number"
placeholder="0000-0000-0000-0000"
value="4432-8015-6152-0454"
required pattern="\d{4}-\d{4}-\d{4}-\d{4}">
</div>
<div class="col-md-2 mb-3">
<label for="credit_card_expiration_month">Month</label>
<select name="credit_card_expiration_month" id="credit_card_expiration_month"
class="form-control">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">January</option>
</select>
</div>
<div class="col-md-2 mb-3">
<label for="credit_card_expiration_year">Year</label>
<select name="credit_card_expiration_year" id="credit_card_expiration_year"
class="form-control">
{{range $.expiration_years}}<option value="{{.}}">{{.}}</option>{{end}}
</select>
</div>
<div class="col-md-2 mb-3">
<label for="credit_card_cvv">CVV</label>
<input type="text" class="form-control" id="credit_card_cvv"
name="credit_card_cvv" value="672" required pattern="\d{3}">
</div>
</div>
<div class="form-row">
<button class="btn btn-primary" type="submit">Place your order &rarr;</button>
</div>
</form>
</div>
</div>
{{ end }} <!-- end if $.items -->
{{ if $.recommendations}}
<hr/>

View file

@ -1,6 +1,6 @@
{{ define "footer" }}
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
<small class="text-muted mx-auto">This is a demo application.</small>
<small class="text-muted mx-auto">This is a demo application. ({{$.session_id}})</small>
</body>
</html>
{{ end }}

View file

@ -16,6 +16,7 @@
<a href="/" class="navbar-brand d-flex align-items-center">
Hipster Shop
</a>
{{ if $.currencies }}
<form class="form-inline ml-auto" method="POST" action="/setCurrency" id="currency_form">
<select name="currency_code" class="form-control"
onchange="document.getElementById('currency_form').submit();">
@ -23,8 +24,9 @@
<option value="{{.}}" {{if eq . $.user_currency}}selected="selected"{{end}}>{{.}}</option>
{{end}}
</select>
<a class="btn btn-primary ml-2" href="/cart" role="button">View Cart ({{$.cart_size}})</a>
<a class="btn btn-primary btn-light ml-2" href="/cart" role="button">View Cart ({{$.cart_size}})</a>
</form>
{{ end }}
</div>
</div>
</header>

View file

@ -38,10 +38,8 @@
</a>
</div>
<small class="text-muted">
{{.Price.CurrencyCode}}
<strong>{{.Price.Amount.Decimal}}.{{.Price.Amount.Fractional}}
{{- if lt .Price.Amount.Fractional 10}}0{{end}}
</strong>
{{ renderMoney .Price }}
</strong>
</small>
</div>
</div>

View file

@ -0,0 +1,20 @@
{{ define "order" }}
{{ template "header" . }}
<main role="main">
<div class="py-5">
<div class="container bg-light py-3 px-lg-5 py-lg-5">
<h3>
Your order is complete!
</h3>
<p>
Order Confirmation ID: {{ $.order }}
</p>
{{ template "recommendations" $.recommendations }}
</div>
</div>
</main>
{{ template "footer" . }}
{{ end }}

View file

@ -13,9 +13,7 @@
<h2>{{$.product.Item.Name}}</h2>
<p class="text-muted">
{{$.product.Price.CurrencyCode}}
{{$.product.Price.Amount.Decimal}}.
{{- $.product.Price.Amount.Fractional}}{{- if lt $.product.Price.Amount.Fractional 10}}0{{end}}
{{ renderMoney $.product.Price}}
</p>
<hr/>
<p>
@ -30,15 +28,16 @@
<div class="input-group-prepend">
<label class="input-group-text" for="quantity">Quantity</label>
</div>
<select name="quantity" id="quantity" class="custom-select">
<select name="quantity" id="quantity" class="custom-select form-control form-control-lg">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>10</option>
</select>
</div>
<button type="submit" class="btn btn-secondary ml-3">Add to Cart</button>
<button type="submit" class="btn btn-info btn-lg ml-3">Add to Cart</button>
</form>
</div>
</div>

View file

@ -1,6 +1,6 @@
{{ define "recommendations" }}
<h5 class="text-muted">Similar products</h5>
<div class="row">
<h5 class="text-muted">Products you might like</h5>
<div class="row my-2 py-3">
{{range . }}
<div class="col-3">
<div class="card mb-3 box-shadow">

View file

@ -58,7 +58,7 @@ module.exports = function charge(request) {
throw new ExpiredCreditCard(cardNumber.replace('-', ''), month, year);
console.log(`Transaction processed: ${cardType} ending ${cardNumber.substr(-4)} \
Amount: ${amount.currency_code}${amount.amount.decimal}.${amount.amount.fractional}`)
Amount: ${amount.currency_code}${amount.units}.${amount.nanos}`)
return { transaction_id: uuid() }
}

View file

@ -63,7 +63,7 @@ message Product {
string name = 2;
string description = 3;
string picture = 4;
MoneyAmount price_usd = 5;
Money price_usd = 5;
}
message ListProductsResponse {
@ -95,7 +95,7 @@ message GetQuoteRequest {
}
message GetQuoteResponse {
MoneyAmount cost_usd = 1;
Money cost_usd = 1;
}
message ShipOrderRequest {
@ -122,18 +122,22 @@ service CurrencyService {
rpc Convert(CurrencyConversionRequest) returns (Money) {}
}
// Describes a money amount without currency. For example, decimal=2 and
// fractional=500 (or fractional=5) makes up 2.5 units.
message MoneyAmount {
uint32 decimal = 1;
uint32 fractional = 2;
}
// Represents an amount of money with its currency type.
message Money {
// The 3-letter currency code defined in ISO 4217.
string currency_code = 1;
MoneyAmount amount = 2;
// The whole units of the amount.
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
int64 units = 2;
// Number of nano (10^-9) units of the amount.
// The value must be between -999,999,999 and +999,999,999 inclusive.
// If `units` is positive, `nanos` must be positive or zero.
// If `units` is zero, `nanos` can be positive, zero, or negative.
// If `units` is negative, `nanos` must be negative or zero.
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
int32 nanos = 3;
}
message GetSupportedCurrenciesResponse {

View file

@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} }
func (m *CartItem) String() string { return proto.CompactTextString(m) }
func (*CartItem) ProtoMessage() {}
func (*CartItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{0}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{0}
}
func (m *CartItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CartItem.Unmarshal(m, b)
@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} }
func (m *AddItemRequest) String() string { return proto.CompactTextString(m) }
func (*AddItemRequest) ProtoMessage() {}
func (*AddItemRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{1}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{1}
}
func (m *AddItemRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddItemRequest.Unmarshal(m, b)
@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} }
func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) }
func (*EmptyCartRequest) ProtoMessage() {}
func (*EmptyCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{2}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{2}
}
func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b)
@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} }
func (m *GetCartRequest) String() string { return proto.CompactTextString(m) }
func (*GetCartRequest) ProtoMessage() {}
func (*GetCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{3}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{3}
}
func (m *GetCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetCartRequest.Unmarshal(m, b)
@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} }
func (m *Cart) String() string { return proto.CompactTextString(m) }
func (*Cart) ProtoMessage() {}
func (*Cart) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{4}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{4}
}
func (m *Cart) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Cart.Unmarshal(m, b)
@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{5}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{5}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Empty.Unmarshal(m, b)
@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR
func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsRequest) ProtoMessage() {}
func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{6}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{6}
}
func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b)
@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations
func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsResponse) ProtoMessage() {}
func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{7}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{7}
}
func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b)
@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string {
}
type Product struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Product) Reset() { *m = Product{} }
func (m *Product) String() string { return proto.CompactTextString(m) }
func (*Product) ProtoMessage() {}
func (*Product) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{8}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{8}
}
func (m *Product) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Product.Unmarshal(m, b)
@ -414,7 +414,7 @@ func (m *Product) GetPicture() string {
return ""
}
func (m *Product) GetPriceUsd() *MoneyAmount {
func (m *Product) GetPriceUsd() *Money {
if m != nil {
return m.PriceUsd
}
@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} }
func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) }
func (*ListProductsResponse) ProtoMessage() {}
func (*ListProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{9}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{9}
}
func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b)
@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} }
func (m *GetProductRequest) String() string { return proto.CompactTextString(m) }
func (*GetProductRequest) ProtoMessage() {}
func (*GetProductRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{10}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{10}
}
func (m *GetProductRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetProductRequest.Unmarshal(m, b)
@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} }
func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) }
func (*SearchProductsRequest) ProtoMessage() {}
func (*SearchProductsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{11}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{11}
}
func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b)
@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{}
func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) }
func (*SearchProductsResponse) ProtoMessage() {}
func (*SearchProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{12}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{12}
}
func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b)
@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} }
func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) }
func (*GetQuoteRequest) ProtoMessage() {}
func (*GetQuoteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{13}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{13}
}
func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b)
@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem {
}
type GetQuoteResponse struct {
CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} }
func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) }
func (*GetQuoteResponse) ProtoMessage() {}
func (*GetQuoteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{14}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{14}
}
func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b)
@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo
func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount {
func (m *GetQuoteResponse) GetCostUsd() *Money {
if m != nil {
return m.CostUsd
}
@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} }
func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) }
func (*ShipOrderRequest) ProtoMessage() {}
func (*ShipOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{15}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{15}
}
func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b)
@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} }
func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) }
func (*ShipOrderResponse) ProtoMessage() {}
func (*ShipOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{16}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{16}
}
func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b)
@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} }
func (m *Address) String() string { return proto.CompactTextString(m) }
func (*Address) ProtoMessage() {}
func (*Address) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{17}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{17}
}
func (m *Address) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Address.Unmarshal(m, b)
@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 {
return 0
}
// Describes a money amount without currency. For example, decimal=2 and
// fractional=500 (or fractional=5) makes up 2.5 units.
type MoneyAmount struct {
Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"`
Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"`
// Represents an amount of money with its currency type.
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
// The whole units of the amount.
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"`
// Number of nano (10^-9) units of the amount.
// The value must be between -999,999,999 and +999,999,999 inclusive.
// If `units` is positive, `nanos` must be positive or zero.
// If `units` is zero, `nanos` can be positive, zero, or negative.
// If `units` is negative, `nanos` must be negative or zero.
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MoneyAmount) Reset() { *m = MoneyAmount{} }
func (m *MoneyAmount) String() string { return proto.CompactTextString(m) }
func (*MoneyAmount) ProtoMessage() {}
func (*MoneyAmount) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{18}
}
func (m *MoneyAmount) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MoneyAmount.Unmarshal(m, b)
}
func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic)
}
func (dst *MoneyAmount) XXX_Merge(src proto.Message) {
xxx_messageInfo_MoneyAmount.Merge(dst, src)
}
func (m *MoneyAmount) XXX_Size() int {
return xxx_messageInfo_MoneyAmount.Size(m)
}
func (m *MoneyAmount) XXX_DiscardUnknown() {
xxx_messageInfo_MoneyAmount.DiscardUnknown(m)
}
var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo
func (m *MoneyAmount) GetDecimal() uint32 {
if m != nil {
return m.Decimal
}
return 0
}
func (m *MoneyAmount) GetFractional() uint32 {
if m != nil {
return m.Fractional
}
return 0
}
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Money) Reset() { *m = Money{} }
func (m *Money) String() string { return proto.CompactTextString(m) }
func (*Money) ProtoMessage() {}
func (*Money) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{19}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{18}
}
func (m *Money) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Money.Unmarshal(m, b)
@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string {
return ""
}
func (m *Money) GetAmount() *MoneyAmount {
func (m *Money) GetUnits() int64 {
if m != nil {
return m.Amount
return m.Units
}
return nil
return 0
}
func (m *Money) GetNanos() int32 {
if m != nil {
return m.Nanos
}
return 0
}
type GetSupportedCurrenciesResponse struct {
@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr
func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) }
func (*GetSupportedCurrenciesResponse) ProtoMessage() {}
func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{20}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{19}
}
func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b)
@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq
func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) }
func (*CurrencyConversionRequest) ProtoMessage() {}
func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{21}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{20}
}
func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b)
@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} }
func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) }
func (*CreditCardInfo) ProtoMessage() {}
func (*CreditCardInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{22}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{21}
}
func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b)
@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} }
func (m *ChargeRequest) String() string { return proto.CompactTextString(m) }
func (*ChargeRequest) ProtoMessage() {}
func (*ChargeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{23}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{22}
}
func (m *ChargeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeRequest.Unmarshal(m, b)
@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} }
func (m *ChargeResponse) String() string { return proto.CompactTextString(m) }
func (*ChargeResponse) ProtoMessage() {}
func (*ChargeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{24}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{23}
}
func (m *ChargeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeResponse.Unmarshal(m, b)
@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} }
func (m *OrderItem) String() string { return proto.CompactTextString(m) }
func (*OrderItem) ProtoMessage() {}
func (*OrderItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{25}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{24}
}
func (m *OrderItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderItem.Unmarshal(m, b)
@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} }
func (m *OrderResult) String() string { return proto.CompactTextString(m) }
func (*OrderResult) ProtoMessage() {}
func (*OrderResult) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{26}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{25}
}
func (m *OrderResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderResult.Unmarshal(m, b)
@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat
func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) }
func (*SendOrderConfirmationRequest) ProtoMessage() {}
func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{27}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{26}
}
func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b)
@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} }
func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) }
func (*CreateOrderRequest) ProtoMessage() {}
func (*CreateOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{28}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{27}
}
func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b)
@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} }
func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) }
func (*CreateOrderResponse) ProtoMessage() {}
func (*CreateOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{29}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{28}
}
func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b)
@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} }
func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderRequest) ProtoMessage() {}
func (*PlaceOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{30}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{29}
}
func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b)
@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} }
func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderResponse) ProtoMessage() {}
func (*PlaceOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{31}
return fileDescriptor_demo_be349a9cb1cf0a0c, []int{30}
}
func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b)
@ -1527,7 +1496,6 @@ func init() {
proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest")
proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse")
proto.RegisterType((*Address)(nil), "hipstershop.Address")
proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount")
proto.RegisterType((*Money)(nil), "hipstershop.Money")
proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse")
proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest")
@ -2294,100 +2262,99 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{
Metadata: "demo.proto",
}
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) }
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_be349a9cb1cf0a0c) }
var fileDescriptor_demo_40506d781b7ed975 = []byte{
// 1466 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6,
0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66,
0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa,
0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a,
0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3,
0xab, 0x5d, 0x7d, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xe7, 0xdd, 0xfd, 0xed, 0x39, 0xbf, 0x3d, 0xdf,
0x32, 0x80, 0x4d, 0x5c, 0x7f, 0x3f, 0xa0, 0x3e, 0xf3, 0x51, 0x7b, 0xe2, 0x04, 0x21, 0x23, 0x34,
0x9c, 0xf8, 0x01, 0x3e, 0x80, 0xe6, 0xc0, 0xa4, 0x6c, 0xc4, 0x88, 0x8b, 0x2e, 0x01, 0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, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4,
0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e,
0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00,
0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00,
var fileDescriptor_demo_be349a9cb1cf0a0c = []byte{
// 1442 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdf, 0x72, 0xd3, 0xc6,
0x17, 0x8e, 0x92, 0x38, 0x8e, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x7e, 0x46, 0xe1, 0x4f, 0x7e, 0x9b,
0x29, 0x0d, 0x05, 0x52, 0x70, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8,
0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xd2, 0x82, 0x55, 0x22, 0xad, 0x58, 0xad, 0x32, 0x35, 0xd3,
0x2b, 0xfa, 0x16, 0x7d, 0x80, 0x5e, 0xf4, 0x01, 0xda, 0x77, 0xe8, 0x7d, 0x5f, 0xa1, 0xcf, 0xd1,
0xd9, 0xd5, 0xae, 0xfe, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xa7, 0xdd, 0xfd, 0xf6, 0x9c, 0x6f, 0xcf,
0x9e, 0x73, 0xf6, 0xb3, 0x01, 0x5c, 0xe2, 0xd3, 0xbd, 0x90, 0x51, 0x4e, 0x51, 0x7b, 0xe2, 0x85,
0x11, 0x27, 0x2c, 0x9a, 0xd0, 0x10, 0xef, 0xc3, 0xf2, 0xc0, 0x66, 0x7c, 0xc4, 0x89, 0x8f,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, 0xa6, 0xc0,
0x88, 0xab, 0xa1, 0xb0, 0x76, 0x30, 0xf1, 0xc2, 0x47, 0xcc, 0x25, 0xec, 0x5f, 0xe1, 0xfc, 0x29,
0xac, 0xe7, 0x1c, 0x66, 0xe9, 0xcd, 0x99, 0xed, 0xbc, 0xf6, 0x82, 0x57, 0x59, 0xed, 0x80, 0x9e,
0x1a, 0xb9, 0xf8, 0x57, 0x03, 0x9a, 0xca, 0x2f, 0xda, 0x85, 0xb5, 0x88, 0x33, 0x42, 0xf8, 0x58,
0x11, 0x18, 0xdf, 0x54, 0x3b, 0xba, 0xc9, 0xbc, 0x02, 0xde, 0xac, 0x40, 0xf6, 0x55, 0x11, 0x14,
0x91, 0x7d, 0x51, 0x22, 0x8e, 0xe8, 0x79, 0x49, 0x1d, 0xc8, 0x6f, 0x51, 0x00, 0x0e, 0x8d, 0x03,
0xce, 0xa6, 0xba, 0x00, 0xd4, 0x10, 0x9d, 0x83, 0xe5, 0xb7, 0x5e, 0x38, 0x76, 0xa8, 0x4b, 0x64,
0xfe, 0x37, 0xac, 0xe6, 0x5b, 0x2f, 0x1c, 0x50, 0x97, 0xe0, 0x67, 0xd0, 0x90, 0x11, 0x46, 0x3b,
0xd0, 0x71, 0x62, 0xc6, 0x48, 0xe0, 0x4c, 0x13, 0x60, 0x42, 0x71, 0x45, 0x4f, 0x0a, 0xb4, 0x48,
0xc8, 0x38, 0xf0, 0x78, 0x24, 0x59, 0x2d, 0x58, 0xc9, 0x40, 0xcc, 0x06, 0x76, 0x40, 0x23, 0xc9,
0xa6, 0x61, 0x25, 0x03, 0x3c, 0x84, 0x8b, 0x43, 0xc2, 0x0f, 0xe2, 0x30, 0xa4, 0x8c, 0x13, 0x77,
0x90, 0xd8, 0xf1, 0x48, 0x96, 0xae, 0x1f, 0x40, 0xb7, 0xe0, 0x52, 0xf7, 0x89, 0x4e, 0xde, 0x67,
0x84, 0xbf, 0x83, 0x73, 0x83, 0x74, 0x22, 0x38, 0x22, 0x2c,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60, 0x5e, 0xaa, 0x5d, 0xd7, 0x06, 0x5f, 0x2c,
0xc9, 0xff, 0x50, 0x3e, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x67, 0x70, 0xff, 0x79, 0x51, 0x11,
0x00, 0x00,
}

View file

@ -22,63 +22,63 @@ var catalog = []*pb.Product{
Name: "Vintage Typewriter",
Description: "This typewriter looks good in your living room.",
Picture: "/static/img/products/typewriter.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 67, Fractional: 99},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 67, Nanos: 990000000},
},
{
Id: "66VCHSJNUP",
Name: "Vintage Camera Lens",
Description: "You won't have a camera to use it and it probably doesn't work anyway.",
Picture: "/static/img/products/camera-lens.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 12, Fractional: 49},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 12, Nanos: 490000000},
},
{
Id: "1YMWWN1N4O",
Name: "Home Barista Kit",
Description: "Always wanted to brew coffee with Chemex and Aeropress at home?",
Picture: "/static/img/products/barista-kit.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 124, Fractional: 0},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 124, Nanos: 0},
},
{
Id: "L9ECAV7KIM",
Name: "Terrarium",
Description: "This terrarium will looks great in your white painted living room.",
Picture: "/static/img/products/terrarium.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 36, Fractional: 45},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 36, Nanos: 450000000},
},
{
Id: "2ZYFJ3GM2N",
Name: "Film Camera",
Description: "This camera looks like it's a film camera, but it's actually digital.",
Picture: "/static/img/products/film-camera.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 2245, Fractional: 0},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 2245, Nanos: 00000000},
},
{
Id: "0PUK6V6EV0",
Name: "Vintage Record Player",
Description: "It still works.",
Picture: "/static/img/products/record-player.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 65, Fractional: 50},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 65, Nanos: 500000000},
},
{
Id: "LS4PSXUNUM",
Name: "Metal Camping Mug",
Description: "You probably don't go camping that often but this is better than plastic cups.",
Picture: "/static/img/products/camp-mug.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 24, Fractional: 33},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 24, Nanos: 330000000},
},
{
Id: "9SIQT8TOJO",
Name: "City Bike",
Description: "This single gear bike probably cannot climb the hills of San Francisco.",
Picture: "/static/img/products/city-bike.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 789, Fractional: 50},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 789, Nanos: 500000000},
},
{
Id: "6E92ZMYYFZ",
Name: "Air Plant",
Description: "Have you ever wondered whether air plants need water? Buy one and figure out.",
Picture: "/static/img/products/air-plant.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 12, Fractional: 30},
PriceUsd: &pb.Money{CurrencyCode: "USD", Units: 12, Nanos: 300000000},
},
}
@ -118,7 +118,8 @@ func (p *productCatalog) SearchProducts(ctx context.Context, req *pb.SearchProdu
// Intepret query as a substring match in name or description.
var ps []*pb.Product
for _, p := range catalog {
if strings.Contains(p.Name, req.Query) || strings.Contains(p.Description, req.Query) {
if strings.Contains(strings.ToLower(p.Name), strings.ToLower(req.Query)) ||
strings.Contains(strings.ToLower(p.Description), strings.ToLower(req.Query)) {
ps = append(ps, p)
}
}

View file

@ -29,11 +29,11 @@ func TestServer(t *testing.T) {
t.Error(diff)
}
got, err := client.GetProduct(ctx, &pb.GetProductRequest{Id: "2"})
got, err := client.GetProduct(ctx, &pb.GetProductRequest{Id: "OLJCESPC7Z"})
if err != nil {
t.Fatal(err)
}
if want := catalog[1]; !proto.Equal(got, want) {
if want := catalog[0]; !proto.Equal(got, want) {
t.Errorf("got %v, want %v", got, want)
}
_, err = client.GetProduct(ctx, &pb.GetProductRequest{Id: "N/A"})
@ -41,11 +41,11 @@ func TestServer(t *testing.T) {
t.Errorf("got %s, want %s", got, want)
}
sres, err := client.SearchProducts(ctx, &pb.SearchProductsRequest{Query: "nice"})
sres, err := client.SearchProducts(ctx, &pb.SearchProductsRequest{Query: "typewriter"})
if err != nil {
t.Fatal(err)
}
if diff := cmp.Diff(sres.Results, catalog, cmp.Comparer(proto.Equal)); diff != "" {
if diff := cmp.Diff(sres.Results, []*pb.Product{catalog[0]}, cmp.Comparer(proto.Equal)); diff != "" {
t.Error(diff)
}
}

File diff suppressed because one or more lines are too long

View file

@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} }
func (m *CartItem) String() string { return proto.CompactTextString(m) }
func (*CartItem) ProtoMessage() {}
func (*CartItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{0}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{0}
}
func (m *CartItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CartItem.Unmarshal(m, b)
@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} }
func (m *AddItemRequest) String() string { return proto.CompactTextString(m) }
func (*AddItemRequest) ProtoMessage() {}
func (*AddItemRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{1}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{1}
}
func (m *AddItemRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddItemRequest.Unmarshal(m, b)
@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} }
func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) }
func (*EmptyCartRequest) ProtoMessage() {}
func (*EmptyCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{2}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{2}
}
func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b)
@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} }
func (m *GetCartRequest) String() string { return proto.CompactTextString(m) }
func (*GetCartRequest) ProtoMessage() {}
func (*GetCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{3}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{3}
}
func (m *GetCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetCartRequest.Unmarshal(m, b)
@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} }
func (m *Cart) String() string { return proto.CompactTextString(m) }
func (*Cart) ProtoMessage() {}
func (*Cart) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{4}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{4}
}
func (m *Cart) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Cart.Unmarshal(m, b)
@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{5}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{5}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Empty.Unmarshal(m, b)
@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR
func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsRequest) ProtoMessage() {}
func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{6}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{6}
}
func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b)
@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations
func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsResponse) ProtoMessage() {}
func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{7}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{7}
}
func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b)
@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string {
}
type Product struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Product) Reset() { *m = Product{} }
func (m *Product) String() string { return proto.CompactTextString(m) }
func (*Product) ProtoMessage() {}
func (*Product) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{8}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{8}
}
func (m *Product) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Product.Unmarshal(m, b)
@ -414,7 +414,7 @@ func (m *Product) GetPicture() string {
return ""
}
func (m *Product) GetPriceUsd() *MoneyAmount {
func (m *Product) GetPriceUsd() *Money {
if m != nil {
return m.PriceUsd
}
@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} }
func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) }
func (*ListProductsResponse) ProtoMessage() {}
func (*ListProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{9}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{9}
}
func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b)
@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} }
func (m *GetProductRequest) String() string { return proto.CompactTextString(m) }
func (*GetProductRequest) ProtoMessage() {}
func (*GetProductRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{10}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{10}
}
func (m *GetProductRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetProductRequest.Unmarshal(m, b)
@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} }
func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) }
func (*SearchProductsRequest) ProtoMessage() {}
func (*SearchProductsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{11}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{11}
}
func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b)
@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{}
func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) }
func (*SearchProductsResponse) ProtoMessage() {}
func (*SearchProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{12}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{12}
}
func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b)
@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} }
func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) }
func (*GetQuoteRequest) ProtoMessage() {}
func (*GetQuoteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{13}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{13}
}
func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b)
@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem {
}
type GetQuoteResponse struct {
CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} }
func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) }
func (*GetQuoteResponse) ProtoMessage() {}
func (*GetQuoteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{14}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{14}
}
func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b)
@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo
func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount {
func (m *GetQuoteResponse) GetCostUsd() *Money {
if m != nil {
return m.CostUsd
}
@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} }
func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) }
func (*ShipOrderRequest) ProtoMessage() {}
func (*ShipOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{15}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{15}
}
func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b)
@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} }
func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) }
func (*ShipOrderResponse) ProtoMessage() {}
func (*ShipOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{16}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{16}
}
func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b)
@ -742,9 +742,9 @@ func (m *ShipOrderResponse) GetTrackingId() string {
}
type Address struct {
StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"`
StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"`
City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"`
StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress" json:"street_address,omitempty"`
City string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"`
State string `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"`
Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"`
ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} }
func (m *Address) String() string { return proto.CompactTextString(m) }
func (*Address) ProtoMessage() {}
func (*Address) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{17}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{17}
}
func (m *Address) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Address.Unmarshal(m, b)
@ -776,16 +776,9 @@ func (m *Address) XXX_DiscardUnknown() {
var xxx_messageInfo_Address proto.InternalMessageInfo
func (m *Address) GetStreetAddress_1() string {
func (m *Address) GetStreetAddress() string {
if m != nil {
return m.StreetAddress_1
}
return ""
}
func (m *Address) GetStreetAddress_2() string {
if m != nil {
return m.StreetAddress_2
return m.StreetAddress
}
return ""
}
@ -797,6 +790,13 @@ func (m *Address) GetCity() string {
return ""
}
func (m *Address) GetState() string {
if m != nil {
return m.State
}
return ""
}
func (m *Address) GetCountry() string {
if m != nil {
return m.Country
@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 {
return 0
}
// Describes a money amount without currency. For example, decimal=2 and
// fractional=500 (or fractional=5) makes up 2.5 units.
type MoneyAmount struct {
Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"`
Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"`
// Represents an amount of money with its currency type.
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
// The whole units of the amount.
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"`
// Number of nano (10^-9) units of the amount.
// The value must be between -999,999,999 and +999,999,999 inclusive.
// If `units` is positive, `nanos` must be positive or zero.
// If `units` is zero, `nanos` can be positive, zero, or negative.
// If `units` is negative, `nanos` must be negative or zero.
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MoneyAmount) Reset() { *m = MoneyAmount{} }
func (m *MoneyAmount) String() string { return proto.CompactTextString(m) }
func (*MoneyAmount) ProtoMessage() {}
func (*MoneyAmount) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{18}
}
func (m *MoneyAmount) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MoneyAmount.Unmarshal(m, b)
}
func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic)
}
func (dst *MoneyAmount) XXX_Merge(src proto.Message) {
xxx_messageInfo_MoneyAmount.Merge(dst, src)
}
func (m *MoneyAmount) XXX_Size() int {
return xxx_messageInfo_MoneyAmount.Size(m)
}
func (m *MoneyAmount) XXX_DiscardUnknown() {
xxx_messageInfo_MoneyAmount.DiscardUnknown(m)
}
var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo
func (m *MoneyAmount) GetDecimal() uint32 {
if m != nil {
return m.Decimal
}
return 0
}
func (m *MoneyAmount) GetFractional() uint32 {
if m != nil {
return m.Fractional
}
return 0
}
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Money) Reset() { *m = Money{} }
func (m *Money) String() string { return proto.CompactTextString(m) }
func (*Money) ProtoMessage() {}
func (*Money) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{19}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{18}
}
func (m *Money) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Money.Unmarshal(m, b)
@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string {
return ""
}
func (m *Money) GetAmount() *MoneyAmount {
func (m *Money) GetUnits() int64 {
if m != nil {
return m.Amount
return m.Units
}
return nil
return 0
}
func (m *Money) GetNanos() int32 {
if m != nil {
return m.Nanos
}
return 0
}
type GetSupportedCurrenciesResponse struct {
@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr
func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) }
func (*GetSupportedCurrenciesResponse) ProtoMessage() {}
func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{20}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{19}
}
func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b)
@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq
func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) }
func (*CurrencyConversionRequest) ProtoMessage() {}
func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{21}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{20}
}
func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b)
@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} }
func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) }
func (*CreditCardInfo) ProtoMessage() {}
func (*CreditCardInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{22}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{21}
}
func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b)
@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} }
func (m *ChargeRequest) String() string { return proto.CompactTextString(m) }
func (*ChargeRequest) ProtoMessage() {}
func (*ChargeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{23}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{22}
}
func (m *ChargeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeRequest.Unmarshal(m, b)
@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} }
func (m *ChargeResponse) String() string { return proto.CompactTextString(m) }
func (*ChargeResponse) ProtoMessage() {}
func (*ChargeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{24}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{23}
}
func (m *ChargeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeResponse.Unmarshal(m, b)
@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} }
func (m *OrderItem) String() string { return proto.CompactTextString(m) }
func (*OrderItem) ProtoMessage() {}
func (*OrderItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{25}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{24}
}
func (m *OrderItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderItem.Unmarshal(m, b)
@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} }
func (m *OrderResult) String() string { return proto.CompactTextString(m) }
func (*OrderResult) ProtoMessage() {}
func (*OrderResult) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{26}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{25}
}
func (m *OrderResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderResult.Unmarshal(m, b)
@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat
func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) }
func (*SendOrderConfirmationRequest) ProtoMessage() {}
func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{27}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{26}
}
func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b)
@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} }
func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) }
func (*CreateOrderRequest) ProtoMessage() {}
func (*CreateOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{28}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{27}
}
func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b)
@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} }
func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) }
func (*CreateOrderResponse) ProtoMessage() {}
func (*CreateOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{29}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{28}
}
func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b)
@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} }
func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderRequest) ProtoMessage() {}
func (*PlaceOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{30}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{29}
}
func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b)
@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} }
func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderResponse) ProtoMessage() {}
func (*PlaceOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{31}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{30}
}
func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b)
@ -1527,7 +1496,6 @@ func init() {
proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest")
proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse")
proto.RegisterType((*Address)(nil), "hipstershop.Address")
proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount")
proto.RegisterType((*Money)(nil), "hipstershop.Money")
proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse")
proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest")
@ -2294,100 +2262,98 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{
Metadata: "demo.proto",
}
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) }
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) }
var fileDescriptor_demo_40506d781b7ed975 = []byte{
// 1466 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6,
0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66,
0x4a, 0x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52, 0xa5, 0x6e, 0xbb,
0x56, 0x24, 0x7c, 0xc2, 0x08, 0x86, 0x17, 0xd0, 0x10, 0x1a, 0xf1, 0x54, 0xc5, 0xd0, 0x95, 0x7c,
0x2e, 0x54, 0xcd, 0x5c, 0x7a, 0x49, 0xa5, 0xc3, 0x0b, 0xfd, 0x67, 0xd0, 0x7d, 0x62, 0xce, 0x5c,
0xe2, 0x25, 0x19, 0x3c, 0x80, 0xe5, 0xb8, 0xed, 0x23, 0x3d, 0x2f, 0x39, 0x3b, 0x86, 0xe8, 0x5b,
0xa5, 0x67, 0x89, 0x41, 0x26, 0xb0, 0x72, 0xc0, 0x6b, 0x94, 0x12, 0xfa, 0x2d, 0xff, 0x02, 0x2b,
0xe9, 0x56, 0xe8, 0x6a, 0x21, 0x1a, 0xaa, 0x3b, 0x5a, 0x45, 0xce, 0xfe, 0xce, 0x4d, 0x3f, 0x21,
0xd6, 0x6b, 0x3f, 0x4a, 0x9e, 0x60, 0x40, 0x3b, 0xd3, 0x30, 0xd0, 0xe5, 0x62, 0x49, 0x2c, 0xb4,
0x33, 0x7d, 0xa7, 0x1a, 0x90, 0x58, 0xfc, 0x31, 0x40, 0x5a, 0x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e,
0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00,
0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00,
var fileDescriptor_demo_bbfc9458084e7e4b = []byte{
// 1435 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46,
0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40,
0xa1, 0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4, 0x19, 0x3c, 0x80, 0xa5, 0xb8, 0xed, 0x23, 0xb3, 0x28, 0x39, 0x3f, 0x86, 0x98,
0x9b, 0x73, 0xcf, 0x52, 0x83, 0x4c, 0x60, 0x79, 0x4f, 0xd6, 0x28, 0x2d, 0xf4, 0xb9, 0xfc, 0x55,
0x34, 0xa7, 0x5b, 0xa1, 0x6b, 0xa5, 0x68, 0xa8, 0xee, 0x68, 0x15, 0x39, 0xfb, 0x87, 0x34, 0xfd,
0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58,
0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6,
0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00,
0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00,
}

View file

@ -34,10 +34,10 @@ func (s *server) GetQuote(ctx context.Context, in *pb.GetQuoteRequest) (*pb.GetQ
// 3. Generate a response.
return &pb.GetQuoteResponse{
CostUsd: &pb.MoneyAmount{
Decimal: quote.Dollars,
Fractional: quote.Cents,
},
CostUsd: &pb.Money{
CurrencyCode: "USD",
Units: int64(quote.Dollars),
Nanos: int32(quote.Cents * 10000000)},
}, nil
}
@ -46,7 +46,7 @@ func (s *server) GetQuote(ctx context.Context, in *pb.GetQuoteRequest) (*pb.GetQ
// It supplies a tracking ID for notional lookup of shipment delivery status.
func (s *server) ShipOrder(ctx context.Context, in *pb.ShipOrderRequest) (*pb.ShipOrderResponse, error) {
// 1. Create a Tracking ID
baseAddress := fmt.Sprintf("%s, %s, %s", in.Address.StreetAddress_1, in.Address.StreetAddress_2, in.Address.City)
baseAddress := fmt.Sprintf("%s, %s, %s", in.Address.StreetAddress, in.Address.City, in.Address.State)
id := CreateTrackingId(baseAddress)
// 2. Generate a response.

View file

@ -15,10 +15,10 @@ func TestGetQuote(t *testing.T) {
// A basic test case to test logic and protobuf interactions.
req := &pb.GetQuoteRequest{
Address: &pb.Address{
StreetAddress_1: "Muffin Man",
StreetAddress_2: "Drury Lane",
City: "London",
Country: "England",
StreetAddress: "Muffin Man",
City: "London",
State: "",
Country: "England",
},
Items: []*pb.CartItem{
{
@ -36,8 +36,8 @@ func TestGetQuote(t *testing.T) {
if err != nil {
t.Errorf("TestGetQuote (%v) failed", err)
}
if res.CostUsd.Decimal != 11 || res.CostUsd.Fractional != 22 {
t.Errorf("TestGetQuote: Quote value '%d.%d' does not match expected '%s'", res.CostUsd.Decimal, res.CostUsd.Fractional, "11.22")
if res.CostUsd.GetUnits() != 11 || res.CostUsd.GetNanos() != 220000000 {
t.Errorf("TestGetQuote: Quote value '%d.%d' does not match expected '%s'", res.CostUsd.GetUnits(), res.CostUsd.GetNanos(), "11.220000000")
}
}
@ -48,10 +48,10 @@ func TestShipOrder(t *testing.T) {
// A basic test case to test logic and protobuf interactions.
req := &pb.ShipOrderRequest{
Address: &pb.Address{
StreetAddress_1: "Muffin Man",
StreetAddress_2: "Drury Lane",
City: "London",
Country: "England",
StreetAddress: "Muffin Man",
City: "London",
State: "",
Country: "England",
},
Items: []*pb.CartItem{
{

View file

@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} }
func (m *CartItem) String() string { return proto.CompactTextString(m) }
func (*CartItem) ProtoMessage() {}
func (*CartItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{0}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{0}
}
func (m *CartItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CartItem.Unmarshal(m, b)
@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} }
func (m *AddItemRequest) String() string { return proto.CompactTextString(m) }
func (*AddItemRequest) ProtoMessage() {}
func (*AddItemRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{1}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{1}
}
func (m *AddItemRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddItemRequest.Unmarshal(m, b)
@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} }
func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) }
func (*EmptyCartRequest) ProtoMessage() {}
func (*EmptyCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{2}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{2}
}
func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b)
@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} }
func (m *GetCartRequest) String() string { return proto.CompactTextString(m) }
func (*GetCartRequest) ProtoMessage() {}
func (*GetCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{3}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{3}
}
func (m *GetCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetCartRequest.Unmarshal(m, b)
@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} }
func (m *Cart) String() string { return proto.CompactTextString(m) }
func (*Cart) ProtoMessage() {}
func (*Cart) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{4}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{4}
}
func (m *Cart) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Cart.Unmarshal(m, b)
@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{5}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{5}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Empty.Unmarshal(m, b)
@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR
func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsRequest) ProtoMessage() {}
func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{6}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{6}
}
func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b)
@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations
func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsResponse) ProtoMessage() {}
func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{7}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{7}
}
func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b)
@ -352,21 +352,21 @@ func (m *ListRecommendationsResponse) GetProductIds() []string {
}
type Product struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *MoneyAmount `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
Picture string `protobuf:"bytes,4,opt,name=picture" json:"picture,omitempty"`
PriceUsd *Money `protobuf:"bytes,5,opt,name=price_usd,json=priceUsd" json:"price_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Product) Reset() { *m = Product{} }
func (m *Product) String() string { return proto.CompactTextString(m) }
func (*Product) ProtoMessage() {}
func (*Product) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{8}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{8}
}
func (m *Product) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Product.Unmarshal(m, b)
@ -414,7 +414,7 @@ func (m *Product) GetPicture() string {
return ""
}
func (m *Product) GetPriceUsd() *MoneyAmount {
func (m *Product) GetPriceUsd() *Money {
if m != nil {
return m.PriceUsd
}
@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} }
func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) }
func (*ListProductsResponse) ProtoMessage() {}
func (*ListProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{9}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{9}
}
func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b)
@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} }
func (m *GetProductRequest) String() string { return proto.CompactTextString(m) }
func (*GetProductRequest) ProtoMessage() {}
func (*GetProductRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{10}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{10}
}
func (m *GetProductRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetProductRequest.Unmarshal(m, b)
@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} }
func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) }
func (*SearchProductsRequest) ProtoMessage() {}
func (*SearchProductsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{11}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{11}
}
func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b)
@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{}
func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) }
func (*SearchProductsResponse) ProtoMessage() {}
func (*SearchProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{12}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{12}
}
func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b)
@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} }
func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) }
func (*GetQuoteRequest) ProtoMessage() {}
func (*GetQuoteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{13}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{13}
}
func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b)
@ -620,17 +620,17 @@ func (m *GetQuoteRequest) GetItems() []*CartItem {
}
type GetQuoteResponse struct {
CostUsd *MoneyAmount `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
CostUsd *Money `protobuf:"bytes,1,opt,name=cost_usd,json=costUsd" json:"cost_usd,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} }
func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) }
func (*GetQuoteResponse) ProtoMessage() {}
func (*GetQuoteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{14}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{14}
}
func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b)
@ -650,7 +650,7 @@ func (m *GetQuoteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_GetQuoteResponse proto.InternalMessageInfo
func (m *GetQuoteResponse) GetCostUsd() *MoneyAmount {
func (m *GetQuoteResponse) GetCostUsd() *Money {
if m != nil {
return m.CostUsd
}
@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} }
func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) }
func (*ShipOrderRequest) ProtoMessage() {}
func (*ShipOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{15}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{15}
}
func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b)
@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} }
func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) }
func (*ShipOrderResponse) ProtoMessage() {}
func (*ShipOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{16}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{16}
}
func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b)
@ -742,9 +742,9 @@ func (m *ShipOrderResponse) GetTrackingId() string {
}
type Address struct {
StreetAddress_1 string `protobuf:"bytes,1,opt,name=street_address_1,json=streetAddress1" json:"street_address_1,omitempty"`
StreetAddress_2 string `protobuf:"bytes,2,opt,name=street_address_2,json=streetAddress2" json:"street_address_2,omitempty"`
City string `protobuf:"bytes,3,opt,name=city" json:"city,omitempty"`
StreetAddress string `protobuf:"bytes,1,opt,name=street_address,json=streetAddress" json:"street_address,omitempty"`
City string `protobuf:"bytes,2,opt,name=city" json:"city,omitempty"`
State string `protobuf:"bytes,3,opt,name=state" json:"state,omitempty"`
Country string `protobuf:"bytes,4,opt,name=country" json:"country,omitempty"`
ZipCode int32 `protobuf:"varint,5,opt,name=zip_code,json=zipCode" json:"zip_code,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} }
func (m *Address) String() string { return proto.CompactTextString(m) }
func (*Address) ProtoMessage() {}
func (*Address) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{17}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{17}
}
func (m *Address) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Address.Unmarshal(m, b)
@ -776,16 +776,9 @@ func (m *Address) XXX_DiscardUnknown() {
var xxx_messageInfo_Address proto.InternalMessageInfo
func (m *Address) GetStreetAddress_1() string {
func (m *Address) GetStreetAddress() string {
if m != nil {
return m.StreetAddress_1
}
return ""
}
func (m *Address) GetStreetAddress_2() string {
if m != nil {
return m.StreetAddress_2
return m.StreetAddress
}
return ""
}
@ -797,6 +790,13 @@ func (m *Address) GetCity() string {
return ""
}
func (m *Address) GetState() string {
if m != nil {
return m.State
}
return ""
}
func (m *Address) GetCountry() string {
if m != nil {
return m.Country
@ -811,68 +811,30 @@ func (m *Address) GetZipCode() int32 {
return 0
}
// Describes a money amount without currency. For example, decimal=2 and
// fractional=500 (or fractional=5) makes up 2.5 units.
type MoneyAmount struct {
Decimal uint32 `protobuf:"varint,1,opt,name=decimal" json:"decimal,omitempty"`
Fractional uint32 `protobuf:"varint,2,opt,name=fractional" json:"fractional,omitempty"`
// Represents an amount of money with its currency type.
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
// The whole units of the amount.
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
Units int64 `protobuf:"varint,2,opt,name=units" json:"units,omitempty"`
// Number of nano (10^-9) units of the amount.
// The value must be between -999,999,999 and +999,999,999 inclusive.
// If `units` is positive, `nanos` must be positive or zero.
// If `units` is zero, `nanos` can be positive, zero, or negative.
// If `units` is negative, `nanos` must be negative or zero.
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
Nanos int32 `protobuf:"varint,3,opt,name=nanos" json:"nanos,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *MoneyAmount) Reset() { *m = MoneyAmount{} }
func (m *MoneyAmount) String() string { return proto.CompactTextString(m) }
func (*MoneyAmount) ProtoMessage() {}
func (*MoneyAmount) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{18}
}
func (m *MoneyAmount) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MoneyAmount.Unmarshal(m, b)
}
func (m *MoneyAmount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_MoneyAmount.Marshal(b, m, deterministic)
}
func (dst *MoneyAmount) XXX_Merge(src proto.Message) {
xxx_messageInfo_MoneyAmount.Merge(dst, src)
}
func (m *MoneyAmount) XXX_Size() int {
return xxx_messageInfo_MoneyAmount.Size(m)
}
func (m *MoneyAmount) XXX_DiscardUnknown() {
xxx_messageInfo_MoneyAmount.DiscardUnknown(m)
}
var xxx_messageInfo_MoneyAmount proto.InternalMessageInfo
func (m *MoneyAmount) GetDecimal() uint32 {
if m != nil {
return m.Decimal
}
return 0
}
func (m *MoneyAmount) GetFractional() uint32 {
if m != nil {
return m.Fractional
}
return 0
}
type Money struct {
// The 3-letter currency code defined in ISO 4217.
CurrencyCode string `protobuf:"bytes,1,opt,name=currency_code,json=currencyCode" json:"currency_code,omitempty"`
Amount *MoneyAmount `protobuf:"bytes,2,opt,name=amount" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Money) Reset() { *m = Money{} }
func (m *Money) String() string { return proto.CompactTextString(m) }
func (*Money) ProtoMessage() {}
func (*Money) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{19}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{18}
}
func (m *Money) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Money.Unmarshal(m, b)
@ -899,11 +861,18 @@ func (m *Money) GetCurrencyCode() string {
return ""
}
func (m *Money) GetAmount() *MoneyAmount {
func (m *Money) GetUnits() int64 {
if m != nil {
return m.Amount
return m.Units
}
return nil
return 0
}
func (m *Money) GetNanos() int32 {
if m != nil {
return m.Nanos
}
return 0
}
type GetSupportedCurrenciesResponse struct {
@ -918,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr
func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) }
func (*GetSupportedCurrenciesResponse) ProtoMessage() {}
func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{20}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{19}
}
func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b)
@ -958,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq
func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) }
func (*CurrencyConversionRequest) ProtoMessage() {}
func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{21}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{20}
}
func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b)
@ -1006,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} }
func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) }
func (*CreditCardInfo) ProtoMessage() {}
func (*CreditCardInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{22}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{21}
}
func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b)
@ -1066,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} }
func (m *ChargeRequest) String() string { return proto.CompactTextString(m) }
func (*ChargeRequest) ProtoMessage() {}
func (*ChargeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{23}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{22}
}
func (m *ChargeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeRequest.Unmarshal(m, b)
@ -1111,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} }
func (m *ChargeResponse) String() string { return proto.CompactTextString(m) }
func (*ChargeResponse) ProtoMessage() {}
func (*ChargeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{24}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{23}
}
func (m *ChargeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeResponse.Unmarshal(m, b)
@ -1150,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} }
func (m *OrderItem) String() string { return proto.CompactTextString(m) }
func (*OrderItem) ProtoMessage() {}
func (*OrderItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{25}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{24}
}
func (m *OrderItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderItem.Unmarshal(m, b)
@ -1199,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} }
func (m *OrderResult) String() string { return proto.CompactTextString(m) }
func (*OrderResult) ProtoMessage() {}
func (*OrderResult) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{26}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{25}
}
func (m *OrderResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderResult.Unmarshal(m, b)
@ -1266,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat
func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) }
func (*SendOrderConfirmationRequest) ProtoMessage() {}
func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{27}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{26}
}
func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b)
@ -1313,7 +1282,7 @@ func (m *CreateOrderRequest) Reset() { *m = CreateOrderRequest{} }
func (m *CreateOrderRequest) String() string { return proto.CompactTextString(m) }
func (*CreateOrderRequest) ProtoMessage() {}
func (*CreateOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{28}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{27}
}
func (m *CreateOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderRequest.Unmarshal(m, b)
@ -1366,7 +1335,7 @@ func (m *CreateOrderResponse) Reset() { *m = CreateOrderResponse{} }
func (m *CreateOrderResponse) String() string { return proto.CompactTextString(m) }
func (*CreateOrderResponse) ProtoMessage() {}
func (*CreateOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{29}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{28}
}
func (m *CreateOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateOrderResponse.Unmarshal(m, b)
@ -1415,7 +1384,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} }
func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderRequest) ProtoMessage() {}
func (*PlaceOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{30}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{29}
}
func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b)
@ -1481,7 +1450,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} }
func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderResponse) ProtoMessage() {}
func (*PlaceOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_40506d781b7ed975, []int{31}
return fileDescriptor_demo_bbfc9458084e7e4b, []int{30}
}
func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b)
@ -1527,7 +1496,6 @@ func init() {
proto.RegisterType((*ShipOrderRequest)(nil), "hipstershop.ShipOrderRequest")
proto.RegisterType((*ShipOrderResponse)(nil), "hipstershop.ShipOrderResponse")
proto.RegisterType((*Address)(nil), "hipstershop.Address")
proto.RegisterType((*MoneyAmount)(nil), "hipstershop.MoneyAmount")
proto.RegisterType((*Money)(nil), "hipstershop.Money")
proto.RegisterType((*GetSupportedCurrenciesResponse)(nil), "hipstershop.GetSupportedCurrenciesResponse")
proto.RegisterType((*CurrencyConversionRequest)(nil), "hipstershop.CurrencyConversionRequest")
@ -2294,100 +2262,98 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{
Metadata: "demo.proto",
}
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_40506d781b7ed975) }
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_bbfc9458084e7e4b) }
var fileDescriptor_demo_40506d781b7ed975 = []byte{
// 1466 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0xc6,
0x17, 0x8f, 0x9c, 0x38, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0xfe, 0x46, 0x81, 0x90, 0xff, 0x66,
0x4a, 0x43, 0xa1, 0x19, 0x30, 0xed, 0x70, 0x51, 0x5a, 0xca, 0x98, 0x8c, 0xf1, 0x0c, 0x14, 0xaa,
0x40, 0xa7, 0x1d, 0x3a, 0x78, 0x84, 0xb4, 0xc1, 0x2a, 0xd6, 0x07, 0xab, 0x55, 0xa6, 0x66, 0x7a,
0x45, 0x5f, 0xa4, 0x57, 0xbd, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3,
0xab, 0x5d, 0x7d, 0x59, 0x4a, 0xc2, 0x4d, 0x7b, 0xe7, 0xdd, 0xfd, 0xed, 0x39, 0xbf, 0x3d, 0xdf,
0x32, 0x80, 0x4d, 0x5c, 0x7f, 0x3f, 0xa0, 0x3e, 0xf3, 0x51, 0x7b, 0xe2, 0x04, 0x21, 0x23, 0x34,
0x9c, 0xf8, 0x01, 0x3e, 0x80, 0xe6, 0xc0, 0xa4, 0x6c, 0xc4, 0x88, 0x8b, 0x2e, 0x01, 0x04, 0xd4,
0xb7, 0x23, 0x8b, 0x8d, 0x1d, 0xbb, 0xa7, 0xed, 0x68, 0x7b, 0x2d, 0xa3, 0x25, 0x77, 0x46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x2e, 0x0b, 0x29, 0x33, 0xd7, 0x1e,
0xf4, 0xcb, 0x95, 0xe7, 0x4a, 0xe0, 0xcb, 0x65, 0xf1, 0xf7, 0xcc, 0xad, 0x7f, 0x02, 0x00, 0x00,
0xff, 0xff, 0xdd, 0xe8, 0xfb, 0x77, 0xac, 0x11, 0x00, 0x00,
var fileDescriptor_demo_bbfc9458084e7e4b = []byte{
// 1435 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xdd, 0x72, 0xd3, 0x46,
0x14, 0x8e, 0x1c, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0x59, 0x12, 0x6a, 0x14, 0x7e, 0xd2, 0xcd, 0x40,
0xa1, 0x40, 0xca, 0xa4, 0x9d, 0xe1, 0xa2, 0xb4, 0x94, 0x31, 0x19, 0xe3, 0x19, 0x28, 0x54, 0x81,
0x0e, 0x1d, 0x3a, 0xf5, 0x08, 0x69, 0xc1, 0x2a, 0x91, 0x56, 0xd9, 0x5d, 0x65, 0x6a, 0xa6, 0x57,
0xf4, 0x01, 0x7a, 0xdf, 0x47, 0xe8, 0x03, 0xb4, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3,
0x2b, 0xad, 0xfe, 0x6c, 0x25, 0xe1, 0xa6, 0xbd, 0xd3, 0xee, 0x7e, 0x7b, 0xce, 0xb7, 0xe7, 0xdf,
0x06, 0x70, 0x89, 0x4f, 0x77, 0x42, 0x46, 0x05, 0x45, 0x9d, 0x89, 0x17, 0x72, 0x41, 0x18, 0x9f,
0xd0, 0x10, 0xef, 0x41, 0x6b, 0x60, 0x33, 0x31, 0x12, 0xc4, 0x47, 0x17, 0x00, 0x42, 0x46, 0xdd,
0xc8, 0x11, 0x63, 0xcf, 0xed, 0x1b, 0x5b, 0xc6, 0xd5, 0xb6, 0xd5, 0x4e, 0x76, 0x46, 0x2e, 0x32,
0xa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x49, 0xe7, 0x27, 0x5f, 0xf3, 0x42, 0xc5, 0x69, 0x6a,
0x81, 0x87, 0xd0, 0x4e, 0x27, 0xc1, 0x52, 0xb0, 0x94, 0x47, 0x52, 0xf3, 0x62, 0xd5, 0x71, 0x4a,
0xf6, 0x4f, 0x03, 0x56, 0x74, 0x72, 0x6b, 0xb2, 0x2f, 0xe0, 0xec, 0xfc, 0x49, 0x6a, 0xae, 0xdb,
0xae, 0x97, 0x09, 0x1f, 0x33, 0x82, 0xe1, 0x05, 0x34, 0x84, 0x66, 0x3c, 0x55, 0x09, 0x74, 0xa5,
0x98, 0x0b, 0x55, 0x33, 0x97, 0x39, 0xa7, 0xd2, 0xe1, 0x85, 0xdd, 0x67, 0xd0, 0x7b, 0x62, 0x4f,
0x7d, 0x12, 0xa4, 0x19, 0x3c, 0x80, 0xa5, 0xb8, 0xed, 0x23, 0xb3, 0x28, 0x39, 0x3f, 0x86, 0x98,
0x9b, 0x73, 0xcf, 0x52, 0x83, 0x4c, 0x60, 0x79, 0x4f, 0xd6, 0x28, 0x2d, 0xf4, 0xb9, 0xfc, 0x55,
0x34, 0xa7, 0x5b, 0xa1, 0x6b, 0xa5, 0x68, 0xa8, 0xee, 0x68, 0x15, 0x39, 0xfb, 0x87, 0x34, 0xfd,
0x84, 0x38, 0x6f, 0x68, 0x94, 0x3e, 0xc1, 0x82, 0x4e, 0xae, 0x61, 0xa0, 0x4b, 0xe5, 0x92, 0x58,
0x6a, 0x67, 0xe6, 0x56, 0x35, 0x20, 0xb5, 0xf8, 0x63, 0x80, 0xac, 0x5c, 0x96, 0x52, 0x66, 0xa6,
0x3d, 0x98, 0x97, 0x2a, 0xcf, 0xb5, 0xc0, 0x97, 0x4b, 0xea, 0xcf, 0x92, 0x4f, 0xff, 0x0d, 0x00,
0x00, 0xff, 0xff, 0x1d, 0x9c, 0xae, 0xb8, 0x3a, 0x11, 0x00, 0x00,
}

View file

@ -111,10 +111,10 @@ func testShippingService() error {
defer conn.Close()
address := &pb.Address{
StreetAddress_1: "Muffin Man",
StreetAddress_2: "Drury Lane",
City: "London",
Country: "United Kingdom",
StreetAddress: "Muffin Man",
State: "",
City: "London",
Country: "United Kingdom",
}
items := []*pb.CartItem{
{
@ -183,10 +183,8 @@ func testPaymentService() error {
resp, err := cl.Charge(context.TODO(), &pb.ChargeRequest{
Amount: &pb.Money{
CurrencyCode: "USD",
Amount: &pb.MoneyAmount{
Decimal: 10,
Fractional: 55},
},
Units: 10,
Nanos: 550000000},
CreditCard: &pb.CreditCardInfo{
CreditCardNumber: "4444-4530-1092-6639",
CreditCardCvv: 612,
@ -216,15 +214,13 @@ func testEmailService() error {
ShippingTrackingId: "000-123-456",
ShippingCost: &pb.Money{
CurrencyCode: "CAD",
Amount: &pb.MoneyAmount{
Decimal: 10,
Fractional: 55},
},
Units: 10,
Nanos: 550000000},
ShippingAddress: &pb.Address{
StreetAddress_1: "Muffin Man",
StreetAddress_2: "Drury Lane",
City: "London",
Country: "United Kingdom",
StreetAddress: "Muffin Man",
State: "XX",
City: "London",
Country: "United Kingdom",
},
Items: []*pb.OrderItem{
&pb.OrderItem{
@ -233,9 +229,8 @@ func testEmailService() error {
Quantity: 4},
Cost: &pb.Money{
CurrencyCode: "CAD",
Amount: &pb.MoneyAmount{
Decimal: 120,
Fractional: 0}},
Units: 120,
Nanos: 0},
},
&pb.OrderItem{
Item: &pb.CartItem{
@ -243,9 +238,8 @@ func testEmailService() error {
Quantity: 1},
Cost: &pb.Money{
CurrencyCode: "CAD",
Amount: &pb.MoneyAmount{
Decimal: 12,
Fractional: 25}},
Units: 12,
Nanos: 250000000},
},
},
},
@ -276,10 +270,8 @@ func testCurrencyService() error {
log.Println("--- rpc Convert()")
in := &pb.Money{
CurrencyCode: "CAD",
Amount: &pb.MoneyAmount{
Decimal: 12,
Fractional: 25},
}
Units: 12,
Nanos: 250000000}
convertResp, err := cl.Convert(context.TODO(), &pb.CurrencyConversionRequest{
From: in,
ToCode: "USD"})