Changeset 3347015
- Timestamp:
- 08/19/2025 12:45:13 PM (8 months ago)
- Location:
- sendbox-shipping
- Files:
-
- 46 added
- 3 edited
-
tags/5.2/includes/class-wooss-sendbox-shipping-api.php (modified) (1 diff)
-
tags/5.2/includes/class-wooss-shipping-method.php (modified) (7 diffs)
-
tags/5.3 (added)
-
tags/5.3/LICENSE.txt (added)
-
tags/5.3/README.md (added)
-
tags/5.3/README.txt (added)
-
tags/5.3/admin (added)
-
tags/5.3/admin/class-wooss-admin.php (added)
-
tags/5.3/admin/css (added)
-
tags/5.3/admin/css/wooss-admin.css (added)
-
tags/5.3/admin/images (added)
-
tags/5.3/admin/images/loader.gif (added)
-
tags/5.3/admin/index.php (added)
-
tags/5.3/admin/js (added)
-
tags/5.3/admin/js/wooss-admin.js (added)
-
tags/5.3/admin/partials (added)
-
tags/5.3/admin/partials/wooss-admin-display.php (added)
-
tags/5.3/includes (added)
-
tags/5.3/includes/assets (added)
-
tags/5.3/includes/assets/css (added)
-
tags/5.3/includes/assets/css/styles.css (added)
-
tags/5.3/includes/assets/js (added)
-
tags/5.3/includes/assets/js/jqueryserilize.js (added)
-
tags/5.3/includes/assets/js/script.js (added)
-
tags/5.3/includes/class-wooss-activator.php (added)
-
tags/5.3/includes/class-wooss-deactivator.php (added)
-
tags/5.3/includes/class-wooss-i18n.php (added)
-
tags/5.3/includes/class-wooss-loader.php (added)
-
tags/5.3/includes/class-wooss-sendbox-shipping-api.php (added)
-
tags/5.3/includes/class-wooss-shipping-method.php (added)
-
tags/5.3/includes/class-wooss.php (added)
-
tags/5.3/includes/index.php (added)
-
tags/5.3/index.php (added)
-
tags/5.3/languages (added)
-
tags/5.3/languages/wooss-en_US.mo (added)
-
tags/5.3/languages/wooss-en_US.po (added)
-
tags/5.3/languages/wooss.pot (added)
-
tags/5.3/public (added)
-
tags/5.3/public/class-wooss-public.php (added)
-
tags/5.3/public/css (added)
-
tags/5.3/public/css/wooss-public.css (added)
-
tags/5.3/public/index.php (added)
-
tags/5.3/public/js (added)
-
tags/5.3/public/js/wooss-public.js (added)
-
tags/5.3/public/partials (added)
-
tags/5.3/public/partials/wooss-public-display.php (added)
-
tags/5.3/uninstall.php (added)
-
tags/5.3/wooss.php (added)
-
trunk/includes/class-wooss-shipping-method.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sendbox-shipping/tags/5.2/includes/class-wooss-sendbox-shipping-api.php
r3255662 r3347015 98 98 $api_key = $sendbox_data_db['sendbox_auth_token']; 99 99 $profile_url = 'https://live.sendbox.co/oauth/profile'; 100 101 $profile_res = wp_remote_get(102 $profile_url,103 array(104 'timeout' => 40,105 'headers' => array(106 'Content-Type' => 'application/json',107 'Authorization' => $api_key,108 ),109 )110 );111 //var_dump($sendbox_data_db);112 $class_name = 'WP_Error';113 if ( ! ( $profile_res instanceof $class_name ) && isset( $profile_res['body'] ) ) {114 $profile_obj = json_decode( $profile_res['body'] );115 } else {116 $profile_obj = null;117 }118 119 if ( isset( $profile_obj->title ) ) {120 121 $s_url = 'https://live.sendbox.co/oauth/access/access_token/refresh?';122 $app_id = $sendbox_data_db['sendbox_app_id'];123 $client_secret = $sendbox_data_db['sendbox_client_secret'];124 $url_oauth = $s_url . 'app_id=' . $app_id . '&client_secret=' . $client_secret;125 $refresh_token = $sendbox_data_db['sendbox_refresh_token'];126 127 $oauth_res = wp_remote_get(128 $url_oauth,129 array(130 'timeout' => 10,131 'headers' => array(132 'Content-Type' => 'application/json',133 'Refresh-Token' => $refresh_token,134 ),135 )136 );137 $oauth_obj = json_decode( $oauth_res['body'] );138 if ( ! ( $oauth_res instanceof $class_name ) && ! isset( $oauth_res['body'] ) ) {139 return $api_key;140 }141 142 if ( isset( $oauth_obj->access_token ) ) {143 $new_auth = $oauth_obj->access_token;144 $sendbox_data_db['sendbox_auth_token'] = $new_auth;145 update_option( 'sendbox_data', $sendbox_data_db );146 147 }148 if ( isset( $oauth_obj->refresh_token ) ) {149 $new_refresh = $oauth_obj->refresh_token;150 $sendbox_data_db['sendbox_refresh_token'] = $new_refresh;151 update_option( 'sendbox_data', $sendbox_data_db );152 }153 }154 155 100 return $api_key; 156 157 101 } 158 102 -
sendbox-shipping/tags/5.2/includes/class-wooss-shipping-method.php
r3255662 r3347015 96 96 $output->value = round( $values['line_total'] ); 97 97 $output->amount_to_receive = round( $values['line_total'] ); 98 $output->item_type = $values['data']->get_categories();98 $output->item_type = "other"; 99 99 $items_lists[] = $output; 100 100 } 101 101 102 // var_dump($items_lists); 102 103 // Retrieve sendbox settings and API authentication 103 104 $sendbox_data = get_option( 'sendbox_data' ); … … 186 187 187 188 // Build label with optional service details 188 $label = $this->title; 189 if ( ! empty( $rate->service_code ) ) { 190 $label .= ' - ' . $rate->service_code; 191 } elseif ( ! empty( $rate->description ) ) { 192 $label .= ' - ' . $rate->description; 193 } 194 189 $label = $rate->name; 195 190 // Create a unique rate ID (append index or service code) 196 191 $rate_id = $this->id . '_' . $index; … … 214 209 $this->add_rate( $new_rate ); 215 210 } else { 211 error_log( 'Sendbox API Key: ' . $api_key ); 212 var_dump("some ssusuus"); 216 213 wc_add_notice( __( 'No shipping rates available.', 'wooss' ), 'error' ); 217 214 } … … 340 337 $states_data_obj = wp_remote_get( $states_api_url, $args ); 341 338 $states_body = json_decode( wp_remote_retrieve_body( $states_data_obj )); 342 343 344 339 340 341 345 342 //$nigeria_states= $api_call->get_nigeria_states(); 346 343 … … 437 434 } 438 435 439 436 440 437 } 441 438 442 439 } 443 440 echo '</select>'; … … 506 503 507 504 </div> 508 505 509 506 <span class="wooss_errors_pages wooss_fields"></span> 510 507 </div> … … 605 602 606 603 604 case 'items_list': 605 $payload_data->items = $value; 606 break; 607 607 608 case 'weight': 608 609 $payload_data->weight = $value; -
sendbox-shipping/trunk/includes/class-wooss-shipping-method.php
r3255662 r3347015 96 96 $output->value = round( $values['line_total'] ); 97 97 $output->amount_to_receive = round( $values['line_total'] ); 98 $output->item_type = $values['data']->get_categories();98 $output->item_type = "other"; 99 99 $items_lists[] = $output; 100 100 } 101 101 102 // var_dump($items_lists); 102 103 // Retrieve sendbox settings and API authentication 103 104 $sendbox_data = get_option( 'sendbox_data' ); … … 186 187 187 188 // Build label with optional service details 188 $label = $this->title; 189 if ( ! empty( $rate->service_code ) ) { 190 $label .= ' - ' . $rate->service_code; 191 } elseif ( ! empty( $rate->description ) ) { 192 $label .= ' - ' . $rate->description; 193 } 194 189 $label = $rate->name; 195 190 // Create a unique rate ID (append index or service code) 196 191 $rate_id = $this->id . '_' . $index; … … 214 209 $this->add_rate( $new_rate ); 215 210 } else { 211 error_log( 'Sendbox API Key: ' . $api_key ); 212 var_dump("some ssusuus"); 216 213 wc_add_notice( __( 'No shipping rates available.', 'wooss' ), 'error' ); 217 214 } … … 340 337 $states_data_obj = wp_remote_get( $states_api_url, $args ); 341 338 $states_body = json_decode( wp_remote_retrieve_body( $states_data_obj )); 342 343 344 339 340 341 345 342 //$nigeria_states= $api_call->get_nigeria_states(); 346 343 … … 437 434 } 438 435 439 436 440 437 } 441 438 442 439 } 443 440 echo '</select>'; … … 506 503 507 504 </div> 508 505 509 506 <span class="wooss_errors_pages wooss_fields"></span> 510 507 </div> … … 605 602 606 603 604 case 'items_list': 605 $payload_data->items = $value; 606 break; 607 607 608 case 'weight': 608 609 $payload_data->weight = $value;
Note: See TracChangeset
for help on using the changeset viewer.