Skip to content

Commit

Permalink
fix: file and class names corrected based on wordpress requirements (#53
Browse files Browse the repository at this point in the history
)

* fix: files name fixed based on wordpress reqs

* fix: corrected classes and namespaces name

* fix: change naming to commerce

* fix: change form names

* docs: add the naming ADR

---------

Co-authored-by: Maria Fernanda Magallanes Zubillaga <[email protected]>
  • Loading branch information
julianramirez2 and MaferMazu authored Nov 9, 2023
1 parent 3f8a41c commit 79bdd6a
Show file tree
Hide file tree
Showing 27 changed files with 244 additions and 201 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
with:
find: "Version: *[0-9.]*"
replace: "Version: ${{ steps.tag_version.outputs.new_version }}"
include: "openedx-ecommerce.php"
include: "openedx-commerce.php"

- name: Update php file version - define statement
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "(define\\( 'OPENEDX_WOOCOMMERCE_PLUGIN_VERSION', ')([^']*)(.*);"
replace: "define( 'OPENEDX_WOOCOMMERCE_PLUGIN_VERSION', '${{ steps.tag_version.outputs.new_version }}' );"
include: "openedx-ecommerce.php"
find: "(define\\( 'OPENEDX_COMMERCE_VERSION', ')([^']*)(.*);"
replace: "define( 'OPENEDX_COMMERCE_VERSION', '${{ steps.tag_version.outputs.new_version }}' );"
include: "openedx-commerce.php"

- name: Update README version
uses: jacobtomlinson/gha-find-replace@v3
Expand All @@ -60,7 +60,7 @@ jobs:
with:
branch: ${{ github.ref }}
commit_message: "docs(bumpversion): ${{ steps.tag_version.outputs.previous_tag }} → ${{ steps.tag_version.outputs.new_tag }}"
file_pattern: README.txt CHANGELOG.md openedx-ecommerce.php
file_pattern: README.txt CHANGELOG.md openedx-commerce.php

release:
needs: bumpversion
Expand Down Expand Up @@ -92,4 +92,4 @@ jobs:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
artifacts: "openedx-woocommerce-plugin.zip"
artifacts: "openedx-commerce.zip"
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
=== Open edX Ecommerce ===
=== Open edX Commerce ===
Contributors: felipemontoya, julianrg2, mafermazu
Tags: openedx, open edx, ecommerce, lms, courses
Requires at least: 6.3
Expand All @@ -12,7 +12,7 @@ You can sell your Open edX courses with WooCommerce using this free and open-sou

== Description ==

The "Open edX Ecommerce" package is a free and open-source WordPress plugin that allows you to integrate WooCommerce with your Open edX platform.
The "Open edX Commerce" package is a free and open-source WordPress plugin that allows you to integrate WooCommerce with your Open edX platform.

**What does this mean?**
You can create Open edX courses as products in WooCommerce, and when you perform purchase or refund operations for these products, your Open edX platform will reflect these changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
*
* @category Admin
* @package WordPress
* @subpackage Openedx_Woocommerce_Plugin
* @subpackage Openedx_Commerce
* @since 1.0.0
*/

namespace App\admin;

use App\model\Openedx_Woocommerce_Plugin_Enrollment;
use App\model\Openedx_Woocommerce_Plugin_Post_Type;
use App\admin\views\Openedx_Woocommerce_Plugin_Enrollment_Info_Form;
use App\model\Openedx_Commerce_Enrollment;
use App\model\Openedx_Commerce_Post_Type;
use App\admin\views\Openedx_Commerce_Enrollment_Info_Form;
use App\utils;

/**
Expand All @@ -22,8 +22,8 @@
* @link https://edunext.co/
* @since 1.0.0
*
* @package Openedx_Woocommerce_Plugin
* @subpackage Openedx_Woocommerce_Plugin/admin
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/admin
*/

