DataGeneralHelper   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 163
Duplicated Lines 0 %

Test Coverage

Coverage 78.56%

Importance

Changes 0
Metric Value
wmc 14
eloc 15
c 0
b 0
f 0
dl 0
loc 163
ccs 22
cts 28
cp 0.7856
rs 10

14 Methods

Rating   Name   Duplication   Size   Complexity  
A set_order_id() 0 2 1
A set_alias_usage() 0 2 1
A set_alias() 0 2 1
A set_psp_id() 0 2 1
A set_order_description() 0 2 1
A set_payment_method() 0 2 1
A set_customer_name() 0 2 1
A set_amount() 0 2 1
A set_language() 0 2 1
A set_payment_methods_list() 0 2 1
A set_brand() 0 2 1
A set_currency() 0 2 1
A set_param_plus() 0 2 1
A set_email() 0 2 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Ingenico;
4
5
/**
6
 * Title: Ingenico data default helper class
7
 * Description:
8
 * Copyright: 2005-2021 Pronamic
9
 * Company: Pronamic
10
 *
11
 * @author  Remco Tolsma
12
 * @version 2.0.0
13
 * @since   1.0.0
14
 */
15
class DataGeneralHelper extends DataHelper {
16
	/**
17
	 * Set alias.
18
	 *
19
	 * @param string $alias Alias.
20
	 *
21
	 * @return DataGeneralHelper
22
	 */
23
	public function set_alias( $alias ) {
24
		return $this->set_field( 'ALIAS', $alias );
25
	}
26
27
	/**
28
	 * Set alias usage.
29
	 *
30
	 * @param string $alias_usage Alias usage.
31
	 *
32
	 * @return DataGeneralHelper
33
	 */
34
	public function set_alias_usage( $alias_usage ) {
35
		return $this->set_field( 'ALIASUSAGE', $alias_usage );
36
	}
37
38
	/**
39
	 * Set PSP ID
40
	 *
41
	 * @param int $number PSP ID.
42
	 *
43
	 * @return DataGeneralHelper
44
	 */
45 1
	public function set_psp_id( $number ) {
46 1
		return $this->set_field( 'PSPID', $number );
47
	}
48
49
	/**
50
	 * Set order ID
51
	 *
52
	 * @param string $order_id Order ID.
53
	 *
54
	 * @return DataGeneralHelper
55
	 */
56 2
	public function set_order_id( $order_id ) {
57 2
		return $this->set_field( 'ORDERID', $order_id );
58
	}
59
60
	/**
61
	 * Set order description
62
	 * AN..max32 (AN = Alphanumeric, free text)
63
	 *
64
	 * @param string $description Description.
65
	 *
66
	 * @return DataGeneralHelper
67
	 */
68 1
	public function set_order_description( $description ) {
69 1
		return $this->set_field( 'COM', $description );
70
	}
71
72
	/**
73
	 * Set amount
74
	 *
75
	 * @param string $amount Amount in cents.
76
	 * @return DataGeneralHelper
77
	 */
78 2
	public function set_amount( $amount ) {
79 2
		return $this->set_field( 'AMOUNT', $amount );
80
	}
81
82
	/**
83
	 * Set currency
84
	 *
85
	 * @param string $currency Currency.
86
	 *
87
	 * @return DataGeneralHelper
88
	 */
89 2
	public function set_currency( $currency ) {
90 2
		return $this->set_field( 'CURRENCY', $currency );
91
	}
92
93
	/**
94
	 * Set customer name
95
	 *
96
	 * @deprecated since 1.3.0
97
	 *
98
	 * @param string $name Customer name.
99
	 *
100
	 * @return DataGeneralHelper
101
	 */
102 1
	public function set_customer_name( $name ) {
103 1
		return $this->set_field( 'CN', $name );
104
	}
105
106
	/**
107
	 * Set email address
108
	 *
109
	 * @deprecated since 1.3.0
110
	 *
111
	 * @param string $email Email address.
112
	 *
113
	 * @return DataGeneralHelper
114
	 */
115 1
	public function set_email( $email ) {
116 1
		return $this->set_field( 'EMAIL', $email );
117
	}
118
119
	/**
120
	 * Set language
121
	 *
122
	 * @param string $language Language.
123
	 *
124
	 * @return DataGeneralHelper
125
	 */
126 2
	public function set_language( $language ) {
127 2
		return $this->set_field( 'LANGUAGE', $language );
128
	}
129
130
	/**
131
	 * Set payment method
132
	 *
133
	 * @param string $payment_method Payment method.
134
	 *
135
	 * @return DataGeneralHelper
136
	 */
137 1
	public function set_payment_method( $payment_method ) {
138 1
		return $this->set_field( 'PM', $payment_method );
139
	}
140
141
	/**
142
	 * Set payment methods list
143
	 *
144
	 * @param string $list Payment method list.
145
	 *
146
	 * @return DataGeneralHelper
147
	 */
148 1
	public function set_payment_methods_list( $list ) {
149 1
		return $this->set_field( 'PMLIST', $list );
150
	}
151
152
	/**
153
	 * Set brand of a credit/debit/purchasing card
154
	 *
155
	 * If you send the BRAND field without sending a value in the PM field (‘CreditCard’ or ‘Purchasing Card’),
156
	 * the BRAND value will not be taken into account.
157
	 *
158
	 * @param string $brand Brand of card.
159
	 *
160
	 * @return DataGeneralHelper
161
	 */
162 1
	public function set_brand( $brand ) {
163 1
		return $this->set_field( 'BRAND', $brand );
164
	}
165
166
	/**
167
	 * Set PARAMPLUS feedback parameters
168
	 *
169
	 * @link https://payment-services.ingenico.com/int/en/ogone/support/guides/integration%20guides/e-commerce/transaction-feedback#feedbackparameters_variablefeedbackparameters
170
	 * @since 1.2.6
171
	 *
172
	 * @param string $param_plus `PARAMPLUS` parameter value.
173
	 *
174
	 * @return DataGeneralHelper
175
	 */
176
	public function set_param_plus( $param_plus ) {
177
		return $this->set_field( 'PARAMPLUS', $param_plus );
178
	}
179
}
180