Couple small bug fixes
diff --git a/api/api.go b/api/api.go
index ca2d365..317690d 100644
--- a/api/api.go
+++ b/api/api.go
@@ -420,7 +420,11 @@
return fmt.Errorf("CheckOrderFulfillability: Could not parse HTTP response to pb3: %v", err)
}
- // We ignore price for now. This is difficult to verify without knowing aggregator specific taxes/fees.
+ // Price is difficult to verify without knowing aggregator specific taxes/fees. We only check that it is present.
+ if resp.GetFeesAndTaxes() == nil || cmp.Diff(fpb.Price{}, *resp.GetFeesAndTaxes(), cmp.Comparer(proto.Equal)) == "" {
+ return fmt.Errorf("invalid response. CheckOrderFulfillability.FeesAndTaxes must be populated. Offending response: %v", resp)
+ }
+
orderFulfillability := resp.GetFulfillability()
// TODO(ccawdrey): Add validation cases for other OrderFulFillability enums.
if diff := cmp.Diff(orderFulfillability.GetResult(), mpb.OrderFulfillability_CAN_FULFILL); diff != "" {
diff --git a/utils/utils.go b/utils/utils.go
index 7e2bf7c..6e4d65d 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -90,7 +90,7 @@
}
for i := 0; i < int(availability.GetSpotsOpen()); i++ {
- // This deterministic which is fine given that we just want to get a mix of ticket types.
+ // This is deterministic which is fine given that we just want to get a mix of ticket types.
ticketTypeIndex := rand.Intn(len(tickets))
// Calculate price of line item.
if lineItem.GetPrice().GetCurrencyCode() == "" && tickets[ticketTypeIndex].GetPrice().GetCurrencyCode() != "" {
@@ -121,8 +121,7 @@
merchantServiceID := merchantService(service.GetMerchantId(), service.GetServiceId())
for _, ticket := range service.GetTicketType() {
// TicketType can't have an empty price message or ticket_type_id. If it does it's excluded from map.
- diff := cmp.Diff(&fpb.Price{}, ticket.GetPrice(), cmp.Comparer(proto.Equal))
- if len(ticket.GetTicketTypeId()) == 0 || diff == "" {
+ if ticket.GetPrice() == nil || len(ticket.GetTicketTypeId()) == 0 || cmp.Diff(fpb.Price{}, *ticket.GetPrice(), cmp.Comparer(proto.Equal)) == "" {
continue
}