File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
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\OnePay\Message\Response ` .
8+ - Throw exception ở concern ` \Omnipay\OnePay\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,20 @@ trait ResponseSignatureValidation
2323 */
2424 protected function validateSignature (): void
2525 {
26- $ data = array_filter ($ this ->data , function ($ parameter ) {
26+ $ data = $ this ->getData ();
27+
28+ if (! isset ($ data ['vpc_SecureHash ' ])) {
29+ throw new InvalidResponseException ('Response from OnePay is invalid! ' );
30+ }
31+
32+ $ dataSignature = array_filter ($ data , function ($ parameter ) {
2733 return 0 === strpos ($ parameter , 'vpc_ ' ) && 'vpc_SecureHash ' !== $ parameter ;
2834 }, ARRAY_FILTER_USE_KEY );
2935 $ signature = new Signature (
3036 $ this ->getRequest ()->getVpcHashKey ()
3137 );
3238
33- if (! $ signature ->validate ($ data , $ this -> data ['vpc_SecureHash ' ])) {
39+ if (! $ signature ->validate ($ dataSignature , $ data ['vpc_SecureHash ' ])) {
3440 throw new InvalidResponseException (sprintf ('Data signature response from OnePay is invalid! ' ));
3541 }
3642 }
You can’t perform that action at this time.
0 commit comments