1 | <?php |
||
11 | class Handler |
||
12 | { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $sharedKey1; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $sharedKey2; |
||
22 | |||
23 | /** |
||
24 | * @var PaymentRequest |
||
25 | */ |
||
26 | protected $paymentRequest; |
||
27 | |||
28 | public function __construct(Request $request, string $sharedKey1, string $sharedKey2) |
||
37 | |||
38 | /** |
||
39 | * Returns true if the checksum given from Dandomain matches the checksum we can compute |
||
40 | * |
||
41 | * @return bool |
||
42 | */ |
||
43 | public function checksumMatches() : bool |
||
47 | |||
48 | /** |
||
49 | * @return string |
||
50 | */ |
||
51 | public function getChecksum1() { |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getChecksum2() { |
||
70 | |||
71 | /** |
||
72 | * @param int $orderId |
||
73 | * @param float $amount |
||
74 | * @param string $sharedKey |
||
75 | * @param int $currency |
||
76 | * @return string |
||
77 | */ |
||
78 | public static function generateChecksum1(int $orderId, float $amount, string $sharedKey, int $currency) : string |
||
84 | |||
85 | /** |
||
86 | * Dandomain has a bug in their payment implementation where they don't |
||
87 | * include amount in checksum on their complete/success page. |
||
88 | * That is why we have a second method for computing that checksum |
||
89 | * |
||
90 | * @param int $orderId |
||
91 | * @param string $sharedKey |
||
92 | * @param int $currency |
||
93 | * @return string |
||
94 | */ |
||
95 | public static function generateChecksum2(int $orderId, string $sharedKey, int $currency) : string |
||
99 | |||
100 | /** |
||
101 | * @return PaymentRequest |
||
102 | */ |
||
103 | public function getPaymentRequest() : PaymentRequest |
||
107 | |||
108 | /** |
||
109 | * @param PaymentRequest $paymentRequest |
||
110 | * @return Handler |
||
111 | */ |
||
112 | public function setPaymentRequest(PaymentRequest $paymentRequest) : self |
||
117 | } |
||
118 |