Failed Conditions
Push — develop ( f60bb0...ae6dce )
by Remco
02:44
created

PaymentRequest::get_shopper_name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Payment request
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 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
 * Title: Adyen payment request
15
 * Description:
16
 * Copyright: 2005-2019 Pronamic
17
 * Company: Pronamic
18
 *
19
 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v40/payments
20
 *
21
 * @author  Reüel van der Steege
22
 * @version 1.0.0
23
 * @since   1.0.0
24
 */
25
class PaymentRequest extends AbstractPaymentRequest {
26
	/**
27
	 * The collection that contains the type of the payment method and its
28
	 * specific information (e.g. idealIssuer).
29
	 *
30
	 * @var PaymentMethod
31
	 */
32
	private $payment_method;
33
34
	/**
35
	 * The shopper's telephone number.
36
	 *
37
	 * @var string
38
	 */
39
	public $shopper_telephone_number;
40
41
	/**
42
	 * Construct a payment request object.
43
	 *
44
	 * @param Amount        $amount           The amount information for the transaction.
45
	 * @param string        $merchant_account The merchant account identifier, with which you want to process the transaction.
46
	 * @param string        $reference        The reference to uniquely identify a payment.
47
	 * @param string        $return_url       The URL to return to.
48
	 * @param PaymentMethod $payment_method   The collection that contains the type of the payment method and its specific information (e.g. idealIssuer).
49
	 */
50
	public function __construct( Amount $amount, $merchant_account, $reference, $return_url, PaymentMethod $payment_method ) {
51
		parent::__construct( $amount, $merchant_account, $reference, $return_url );
52
53
		$this->set_payment_method( $payment_method );
54
	}
55
56
	/**
57
	 * Get payment method.
58
	 *
59
	 * @return PaymentMethod
60
	 */
61
	public function get_payment_method() {
62
		return $this->payment_method;
63
	}
64
65
	/**
66
	 * Set payment method.
67
	 *
68
	 * @param PaymentMethod $payment_method Payment method.
69
	 */
70
	public function set_payment_method( PaymentMethod $payment_method ) {
71
		$this->payment_method = $payment_method;
72
	}
73
74
	/**
75
	 * Get JSON.
76
	 *
77
	 * @return object
78
	 */
79
	public function get_json() {
80
		$object = parent::get_json();
81
82
		// Payment method.
83
		$object->paymentMethod = $this->get_payment_method()->get_json();
84
85
		// Return object.
86
		return $object;
87
	}
88
}
89