/** * Process a checkout and mark it as completed if successful. * Processing a checkout means creating an order object. * * @return \Shop\Models\Checkout */ public function createOrder($refresh = false) { if (!empty($this->__order) && empty($refresh)) { return $this; } // Convert the cart to an Order object $this->__order = \Shop\Models\Orders::fromCart($this->cart()); // Add payment details if applicable // Don't add the credit card number form the PaymentData to the cart, it shouldn't be stored in the order object in the DB $payment_data = (array) $this->paymentData(); \Dsc\ArrayHelper::clear($payment_data, 'card'); $this->__order->addPayment($payment_data); return $this; }
/** * Delete field * @return NULL * @param $key string **/ function clear($key) { \Dsc\ArrayHelper::clear($this->document, $key); }
/** * Delete field * * @return NULL * @param $key string * */ function clear($key) { $keys = explode('.', $key); $first_key = $keys[0]; if ($this->isPublic($first_key)) { \Dsc\ObjectHelper::clear($this, $key); } \Dsc\ArrayHelper::clear($this->__doc, $key); return $this; }