@@ 10-88 (lines=79) @@ | ||
7 | * |
|
8 | * @method Response send() |
|
9 | */ |
|
10 | class CompleteAuthorizeRequest extends AbstractRequest |
|
11 | { |
|
12 | /** |
|
13 | * Get MD. |
|
14 | * |
|
15 | * @return string |
|
16 | */ |
|
17 | public function getMD() |
|
18 | { |
|
19 | return $this->getParameter('MD'); |
|
20 | } |
|
21 | ||
22 | /** |
|
23 | * Set MD. |
|
24 | * |
|
25 | * @param string $value |
|
26 | * |
|
27 | * @return static|\Omnipay\Common\Message\AbstractRequest |
|
28 | */ |
|
29 | public function setMD($value) |
|
30 | { |
|
31 | return $this->setParameter('MD', $value); |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * Get PaRes. |
|
36 | * |
|
37 | * @return string |
|
38 | */ |
|
39 | public function getPaRes() |
|
40 | { |
|
41 | return $this->getParameter('PaRes'); |
|
42 | } |
|
43 | ||
44 | /** |
|
45 | * Set PaRes. |
|
46 | * |
|
47 | * @param string $value |
|
48 | * |
|
49 | * @return static|\Omnipay\Common\Message\AbstractRequest |
|
50 | */ |
|
51 | public function setPaRes($value) |
|
52 | { |
|
53 | return $this->setParameter('PaRes', $value); |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * Get the raw data array for this message. The format of this varies from gateway to |
|
58 | * gateway, but will usually be either an associative array, or a SimpleXMLElement. |
|
59 | * |
|
60 | * @return array |
|
61 | */ |
|
62 | public function getData() |
|
63 | { |
|
64 | $this->validate('transactionReference', 'MD', 'PaRes'); |
|
65 | ||
66 | return [ |
|
67 | 'opcode' => 3, |
|
68 | 'payment_id' => $this->getTransactionReference(), |
|
69 | 'PaRes' => $this->getPaRes(), |
|
70 | 'MD' => $this->getMD(), |
|
71 | 'token' => $this->getRequestToken(), |
|
72 | ]; |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * Get a request token. |
|
77 | * |
|
78 | * @return string |
|
79 | */ |
|
80 | public function getRequestToken() |
|
81 | { |
|
82 | return md5( |
|
83 | $this->getMerchantId() |
|
84 | .$this->getTransactionReference() |
|
85 | .$this->getSecretWord() |
|
86 | ); |
|
87 | } |
|
88 | } |
|
89 |
@@ 10-88 (lines=79) @@ | ||
7 | * |
|
8 | * @method Response send() |
|
9 | */ |
|
10 | class CompletePurchaseRequest extends AbstractRequest |
|
11 | { |
|
12 | /** |
|
13 | * Get MD. |
|
14 | * |
|
15 | * @return string |
|
16 | */ |
|
17 | public function getMD() |
|
18 | { |
|
19 | return $this->getParameter('MD'); |
|
20 | } |
|
21 | ||
22 | /** |
|
23 | * Set MD. |
|
24 | * |
|
25 | * @param string $value |
|
26 | * |
|
27 | * @return static|\Omnipay\Common\Message\AbstractRequest |
|
28 | */ |
|
29 | public function setMD($value) |
|
30 | { |
|
31 | return $this->setParameter('MD', $value); |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * Get PaRes. |
|
36 | * |
|
37 | * @return string |
|
38 | */ |
|
39 | public function getPaRes() |
|
40 | { |
|
41 | return $this->getParameter('PaRes'); |
|
42 | } |
|
43 | ||
44 | /** |
|
45 | * Set PaRes. |
|
46 | * |
|
47 | * @param string $value |
|
48 | * |
|
49 | * @return static|\Omnipay\Common\Message\AbstractRequest |
|
50 | */ |
|
51 | public function setPaRes($value) |
|
52 | { |
|
53 | return $this->setParameter('PaRes', $value); |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * Get the raw data array for this message. The format of this varies from gateway to |
|
58 | * gateway, but will usually be either an associative array, or a SimpleXMLElement. |
|
59 | * |
|
60 | * @return array |
|
61 | */ |
|
62 | public function getData() |
|
63 | { |
|
64 | $this->validate('transactionReference', 'MD', 'PaRes'); |
|
65 | ||
66 | return [ |
|
67 | 'opcode' => 3, |
|
68 | 'payment_id' => $this->getTransactionReference(), |
|
69 | 'PaRes' => $this->getPaRes(), |
|
70 | 'MD' => $this->getMD(), |
|
71 | 'token' => $this->getRequestToken(), |
|
72 | ]; |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * Get a request token. |
|
77 | * |
|
78 | * @return string |
|
79 | */ |
|
80 | public function getRequestToken() |
|
81 | { |
|
82 | return md5( |
|
83 | $this->getMerchantId() |
|
84 | .$this->getTransactionReference() |
|
85 | .$this->getSecretWord() |
|
86 | ); |
|
87 | } |
|
88 | } |
|
89 |