Test Failed
Push — develop ( 61c5d3...602393 )
by Reüel
06:05
created

PaymentDetailsRequest::set_details()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php
2
/**
3
 * Payment details request
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2020 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\Adyen
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Adyen;
12
13
/**
14
 * Payment details request
15
 *
16
 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments/details
17
 *
18
 * @author  Reüel van der Steege
19
 * @version 1.1.0
20
 * @since   1.1.0
21
 */
22
class PaymentDetailsRequest extends Request {
23
	/**
24
	 * Use this collection to submit the details that were returned as a result of the /payments call.
25
	 *
26
	 * @var object
27
	 */
28
	private $details;
29
30
	/**
31
	 * The paymentData value that you received in the response to the /payments call.
32
	 *
33
	 * @var string
34
	 */
35
	private $payment_data;
36
37
	/**
38
	 * Construct a payment details request object.
39
	 *
40
	 * @param object $details Details.
41
	 */
42
	public function __construct( $details ) {
43
		$this->details = $details;
44
	}
45
46
	/**
47
	 * Get details.
48
	 *
49
	 * @return object
50
	 */
51
	public function get_details() {
52
		return $this->details;
53
	}
54
55
	/**
56
	 * Set details.
57
	 *
58
	 * @param DetailsInformation $details Details.
59
	 */
60
	public function set_details( DetailsInformation $details ) {
61
		$this->details = $details;
62
	}
63
64
	/**
65
	 * Get payment data.
66
	 *
67
	 * @return string
68
	 */
69
	public function get_payment_data() {
70
		return $this->payment_data;
71
	}
72
73
	/**
74
	 * Set payment data.
75
	 *
76
	 * @param string $payment_data Payment data.
77
	 */
78
	public function set_payment_data( $payment_data ) {
79
		$this->payment_data = $payment_data;
80
	}
81
82
	/**
83
	 * Get JSON.
84
	 *
85
	 * @return object
86
	 */
87
	public function get_json() {
88
		$properties = Util::filter_null(
89
			array(
90
				'details'     => $this->get_details(),
91
				'paymentData' => $this->get_payment_data(),
92
			)
93
		);
94
95
		$object = (object) $properties;
96
97
		return $object;
98
	}
99
}
100