|
1
|
|
|
<?php |
|
2
|
|
|
namespace Omnipay\Heidelpay\Message; |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* Payment Request |
|
6
|
|
|
* |
|
7
|
|
|
* @method Response send() |
|
8
|
|
|
*/ |
|
9
|
|
|
class PaymentRequest extends AbstractRequest |
|
10
|
|
|
{ |
|
11
|
|
|
public function getData() |
|
12
|
|
|
{ |
|
13
|
|
|
$this->validate('amount', 'currency', 'typeId'); |
|
14
|
|
|
|
|
15
|
|
|
$data = []; |
|
16
|
|
|
$data['amount'] = $this->getAmount(); |
|
17
|
|
|
$data['currency'] = $this->getCurrency(); |
|
18
|
|
|
|
|
19
|
|
|
if ($this->getReturnUrl()) { |
|
20
|
|
|
$data['returnUrl'] = $this->getReturnUrl(); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
if ($this->getTransactionId()) { |
|
24
|
|
|
$data['orderId'] = $this->getTransactionId(); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
$data['resources.typeId'] = $this->getTypeId(); |
|
28
|
|
|
|
|
29
|
|
|
if ($this->getCustomerId()) { |
|
30
|
|
|
$data['resources.customerId'] = $this->getCustomerId(); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
if ($this->getBasketId()) { |
|
34
|
|
|
$data['resources.basketId'] = $this->getBasketId(); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
if ($this->getMetaDataId()) { |
|
38
|
|
|
$data['resources.metadataid'] = $this->getMetaDataId(); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
return $data; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function getMetaDataId() |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->getParameter('metadataid'); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function setMetaDataId($value) |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->setParameter('metadataid', $value); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getBasketId() |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->getParameter('basketId'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function setBasketId($value) |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->setParameter('basketId', $value); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function getCustomerId() |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->getParameter('customerId'); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function setCustomerId($value) |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->setParameter('customerId', $value); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getTypeId() |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->getParameter('typeId'); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function setTypeId($value) |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->setParameter('typeId', $value); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function getEndpoint() |
|
85
|
|
|
{ |
|
86
|
|
|
return parent::getEndpoint() . 'payments/'; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
protected function createResponse($data) |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->response = new PaymentResponse($this, $data); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|