Skip to content

Commit 672fb90

Browse files
committed
rename
1 parent f1cf796 commit 672fb90

File tree

8 files changed

+23
-18
lines changed

8 files changed

+23
-18
lines changed

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,10 @@
4343
}
4444
},
4545
"minimum-stability": "dev",
46-
"prefer-stable": true
46+
"prefer-stable": true,
47+
"config": {
48+
"allow-plugins": {
49+
"php-http/discovery": true
50+
}
51+
}
4752
}

src/Encryption.php renamed to src/Encryptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use phpseclib3\Crypt\AES;
66
use phpseclib3\Crypt\Random;
77

8-
class Encryption
8+
class Encryptor
99
{
1010
/**
1111
* @var AES

src/Message/AbstractRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Omnipay\Common\Message\AbstractRequest as BaseAbstractRequest;
66
use Omnipay\Common\Message\ResponseInterface;
7-
use Omnipay\MyPay\Encryption;
7+
use Omnipay\MyPay\Encryptor;
88
use Omnipay\MyPay\Traits\HasStore;
99

1010
/**
@@ -22,7 +22,7 @@ public function sendData($data)
2222
{
2323
$url = $this->getEndpoint();
2424
$headers = ['Content-Type' => 'application/x-www-form-urlencoded'];
25-
$body = $this->createBody(new Encryption($this->getStoreKey()), $data);
25+
$body = $this->createBody(new Encryptor($this->getStoreKey()), $data);
2626
$response = $this->httpClient->request('POST', $url, $headers, http_build_query($body));
2727

2828
return $this->createResponse(json_decode((string) $response->getBody(), true));
@@ -36,7 +36,7 @@ protected function getEndpoint()
3636
/**
3737
* @return array
3838
*/
39-
abstract protected function createBody(Encryption $encryption, array $data);
39+
abstract protected function createBody(Encryptor $encryption, array $data);
4040

4141
/**
4242
* @param array $data

src/Message/FetchTransactionRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Omnipay\MyPay\Message;
44

5-
use Omnipay\MyPay\Encryption;
5+
use Omnipay\MyPay\Encryptor;
66
use Omnipay\MyPay\Traits\HasKey;
77
use Omnipay\MyPay\Traits\HasUid;
88

@@ -18,7 +18,7 @@ public function getData()
1818
return ['uid' => $this->getTransactionReference(), 'key' => $this->getKey()];
1919
}
2020

21-
protected function createBody(Encryption $encryption, array $data)
21+
protected function createBody(Encryptor $encryption, array $data)
2222
{
2323
return [
2424
'store_uid' => $this->getStoreUid(),

src/Message/PurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Omnipay\MyPay\Message;
44

55
use Omnipay\Common\Exception\InvalidRequestException;
6-
use Omnipay\MyPay\Encryption;
6+
use Omnipay\MyPay\Encryptor;
77
use Omnipay\MyPay\Item;
88
use Omnipay\MyPay\Traits\HasAgent;
99
use Omnipay\MyPay\Traits\HasAmount;
@@ -338,7 +338,7 @@ public function getData()
338338
/**
339339
* @return array
340340
*/
341-
protected function createBody(Encryption $encryption, array $data)
341+
protected function createBody(Encryptor $encryption, array $data)
342342
{
343343
return [
344344
'store_uid' => $this->getStoreUid(),

src/Message/RefundRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Omnipay\MyPay\Message;
44

5-
use Omnipay\MyPay\Encryption;
5+
use Omnipay\MyPay\Encryptor;
66
use Omnipay\MyPay\Traits\HasAmount;
77
use Omnipay\MyPay\Traits\HasCost;
88
use Omnipay\MyPay\Traits\HasKey;
@@ -49,7 +49,7 @@ public function getData()
4949
];
5050
}
5151

52-
protected function createBody(Encryption $encryption, array $data)
52+
protected function createBody(Encryptor $encryption, array $data)
5353
{
5454
return [
5555
'store_uid' => $this->getStoreUid(),

tests/EncryptionTest.php renamed to tests/EncryptorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Omnipay\MyPay\Test;
44

5-
use Omnipay\MyPay\Encryption;
5+
use Omnipay\MyPay\Encryptor;
66
use PHPUnit\Framework\TestCase;
77

8-
class EncryptionTest extends TestCase
8+
class EncryptorTest extends TestCase
99
{
1010
public function testEncryptByPhpseclib()
1111
{
@@ -26,7 +26,7 @@ public function testEncryptByPhpseclib()
2626
'ip' => '127.0.0.1', // 此為消費者IP,會做為驗證用
2727
'pfn' => 'all',
2828
];
29-
$encryption = new Encryption($key);
29+
$encryption = new Encryptor($key);
3030
$encrypt = $encryption->encrypt($payment);
3131

3232
self::assertEquals($payment, decrypt($encrypt, $key));
@@ -52,7 +52,7 @@ public function testDecryptByPhpseclib()
5252
'pfn' => 'all',
5353
];
5454
$encrypt = encrypt($payment, $key);
55-
$encryption = new Encryption($key);
55+
$encryption = new Encryptor($key);
5656

5757
self::assertEquals($payment, $encryption->decrypt($encrypt));
5858
}

tests/GatewayTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Omnipay\MyPay\Test;
44

5-
use Omnipay\MyPay\Encryption;
5+
use Omnipay\MyPay\Encryptor;
66
use Omnipay\MyPay\Gateway;
77
use Omnipay\MyPay\Item;
88
use Omnipay\Tests\GatewayTestCase;
@@ -14,7 +14,7 @@ class GatewayTest extends GatewayTestCase
1414
protected $gateway;
1515

1616
/**
17-
* @var Encryption
17+
* @var Encryptor
1818
*/
1919
private $encryption;
2020

@@ -35,7 +35,7 @@ public function setUp(): void
3535
$httpRequest = Request::createFromGlobals();
3636
$httpRequest->server->set('REMOTE_ADDR', '127.0.0.1');
3737
$this->gateway = new Gateway($this->getHttpClient(), $httpRequest);
38-
$this->encryption = new Encryption($this->storeKey);
38+
$this->encryption = new Encryptor($this->storeKey);
3939
$this->gateway->initialize([
4040
'store_uid' => $this->storeUid,
4141
'store_key' => $this->storeKey,

0 commit comments

Comments
 (0)