1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay\XML; |
4
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\Core\XML\Util as XML_Util; |
6
|
|
|
use Pronamic\WordPress\Pay\Gateways\MultiSafepay\Customer; |
7
|
|
|
use Pronamic\WordPress\Pay\Gateways\MultiSafepay\Merchant; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Title: MultiSafepay Connect XML gateways request message |
11
|
|
|
* Description: |
12
|
|
|
* Copyright: 2005-2021 Pronamic |
13
|
|
|
* Company: Pronamic |
14
|
|
|
* |
15
|
|
|
* @author Remco Tolsma |
16
|
|
|
* @version 2.0.2 |
17
|
|
|
* @since 1.2.0 |
18
|
|
|
*/ |
19
|
|
|
class GatewaysRequestMessage extends RequestMessage { |
20
|
|
|
/** |
21
|
|
|
* The document element name |
22
|
|
|
* |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
const NAME = 'gateways'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Constructs and initialize an directory response message |
29
|
|
|
* |
30
|
|
|
* @param Merchant $merchant Merchant. |
31
|
|
|
* @param Customer $customer Customer. |
32
|
|
|
*/ |
33
|
1 |
|
public function __construct( Merchant $merchant, Customer $customer ) { |
34
|
1 |
|
parent::__construct( self::NAME ); |
35
|
|
|
|
36
|
1 |
|
$this->merchant = $merchant; |
37
|
1 |
|
$this->customer = $customer; |
38
|
1 |
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Get document |
42
|
|
|
* |
43
|
|
|
* @see Pronamic_Gateways_IDealAdvancedV3_XML_RequestMessage::get_document() |
44
|
|
|
*/ |
45
|
1 |
|
public function get_document() { |
46
|
1 |
|
$document = parent::get_document(); |
47
|
|
|
|
48
|
|
|
// Merchant. |
49
|
1 |
|
$merchant = XML_Util::add_element( $document, $document->documentElement, 'merchant' ); |
50
|
|
|
|
51
|
1 |
|
XML_Util::add_elements( |
52
|
1 |
|
$document, |
53
|
1 |
|
$merchant, |
54
|
|
|
array( |
55
|
1 |
|
'account' => $this->merchant->account, |
56
|
1 |
|
'site_id' => $this->merchant->site_id, |
57
|
1 |
|
'site_secure_code' => $this->merchant->site_secure_code, |
58
|
|
|
) |
59
|
|
|
); |
60
|
|
|
|
61
|
|
|
// Customer. |
62
|
1 |
|
$customer = XML_Util::add_element( $document, $document->documentElement, 'customer' ); |
63
|
|
|
|
64
|
1 |
|
XML_Util::add_elements( |
65
|
1 |
|
$document, |
66
|
1 |
|
$customer, |
67
|
|
|
array( |
68
|
1 |
|
'country' => $this->customer->country, |
69
|
1 |
|
'locale' => $this->customer->locale, |
70
|
|
|
) |
71
|
|
|
); |
72
|
|
|
|
73
|
1 |
|
return $document; |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|