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 1010use Omnipay \Common \Message \AbstractResponse as BaseAbstractResponse ;
1111
1212/**
13+ * @method AbstractRequest getRequest()
14+ *
1315 * @author Vuong Minh <vuongxuongminh@gmail.com>
1416 * @since 1.0.0
1517 */
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ trait RequestHash
2424 protected function generateHash (): string
2525 {
2626 $ data = [];
27- $ rsa = new RSAEncrypt ($ this ->getParameter ('publicKey ' ));
27+ $ rsa = new RSAEncrypt (
28+ $ this ->getPublicKey ()
29+ );
2830 $ parameters = $ this ->getParameters ();
2931
3032 foreach ($ this ->getHashParameters () as $ pos => $ parameter ) {
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ trait RequestSignature
2424 protected function generateSignature (): string
2525 {
2626 $ data = [];
27- $ signature = new Signature ($ this ->getParameter ('secretKey ' ));
27+ $ signature = new Signature (
28+ $ this ->getSecretKey ()
29+ );
2830 $ parameters = $ this ->getParameters ();
2931
3032 foreach ($ this ->getSignatureParameters () as $ pos => $ parameter ) {
Original file line number Diff line number Diff line change @@ -25,8 +25,9 @@ trait ResponseSignatureValidation
2525 protected function validateSignature (): void
2626 {
2727 $ data = [];
28- $ requestParameters = $ this ->getRequest ()->getParameters ();
29- $ signature = new Signature ($ requestParameters ['secretKey ' ]);
28+ $ signature = new Signature (
29+ $ this ->getRequest ()->getSecretKey ()
30+ );
3031
3132 foreach ($ this ->getSignatureParameters () as $ pos => $ parameter ) {
3233 if (! is_string ($ pos )) {
Original file line number Diff line number Diff line change @@ -30,9 +30,7 @@ public function testPurchaseSuccess()
3030 {
3131 $ httpResponse = $ this ->getMockHttpResponse ('PurchaseSuccess.txt ' );
3232 $ request = $ this ->getMockRequest ();
33- $ request ->shouldReceive ('getParameters ' )->once ()->andReturn ([
34- 'secretKey ' => 'fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' ,
35- ]);
33+ $ request ->shouldReceive ('getSecretKey ' )->once ()->andReturn ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
3634 $ response = new PurchaseResponse (
3735 $ request ,
3836 json_decode ($ httpResponse ->getBody ()->getContents (), true )
Original file line number Diff line number Diff line change @@ -30,9 +30,7 @@ public function testResponse()
3030 {
3131 $ httpResponse = $ this ->getMockHttpResponse ('PurchaseSuccess.txt ' );
3232 $ request = $ this ->getMockRequest ();
33- $ request ->shouldReceive ('getParameters ' )->once ()->andReturn ([
34- 'secretKey ' => 'fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' ,
35- ]);
33+ $ request ->shouldReceive ('getSecretKey ' )->once ()->andReturn ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
3634 $ response = new PurchaseResponse (
3735 $ request ,
3836 json_decode ($ httpResponse ->getBody ()->getContents (), true )
Original file line number Diff line number Diff line change @@ -30,9 +30,7 @@ public function testResponse()
3030 {
3131 $ httpResponse = $ this ->getMockHttpResponse ('PayConfirmResponse.txt ' );
3232 $ request = $ this ->getMockRequest ();
33- $ request ->shouldReceive ('getParameters ' )->once ()->andReturn ([
34- 'secretKey ' => 'fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' ,
35- ]);
33+ $ request ->shouldReceive ('getSecretKey ' )->once ()->andReturn ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
3634 $ response = new PayConfirmResponse (
3735 $ request ,
3836 json_decode ($ httpResponse ->getBody ()->getContents (), true )
Original file line number Diff line number Diff line change @@ -29,9 +29,7 @@ public function testConstruct()
2929 public function testResponse ()
3030 {
3131 $ request = $ this ->getMockRequest ();
32- $ request ->shouldReceive ('getParameters ' )->once ()->andReturn ([
33- 'secretKey ' => 'fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' ,
34- ]);
32+ $ request ->shouldReceive ('getSecretKey ' )->once ()->andReturn ('fj00YKnJhmYqahaFWUgkg75saNTzMrbO ' );
3533 $ response = new NotificationResponse (
3634 $ request ,
3735 [
You can’t perform that action at this time.
0 commit comments