Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (isset($this->session->data['order_id'])) {
- $this->cart->clear();
- $server_url = 'http://filpal-license.apphb.com/';
- $token = "QMtjQamHO_v_jiO55dnWEnoWGeNPso4H2bXy6s8058ZAYnjr5We1EOsKLb7wwH9j7u1EX8w5a2K6tgnqy3Ju1_1gvm6OG58Kmv3XN_xwJwXWeMbZ5USm4BrEt71oCsT3ooFtUohxrZvja5NluplaZisXsyb7tWYU-AJjpeAksafySlUNsaTjmjXxr66FOv48cxeB3yyEXHQeGG4lzptxn9Y9ghzu5_3EiUYN37FroXBeZm2ooa5yfFojAOK3gFZH5dpedbB3uhGLzktBgi89AxxhFfjh8viIl7h9tg2hJ7hhi-DzXolisOuN3V8rGe2Fs4--KQUAQ2GnJCFYr6heF_eK2dOQGiGo8xqrznCBeiv4dOix7Wl6KGPqeOCwoFhn0rVetnfwADqoquuge4927OQbCmPZDjMbvWjVX8cLcejXlS3tsrUaUQBD9aqa7mYwR9ak6XNTdivVGVQtSIwkdquNOVZXPQCEbTbO0IcOY80fIs3EYt2ruUt4NdBnOK4Xxs011H1xRAJAiJKwtsMAog";
- $this->load->model('account/activity');
- if ($this->customer->isLogged()) {
- $address_id = $this->customer->getAddressId();
- $this->load->model('account/address');
- $address = $this->model_account_address->getAddress($address_id);
- $license_data = array(
- 'FirstName' => $this->customer->getFirstName(),
- 'LastName' => $this->customer->getLastName(),
- 'Age' => '',
- 'Gender' => '',
- 'Birthday' => '',
- 'UserName' => $this->customer->getEmail(),
- 'Password' => $this->customer->getPasswd(),
- 'Salt' => $this->customer->getSalt(),
- 'Email' => $this->customer->getEmail(),
- 'Telephone' => '',
- 'Mobile' => $this->customer->getTelephone(),
- 'Fax' => $this->customer->getFax(),
- 'Address1' => $address['address_1'],
- 'Address2' => $address['address_2'],
- 'City' => $address['city'],
- 'Postcode' => $address['postcode'],
- 'State' => $address['zone'],
- 'Country' => $address['country']
- );
- /* PROCESS 1 */
- /* CALL CURL TO MAKE REGISTRATION TO LICENSE SERVER */
- $add_user = $this->model_account_activity->addLicence($license_data,$server_url.'api/user',$token);
- /* RECIEVE CALLBACK/RETURN DATA (UserID) FROM LICENSE SERVER IN JSON
- NEW USER OR EXISTING USER NEED TO GET RETURN DATA (UserID) FROM LICENSE SERVER FOR SUBSCRIBE LICENSE IN PROCESS 2 */
- $user_info = json_decode($add_user, true);
- /* PROCESS 2*/
- /* SUBSCRIBE LICENSE */
- $orders = $this->model_account_activity->getOrderInfo($this->session->data['order_id']);
- foreach ($orders as $order){
- $product_id = $order['product_id'];
- //$product_id is get from Product in JeC [Jumix eCommerce]
- if($product_id == '58'){
- $product_id_license = 1; //Monthly License
- }elseif($product_id == '59'){
- $product_id_license = 2; //Yearly License
- }elseif($product_id == '60'){
- $product_id_license = 3; //Perpetual
- }else{
- $product_id_license = 4; //Other product have same license
- }
- /* DATA FROM $user_info AND $product_id IN ARRAY */
- $license_order = array(
- 'UserID' => $user_info['ID'],
- 'ProductID' => $product_id_license,
- );
- /* CALL CURL TO ADD SUBSCRIBE LICENSE TO LICENSE SERVER */
- $this->model_account_activity->addLicence($license_order,$server_url.'api/subscription',$token);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement