Money normalizer
The normalizeMoney function maps Magento Money into Unified SfMoney.
Parameters
| Name | Type | Default value | Description | 
|---|---|---|---|
| context | NormalizerContext | context needed for the normalizer | |
| money | Money | Magento money | 
Extending
The SfMoney is returned as a part of multiple models, as for example SfProduct, SfProductCatalogItem, and SfCart. If you want to change the global attributes representation, you should override all root normalizers, so for example normalizeCart, normalizeProduct etc. If you want to extend the SfMoney with custom fields, you should use the addCustomFields API.
Source
money.ts
import { defineNormalizer } from "../defineNormalizer";
export const normalizeMoney = defineNormalizer.normalizeMoney((_context, price) => {
  const amount = price.value ?? 0;
  return {
    amount,
    currency: price.currency as string,
    precisionAmount: amount.toFixed(2),
  };
});