File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Omnipay \NABTransact \Message ;
4+
5+ class DirectPostWebhookRequest extends DirectPostAbstractRequest
6+ {
7+ private $ data = [];
8+
9+ public function __construct ($ data = [])
10+ {
11+ $ this ->data = $ data ;
12+ }
13+
14+ public function generateResponseFingerprint ($ data )
15+ {
16+ $ hashable = [
17+ $ data ['merchant ' ],
18+ $ data ['txn_password ' ],
19+ $ data ['refid ' ],
20+ $ data ['amount ' ],
21+ $ data ['timestamp ' ],
22+ $ data ['summarycode ' ],
23+ ];
24+
25+ $ fields = implode ('| ' , $ hashable );
26+
27+ return sha1 ($ fields );
28+ }
29+
30+ public function vefiyFingerPrint ($ fingerprint )
31+ {
32+ $ data = $ this ->data ;
33+
34+ if ($ fingerprint !== $ this ->generateResponseFingerprint ($ data )) {
35+ $ data ['restext ' ] = $ data ['restext ' ] . ', Invalid fingerprint. ' ;
36+ $ data ['summarycode ' ] = 3 ;
37+ }
38+
39+ return new DirectPostCompletePurchaseResponse ($ this , $ data );
40+ }
41+
42+ public function getData ()
43+ {
44+ return $ this ->data ;
45+ }
46+
47+ public function sendData ($ data ){}
48+ }
You can’t perform that action at this time.
0 commit comments