Payment_Adaptive_PaymentDetails   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 2
dl 0
loc 40
ccs 0
cts 26
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A payment_details() 0 4 1
A get_payment_details() 0 7 3
A fields() 0 19 5
1
<?php
2
3
namespace OpenBuildings\PayPal;
4
5
class Payment_Adaptive_PaymentDetails extends Payment_Adaptive {
6
7
	const API_OPERATION_PAYMENT_DETAILS = 'PaymentDetails';
8
9
	/**
10
	 * Perform a low-level PaymentDetails API request.
11
	 */
12
	public function payment_details($data)
13
	{
14
		return $this->_request(self::API_OPERATION_PAYMENT_DETAILS, $data);
15
	}
16
17
	public function get_payment_details(array $transaction)
18
	{
19
		if (empty($transaction['payKey']) AND empty($transaction['trackingId']))
20
			throw new Exception('You must provide either "payKey" or "trackingId" to PaymentDetails API operation.');
21
22
		return $this->payment_details($transaction);
23
	}
24
	
25
	public function fields()
26
	{
27
		$fields = parent::fields();
0 ignored issues
show
Bug introduced by
The method fields() does not exist on OpenBuildings\PayPal\Payment_Adaptive. Did you maybe mean common_fields()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
28
		$order = $this->order();
29
30
		foreach ($order['receivers'] as $index => $receiver)
31
		{
32
			$fields['receiverList'][$index]['primary'] = empty($receiver['primary'])
33
				? 'false'
34
				: 'true';
35
		}
36
37
		if ($this->config('pay_only_primary') AND $this->action_type() == 'PAY')
0 ignored issues
show
Bug introduced by
The method action_type() does not seem to exist on object<OpenBuildings\Pay...daptive_PaymentDetails>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
		{
39
			$fields['actionType'] = 'PAY_PRIMARY';
40
		}
41
42
		return $fields;
43
	}
44
}