|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Omnipay\Sofort\Message; |
|
4
|
|
|
|
|
5
|
|
|
use SimpleXMLElement; |
|
6
|
|
|
|
|
7
|
|
|
class AuthorizeRequest extends AbstractRequest |
|
8
|
|
|
{ |
|
9
|
|
|
public function getData() |
|
10
|
|
|
{ |
|
11
|
|
|
$data = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><multipay/>'); |
|
12
|
|
|
|
|
13
|
|
|
$data->addChild('project_id', $this->getProjectId()); |
|
14
|
|
|
$data->addChild('amount', $this->getAmount()); |
|
15
|
|
|
$data->addChild('currency_code', $this->getCurrency()); |
|
16
|
|
|
$data->addChild('test', $this->getTestMode()); |
|
17
|
|
|
$data->addChild('success_url', str_replace('&', '&', $this->getReturnUrl())); |
|
18
|
|
|
$data->addChild('abort_url', str_replace('&', '&', $this->getCancelUrl())); |
|
19
|
|
|
$data->addChild('notification_urls')->addChild( |
|
20
|
|
|
'notification_url', |
|
21
|
|
|
str_replace('&', '&', $this->getNotifyUrl()) |
|
22
|
|
|
); |
|
23
|
|
|
|
|
24
|
|
|
$reasons = $data->addChild('reasons'); |
|
25
|
|
|
|
|
26
|
|
|
if (is_string($this->getDescription())) { |
|
27
|
|
|
$reasons->addChild('reason', $this->getDescription()); |
|
28
|
|
|
} elseif (is_array($this->getDescription())) { |
|
29
|
|
|
foreach ($this->getDescription() as $reason) { |
|
30
|
|
|
$reasons->addChild('reason', $reason); |
|
31
|
|
|
} |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
$su = $data->addChild('su'); |
|
35
|
|
|
$su->addChild('customer_protection', (int) (bool) $this->getProtection()); |
|
36
|
|
|
|
|
37
|
|
|
$sender = $data->addChild('sender'); |
|
38
|
|
|
$sender->addChild('country_code', $this->getCountry()); |
|
39
|
|
|
|
|
40
|
|
|
return $data; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
protected function createResponse($response) |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->response = new AuthorizeResponse($this, $response); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|