Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the following bugs #14

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

fix the following bugs #14

wants to merge 8 commits into from

Conversation

shunsuke-h-opn
Copy link

@shunsuke-h-opn shunsuke-h-opn commented Nov 2, 2023

1. Objective

Current plugin is not compatible with EC-CUBE2.17, and it has a lot of bugs.
I fixed the following bugs.

  • install plugin
  • update plugin
  • charge
  • capture
  • refund
  • change card
  • delete card
  • settings

2. Description of change

  • Fixed this plugin for 2.17
  • Fixed a lot of bugs that is explained at Objective section.

3. Quality assurance

Use latest EC-CUBE2 at local.
https://github.com/EC-CUBE/ec-cube2#%E3%83%AD%E3%83%BC%E3%82%AB%E3%83%AB%E7%92%B0%E5%A2%83%E3%82%92%E3%83%9E%E3%82%A6%E3%83%B3%E3%83%88%E3%81%99%E3%82%8B%E5%A0%B4%E5%90%88

Build environment with this command.

docker-compose -f docker-compose.yml -f docker-compose.mysql.yml -f docker-compose.dev.yml up -d

Fix and test the following bugs.

  • install plugin
  • update plugin
  • charge
  • capture
  • refund
  • change card
  • delete card
  • settings

I ran test by hand.
So If you need some evidence, please let me know.

4. Impact of the change

Current plugin can not be installed and not worked at latest EC-CUBE2.
So if this change is applied, it will work properly.

5. Priority of change

Normal

6. Additional Notes

We gonna update this document about how to install.
It is also wrong.
https://docs.opn.ooo/ja/eccube-plugin/japan#part-bdf5c55b74bb686

And at the left menu, EC-CUBE is gone now, we will add EC-CUBE again.

7. How to set up EC-CUBE2 at local

There are some ways.
At this time, I use docker-compose.

Clone this repository.
https://github.com/EC-CUBE/ec-cube2

Prepare config.php and place at data/config.

config.php need to be like this.(You need to change it to your environment)

<?php
define('ECCUBE_INSTALL', 'ON');
define('HTTP_URL', 'http://127.0.0.1:8080/');
define('HTTPS_URL', 'http://127.0.0.1:8080/');
define('ROOT_URLPATH', '/');
define('DOMAIN_NAME', '');
define('DB_TYPE', 'mysqli');
define('DB_USER', 'root');
define('DB_PASSWORD', 'password');
define('DB_SERVER', 'mysql');
define('DB_NAME', 'eccube_db');
define('DB_PORT', '3306');
define('ADMIN_DIR', 'admint/');
define('ADMIN_FORCE_SSL', FALSE);
define('ADMIN_ALLOW_HOSTS', 'a:0:{}');
define('AUTH_MAGIC', '1f76e1f7bb995d995fb6fc12ce6101c553fd0eae');
define('PASSWORD_HASH_ALGOS', 'sha256');
define('MAIL_BACKEND', 'smtp');
define('SMTP_HOST', 'mailcatcher');
define('SMTP_PORT', '1025');
define('SMTP_USER', '');
define('SMTP_PASSWORD', '');

Run the launch command of docker-compose.

docker-compose -f docker-compose.yml -f docker-compose.mysql.yml -f docker-compose.dev.yml up -d

Before opening the browser, you need to create a database at mysql of docker.

mysql> create database eccube_db;

Then,

8. How to install plugin.

https://github.com/omise/omise-eccube/releases/tag/v2.2

This tar.gz file has unneeded directory hierarchy.

It means above tar.gz file has this hierarchy.

➜  Downloads tree omise-eccube-2.2 -L 1
omise-eccube-2.2
├── Build
├── CHANGELOG.md
├── OmiseExt.php
├── README.md
├── class
├── config.php
├── inc
├── logo.png
├── mdl_omise
├── omise-php
├── plugin_info.php
├── plugin_update.php
├── release
└── templates

This one omise-eccube-2.2 directory is not necessary.

We need to create tar.gz file at the root directory of this repository.

➜  omise-eccube git:(master) ls
Build             README.md         inc               omise-php         release
CHANGELOG.md      class             logo.png          plugin_info.php   templates
OmiseExt.php      config.php        mdl_omise         plugin_update.php
➜  omise-eccube git:(master) ✗ tar -zcvf xxxx.tar.gz .

Otherwise, the plugin will fail to install.

- install plugin
- update plugin
- charge
- capture
- refund
- change card
- delete card
- settings
@danfowler danfowler requested a review from a team November 2, 2023 03:13
inc/include.php Outdated Show resolved Hide resolved
@@ -20,7 +20,7 @@ class OmiseExt extends SC_Plugin_Base
* @param array $arrPlugin plugin_infoを元にDBに登録されたプラグイン情報(dtb_plugin)
* @return void
*/
public function install($arrPlugin)
public static function install($arrPlugin, $objPluginInstaller = null)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are changing these methods to static, are these required for ECube 2.12.5 and 2.13.3 as well or just 2.17?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aashishgurung

Just for 2.17.

Both ECCube 2.12.5 and 2.13 require PHP 5.X.
These version are already out of support from PHP official.
So, this fix is for EC-CUBE ver 2.17.
It works with current supported PHP version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shunsuke-h-opn @aashishgurung what will happen for current users of PHP 5.x who migrate to this version?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shunsuke-h-opn
I will ask it to EC-CUBE official support team.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static method was available since PHP 5.x. So, this should work if 2.17 version of EC-CUBE allows PHP 5.x.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is that the way install method needs to be implemented after this change. Before, we would do like following

$obj = new OmiseExt;

$obj->install(<params>)

But, with this change, we have to do like

OmiseExt::install(<params>)

So, if we release with this change and a merchant with legacy EC-CUBE version, i.e a version before 2.17, upgrades our plugin then this might break his/her implementation. We do have a few merchants using EC-CUBE older versions.

Copy link

sonarqubecloud bot commented Nov 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants