public static function borrar($idCart) { $registro = new TPTransaccion($idCart); $registro->delete(); }
private function _guardarTransaccion($cart, $statusMessage, $respuesta) { if (!Transaccion::existe($cart->id)) { Transaccion::agregar($cart->id, array('customer' => $cart->id_customer, 'respuesta' => $respuesta, 'status' => $statusMessage, 'total' => $cart->getOrderTotal(true, Cart::BOTH))); } else { Transaccion::actualizar($cart->id, array('customer' => $cart->id_customer, 'status' => $statusMessage, 'respuesta' => $respuesta)); } }
/** * Se ejecuta cuando se quiere acceder a la orden desde el backoffice * @param $params un array con los siguientes objetos: order, products y customer */ public function hookDisplayAdminOrderTabOrder($params) { $order_id = $params['order']->id_cart; if (TPTransaccion::existe($order_id)) { return $this->display(__FILE__, 'views/templates/admin/order-tab.tpl'); //indico la template a utilizar } return; }
public function postProcess() { $prefijo = $this->module->getPrefijo('CONFIG_ESTADOS'); $orderState = Configuration::get($prefijo . '_APROBADA'); //Order State si la transaccion es aprobada $cart = $this->context->cart; //recupero el carrito $transaccion = TPTransaccion::getRespuesta($cart->id); //si no hay un cliente registrado, o una direccion de entrega, o direccion de contacto o el modulo no esta activo if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active || !$this->module->isActivo()) { Tools::redirect('index.php?controller=order&step=1'); } //redirecciona al primer paso // Verifica que la opcion de pago este disponible $authorized = false; foreach (Module::getPaymentModules() as $module) { if ($module['name'] == $this->module->name) { $authorized = true; break; } } if (!$authorized) { //si no esta disponible la opcion de pago die($this->module->l('Este modo de pago no esta disponible.', 'validation')); } //avisa $customer = new Customer($cart->id_customer); //recupera al objeto cliente if (!Validate::isLoadedObject($customer)) { //si no hay un cliente Tools::redirect('index.php?controller=order&step=1'); } //redirecciona al primer paso $currency = $this->context->currency; //recupero la moneda de la compra $total = (double) $cart->getOrderTotal(true, Cart::BOTH); //recupero el total de la compra /* VERIFICACION DE LA ORDEN. Los parametros enviados a la funcion validateOrder son: * id del carrito * Order Status correspondiente a este metodo de pago (sacado de la tabla configuration) * monto total de la orden * metodo de pago / nombre del modulo * mensaje : null * variables extra: null * moneda en la que se hace el pago * dont_touch_amount * secure_key del cliente * shop / tienda: null */ $this->module->validateOrder((int) $cart->id, $orderState, $total, $this->module->displayName, NULL, NULL, (int) $currency->id, false, $customer->secure_key); $this->module->log->info('Creada orden id ' . (int) $this->module->currentOrder . ' para carro id ' . $cart->id); $this->module->log->info('Status: ' . json_encode($transaccion)); $this->module->log->info('Actualizando registro OrderPayment para orden id ' . (int) $this->module->currentOrder . ' con OPERATIONID=' . $transaccion['OPERATIONID'] . ' CARDNUMBERVISIBLE=' . $transaccion['CARDNUMBERVISIBLE'] . ' PAYMENTMETHODNAME=' . $transaccion['PAYMENTMETHODNAME']); try { $this->_addPaymentDetalle((int) $this->module->currentOrder, $transaccion); } catch (Exception $e) { $this->module->log->error('EXCEPCION', $e); //guardo el mensaje } Tools::redirect('index.php?controller=order-confirmation&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); }