Пример #1
0
 /**
  * Call CONFIRMATION_DELIVER and updates order and item data
  */
 public static function deliverAction($deliverByCredit = false)
 {
     $post = !$deliverByCredit ? rpGlobals::getPost() : $deliverByCredit;
     $orderId = rpGlobals::getPostEntry('order_number');
     $order = new order($orderId);
     $payment = rpLoader::getRatepayPayment($order->info['payment_method']);
     $transactionId = rpDb::getRatepayOrderDataEntry($orderId, 'transaction_id');
     $transactionShortId = rpDb::getRatepayOrderDataEntry($orderId, 'transaction_short_id');
     $data = array('HeadInfo' => rpRequestMapper::getHeadInfoModel($order, $transactionId, $transactionShortId, $orderId), 'BasketInfo' => rpRequestMapper::getBasketInfoModel($order, $orderId, self::getDeliverPostData($post)));
     $requestService = new rpRequestService($payment->sandbox, $data);
     $result = $requestService->callConfirmationDeliver();
     rpDb::xmlLog($order, $requestService->getRequest(), $orderId, $requestService->getResponse());
     if (!array_key_exists('error', $result)) {
         rpSession::setRpSessionEntry('message_css_class', 'messageStackSuccess');
         rpSession::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_DELIVER_SUCCESS);
         rpDb::shipRpOrder(self::getDeliverPostData($post), $order);
         rpDb::setRpHistoryEntrys($post, 'CONFIRMATION_DELIVER', '');
     } else {
         rpSession::setRpSessionEntry('message_css_class', 'messageStackError');
         rpSession::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_DELIVER_ERROR);
     }
     xtc_redirect(xtc_href_link("ratepay_order.php", 'oID=' . $orderId, 'SSL'));
 }