File tree Expand file tree Collapse file tree 8 files changed +15
-16
lines changed Expand file tree Collapse file tree 8 files changed +15
-16
lines changed Original file line number Diff line number Diff line change 10
10
use Omnipay \Common \Message \AbstractResponse as BaseAbstractResponse ;
11
11
12
12
/**
13
+ * @method AbstractRequest getRequest()
14
+ *
13
15
* @author Vuong Minh <vuongxuongminh@gmail.com>
14
16
* @since 1.0.0
15
17
*/
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ trait RequestHash
24
24
protected function generateHash (): string
25
25
{
26
26
$ data = [];
27
- $ rsa = new RSAEncrypt ($ this ->getParameter ('publicKey ' ));
27
+ $ rsa = new RSAEncrypt (
28
+ $ this ->getPublicKey ()
29
+ );
28
30
$ parameters = $ this ->getParameters ();
29
31
30
32
foreach ($ this ->getHashParameters () as $ pos => $ parameter ) {
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ trait RequestSignature
24
24
protected function generateSignature (): string
25
25
{
26
26
$ data = [];
27
- $ signature = new Signature ($ this ->getParameter ('secretKey ' ));
27
+ $ signature = new Signature (
28
+ $ this ->getSecretKey ()
29
+ );
28
30
$ parameters = $ this ->getParameters ();
29
31
30
32
foreach ($ this ->getSignatureParameters () as $ pos => $ parameter ) {
Original file line number Diff line number Diff line change @@ -25,8 +25,9 @@ trait ResponseSignatureValidation
25
25
protected function validateSignature (): void
26
26
{
27
27
$ data = [];
28
- $ requestParameters = $ this ->getRequest ()->getParameters ();
29
- $ signature = new Signature ($ requestParameters ['secretKey ' ]);
28
+ $ signature = new Signature (
29
+ $ this ->getRequest ()->getSecretKey ()
30
+ );
30
31
31
32
foreach ($ this ->getSignatureParameters () as $ pos => $ parameter ) {
32
33
if (! is_string ($ pos )) {
Original file line number Diff line number Diff line change @@ -30,9 +30,7 @@ public function testPurchaseSuccess()
30
30
{
31
31
$ httpResponse = $ this ->getMockHttpResponse ('PurchaseSuccess.txt ' );
32
32
$ request = $ this ->getMockRequest ();
33
- $ request ->shouldReceive ('getParameters ' )->once ()->andReturn ([
34
- 'secretKey ' => 'fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' ,
35
- ]);
33
+ $ request ->shouldReceive ('getSecretKey ' )->once ()->andReturn ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
36
34
$ response = new PurchaseResponse (
37
35
$ request ,
38
36
json_decode ($ httpResponse ->getBody ()->getContents (), true )
Original file line number Diff line number Diff line change @@ -30,9 +30,7 @@ public function testResponse()
30
30
{
31
31
$ httpResponse = $ this ->getMockHttpResponse ('PurchaseSuccess.txt ' );
32
32
$ request = $ this ->getMockRequest ();
33
- $ request ->shouldReceive ('getParameters ' )->once ()->andReturn ([
34
- 'secretKey ' => 'fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' ,
35
- ]);
33
+ $ request ->shouldReceive ('getSecretKey ' )->once ()->andReturn ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
36
34
$ response = new PurchaseResponse (
37
35
$ request ,
38
36
json_decode ($ httpResponse ->getBody ()->getContents (), true )
Original file line number Diff line number Diff line change @@ -30,9 +30,7 @@ public function testResponse()
30
30
{
31
31
$ httpResponse = $ this ->getMockHttpResponse ('PayConfirmResponse.txt ' );
32
32
$ request = $ this ->getMockRequest ();
33
- $ request ->shouldReceive ('getParameters ' )->once ()->andReturn ([
34
- 'secretKey ' => 'fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' ,
35
- ]);
33
+ $ request ->shouldReceive ('getSecretKey ' )->once ()->andReturn ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
36
34
$ response = new PayConfirmResponse (
37
35
$ request ,
38
36
json_decode ($ httpResponse ->getBody ()->getContents (), true )
Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ public function testConstruct()
29
29
public function testResponse ()
30
30
{
31
31
$ request = $ this ->getMockRequest ();
32
- $ request ->shouldReceive ('getParameters ' )->once ()->andReturn ([
33
- 'secretKey ' => 'fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' ,
34
- ]);
32
+ $ request ->shouldReceive ('getSecretKey ' )->once ()->andReturn ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
35
33
$ response = new NotificationResponse (
36
34
$ request ,
37
35
[
You can’t perform that action at this time.
0 commit comments