File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ Tất cả lịch sử tiến trình phát triển thư viện
55## 1.0.1
66
77- Implement phương thức ` isCancelled ` ở lớp ` \Omnipay\VTCPay\Message\Response ` .
8+ - Throw exception ở concern ` \Omnipay\VTCPay\Message\Conerns\ResponseSignatureValidation ` khi response không tồn tại chữ ký.
Original file line number Diff line number Diff line change @@ -23,14 +23,19 @@ trait ResponseSignatureValidation
2323 */
2424 protected function validateSignature (): void
2525 {
26- $ data = $ this ->getData ();
26+ $ data = $ dataSignature = $ this ->getData ();
27+
28+ if (! isset ($ data ['signature ' ])) {
29+ throw new InvalidResponseException (sprintf ('Response from VTCPay is invalid! ' ));
30+ }
31+
2732 $ signature = new Signature (
2833 $ this ->getRequest ()->getSecurityCode ()
2934 );
30- $ actual = $ data ['signature ' ];
31- unset($ data ['signature ' ]);
3235
33- if (! $ signature ->validate ($ data , $ actual )) {
36+ unset($ dataSignature ['signature ' ]);
37+
38+ if (! $ signature ->validate ($ dataSignature , $ data ['signature ' ])) {
3439 throw new InvalidResponseException (sprintf ('Data signature response from VTCPay is invalid! ' ));
3540 }
3641 }
You can’t perform that action at this time.
0 commit comments