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
10
10
## 1.0.2
11
11
12
12
- 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
24
24
*/
25
25
protected function validateSignature (): void
26
26
{
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 = [];
28
34
$ signature = new Signature (
29
35
$ this ->getRequest ()->getSecretKey ()
30
36
);
@@ -34,10 +40,10 @@ protected function validateSignature(): void
34
40
$ pos = $ parameter ;
35
41
}
36
42
37
- $ data [$ pos ] = Arr::getValue ($ parameter , $ this -> data );
43
+ $ dataSignature [$ pos ] = Arr::getValue ($ parameter , $ data );
38
44
}
39
45
40
- if (! $ signature ->validate ($ data , $ this -> data ['signature ' ])) {
46
+ if (! $ signature ->validate ($ dataSignature , $ data ['signature ' ])) {
41
47
throw new InvalidResponseException (sprintf ('Data signature response from MoMo is invalid! ' ));
42
48
}
43
49
}
You can’t perform that action at this time.
0 commit comments