INNER CODE UNIT · Go

parseOrderDetailsNode

tulir/whatsmeow · business.go:66

func parseOrderDetailsNode(orderNode waBinary.Node) (*types.OrderDetails, error) {
	ag := orderNode.AttrGetter()
	details := &types.OrderDetails{
		ID:        ag.String("id"),
		CreatedAt: ag.UnixTime("creation_ts"),
	}
	if err := ag.Error(); err != nil {
		return nil, err
	}

	// Parse Price
	priceNode, ok := orderNode.GetOptionalChildByTag("price")
	if ok {
		subtotal, _ := strconv.ParseInt(getStringChild(priceNode, "subtotal"), 10, 64)
		total, _ := strconv.ParseInt(getStringChild(priceNode, "total"), 10, 64)
		details.Price = types.OrderPrice{
			Subtotal:    subtotal,
			Total:       total,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…