fromResponse static method
Implementation
static CartEntity fromResponse({
required CartResponse? response,
}) {
final List<ProductEntity> products =
ProductsMapper.fromCartResponse(response: response);
final PriceRuleEntity defaultTotalCalculated =
MapperUtils.getDefaultPriceRule(
prices: response?.totalCalculated,
defaultPricingRule: response?.vendorDefaultPriceRule,
);
final List<PriceRuleEntity> priceRules = PriceRulesMapper.fromResponse(
response: response?.totalCalculated,
);
final String vendorLogo = MapperUtils.getVendorLogoUrl(
logoPath: response?.vendorLogo,
);
return CartEntity(
products: products,
defaultTotalCalculated: defaultTotalCalculated,
priceRules: priceRules,
vendorId: response?.vendorId ?? 0,
vendorUrl: response?.vendorUrl,
vendorName: response?.vendorName,
vendorLogo: vendorLogo,
vendorDefaultPriceRule: response?.vendorDefaultPriceRule,
error: response?.error ?? '',
);
}