PaymentMethods   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 26
c 1
b 0
f 0
dl 0
loc 98
ccs 10
cts 10
cp 1
rs 10
wmc 8

1 Method

Rating   Name   Duplication   Size   Complexity  
B transform() 0 25 8
1
<?php
2
/**
3
 * Payment Methods.
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2021 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\ING\KassaCompleet
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\ING\KassaCompleet;
12
13
use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods;
14
15
/**
16
 * Title: ING Kassa Compleet payment methods
17
 * Description:
18
 * Copyright: 2005-2021 Pronamic
19
 * Company: Pronamic
20
 *
21
 * @author  Remco Tolsma
22
 * @version 2.0.0
23
 * @since   1.0.0
24
 */
25
class PaymentMethods {
26
	/**
27
	 * Constant for the Bancontact method.
28
	 *
29
	 * @link https://plugins.trac.wordpress.org/browser/ing-psp/tags/1.0/ing-php/src/Order/Transaction/PaymentMethod.php#L11
30
	 * @var string
31
	 */
32
	const BANCONTACT = 'bancontact';
33
34
	/**
35
	 * Constant for the Banktransfer method.
36
	 *
37
	 * @link https://plugins.trac.wordpress.org/browser/ing-kassa-compleet/tags/1.0.6/ingkassacompleet.php#L339
38
	 * @var string
39
	 */
40
	const BANK_TRANSFER = 'bank-transfer';
41
42
	/**
43
	 * Constant for the Cash on Delivery method.
44
	 *
45
	 * @link https://plugins.trac.wordpress.org/browser/ing-kassa-compleet/tags/1.0.6/ingkassacompleet.php#L463
46
	 * @var string
47
	 */
48
	const CASH_ON_DELIVERY = 'cash-on-delivery';
49
50
	/**
51
	 * Constant for the CreditCard method.
52
	 *
53
	 * @link https://plugins.trac.wordpress.org/browser/ing-kassa-compleet/tags/1.0.6/ingkassacompleet.php#L219
54
	 * @var string
55
	 */
56
	const CREDIT_CARD = 'credit-card';
57
58
	/**
59
	 * Constant for the iDEAL payment method.
60
	 *
61
	 * @link https://plugins.trac.wordpress.org/browser/ing-kassa-compleet/tags/1.0.6/ingkassacompleet.php#L109
62
	 * @var string
63
	 */
64
	const IDEAL = 'ideal';
65
66
	/**
67
	 * Constant for the Payconiq method.
68
	 *
69
	 * @var string
70
	 */
71
	const PAYCONIQ = 'payconiq';
72
73
	/**
74
	 * Constant for the PayPal method.
75
	 *
76
	 * @link https://plugins.trac.wordpress.org/browser/ing-psp/tags/1.2/ing-php/src/Order/Transaction/PaymentMethod.php#L21
77
	 * @var string
78
	 */
79
	const PAYPAL = 'paypal';
80
81
	/**
82
	 * Constant for the SOFORT method.
83
	 *
84
	 * @link https://plugins.trac.wordpress.org/browser/ing-psp/tags/1.0/ing-php/src/Order/Transaction/PaymentMethod.php#L11
85
	 * @var string
86
	 */
87
	const SOFORT = 'sofort';
88
89
	/**
90
	 * Transform WordPress payment method to ING Kassa Compleet method.
91
	 *
92
	 * @since 1.0.5
93
	 *
94
	 * @param string $payment_method WordPress payment method.
95
	 *
96
	 * @return string
97
	 */
98 8
	public static function transform( $payment_method ) {
99 8
		switch ( $payment_method ) {
100
			case Core_PaymentMethods::BANCONTACT:
101 1
				return self::BANCONTACT;
102
103
			case Core_PaymentMethods::BANK_TRANSFER:
104 1
				return self::BANK_TRANSFER;
105
106
			case Core_PaymentMethods::CREDIT_CARD:
107 1
				return self::CREDIT_CARD;
108
109
			case Core_PaymentMethods::IDEAL:
110 1
				return self::IDEAL;
111
112
			case Core_PaymentMethods::PAYCONIQ:
113 1
				return self::PAYCONIQ;
114
115
			case Core_PaymentMethods::PAYPAL:
116 1
				return self::PAYPAL;
117
118
			case Core_PaymentMethods::SOFORT:
119 1
				return self::SOFORT;
120
121
			default:
122 1
				return null;
123
		}
124
	}
125
}
126