Changeset 2841741
- Timestamp:
- 12/31/2022 07:47:30 AM (3 years ago)
- Location:
- eber
- Files:
-
- 20 added
- 3 edited
-
tags/2.7 (added)
-
tags/2.7/assets (added)
-
tags/2.7/assets/icon.png (added)
-
tags/2.7/assets/images (added)
-
tags/2.7/assets/images/logo.png (added)
-
tags/2.7/assets/screenshot-1.PNG (added)
-
tags/2.7/assets/screenshot-2.PNG (added)
-
tags/2.7/index.php (added)
-
tags/2.7/init (added)
-
tags/2.7/init/action.php (added)
-
tags/2.7/init/activate.php (added)
-
tags/2.7/init/api (added)
-
tags/2.7/init/api/API.php (added)
-
tags/2.7/init/api/APIResponse.php (added)
-
tags/2.7/init/eber_woo.php (added)
-
tags/2.7/init/frontend.php (added)
-
tags/2.7/init/menu.php (added)
-
tags/2.7/layout (added)
-
tags/2.7/layout/index.php (added)
-
tags/2.7/readme.txt (added)
-
trunk/index.php (modified) (2 diffs)
-
trunk/init/eber_woo.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eber/trunk/index.php
r2341352 r2841741 5 5 Description: Eber is a smart member system comes with comprehensive loyalty & rewards system, marketing and analytic tool. 6 6 Author: Eber 7 Version: 2. 77 Version: 2.8 8 8 Author URI: https://eber.co 9 9 License: GPLv2 or later … … 49 49 add_action( 'woocommerce_thankyou', array('Eber_Woo','order_action') ); 50 50 } 51 add_action( 'woocommerce_order_actions', array( 'Eber_Woo', 'customAction' ) ); 52 add_action( 'woocommerce_order_action_ns_eber_send', array( 'Eber_Woo', 'order_action_manual' ) ); 53 54 51 55 52 56 // EndWoo -
eber/trunk/init/eber_woo.php
r2341352 r2841741 29 29 $total += $shippingValue; 30 30 } 31 32 31 33 32 // call API … … 92 91 'comment_author_email' => $user->user_email, 93 92 'comment_author_url' => '', 94 'comment_content' => 'Eber Error : '.$result-> data['error'],93 'comment_content' => 'Eber Error : '.$result->getErrorString(), 95 94 'comment_type' => 'order_note', 96 95 'comment_parent' => 0, … … 133 132 return json_encode($itemData); 134 133 } 134 135 public function customAction($actions){ 136 $actions['ns_eber_send'] = __( 'Sync to Eber', 'Eber' ); 137 return $actions; 138 } 139 140 public function order_action_manual($order){ 141 $order_id = $order->ID; 142 $user = get_userdata($order->user_id); 143 $total = 0; 144 $orderData = $order->get_data(); 145 $orderItems = $order->get_items(); 146 foreach($orderItems as $item){ 147 $total += ($item['line_total']); 148 } 149 $exclude_tax = get_option('exclude_tax', true); 150 $exclude_coupon = get_option('exclude_coupon', true); 151 $exclude_shipping = get_option('exclude_shipping', true); 152 153 if(!$exclude_coupon){ 154 $couponValue = isset($orderData['discount_total']) ? $orderData['discount_total'] : 0; 155 $total += $couponValue; 156 } 157 158 if(!$exclude_tax){ 159 $taxValue = isset($orderData['total_tax']) ? $orderData['total_tax'] : 0; 160 $total += $taxValue; 161 } 162 163 if(!$exclude_shipping){ 164 $shippingValue = isset($orderData['shipping_total']) ? $orderData['shipping_total'] : 0; 165 $total += $shippingValue; 166 } 167 168 // call API 169 require_once(dirname(__FILE__).'/api/API.php'); 170 require_once(dirname(__FILE__).'/api/APIResponse.php'); 171 $api_key = get_option('eber_api_key',''); 172 $api = new API(); 173 $post_data = array(); 174 175 $post_data['provider'] = 'wordpress'; 176 $post_data['provider_identifier'] = get_option('eber_hash_key',''); 177 $post_data['email'] = isset($user->user_email)?$user->user_email:$order->billing_email; 178 $post_data['provider_user_id'] = isset($user->ID)?$user->ID:0; 179 $post_data['display_name'] = $user->display_name; 180 $post_data['phone'] = $order->billing_phone; 181 $post_data['phone_code'] = $order->billing_country; 182 $post_data['hash'] = md5($user->ID.get_option('eber_hash_key','')); 183 $post_data['transaction_no'] = $order_id; 184 $post_data['note'] = $order->post->post_password; 185 $post_data['amount'] = floatval($total); 186 $post_data['item_data_json'] = Eber_Woo::parseItemJson($orderItems); 187 if(get_option('adjust_point_when','order_completed') == 'order_completed') 188 { 189 if($order->get_status() != 'completed') 190 { 191 $time = current_time('mysql'); 192 $data = array( 193 'comment_post_ID' => $order_id, 194 'comment_author' => $user->user_login, 195 'comment_author_email' => $user->user_email, 196 'comment_author_url' => '', 197 'comment_content' => 'Eber Error : Order Status Not Completed to sync', 198 'comment_type' => 'order_note', 199 'comment_parent' => 0, 200 'user_id' => $user->ID, 201 'comment_author_IP' => '', 202 'comment_agent' => 'Eber', 203 'comment_date' => $time, 204 'comment_approved' => 1, 205 ); 206 wp_insert_comment($data); 207 return false; 208 } 209 } 210 if(!get_option('eber_sync_non_member',false) && !$order->get_user()) 211 { 212 213 } 214 else 215 { 216 $result = $api->setData($post_data) 217 ->setQueue() 218 ->requireAuth($api_key) 219 ->post('/v5/point/ecom'); 220 221 if (!$result->isFailure()) 222 { 223 $return_api = $result->data; 224 $time = current_time('mysql'); 225 226 $data = array( 227 'comment_post_ID' => $order_id, 228 'comment_author' => $user->user_login, 229 'comment_author_email' => $user->user_email, 230 'comment_author_url' => '', 231 'comment_content' => 'Eber Success : Added '.$return_api['points'].' Points', 232 'comment_type' => 'order_note', 233 'comment_parent' => 0, 234 'user_id' => $user->ID, 235 'comment_author_IP' => '', 236 'comment_agent' => 'Eber', 237 'comment_date' => $time, 238 'comment_approved' => 1, 239 ); 240 wp_insert_comment($data); 241 } 242 else 243 { 244 245 $time = current_time('mysql'); 246 $data = array( 247 'comment_post_ID' => $order_id, 248 'comment_author' => $user->user_login, 249 'comment_author_email' => $user->user_email, 250 'comment_author_url' => '', 251 'comment_content' => 'Eber Error : '.$result->getErrorString(), 252 'comment_type' => 'order_note', 253 'comment_parent' => 0, 254 'user_id' => $user->ID, 255 'comment_author_IP' => '', 256 'comment_agent' => 'Eber', 257 'comment_date' => $time, 258 'comment_approved' => 1, 259 ); 260 wp_insert_comment($data); 261 } 262 } 263 264 265 } 135 266 } 136 267 ?> -
eber/trunk/readme.txt
r2424136 r2841741 4 4 Tags: Membership, Business, Member Card, Loyalty, Reward, Points system 5 5 Requires at least: 4.2 6 Tested up to: 5.67 Stable tag: 5.16 Tested up to: 6.1 7 Stable tag: 6.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 79 79 = 2.7 = 80 80 Fix multi language in line item sync 81 = 2.8 = 82 Update Manual sync button and Sync Logs 81 83 == Upgrade Notice == 82 84 = 0.1 = … … 119 121 = 2.7 = 120 122 Fix multi language in line item sync 123 = 2.8 = 124 Update Manual sync button and Sync Logs 121 125 122 126 … … 125 129 126 130 127
Note: See TracChangeset
for help on using the changeset viewer.