Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
public function addBasketItemParams()
    {
        $basket = $this->getBasket();
        $lang = $this->getLang();
        $request = $this->getPayPalRequest();

        $pos = 0;
        foreach ($basket->getContents() as $basketItem) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($basketItem->getTitle()));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basketItem->getUnitPrice()->getPrice()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", (int) $basketItem->getAmount());
            $request->setParameter("L_PAYMENTREQUEST_0_ITEMURL{$pos}", $basketItem->getLink());

            $basketProduct = $basketItem->getArticle();
            $request->setParameter("L_PAYMENTREQUEST_0_NUMBER{$pos}", $basketProduct->oxarticles__oxartnum->value);

            $pos++;
        }

        //adding payment costs as product
        if ($basket->getPayPalPaymentCosts() > 0) {
            $paymentTitle = $lang->translateString("OEPAYPAL_SURCHARGE") . " " . $lang->translateString("OEPAYPAL_TYPE_OF_PAYMENT");
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $paymentTitle);
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalPaymentCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }

        //adding wrapping as product
        if ($basket->getPayPalWrappingCosts() > 0) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GIFTWRAPPER"));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalWrappingCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }

        //adding greeting card as product
        if ($basket->getPayPalGiftCardCosts() > 0) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GREETING_CARD"));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalGiftCardCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }
    }
public function addBasketItemParams()
    {
        $basket = $this->getBasket();
        $lang = $this->getLang();
        $request = $this->getPayPalRequest();

        $pos = 0;
        foreach ($basket->getContents() as $basketItem) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($basketItem->getTitle()));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basketItem->getUnitPrice()->getPrice()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", (int) $basketItem->getAmount());
            $request->setParameter("L_PAYMENTREQUEST_0_ITEMURL{$pos}", $basketItem->getLink());

            $basketProduct = $basketItem->getArticle();
            $request->setParameter("L_PAYMENTREQUEST_0_NUMBER{$pos}", $basketProduct->oxarticles__oxartnum->value);

            $pos++;
        }

        //adding payment costs as product
        if ($basket->getPayPalPaymentCosts() > 0) {
            $paymentTitle = $lang->translateString("OEPAYPAL_SURCHARGE") . " " . $lang->translateString("OEPAYPAL_TYPE_OF_PAYMENT");
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $paymentTitle);
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalPaymentCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }

        //adding wrapping as product
        if ($basket->getPayPalWrappingCosts() > 0) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GIFTWRAPPER"));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalWrappingCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }

        //adding greeting card as product
        if ($basket->getPayPalGiftCardCosts() > 0) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GREETING_CARD"));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalGiftCardCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }
    }
public function addBasketItemParams ( ) { $ basket = $ this -> getBasket ( ) ; $ lang = $ this -> getLang ( ) ; $ request = $ this -> getPayPalRequest ( ) ; $ pos = 0 ; foreach ( $ basket -> getContents ( ) as $ basketItem ) { $ request -> setParameter ( "L_PAYMENTREQUEST_0_NAME{$pos}" , \ OxidEsales \ Eshop \ Core \ Str :: getStr ( ) -> html_entity_decode ( $ basketItem -> getTitle ( ) ) ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_AMT{$pos}" , $ this -> formatFloat ( $ basketItem -> getUnitPrice ( ) -> getPrice ( ) ) ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_QTY{$pos}" , ( int ) $ basketItem -> getAmount ( ) ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_ITEMURL{$pos}" , $ basketItem -> getLink ( ) ) ; $ basketProduct = $ basketItem -> getArticle ( ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_NUMBER{$pos}" , $ basketProduct -> oxarticles__oxartnum -> value ) ; $ pos ++ ; } //adding payment costs as product if ( $ basket -> getPayPalPaymentCosts ( ) > 0 ) { $ paymentTitle = $ lang -> translateString ( "OEPAYPAL_SURCHARGE" ) . " " . $ lang -> translateString ( "OEPAYPAL_TYPE_OF_PAYMENT" ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_NAME{$pos}" , $ paymentTitle ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_AMT{$pos}" , $ this -> formatFloat ( $ basket -> getPayPalPaymentCosts ( ) ) ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_QTY{$pos}" , 1 ) ; $ pos ++ ; } //adding wrapping as product if ( $ basket -> getPayPalWrappingCosts ( ) > 0 ) { $ request -> setParameter ( "L_PAYMENTREQUEST_0_NAME{$pos}" , $ lang -> translateString ( "OEPAYPAL_GIFTWRAPPER" ) ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_AMT{$pos}" , $ this -> formatFloat ( $ basket -> getPayPalWrappingCosts ( ) ) ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_QTY{$pos}" , 1 ) ; $ pos ++ ; } //adding greeting card as product if ( $ basket -> getPayPalGiftCardCosts ( ) > 0 ) { $ request -> setParameter ( "L_PAYMENTREQUEST_0_NAME{$pos}" , $ lang -> translateString ( "OEPAYPAL_GREETING_CARD" ) ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_AMT{$pos}" , $ this -> formatFloat ( $ basket -> getPayPalGiftCardCosts ( ) ) ) ; $ request -> setParameter ( "L_PAYMENTREQUEST_0_QTY{$pos}" , 1 ) ; $ pos ++ ; } }
Sets basket items parameters to request.
Sets basket items parameters to request .