Ejemplo n.º 1
0
 /**
  * Retrieve the items from the order
  * 
  * @param order $order
  * @return array
  */
 private static function getItemsByOrder(order $order)
 {
     $items = array();
     foreach ($order->products as $product) {
         $items[] = self::getItem(rpData::getItemData($product));
     }
     $shipping = rpData::getShippingData($order);
     if (!empty($shipping)) {
         $items[] = self::getItem($shipping);
     }
     foreach (rpData::getDiscounts() as $discountData) {
         $discount = rpData::getDiscountData($discountData);
         if (!empty($discount)) {
             $items[] = self::getItem($discount);
         }
     }
     return $items;
 }
Ejemplo n.º 2
0
 /**
  * Set all order items to the ratepay order
  *
  * @param order $order
  * @param int $orderId
  * @param string $payment
  */
 public static function setRpOrderItems(order $order, $orderId, $payment)
 {
     foreach ($order->products as $product) {
         self::setRpOrderItem(rpData::getItemData($product), $orderId, $payment);
     }
     foreach (rpData::getDiscounts() as $discountData) {
         $discount = rpData::getDiscountData($discountData);
         if (!empty($discount)) {
             self::setRpOrderItem($discount, $orderId, $payment);
         }
     }
     $shipping = rpData::getShippingData($order);
     if (!empty($shipping)) {
         self::setRpOrderItem($shipping, $orderId, $payment);
     }
 }