libs/order/driver/magento/2-4-1/src/transforms/responses/order.ts
File order.ts
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
daffAdd,
daffSubtract,
} from '@daffodil/core';
import { MagentoDiscount } from '@daffodil/driver/magento';
Function daffMagentoTransformItem
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoTransformItem(item: MagentoOrderItem, order: MagentoOrder, qty: number): DaffOrderItem {
const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);
const rowTotal = qty * item.product_sale_price.value;
const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);
Function daffMagentoTransformTotals
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function daffMagentoTransformTotals(totals: MagentoOrderTotal): DaffOrderTotal[] {
return [
{
label: 'Subtotal',
type: DaffOrderTotalTypeEnum.Subtotal,