1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link https://github.com/phpviet/omnipay-momo |
4
|
|
|
* @copyright (c) PHP Viet |
5
|
|
|
* @license [MIT](http://www.opensource.org/licenses/MIT) |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Omnipay\MoMo\Message\AllInOne; |
9
|
|
|
|
10
|
|
|
use Symfony\Component\HttpFoundation\ParameterBag; |
11
|
|
|
use Omnipay\MoMo\Message\AbstractIncomingRequest as BaseAbstractIncomingRequest; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @author Vuong Minh <[email protected]> |
15
|
|
|
* @since 1.0.0 |
16
|
|
|
*/ |
17
|
|
|
abstract class AbstractIncomingRequest extends BaseAbstractIncomingRequest |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* {@inheritdoc} |
21
|
|
|
* @throws \Omnipay\Common\Exception\InvalidResponseException |
22
|
|
|
*/ |
23
|
|
|
public function sendData($data): IncomingResponse |
24
|
|
|
{ |
25
|
|
|
return $this->response = new IncomingResponse($this, $data); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
|
|
protected function getIncomingParameters(): array |
32
|
|
|
{ |
33
|
|
|
$data = []; |
34
|
|
|
$params = [ |
35
|
|
|
'partnerCode', 'accessKey', 'requestId', 'amount', 'orderId', 'orderInfo', 'orderType', 'transId', |
36
|
|
|
'message', 'localMessage', 'responseTime', 'errorCode', 'extraData', 'signature', 'payType', |
37
|
|
|
]; |
38
|
|
|
$bag = $this->getIncomingParametersBag(); |
39
|
|
|
|
40
|
|
|
foreach ($params as $param) { |
41
|
|
|
$data[$param] = $bag->get($param); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
return $data; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Trả về request parameter bag. |
49
|
|
|
* |
50
|
|
|
* @return \Symfony\Component\HttpFoundation\ParameterBag |
51
|
|
|
*/ |
52
|
|
|
abstract protected function getIncomingParametersBag(): ParameterBag; |
53
|
|
|
} |
54
|
|
|
|