예제 #1
0
 /**
  * Sets the shopping basket in the content tag of the request.
  * 
  * @return rpRequestService
  */
 private function _setRatepayContentBasket()
 {
     $basketInfo = $this->_requestDataObjects['BasketInfo']->getData();
     $shoppingBasket = $this->_request->content->addChild('shopping-basket');
     $shoppingBasket->addAttribute('amount', number_format($basketInfo['amount'], 2, ".", ""));
     $shoppingBasket->addAttribute('currency', strtoupper($basketInfo['currency']));
     $items = $shoppingBasket->addChild('items');
     foreach ($basketInfo['items'] as $itemInfoObject) {
         $itemInfo = $itemInfoObject->getData();
         $item = $items->addCDataChild('item', rpData::removeSpecialChars($itemInfo['articleName']));
         $item->addAttribute('article-number', rpData::removeSpecialChars($itemInfo['articleNumber']));
         $item->addAttribute('unique-article-number', rpData::removeSpecialChars($itemInfo['uniqueArticleNumber']));
         $item->addAttribute('quantity', number_format($itemInfo['quantity'], 0, '.', ''));
         $item->addAttribute('unit-price-gross', number_format(round($itemInfo['unitPriceGross'], 2), 2, ".", ""));
         $item->addAttribute('tax-rate', number_format(round($itemInfo['taxRate'], 2), 0, ".", ""));
     }
     return $this;
 }