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
|
|
|
use Pronamic\WordPress\Pay\Gateways\MultiSafepay\Transaction; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Title: MultiSafepay Connect XML redirect transaction request message |
12
|
|
|
* Description: |
13
|
|
|
* Copyright: 2005-2021 Pronamic |
14
|
|
|
* Company: Pronamic |
15
|
|
|
* |
16
|
|
|
* @author Remco Tolsma |
17
|
|
|
* @version 2.0.2 |
18
|
|
|
* @since 1.0.0 |
19
|
|
|
*/ |
20
|
|
|
class RedirectTransactionRequestMessage extends RequestMessage { |
21
|
|
|
/** |
22
|
|
|
* The document element name |
23
|
|
|
* |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
const NAME = 'redirecttransaction'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Constructs and initialize an directory response message |
30
|
|
|
* |
31
|
|
|
* @param Merchant $merchant Merchant. |
32
|
|
|
* @param Customer $customer Customer. |
33
|
|
|
* @param Transaction $transaction Transaction. |
34
|
|
|
*/ |
35
|
|
|
public function __construct( $merchant, $customer, $transaction ) { |
36
|
|
|
parent::__construct( self::NAME ); |
37
|
|
|
|
38
|
|
|
$this->merchant = $merchant; |
39
|
|
|
$this->customer = $customer; |
40
|
|
|
$this->transaction = $transaction; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Get document |
45
|
|
|
* |
46
|
|
|
* @see Pronamic_Gateways_IDealAdvancedV3_XML_RequestMessage::get_document() |
47
|
|
|
*/ |
48
|
|
|
public function get_document() { |
49
|
|
|
$document = parent::get_document(); |
50
|
|
|
|
51
|
|
|
// Merchant. |
52
|
|
|
$merchant = XML_Util::add_element( $document, $document->documentElement, 'merchant' ); |
53
|
|
|
|
54
|
|
|
XML_Util::add_elements( |
55
|
|
|
$document, |
56
|
|
|
$merchant, |
57
|
|
|
array( |
58
|
|
|
'account' => $this->merchant->account, |
59
|
|
|
'site_id' => $this->merchant->site_id, |
60
|
|
|
'site_secure_code' => $this->merchant->site_secure_code, |
61
|
|
|
'notification_url' => $this->merchant->notification_url, |
62
|
|
|
'redirect_url' => $this->merchant->redirect_url, |
63
|
|
|
'cancel_url' => $this->merchant->cancel_url, |
64
|
|
|
'close_window' => $this->merchant->close_window, |
65
|
|
|
) |
66
|
|
|
); |
67
|
|
|
|
68
|
|
|
// Customer. |
69
|
|
|
$customer = XML_Util::add_element( $document, $document->documentElement, 'customer' ); |
70
|
|
|
|
71
|
|
|
XML_Util::add_elements( |
72
|
|
|
$document, |
73
|
|
|
$customer, |
74
|
|
|
array( |
75
|
|
|
'locale' => $this->customer->locale, |
76
|
|
|
'ipaddress' => $this->customer->ip_address, |
77
|
|
|
'forwardedip' => $this->customer->forwarded_ip, |
78
|
|
|
'firstname' => $this->customer->first_name, |
79
|
|
|
'lastname' => $this->customer->last_name, |
80
|
|
|
'address1' => $this->customer->address_1, |
81
|
|
|
'address2' => $this->customer->address_2, |
82
|
|
|
'housenumber' => $this->customer->house_number, |
83
|
|
|
'zipcode' => $this->customer->zip_code, |
84
|
|
|
'city' => $this->customer->city, |
85
|
|
|
'country' => $this->customer->country, |
86
|
|
|
'phone' => $this->customer->phone, |
87
|
|
|
'email' => $this->customer->email, |
88
|
|
|
) |
89
|
|
|
); |
90
|
|
|
|
91
|
|
|
// Transaction. |
92
|
|
|
$transaction = XML_Util::add_element( $document, $document->documentElement, 'transaction' ); |
93
|
|
|
|
94
|
|
|
XML_Util::add_elements( |
95
|
|
|
$document, |
96
|
|
|
$transaction, |
97
|
|
|
array( |
98
|
|
|
'id' => $this->transaction->id, |
99
|
|
|
'currency' => $this->transaction->currency, |
100
|
|
|
'amount' => $this->transaction->amount, |
101
|
|
|
'description' => $this->transaction->description, |
102
|
|
|
'var1' => $this->transaction->var1, |
103
|
|
|
'var2' => $this->transaction->var2, |
104
|
|
|
'var3' => $this->transaction->var3, |
105
|
|
|
'items' => $this->transaction->items, |
106
|
|
|
'manual' => $this->transaction->manual, |
107
|
|
|
'gateway' => $this->transaction->gateway, |
108
|
|
|
'daysactive' => $this->transaction->days_active, |
109
|
|
|
) |
110
|
|
|
); |
111
|
|
|
|
112
|
|
|
// Signature. |
113
|
|
|
XML_Util::add_element( $document, $document->documentElement, 'signature', $this->signature ); |
|
|
|
|
114
|
|
|
|
115
|
|
|
return $document; |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|