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\Merchant; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Title: MultiSafepay Connect XML status request message |
10
|
|
|
* Description: |
11
|
|
|
* Copyright: 2005-2021 Pronamic |
12
|
|
|
* Company: Pronamic |
13
|
|
|
* |
14
|
|
|
* @author Remco Tolsma |
15
|
|
|
* @version 2.0.2 |
16
|
|
|
* @since 1.0.0 |
17
|
|
|
*/ |
18
|
|
|
class StatusRequestMessage extends RequestMessage { |
19
|
|
|
/** |
20
|
|
|
* The document element name |
21
|
|
|
* |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
const NAME = 'status'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Transaction ID. |
28
|
|
|
* |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
public $transaction_id; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Constructs and initialize an status message |
35
|
|
|
* |
36
|
|
|
* @param Merchant $merchant Merchant. |
37
|
|
|
* @param string $transaction_id Transaction ID. |
38
|
|
|
*/ |
39
|
|
|
public function __construct( Merchant $merchant, $transaction_id ) { |
40
|
|
|
parent::__construct( self::NAME ); |
41
|
|
|
|
42
|
|
|
$this->merchant = $merchant; |
43
|
|
|
$this->transaction_id = $transaction_id; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Get document |
48
|
|
|
* |
49
|
|
|
* @see Pronamic_Gateways_IDealAdvancedV3_XML_RequestMessage::get_document() |
50
|
|
|
*/ |
51
|
|
|
public function get_document() { |
52
|
|
|
$document = parent::get_document(); |
53
|
|
|
|
54
|
|
|
// Merchant. |
55
|
|
|
$merchant = XML_Util::add_element( $document, $document->documentElement, 'merchant' ); |
56
|
|
|
|
57
|
|
|
XML_Util::add_elements( |
58
|
|
|
$document, |
59
|
|
|
$merchant, |
60
|
|
|
array( |
61
|
|
|
'account' => $this->merchant->account, |
62
|
|
|
'site_id' => $this->merchant->site_id, |
63
|
|
|
'site_secure_code' => $this->merchant->site_secure_code, |
64
|
|
|
) |
65
|
|
|
); |
66
|
|
|
|
67
|
|
|
// Transaction. |
68
|
|
|
$transaction = XML_Util::add_element( $document, $document->documentElement, 'transaction' ); |
69
|
|
|
|
70
|
|
|
XML_Util::add_elements( |
71
|
|
|
$document, |
72
|
|
|
$transaction, |
73
|
|
|
array( |
74
|
|
|
'id' => $this->transaction_id, |
75
|
|
|
) |
76
|
|
|
); |
77
|
|
|
|
78
|
|
|
return $document; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|