Bridge/Payum/Paypal/Action/EcNvpConvertAction.php
private function addSaleDetails(array &$details, Model\SaleInterface $sale)
    {
        if ($sale->getCurrency()->getCode() !== $this->currency) {
            return;
        }

        if (0 !== Money::compare($sale->getGrandTotal(), $details['PAYMENTREQUEST_0_AMT'], $this->currency)) {
            return;
        }

        $this->calculator->calculateSale($sale);

        $this->line = 0;
        $lineTotals = 0;

        // Items
        foreach ($sale->getItems() as $item) {
            $lineTotals += $this->addItemDetails($details, $item);
        }

        // Discounts
        foreach ($sale->getAdjustments(Model\AdjustmentTypes::TYPE_DISCOUNT) as $discount) {
            $lineTotals += $this->addDiscountDetails($details, $discount);
        }

        // Lines total
        $details['PAYMENTREQUEST_0_ITEMAMT'] = $this->format($lineTotals);

        // Shipping
        $details['PAYMENTREQUEST_0_SHIPPINGAMT'] = $this->format($sale->getShipmentResult()->getTotal());

        // Taxes
        //$details['PAYMENTREQUEST_0_TAXAMT'] = $this->format($sale->getFinalResult()->getTax());
    }
private function addSaleDetails(array &$details, Model\SaleInterface $sale)
    {
        if ($sale->getCurrency()->getCode() !== $this->currency) {
            return;
        }

        if (0 !== Money::compare($sale->getGrandTotal(), $details['PAYMENTREQUEST_0_AMT'], $this->currency)) {
            return;
        }

        $this->calculator->calculateSale($sale);

        $this->line = 0;
        $lineTotals = 0;

        // Items
        foreach ($sale->getItems() as $item) {
            $lineTotals += $this->addItemDetails($details, $item);
        }

        // Discounts
        foreach ($sale->getAdjustments(Model\AdjustmentTypes::TYPE_DISCOUNT) as $discount) {
            $lineTotals += $this->addDiscountDetails($details, $discount);
        }

        // Lines total
        $details['PAYMENTREQUEST_0_ITEMAMT'] = $this->format($lineTotals);

        // Shipping
        $details['PAYMENTREQUEST_0_SHIPPINGAMT'] = $this->format($sale->getShipmentResult()->getTotal());

        // Taxes
        //$details['PAYMENTREQUEST_0_TAXAMT'] = $this->format($sale->getFinalResult()->getTax());
    }
Adds the sale details.

@param array               $details
@param Model\SaleInterface $sale