File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,4 @@ Tất cả lịch sử tiến trình phát triển thư viện
1010## 1.0.2
1111
1212- Implement phương thức ` isCancelled ` ở lớp ` \Omnipay\MoMo\Message\AbstractResponse ` .
13+ - Throw exception ở concern ` \Omnipay\MoMo\Message\Conerns\ResponseSignatureValidation ` khi response không tồn tại chữ ký.
Original file line number Diff line number Diff line change @@ -24,7 +24,13 @@ trait ResponseSignatureValidation
2424 */
2525 protected function validateSignature (): void
2626 {
27- $ data = [];
27+ $ data = $ this ->getData ();
28+
29+ if (! isset ($ data ['signature ' ])) {
30+ throw new InvalidResponseException (sprintf ('Response from MoMo is invalid! ' ));
31+ }
32+
33+ $ dataSignature = [];
2834 $ signature = new Signature (
2935 $ this ->getRequest ()->getSecretKey ()
3036 );
@@ -34,10 +40,10 @@ protected function validateSignature(): void
3440 $ pos = $ parameter ;
3541 }
3642
37- $ data [$ pos ] = Arr::getValue ($ parameter , $ this -> data );
43+ $ dataSignature [$ pos ] = Arr::getValue ($ parameter , $ data );
3844 }
3945
40- if (! $ signature ->validate ($ data , $ this -> data ['signature ' ])) {
46+ if (! $ signature ->validate ($ dataSignature , $ data ['signature ' ])) {
4147 throw new InvalidResponseException (sprintf ('Data signature response from MoMo is invalid! ' ));
4248 }
4349 }
You can’t perform that action at this time.
0 commit comments