/**
Expand All @@ -32,11 +32,11 @@
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package Openedx_Woocommerce_Plugin
* @subpackage Openedx_Woocommerce_Plugin/admin
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/admin
* @author eduNEXT <[email protected]>
*/
class Openedx_Woocommerce_Plugin_Admin {
class Openedx_Commerce_Admin {

/**
* The ID of this plugin.
Expand Down Expand Up @@ -84,14 +84,14 @@ public function __construct( $plugin_name, $version, $test = null ) {
}

/**
* Create an instance of the Openedx_Woocommerce_Plugin_Enrollment class.
* Create an instance of the Openedx_Commerce_Enrollment class.
*
* @since 1.0.0
*
* @return void
*/
public function create_enrollment_class() {
$this->openedx_enrollment = new Openedx_Woocommerce_Plugin_Enrollment( $this );
$this->openedx_enrollment = new Openedx_Commerce_Enrollment( $this );
}

/**
Expand All @@ -105,10 +105,10 @@ public function enqueue_styles() {
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Openedx_Woocommerce_Plugin_Loader as all of the hooks are defined
* defined in Openedx_Commerce_Loader as all of the hooks are defined
* in that particular class.
*
* The Openedx_Woocommerce_Plugin_Loader will then create the relationship
* The Openedx_Commerce_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
Expand All @@ -127,10 +127,10 @@ public function enqueue_scripts() {
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Openedx_Woocommerce_Plugin_Loader as
* defined in Openedx_Commerce_Loader as
* all of the hooks are defined in that particular class.
*
* The Openedx_Woocommerce_Plugin_Loader will then create the relationship
* The Openedx_Commerce_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
Expand All @@ -152,7 +152,7 @@ public function register_enrollment_custom_post_type() {
* @since 1.0.0
*/
public function render_enrollment_info_form( $post ) {
$this->openedx_enrollment_info_form = new Openedx_Woocommerce_Plugin_Enrollment_Info_Form( $post );
$this->openedx_enrollment_info_form = new Openedx_Commerce_Enrollment_Info_Form( $post );
}

/**
Expand All @@ -178,7 +178,7 @@ public function register_post_type( $post_type = '', $plural = '', $single = '',
}

/**
* Create a new instance of the Openedx_Woocommerce_Plugin_Post_Type class and register a new post type.
* Create a new instance of the Openedx_Commerce_Post_Type class and register a new post type.
*
* @param string $post_type Post type name.
* @param string $plural Post type item plural name.
Expand All @@ -194,7 +194,7 @@ public function create_post_type(
$description = '',
array $options
) {
return new Openedx_Woocommerce_Plugin_Post_Type( $post_type, $plural, $single, $description, $options );
return new Openedx_Commerce_Post_Type( $post_type, $plural, $single, $description, $options );
}

/**
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* @link https://edunext.co/
* @since 1.0.0
*
* @package Openedx_Woocommerce_Plugin
* @subpackage Openedx_Woocommerce_Plugin/admin/partials
* @package Openedx_Commerce
* @subpackage Openedx_Commerce/admin/partials
*/

?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*
* @category Views
* @package WordPress
* @subpackage Openedx_Woocommerce_Plugin
* @subpackage Openedx_Commerce
* @since 1.0.0
*/

namespace App\admin\views;

use App\model\Openedx_Woocommerce_Plugin_Log;
use App\model\Openedx_Commerce_Log;
use App\utils;

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -20,7 +20,7 @@
/**
* The Enrollment Info Form code for the form.
*/
class Openedx_Woocommerce_Plugin_Enrollment_Info_Form {
class Openedx_Commerce_Enrollment_Info_Form {

/**
* The name for the Open edX enrollment custom post type.
Expand All @@ -34,7 +34,7 @@ class Openedx_Woocommerce_Plugin_Enrollment_Info_Form {
/**
* The log manager.
*
* @var Openedx_Woocommerce_Plugin_Log
* @var Openedx_Commerce_Log
* @access private
* @since 1.1.1
*/
Expand All @@ -43,7 +43,7 @@ class Openedx_Woocommerce_Plugin_Enrollment_Info_Form {
/**
* Constructor function.
*
* @param Openedx_Woocommerce_Plugin_Enrollment $enrollment_request The enrollment request object.
* @param Openedx_Commerce_Enrollment $enrollment_request The enrollment request object.
*
* @access public
* @since 1.0.0
Expand All @@ -61,7 +61,7 @@ public function __construct( $enrollment_request ) {
* @return void
*/
public function register_log_manager() {
$this->log_manager = new Openedx_Woocommerce_Plugin_Log();
$this->log_manager = new Openedx_Commerce_Log();
}

/**
Expand Down Expand Up @@ -113,7 +113,7 @@ public function render_enrollment_info_form( $post ) {
?>
>
<span class="tooltip-icon">?</span>
<span class="tooltip-text"><?php esc_html_e( 'The id of the course to be used for the enroll, e.g. course-v1:edX+DemoX+Demo_Course.', 'wp-openedx-woocommerce-plugin' ); ?></span>
<span class="tooltip-text"><?php esc_html_e( 'The id of the course to be used for the enroll, e.g. course-v1:edX+DemoX+Demo_Course.', 'wp-openedx-commerce' ); ?></span>
</td>
</tr>
<tr>
Expand All @@ -123,8 +123,8 @@ public function render_enrollment_info_form( $post ) {
<input type="email" id="openedx_enrollment_email" name="enrollment_email" value="<?php echo esc_attr( $email ); ?>">
</div>
<span class="tooltip-icon">?</span>
<span class="tooltip-text"><?php esc_html_e( 'The email of the user to be used for the enroll.', 'wp-openedx-woocommerce-plugin' ); ?></span>
<button name="enrollment_sync" class="button save_order button-secondary sync_button"><span><?php esc_html_e( 'Read from Open edX', 'wp-openedx-woocommerce-plugin' ); ?></span></button>
<span class="tooltip-text"><?php esc_html_e( 'The email of the user to be used for the enroll.', 'wp-openedx-commerce' ); ?></span>
<button name="enrollment_sync" class="button save_order button-secondary sync_button"><span><?php esc_html_e( 'Read from Open edX', 'wp-openedx-commerce' ); ?></span></button>
</td>
</tr>
<tr class="gray_zone first_zone">
Expand All @@ -138,7 +138,7 @@ public function render_enrollment_info_form( $post ) {
<?php endforeach; ?>
</select>
<span class="tooltip-icon">?</span>
<span class="tooltip-text"><?php esc_html_e( 'The mode of your enrollment request. Make sure to set a mode that your course has.', 'wp-openedx-woocommerce-plugin' ); ?></span>
<span class="tooltip-text"><?php esc_html_e( 'The mode of your enrollment request. Make sure to set a mode that your course has.', 'wp-openedx-commerce' ); ?></span>
</td>
</tr>

Expand All @@ -157,7 +157,7 @@ public function render_enrollment_info_form( $post ) {
?>
>
<?php
esc_html_e( 'Enroll', 'wp-openedx-woocommerce-plugin' );
esc_html_e( 'Enroll', 'wp-openedx-commerce' );
?>
</option>
<option value="unenroll"
Expand All @@ -168,12 +168,12 @@ public function render_enrollment_info_form( $post ) {
?>
>
<?php
esc_html_e( 'Un-enroll', 'wp-openedx-woocommerce-plugin' );
esc_html_e( 'Un-enroll', 'wp-openedx-commerce' );
?>
</option>
</select>
<span class="tooltip-icon">?</span>
<span class="tooltip-text"><?php esc_html_e( 'The type of your request. If you select Enroll, you will create an enrollment, and if you select Un-enroll, you will set a soft unenrollment (enrollment with status inactive).', 'wp-openedx-woocommerce-plugin' ); ?></span>
<span class="tooltip-text"><?php esc_html_e( 'The type of your request. If you select Enroll, you will create an enrollment, and if you select Un-enroll, you will set a soft unenrollment (enrollment with status inactive).', 'wp-openedx-commerce' ); ?></span>
</td>
</tr>
<tr class="gray_zone">
Expand All @@ -192,31 +192,31 @@ public function render_enrollment_info_form( $post ) {
?>
</div>
<span class="tooltip-icon">?</span>
<span class="tooltip-text"><?php esc_html_e( 'The id of the order associated with this request.', 'wp-openedx-woocommerce-plugin' ); ?></span>
<span class="tooltip-text"><?php esc_html_e( 'The id of the order associated with this request.', 'wp-openedx-commerce' ); ?></span>
</td>
</tr>

<tr class="gray_zone">
<td class="checkbox-td">
<input class="action-checkbox" type="checkbox" id="force" name="enrollment_force" value="opcion1">
<label for="force"><?php esc_html_e( 'Use the "force" flag', 'wp-openedx-woocommerce-plugin' ); ?></label>
<label for="force"><?php esc_html_e( 'Use the "force" flag', 'wp-openedx-commerce' ); ?></label>
<span class="tooltip-icon">?</span>
<span class="tooltip-text"><?php esc_html_e( "Disregard the course's enrollment end dates.", 'wp-openedx-woocommerce-plugin' ); ?></span>
<span class="tooltip-text"><?php esc_html_e( "Disregard the course's enrollment end dates.", 'wp-openedx-commerce' ); ?></span>
</td>
<td>
<input class="action-checkbox" type="checkbox" id="no_pre" name="enrollment_allowed" value="opcion1">
<label for="no_pre"><?php esc_html_e( "Create course enrollment allowed if the user doesn't exist", 'wp-openedx-woocommerce-plugin' ); ?></label>
<label for="no_pre"><?php esc_html_e( "Create course enrollment allowed if the user doesn't exist", 'wp-openedx-commerce' ); ?></label>
<span class="tooltip-icon">?</span>
<span class="tooltip-text"><?php esc_html_e( 'Creates a register in the table Course Enrollment Allowed if the email we use in the request is not a user in our Open edX platform yet.', 'wp-openedx-woocommerce-plugin' ); ?></span>
<span class="tooltip-text"><?php esc_html_e( 'Creates a register in the table Course Enrollment Allowed if the email we use in the request is not a user in our Open edX platform yet.', 'wp-openedx-commerce' ); ?></span>
</td>
</tr>

<tr class="gray_zone">
<td class="first">
<button name="enrollment_process" class="button save_order button-primary"><span><?php esc_html_e( 'Save and update Open edX', 'wp-openedx-woocommerce-plugin' ); ?></span></button>
<button name="enrollment_process" class="button save_order button-primary"><span><?php esc_html_e( 'Save and update Open edX', 'wp-openedx-commerce' ); ?></span></button>
</td>
<td>
<button name="save_no_process" class="button save_order button-secondary"><span><?php esc_html_e( 'Save in WordPress', 'wp-openedx-woocommerce-plugin' ); ?></span></button>
<button name="save_no_process" class="button save_order button-secondary"><span><?php esc_html_e( 'Save in WordPress', 'wp-openedx-commerce' ); ?></span></button>
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
*
* @category Views
* @package WordPress
* @subpackage Openedx_Woocommerce_Plugin
* @subpackage Openedx_Commerce
* @since 1.6.0
*/

namespace App\admin\views;

use App\model\Openedx_Woocommerce_Plugin_Api_Calls;
use App\model\Openedx_Commerce_Api_Calls;
use DateTime;
use DateInterval;

/**
* This class allows the user to configure the plugin settings
* focusing on the connection between Open edX platform and the store.
*/
class Openedx_Woocommerce_Plugin_Settings {
class Openedx_Commerce_Settings {
/**
* API call variable.
*
* @var Openedx_Woocommerce_Plugin_Api_Calls
* @var Openedx_Commerce_Api_Calls
*/
private $api_call;

Expand All @@ -34,7 +34,7 @@ class Openedx_Woocommerce_Plugin_Settings {
* @return void
*/
public function __construct() {
$this->api_call = new Openedx_Woocommerce_Plugin_Api_Calls();
$this->api_call = new Openedx_Commerce_Api_Calls();
}

/**
Expand Down Expand Up @@ -161,7 +161,7 @@ public function openedx_settings_init() {
/**
* Make API call to generate new JWT token.
*
* Calls the Openedx_Woocommerce_Plugin_Api_Calls class to generate
* Calls the Openedx_Commerce_Api_Calls class to generate
* a new JWT token using the Open edX API credentials saved in options.
*
* Handles errors from the API request and redirects back to the settings
Expand Down
Loading

0 comments on commit 79bdd6a

Please sign in to comment.