Failed Conditions
Push — master ( cc3467...84f509 )
by Reüel
09:31 queued 01:25
created

ApplicationInfo   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 79
ccs 12
cts 12
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get_json() 0 15 1
A jsonSerialize() 0 2 1
1
<?php
2
/**
3
 * Application info
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
 * Application info
15
 *
16
 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__reqParam_applicationInfo
17
 * @link https://docs.adyen.com/development-resources/building-adyen-solutions
18
 *
19
 * @author  Remco Tolsma
20
 * @version 1.0.0
21
 * @since   1.0.0
22
 */
23
class ApplicationInfo implements \JsonSerializable {
24
	/**
25
	 * Adyen-developed software, such as libraries and plugins, used to interact with the Adyen API. For example, Magento plugin, Java API library, etc.
26
	 *
27
	 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__reqParam_applicationInfo-adyenLibrary
28
	 * @var object|null
29
	 */
30
	public $adyen_library;
31
32
	/**
33
	 * Adyen-developed software to get payment details. For example, Checkout SDK, Secured Fields SDK, etc.
34
	 *
35
	 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__reqParam_applicationInfo-adyenPaymentSource
36
	 * @var object|null
37
	 */
38
	public $adyen_payment_source;
39
40
	/**
41
	 * Third-party developed platform used to initiate payment requests. For example, Magento, Zuora, etc.
42
	 *
43
	 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__reqParam_applicationInfo-externalPlatform
44
	 * @var object|null
45
	 */
46
	public $external_platform;
47
48
	/**
49
	 * Merchant developed software, such as cashier application, used to interact with the Adyen API.
50
	 *
51
	 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__reqParam_applicationInfo-merchantApplication
52
	 * @var object|null
53
	 */
54
	public $merchant_application;
55
56
	/**
57
	 * Merchant device information.
58
	 *
59
	 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__reqParam_applicationInfo-merchantDevice
60
	 * @var object|null
61
	 */
62
	public $merchant_device;
63
64
	/**
65
	 * Shopper interaction device, such as terminal, mobile device or web browser, to initiate payment requests.
66
	 *
67
	 * @link https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v51/payments__reqParam_applicationInfo-shopperInteractionDevice
68
	 * @var object|null
69
	 */
70
	public $shopper_interaction_device;
71
72
	/**
73
	 * Get JSON.
74
	 *
75
	 * @return object
76
	 */
77 2
	public function get_json() {
78 2
		$properties = Util::filter_null(
79
			array(
80 2
				'adyenLibrary'             => $this->adyen_library,
81 2
				'adyenPaymentSource'       => $this->adyen_payment_source,
82 2
				'externalPlatform'         => $this->external_platform,
83 2
				'merchantApplication'      => $this->merchant_application,
84 2
				'merchantDevice'           => $this->merchant_device,
85 2
				'shopperInteractionDevice' => $this->shopper_interaction_device,
86
			)
87
		);
88
89 2
		$object = (object) $properties;
90
91 2
		return $object;
92
	}
93
94
	/**
95
	 * JSON serialize.
96
	 *
97
	 * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
98
	 * @return object
99
	 */
100 2
	public function jsonSerialize() {
101 2
		return $this->get_json();
102
	}
103
}
104