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

Consistent branding: KOMOJU instead of Komoju #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Always start the configuration by using the test mode secret key and do a few te
To enable Debug click the 'Enable logging' box.


### Configuring your Komoju account
### Configuring your KOMOJU account

To ensure that the WooCommerce plugin works correctly you will need to set up a webhook from your Komoju dashboard to the wordpress instance. To do this you will need to go to your [Webhook page on the Komoju dashboard](https://komoju.com/admin/webhooks) and click "New Webhook". If you don't know what the webhook URL should be you can check the admin page for this plugin on your wordpress instance to see the default address. The secret can be anything you want (as long as you remember it), but you must make sure the following events are ticked:

Expand Down
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*** Komoju gateway Changelog ***
*** KOMOJU gateway Changelog ***

2020.04.21
* Update plugin to be compatible with WooCommerce v4
Expand Down
10 changes: 5 additions & 5 deletions class-wc-gateway-komoju.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
}

/**
*Komoju Payment Gateway
* KOMOJU Payment Gateway
*
* Provides access to Japanese local payment methods.
*
Expand All @@ -13,7 +13,7 @@
*
* @version 2.3.1
*
* @author Komoju
* @author KOMOJU
*/
require_once dirname(__FILE__) . '/komoju-php/komoju-php/lib/komoju.php';

