feature/IO-3255-simplified-parts-management - Checkpoint
This commit is contained in:
@@ -23,17 +23,21 @@ const KNOWN_PART_RATE_TYPES = [
|
||||
* @returns {object} The parts tax rates object.
|
||||
*/
|
||||
|
||||
//PF: Major validation would be required on this - EMS files are inconsistent with things like 5% being passed as 5.0 or .05.
|
||||
//PF: Is this data being sent by them now?
|
||||
//TODO: Major validation would be required on this - EMS files are inconsistent with things like 5% being passed as 5.0 or .05.
|
||||
const extractPartsTaxRates = (profile = {}) => {
|
||||
const rateInfos = Array.isArray(profile.RateInfo) ? profile.RateInfo : [profile.RateInfo || {}];
|
||||
const partsTaxRates = {};
|
||||
|
||||
/**
|
||||
* In this context, r.RateType._ accesses the property named _ on the RateType object.
|
||||
* This pattern is common when handling data parsed from XML, where element values are stored under the _ key. So,
|
||||
* _ aligns to the actual value/content of the RateType field when RateType is an object (not a string).
|
||||
*/
|
||||
for (const r of rateInfos) {
|
||||
const rateTypeRaw =
|
||||
typeof r?.RateType === "string"
|
||||
? r.RateType
|
||||
: typeof r?.RateType === "object" && r?.RateType._ //PF: what does _ align to?
|
||||
: typeof r?.RateType === "object" && r?.RateType._
|
||||
? r.RateType._
|
||||
: "";
|
||||
const rateType = (rateTypeRaw || "").toUpperCase();
|
||||
|
||||
Reference in New Issue
Block a user