Skip to content

Commit

Permalink
Tool - Change merchant config to php array
Browse files Browse the repository at this point in the history
  • Loading branch information
yidas committed Aug 27, 2020
1 parent 50ce6f3 commit 52e2d38
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
composer.phar
composer.lock
# Tool's optional config
/tool/_merchants.json
/tool/_merchants.php
30 changes: 16 additions & 14 deletions tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,22 @@ MERCHANTS SETTING

You can save your favorite or test LINE Pay merchant account for display and selection on the sample page.

To enable the setting, create `tool/_merchants.json` file (Under `tool` folder) using the following JSON format:

```json
[
{
"title": "First Merchant",
"channelId": "{your channelId}",
"channelSecret": "{your channelSecret}"
},
{
"title": "Second Merchant",
"channelId": "{your channelId}",
"channelSecret": "{your channelSecret}"
}
To enable the setting, create `tool/_merchants.php` file (Under `tool` folder) using the following PHP array format:

```php
<?php

return [
[
"title" => "First Merchant",
"channelId" => "{your channelId}",
"channelSecret" => "{your channelSecret}",
],
[
"title" => "Second Merchant",
"channelId" => "{your channelId}",
"channelSecret" => "{your channelSecret}",
],
]
```

Expand Down
4 changes: 2 additions & 2 deletions tool/_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function saveErrorLog($name, \Psr\Http\Message\RequestInterface $request, $reset
*/
class Merchant
{
private static $configPath = __DIR__ . "/_merchants.json";
private static $configPath = __DIR__ . "/_merchants.php";

/**
* Get merchant list from config
Expand All @@ -98,7 +98,7 @@ public static function getList()
{
if (file_exists(self::$configPath)) {

$data = json_decode(file_get_contents(self::$configPath), true);
$data = include self::$configPath;

// Check format
foreach ((array)$data as $key => $each) {
Expand Down

0 comments on commit 52e2d38

Please sign in to comment.