function requestGeo() { $q = "{$this->end_point}?q={$this->address}&output=json&sensor=true_or_false&key=AIzaSyAUW2QBXn3_q8CYGkWgnb06nmXfkjrFlkc"; $u = new Evin_Utility(); $r = $u->curl_get($q, ''); $decode = json_decode($r, true); echo '<h1>GEO</h1>'; $this->lon = $decode['Placemark'][0]['Point']['coordinates']['0']; $this->lat = $decode['Placemark'][0]['Point']['coordinates']['1']; return $decode; }
function setProperties() { $this->product_id = Evin_Utility::genRandomString(); $this->product_name = $_REQUEST['name']; $this->product_description = $_REQUEST['description']; $this->product_price = $_REQUEST['price']; $this->product_color = $_REQUEST['color']; $this->product_size = $_REQUEST['size']; $this->product_sku = $_REQUEST['sku']; $this->product_gender = $_REQUEST['gender']; $this->product_category = $_REQUEST['category']; $this->product_date = new MongoTimestamp(); }
function createNewCustomer() { /* * Customer Object */ $customer_object = new Evin_Customer(); /* * Subscription ID will be first order ever placed by customer. * Customer Cannot have more than 1 subscription ID. */ if ($this->one_off == 1) { } $customer_object->hash_password = Evin_Utility::createRandomTempPassword($this->email); $customer_object->subscription_id = $this->order_id; $customer_object->bill_first_name = $this->bill_first_name; $customer_object->bill_last_name = $this->bill_last_name; $customer_object->bill_address = $this->bill_address; $customer_object->bill_city = $this->bill_city; $customer_object->bill_state = $this->bill_state; $customer_object->bill_zip = $this->bill_zip; $customer_object->bill_country = $this->bill_country; $customer_object->ship_first_name = $this->ship_first_name; $customer_object->ship_last_name = $this->ship_last_name; $customer_object->ship_address = $this->ship_address; $customer_object->ship_city = $this->ship_city; $customer_object->ship_state = $this->ship_state; $customer_object->ship_zip = $this->ship_zip; $customer_object->ship_country = $this->ship_country; $customer_object->cc_type = $this->cc_type; $customer_object->cc = $this->cc; $customer_object->exp_month = $this->exp_month; $customer_object->exp_year = $this->exp_year; $customer_object->cvv = $this->cvv; $customer_object->cc_type = $this->cc_type; $customer_object->phone = $this->phone; $customer_object->email = $this->email; /* * Create Customer Model */ $model = new Application_Models_MongoDB(); $model->customer_object = $customer_object; $model->createCustomer(); }
function createRecurOrder() { try { $model = new Application_Models_MongoDB(); $model->order_id = $this->order_id; $obj = $model->getOrderById(); //Set object to send to mongoDB $this->bill_first_name = $obj['bill_first_name']; $this->bill_last_name = $obj['bill_last_name']; $this->bill_first_name = $obj['bill_first_name']; $this->bill_address = $obj['bill_address']; $this->bill_city = $obj['bill_city']; $this->bill_state = $obj['bill_state']; $this->bill_zip = $obj['bill_zip']; $this->bill_country = $obj['bill_country']; $this->same_as_billing = $obj['same_as_billing']; $this->ship_first_name = $obj['ship_first_name']; $this->ship_last_name = $obj['ship_first_name']; $this->ship_address = $obj['ship_address']; $this->ship_city = $obj['ship_address']; $this->ship_state = $obj['ship_state']; $this->ship_zip = $obj['ship_zip']; $this->ship_country = $obj['ship_country']; $this->phone = $obj['phone']; $this->email = $obj['email']; $this->cc_type = $obj['cc_type']; $this->cc = $obj['cc']; $this->cvv = $obj['cvv']; $this->exp_month = $obj['exp_month']; $this->exp_year = $obj['exp_year']; $this->amount = $obj['amount']; $this->tax = $obj['tax']; $this->tax_amount = $obj['tax_amount']; $this->grand_total = $obj['grand_total']; $this->shipping = $obj['shipping']; $this->product_ids = $obj['product_ids']; $this->notes = $obj['notes']; $this->order_ip = $obj['order_ip']; $this->is_recurring = 1; $this->recurring_interval = $obj['recurring_interval']; $this->is_parent_order = 0; $this->parent_order_id = $obj['order_id']; $this->preceding_order_id = $model->order_id; $this->order_type = 'recur'; $this->is_recurring_active = $obj['order_ip']; $this->referral_url = $obj['referral_url']; $this->aff_id = $obj['aff_id']; $this->browser = $obj['browser']; $this->browser = $obj['browser_language']; $this->currency = $obj['currency']; $this->request_time = $_SERVER['REQUEST_TIME']; $this->payment_service = $obj['payment_service']; $this->order_ip = $obj['order_ip']; /* * Create New Order ID */ $this->order_id = 'MR' . strtoupper(Evin_Utility::genRandomString()); $this->is_discount = $obj['is_discount']; $this->is_discount_value = $obj['is_discount_value']; $this->is_promo_code = $obj['is_promo_code']; $this->is_promo_value = $obj['is_promo_value']; $this->is_upsell = $obj['is_upsell']; $this->upsell_product_ids = $obj['upsell_product_ids']; $this->date = new MongoDate(); $this->php_date = date('mdy'); $this->timestamp = new MongoTimestamp(); $this->php_timestamp = time(); $this->loc = array('lon' => $obj['long'], 'lat' => $obj['lat']); //$this->lon = $obj['long']; //$this->lat = $obj['lat']; $p = new Evin_Authorize('4bvC73F7', '427De3sVrs378S2N'); /* * @todo decrypt cc */ $p->setTransaction($obj['cc'], $obj['exp_month'] . $obj['exp_year'], $obj['grand_total']); $p->setParameter('x_email', $obj['email']); $p->setParameter("x_duplicate_window", 180); $p->setParameter("x_cust_id", $this->email); //$p->setParameter("x_transaction_id", 'wrwrw'); $p->setParameter("x_customer_ip", $_SERVER['REMOTE_ADDR']); $p->setParameter("x_email_customer", true); // false for testing $p->setParameter("x_first_name", $obj['bill_first_name']); $p->setParameter("x_last_name", $obj['bill_last_name']); $p->setParameter("x_address", $obj['bill_address']); $p->setParameter("x_city", $obj['bill_city']); $p->setParameter("x_state", $obj['bill_state']); $p->setParameter("x_zip", $obj['bill_zip']); $p->setParameter("x_phone", $obj['bill_country']); $p->setParameter("x_ship_to_first_name", $obj['ship_first_name']); $p->setParameter("x_ship_to_last_name", $obj['ship_last_name']); $p->setParameter("x_ship_to_address", $obj['ship_address']); $p->setParameter("x_ship_to_city", $obj['ship_city']); $p->setParameter("x_ship_to_state", $obj['ship_state']); $p->setParameter("x_ship_to_zip", $obj['ship_zip']); $p->setParameter("x_description", 'Order Id: re,' . $obj['order_id']); $p->setParameter("x_tax", $obj['tax_amount']); //$p->setParameter("") $p->process(); if ($p->isApproved()) { $this->order_status = 'Approved'; $this->is_recurring_active = 1; } else { $this->order_status = 'Declined'; $this->is_recurring_active = 0; } $explode = explode('|', $p->response); $this->payment_service_response = $explode; print_r($p); //todo save into mongoDB $m = new Mongo(); $db = $m->selectDB('meundies'); $collection = $db->selectCollection('orders'); $collection->insert($this); return $obj; //$p = new Evin_Authorize(); //$charge $p->chargeCreditCard(); } catch (Exception $e) { echo $e->getMessage(); } }