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 |
||
52 | |||
53 | /** |
||
54 | * @param int $orderId |
||
55 | * @param float $amount |
||
56 | * @param string $sharedKey |
||
57 | * @param string $currency |
||
58 | * @return string |
||
59 | */ |
||
60 | public static function generateChecksum1(int $orderId, float $amount, string $sharedKey, string $currency) : string |
||
66 | |||
67 | /** |
||
68 | * Dandomain has a bug in their payment implementation where they don't |
||
69 | * include amount in checksum on their complete/success page |
||
70 | * |
||
71 | * @param int $orderId |
||
72 | * @param string $sharedKey |
||
73 | * @param string $currency |
||
74 | * @return string |
||
75 | */ |
||
76 | public static function generateChecksum2(int $orderId, string $sharedKey, string $currency) : string |
||
80 | |||
81 | /** |
||
82 | * @return PaymentRequest |
||
83 | */ |
||
84 | public function getPaymentRequest() : PaymentRequest |
||
88 | |||
89 | /** |
||
90 | * @param PaymentRequest $paymentRequest |
||
91 | * @return Handler |
||
92 | */ |
||
93 | public function setPaymentRequest(PaymentRequest $paymentRequest) : self |
||
98 | } |
||
99 |