File tree Expand file tree Collapse file tree 2 files changed +45
-17
lines changed
Expand file tree Collapse file tree 2 files changed +45
-17
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Omnipay \Gomypay ;
4+
5+ class Hasher
6+ {
7+ /**
8+ * @var string
9+ */
10+ private $ customerId ;
11+ /**
12+ * @var string
13+ */
14+ private $ strCheck ;
15+
16+ public function __construct ($ customerId , $ strCheck )
17+ {
18+ $ this ->customerId = $ customerId ;
19+ $ this ->strCheck = $ strCheck ;
20+ }
21+
22+ public function make (array $ data )
23+ {
24+ $ amount = 0 ;
25+ if (array_key_exists ('PayAmount ' , $ data )) {
26+ $ amount = $ data ['PayAmount ' ];
27+ } elseif (array_key_exists ('e_money ' , $ data )) {
28+ $ amount = $ data ['e_money ' ];
29+ } elseif (array_key_exists ('Amount ' , $ data )) {
30+ $ amount = $ data ['Amount ' ];
31+ }
32+
33+ return md5 (implode ('' , [
34+ $ data ['result ' ],
35+ $ data ['e_orderno ' ],
36+ $ this ->customerId ,
37+ $ amount ,
38+ $ data ['OrderID ' ],
39+ $ this ->strCheck ,
40+ ]));
41+ }
42+ }
Original file line number Diff line number Diff line change 22
33namespace Omnipay \Gomypay \Traits ;
44
5+ use Omnipay \Gomypay \Hasher ;
6+
57trait HasGomypay
68{
79 public function getCustomerId ()
@@ -47,22 +49,6 @@ public function setStr_Check($value)
4749
4850 public function makeHash (array $ data )
4951 {
50- $ amount = 0 ;
51- if (array_key_exists ('PayAmount ' , $ data )) {
52- $ amount = $ data ['PayAmount ' ];
53- } elseif (array_key_exists ('e_money ' , $ data )) {
54- $ amount = $ data ['e_money ' ];
55- } elseif (array_key_exists ('Amount ' , $ data )) {
56- $ amount = $ data ['Amount ' ];
57- }
58-
59- return md5 (implode ('' , [
60- $ data ['result ' ],
61- $ data ['e_orderno ' ],
62- $ this ->getCustomerId (),
63- $ amount ,
64- $ data ['OrderID ' ],
65- $ this ->getStrCheck (),
66- ]));
52+ return (new Hasher ($ this ->getCustomerId (), $ this ->getStrCheck ()))->make ($ data );
6753 }
6854}
You can’t perform that action at this time.
0 commit comments