Changeset 3302010
- Timestamp:
- 05/28/2025 08:03:38 AM (10 months ago)
- Location:
- pitchprint
- Files:
-
- 6 edited
- 1 copied
-
tags/11.0.11 (copied) (copied from pitchprint/trunk)
-
tags/11.0.11/functions/admin/orders.php (modified) (3 diffs)
-
tags/11.0.11/pitchprint.php (modified) (2 diffs)
-
tags/11.0.11/readme.txt (modified) (2 diffs)
-
trunk/functions/admin/orders.php (modified) (3 diffs)
-
trunk/pitchprint.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pitchprint/tags/11.0.11/functions/admin/orders.php
r3294021 r3302010 99 99 function handle_new_order( $order_id, $order ) { 100 100 $items = $order->get_items(); 101 $should_update_user_id = false; 101 102 $project_ids = []; 102 103 $user_data = [ 104 'id' => $order->get_user_id(), 105 'first_name' => $order->get_billing_first_name(), 106 'last_name' => $order->get_billing_last_name(), 107 'email' => $order->get_billing_email(), 108 'info' => 'Order Id: ' . $order_id, 109 ]; 103 $user_id = $order->get_user_id(); 110 104 111 105 foreach ( $items as $item ) { … … 119 113 120 114 if ( !empty($pitchprint_customization['projectId']) ) { 115 if ( $user_id && $pitchprint_customization['userId'] === 'guest' ) { 116 $should_update_user_id = true; 117 } 121 118 $project_ids[] = $pitchprint_customization['projectId']; 122 119 } … … 125 122 } 126 123 127 if ( count($project_ids)) {128 $auth_key = 'Bearer ' . get_option('print_app_secret_key');129 130 $response = wp_remote_post(PITCHPRINT_UPDATE_ORDER_ENDPOINT, [124 if ( count($project_ids) ) { 125 $auth_key = get_option( 'ppa_secret_key' ); 126 // Append order ID 127 $response1 = wp_remote_post( 'https://api.pitchprint.com/runtime/append-project-order-id', [ 131 128 'headers' => [ 'Authorization' => $auth_key ], 132 'body' => json_encode( [129 'body' => json_encode( [ 133 130 'projectIds' => $project_ids, 134 ' user' => $user_data,135 ] ),131 'orderId' => $order_id, 132 ] ), 136 133 'method' => 'POST', 137 ] );134 ] ); 138 135 139 136 if ( is_wp_error( $response1 ) || wp_remote_retrieve_response_code( $response1 ) !== 200 ) { 140 error_log( '[PitchPrint] Failed to append order ID to projects: ' . print_r( $response, true ) ); 137 error_log( '[PitchPrint] Failed to append order ID to projects: ' . print_r( $response1, true ) ); 138 } 139 140 // Append user ID if needed 141 if ( $should_update_user_id ) { 142 $response2 = wp_remote_post( 'https://api.pitchprint.com/runtime/append-project-user-id', [ 143 'headers' => [ 'Authorization' => $auth_key ], 144 'body' => json_encode( [ 145 'projectIds' => $project_ids, 146 'userId' => $user_id, 147 ] ), 148 'method' => 'POST', 149 ] ); 150 151 if ( is_wp_error( $response2 ) || wp_remote_retrieve_response_code( $response2 ) !== 200 ) { 152 error_log( '[PitchPrint] Failed to append user ID to projects: ' . print_r( $response2, true ) ); 153 } 141 154 } 142 155 } -
pitchprint/tags/11.0.11/pitchprint.php
r3296178 r3302010 6 6 * Description: A beautiful web based print customization app for your online store. Integrates with WooCommerce. 7 7 * Author: PitchPrint, Inc. 8 * Version: 11.0.1 08 * Version: 11.0.11 9 9 * Author URI: https://pitchprint.com 10 10 * Requires at least: 3.8 … … 47 47 * @var string 48 48 */ 49 public $version = '11.0.1 0';49 public $version = '11.0.11'; 50 50 51 51 /** -
pitchprint/tags/11.0.11/readme.txt
r3296178 r3302010 4 4 Requires at least: 3.8 5 5 Tested up to: 6.8 6 Stable tag: 11.0.1 06 Stable tag: 11.0.11 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 172 172 173 173 == Changelog == 174 175 == 11.0.11 = 176 Minor fix to order details reporting 174 177 175 178 == 11.0.10 = -
pitchprint/trunk/functions/admin/orders.php
r3294021 r3302010 99 99 function handle_new_order( $order_id, $order ) { 100 100 $items = $order->get_items(); 101 $should_update_user_id = false; 101 102 $project_ids = []; 102 103 $user_data = [ 104 'id' => $order->get_user_id(), 105 'first_name' => $order->get_billing_first_name(), 106 'last_name' => $order->get_billing_last_name(), 107 'email' => $order->get_billing_email(), 108 'info' => 'Order Id: ' . $order_id, 109 ]; 103 $user_id = $order->get_user_id(); 110 104 111 105 foreach ( $items as $item ) { … … 119 113 120 114 if ( !empty($pitchprint_customization['projectId']) ) { 115 if ( $user_id && $pitchprint_customization['userId'] === 'guest' ) { 116 $should_update_user_id = true; 117 } 121 118 $project_ids[] = $pitchprint_customization['projectId']; 122 119 } … … 125 122 } 126 123 127 if ( count($project_ids)) {128 $auth_key = 'Bearer ' . get_option('print_app_secret_key');129 130 $response = wp_remote_post(PITCHPRINT_UPDATE_ORDER_ENDPOINT, [124 if ( count($project_ids) ) { 125 $auth_key = get_option( 'ppa_secret_key' ); 126 // Append order ID 127 $response1 = wp_remote_post( 'https://api.pitchprint.com/runtime/append-project-order-id', [ 131 128 'headers' => [ 'Authorization' => $auth_key ], 132 'body' => json_encode( [129 'body' => json_encode( [ 133 130 'projectIds' => $project_ids, 134 ' user' => $user_data,135 ] ),131 'orderId' => $order_id, 132 ] ), 136 133 'method' => 'POST', 137 ] );134 ] ); 138 135 139 136 if ( is_wp_error( $response1 ) || wp_remote_retrieve_response_code( $response1 ) !== 200 ) { 140 error_log( '[PitchPrint] Failed to append order ID to projects: ' . print_r( $response, true ) ); 137 error_log( '[PitchPrint] Failed to append order ID to projects: ' . print_r( $response1, true ) ); 138 } 139 140 // Append user ID if needed 141 if ( $should_update_user_id ) { 142 $response2 = wp_remote_post( 'https://api.pitchprint.com/runtime/append-project-user-id', [ 143 'headers' => [ 'Authorization' => $auth_key ], 144 'body' => json_encode( [ 145 'projectIds' => $project_ids, 146 'userId' => $user_id, 147 ] ), 148 'method' => 'POST', 149 ] ); 150 151 if ( is_wp_error( $response2 ) || wp_remote_retrieve_response_code( $response2 ) !== 200 ) { 152 error_log( '[PitchPrint] Failed to append user ID to projects: ' . print_r( $response2, true ) ); 153 } 141 154 } 142 155 } -
pitchprint/trunk/pitchprint.php
r3296178 r3302010 6 6 * Description: A beautiful web based print customization app for your online store. Integrates with WooCommerce. 7 7 * Author: PitchPrint, Inc. 8 * Version: 11.0.1 08 * Version: 11.0.11 9 9 * Author URI: https://pitchprint.com 10 10 * Requires at least: 3.8 … … 47 47 * @var string 48 48 */ 49 public $version = '11.0.1 0';49 public $version = '11.0.11'; 50 50 51 51 /** -
pitchprint/trunk/readme.txt
r3296178 r3302010 4 4 Requires at least: 3.8 5 5 Tested up to: 6.8 6 Stable tag: 11.0.1 06 Stable tag: 11.0.11 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 172 172 173 173 == Changelog == 174 175 == 11.0.11 = 176 Minor fix to order details reporting 174 177 175 178 == 11.0.10 =
Note: See TracChangeset
for help on using the changeset viewer.