Expand All @@ -35,8 +35,8 @@ public function __construct()
{
$this->id = $this->id ? $this->id : 'komoju';
$this->has_fields = gettype($this->has_fields) == 'boolean' ? $this->has_fields : true;
$this->method_title = $this->method_title ? $this->method_title : __('Komoju', 'komoju-woocommerce');
$this->method_description = __('Allows payments by Komoju, dedicated to Japanese online and offline payment gateways.', 'komoju-woocommerce');
$this->method_title = $this->method_title ? $this->method_title : __('KOMOJU', 'komoju-woocommerce');
$this->method_description = __('Allows payments by KOMOJU, dedicated to Japanese online and offline payment gateways.', 'komoju-woocommerce');
$this->debug = 'yes' === $this->get_option_compat('debug_log', 'debug');
$this->invoice_prefix = $this->get_option_compat('invoice_prefix', 'invoice_prefix');
$this->secretKey = $this->get_option_compat('secret_key', 'secretKey');
Expand Down Expand Up @@ -368,7 +368,7 @@ public static function get_legacy_setting($name, $default_value = null)
*/
protected function default_title()
{
return __('Komoju', 'komoju-woocommerce');
return __('KOMOJU', 'komoju-woocommerce');
}

public static function to_cents($total, $currency = '')
Expand Down
6 changes: 3 additions & 3 deletions class-wc-settings-page-komoju.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* @version 2.3.1
*
* @author Komoju
* @author KOMOJU
*/
require_once dirname(__FILE__) . '/komoju-php/komoju-php/lib/komoju.php';

Expand All @@ -21,7 +21,7 @@ class WC_Settings_Page_Komoju extends WC_Settings_Page
public function __construct()
{
$this->id = 'komoju_settings';
$this->label = __('Komoju', 'komoju-woocommerce');
$this->label = __('KOMOJU', 'komoju-woocommerce');

add_action(
'woocommerce_admin_field_komoju_payment_types',
Expand Down Expand Up @@ -371,7 +371,7 @@ private function secret_key()
$global_option = get_option('komoju_woocommerce_secret_key');
if (!$global_option) {
// This is for backwards compatibility. We used to have all settings saved under
// a single payment gateway called "Komoju". We've sinced moved to having this
// a single payment gateway called "KOMOJU". We've sinced moved to having this
// global settings page, but want to continue supporting old setups.
return WC_Gateway_Komoju::get_legacy_setting('secretKey');
}
Expand Down
2 changes: 1 addition & 1 deletion docs/dev_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ and click "Continue"
16. Click "Save changes" at the bottom:
![Set currency](./images/Set_currency.png)

## Setting up the Komoju WooCommerce plugin
## Setting up the KOMOJU WooCommerce plugin

1. On the WordPress admin page, click "Plugins" on the left side panel
2. On the Plugins page click "Activate" under "WooCommerce Komoju Gateway"
Expand Down
11 changes: 11 additions & 0 deletions docs/uploading_to_wordpress_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This document details how to release a new version of the plugin on the WordPress store. This is intended for Komoju developers and requires access to the company's WordPress account.

## The easy way

We now use GitHub Actions to automate all of this. Unless you have an issue, you can ignore the rest of this document and simply run this command:

```bash
$ git tag v0.0.0 # Replace 0.0.0 with the version you want to upload
$ git push --tags
```

That's it. You can check the result on the Actions tab in GitHub.

## Prerequisites

Before you start, make sure to have the SVN cli tools installed. If you are on a Mac, then you can install them with Homebrew: `brew install svn`
Expand Down
2 changes: 1 addition & 1 deletion includes/account-settings-komoju.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

/*
* Settings for the whole Komoju plugin
* Simple settings page with just sign-in button and payment methods
*/

return [
Expand Down
10 changes: 5 additions & 5 deletions includes/api-settings-komoju.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

/*
* Settings for the whole Komoju plugin
* Settings for the whole KOMOJU plugin
*/

return [
Expand All @@ -18,30 +18,30 @@
[
'id' => 'komoju_woocommerce_secret_key',
'placeholder' => 'sk_live_000000000000000000000000',
'title' => __('Secret Key from Komoju', 'komoju-woocommerce'),
'title' => __('Secret Key from KOMOJU', 'komoju-woocommerce'),
'type' => 'text',
'default' => WC_Gateway_Komoju::get_legacy_setting('secretKey'),
'desc_tip' => true,
],
[
'id' => 'komoju_woocommerce_webhook_secret',
'placeholder' => __('Please enter your Komoju Webhook Secret Token', 'komoju-woocommerce'),
'placeholder' => __('Please enter your KOMOJU Webhook Secret Token', 'komoju-woocommerce'),
'title' => __('Webhook Secret Token', 'komoju-woocommerce'),
'type' => 'text',
'default' => WC_Gateway_Komoju::get_legacy_setting('webhookSecretToken'),
'desc_tip' => true,
],
[
'id' => 'komoju_woocommerce_invoice_prefix',
'placeholder' => __('Please enter a prefix for your invoice numbers. If you use your Komoju account for multiple stores ensure this prefix is unique.', 'komoju-woocommerce'),
'placeholder' => __('Please enter a prefix for your invoice numbers. If you use your KOMOJU account for multiple stores ensure this prefix is unique.', 'komoju-woocommerce'),
'title' => __('Invoice Prefix', 'komoju-woocommerce'),
'type' => 'text',
'default' => WC_Gateway_Komoju::get_legacy_setting('invoice_prefix', 'WC-'),
'desc_tip' => true,
],
[
'id' => 'komoju_woocommerce_debug_log',
'desc' => sprintf(__('Log Komoju events inside <code>%s</code>', 'komoju-woocommerce'), wc_get_log_file_path('komoju')),
'desc' => sprintf(__('Log KOMOJU events inside <code>%s</code>', 'komoju-woocommerce'), wc_get_log_file_path('komoju')),
'desc_tip' => true,
'title' => __('Debug Log', 'komoju-woocommerce'),
'type' => 'checkbox',
Expand Down
14 changes: 7 additions & 7 deletions includes/class-wc-gateway-komoju-ipn-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
include_once 'class-wc-gateway-komoju-webhook-event.php';

/**
* Handles responses from Komoju IPN
* Handles responses from KOMOJU IPN
*/
class WC_Gateway_Komoju_IPN_Handler extends WC_Gateway_Komoju_Response
{
Expand All @@ -34,7 +34,7 @@ public function __construct($gateway, $webhookSecretToken = '', $secret_key = ''
}

/**
* Check for Komoju IPN or Session Response
* Check for KOMOJU IPN or Session Response
*/
public function check_response()
{
Expand Down Expand Up @@ -78,7 +78,7 @@ public function check_response()
do_action('valid-komoju-standard-ipn-request', $webhookEvent);
exit;
}
wp_die('Komoju IPN Request Failure', 'Komoju IPN', ['response' => 500]);
wp_die('KOMOJU IPN Request Failure', 'KOMOJU IPN', ['response' => 500]);
}

public function quick_setup($post)
Expand Down Expand Up @@ -137,7 +137,7 @@ public function valid_response($webhookEvent)
}

/**
* Check Komoju IPN validity (hmac control)
* Check KOMOJU IPN validity (hmac control)
*
* @param string $requestBody the body of the request. Needed to correctly
* calculate the HMAC for comparison.
Expand All @@ -153,7 +153,7 @@ public function validate_hmac($requestBody)
$calcHmac = hash_hmac('sha256', $requestBody, $this->webhookSecretToken);

if ($hmacHeader != $calcHmac) {
WC_Gateway_Komoju::log('hmac codes (sent by Komoju / recalculated) don\'t match. Exiting the process...');
WC_Gateway_Komoju::log('hmac codes (sent by KOMOJU / recalculated) don\'t match. Exiting the process...');

return false;
}
Expand All @@ -174,7 +174,7 @@ protected function validate_currency($order, $currency)
WC_Gateway_Komoju::log('Payment error: Currencies do not match (sent "' . $order->get_currency() . '" | returned "' . $currency . '")');

// Put this order on-hold for manual checking
$order->update_status('on-hold', sprintf(__('Validation error: Komoju currencies do not match (code %s).', 'komoju-woocommerce'), $currency));
$order->update_status('on-hold', sprintf(__('Validation error: KOMOJU currencies do not match (code %s).', 'komoju-woocommerce'), $currency));
exit;
}
}
Expand All @@ -191,7 +191,7 @@ protected function validate_amount($order, $amount)
WC_Gateway_Komoju::log('Payment error: Amounts do not match (total: ' . $amount . ') for order #' . $order->get_id() . '(' . $order->get_total() . ')');

// Put this order on-hold for manual checking
$order->update_status('on-hold', sprintf(__('Validation error: Komoju amounts do not match (total %s).', 'komoju-woocommerce'), $amount));
$order->update_status('on-hold', sprintf(__('Validation error: KOMOJU amounts do not match (total %s).', 'komoju-woocommerce'), $amount));
exit;
}
}
Expand Down
8 changes: 4 additions & 4 deletions includes/class-wc-gateway-komoju-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
}

/**
* Generates requests to send to Komoju
* Generates requests to send to KOMOJU
*/
class WC_Gateway_Komoju_Request
{
/**
* Stores line items to send to Komoju
* Stores line items to send to KOMOJU
*
* @var array
*/
Expand All @@ -36,7 +36,7 @@ public function __construct($gateway)
}

/**
* Get the Komoju request URL for an order
* Get the KOMOJU request URL for an order
*
* @param WC_Order $order
*
Expand All @@ -50,7 +50,7 @@ public function get_request_url($order, $method = 'credit_card')
}

/**
* Get Komoju Args for passing to Komoju hosted page
* Get KOMOJU Args for passing to KOMOJU hosted page
*
* @param WC_Order $order
* @param string $method the method of payment the user has selected, ie credit-card
Expand Down
6 changes: 3 additions & 3 deletions includes/class-wc-gateway-komoju-response.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
abstract class WC_Gateway_Komoju_Response
{
/**
* Get the order from the Komoju 'transaction' variable
* Get the order from the KOMOJU 'transaction' variable
*
* @param WC_Gateway_Komoju_Webhook_Event $webhookEvent Webhook event data
* @param string $invoice_prefix set as an option in Komoju plugin dashboard
* @param string $invoice_prefix set as an option in KOMOJU plugin dashboard
*
* @return bool|WC_Order object
*/
Expand Down Expand Up @@ -40,7 +40,7 @@ protected function get_komoju_order($webhookEvent, $invoice_prefix)
* Get an order from a payment associated with a KOMOJU session
*
* @param string $session_id
* @param string $invoice_prefix set as an option in Komoju plugin dashboard
* @param string $invoice_prefix set as an option in KOMOJU plugin dashboard
*/
protected function get_order_from_komoju_session($session, $invoice_prefix)
{
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-gateway-komoju-single-slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct($payment_method)
$this->payment_method = $payment_method;
$this->id = 'komoju_' . $slug;
$this->has_fields = false;
$this->method_title = __('Komoju', 'komoju-woocommerce') . ' - ' . $this->default_title();
$this->method_title = __('KOMOJU', 'komoju-woocommerce') . ' - ' . $this->default_title();

if ($this->get_option('showIcon') == 'yes') {
$this->icon = "https://komoju.com/payment_methods/$slug.svg";
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-gateway-komoju-webhook-event.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public function __construct($requestBody)
$this->requestJson = json_decode($requestBody, true);

if (!empty(json_last_error())) {
$errorMsg = 'Komoju IPN Request JSON Decoding Failure. Error: ' . json_last_error_msg();
wp_die($errorMsg, 'Komoju IPN', ['response' => 400]);
$errorMsg = 'KOMOJU IPN Request JSON Decoding Failure. Error: ' . json_last_error_msg();
wp_die($errorMsg, 'KOMOJU IPN', ['response' => 400]);
}
}

Expand Down
4 changes: 2 additions & 2 deletions includes/gateway-settings-komoju.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
}

/*
* Gateway-specific Settings for Komoju
* Gateway-specific Settings for KOMOJU
*/

return [
'enabled' => [
'title' => __('Enable/Disable', 'komoju-woocommerce'),
'type' => 'checkbox',
'label' => __('Enable Komoju', 'komoju-woocommerce'),
'label' => __('Enable KOMOJU', 'komoju-woocommerce'),
'default' => 'no',
],
'showIcon' => [
Expand Down
Loading