Beispiel #1
0
 /**
  * Process the payment and return the result.
  *
  * @param int $order_id
  *
  * @return array
  */
 public function process_payment($order_id)
 {
     global $woocommerce;
     $order = new WC_Order($order_id);
     $url = $this->payment($order);
     if ('yes' == $this->debug) {
         $this->log->add('pagseguro', 'Payment arguments for order #' . $order_id . ': ' . print_r($order, true));
     }
     //Remove Items Cart
     $woocommerce->cart->empty_cart();
     //Update status to Awaiting payment
     $modal_pagseguro = new WP_WC_Modal_Pagseguro();
     $array_order = $modal_pagseguro->getOrderStatus();
     $key = $modal_pagseguro->getKeyOrderStatusByName($array_order[1]);
     $modal_pagseguro->updateOrder($order_id, $key);
     $modal_pagseguro->saveHistoric($order_id, $modal_pagseguro->getNameOrderStatusByKey($key), true);
     return array('result' => 'success', 'redirect' => $url);
 }
 /**
  * Update the transaction status
  */
 private function updateCms()
 {
     $modal_pagseguro = new WP_WC_Modal_Pagseguro();
     $value_array = $this->array_order_status[$this->obj_transaction->getStatus()->getValue()];
     $id_order_status = $modal_pagseguro->getKeyOrderStatusByName($value_array);
     $this->updateOrder($id_order_status, $modal_pagseguro);
 }