Skip to content

Commit

Permalink
docs: added docs to explain some lines of code
Browse files Browse the repository at this point in the history
  • Loading branch information
julianramirez2 authored and MaferMazu committed Nov 8, 2023
1 parent 3fcddcd commit 5efab09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,10 @@ public function save_enrollment( $post, $enrollment_arr, $enrollment_action, $or
$this->update_post( $post_id );
}

$non_valid_statuses = array( 'enrollment-success', 'enrollment-pending', 'enrollment-error' );
$api = new Openedx_Woocommerce_Plugin_Api_Calls();
$enrollment_api_response = $api->request_handler( $enrollment_data, $enrollment_action );

// The $enrollment_api_response[0] is the status of the request.
$this->update_post( $post_id, $enrollment_api_response[0] );
$this->log_manager->create_change_log( $post_id, $old_data, $enrollment_data, $enrollment_action, $enrollment_api_response );

Expand Down
3 changes: 3 additions & 0 deletions includes/model/class-openedx-woocommerce-plugin-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public function check_api_response( $response ) {
return $response_message;

case 'success':
// Convert the response to JSON to be able to display it in the log.
// The json_decode is needed to convert the response (string) to an asociative array.
// The json_encode is needed to convert the asociative array to a JSON and be able to access the variables.
return wp_json_encode( json_decode( $response_message, true ) );

case 'not_api':
Expand Down

0 comments on commit 5efab09

Please sign in to comment.