@@ -61,28 +61,28 @@ discard block |
||
61 | 61 | { |
62 | 62 | $html = ''; |
63 | 63 | if ($input instanceof EE_Hidden_Input) { |
64 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
64 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
65 | 65 | } elseif ($input instanceof EE_Submit_Input) { |
66 | 66 | $html .= $this->br(); |
67 | 67 | $html .= $input->get_html_for_input(); |
68 | 68 | } elseif ($input instanceof EE_Select_Input) { |
69 | 69 | $html .= $this->br(); |
70 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
71 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
72 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
73 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
70 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
71 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
72 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
73 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
74 | 74 | $html .= $this->br(); |
75 | 75 | } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
76 | 76 | $html .= $this->br(); |
77 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
78 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
79 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
77 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
78 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
79 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
80 | 80 | } else { |
81 | 81 | $html .= $this->br(); |
82 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
83 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
84 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
85 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
82 | + $html .= EEH_HTML::nl(1).$input->get_html_for_label(); |
|
83 | + $html .= EEH_HTML::nl().$input->get_html_for_errors(); |
|
84 | + $html .= EEH_HTML::nl().$input->get_html_for_input(); |
|
85 | + $html .= EEH_HTML::nl().$input->get_html_for_help(); |
|
86 | 86 | } |
87 | 87 | $html .= EEH_HTML::nl(-1); |
88 | 88 | return $html; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function layout_subsection($form_section) |
100 | 100 | { |
101 | 101 | // d( $form_section ); |
102 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
102 | + return EEH_HTML::nl(1).$form_section->get_html().EEH_HTML::nl(-1); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 |
@@ -10,117 +10,117 @@ |
||
10 | 10 | */ |
11 | 11 | class EE_No_Layout extends EE_Div_Per_Section_Layout |
12 | 12 | { |
13 | - /** |
|
14 | - * This is a flag indicating whether to use '<br>' tags after each input in the layout |
|
15 | - * strategy. |
|
16 | - * |
|
17 | - * @var bool |
|
18 | - */ |
|
19 | - protected $_use_break_tags = true; |
|
20 | - |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * EE_No_Layout constructor. |
|
25 | - * |
|
26 | - * @param array $options Currently if this has a 'use_break_tags' key that is used to set the _use_break_tags |
|
27 | - * property on the class. |
|
28 | - */ |
|
29 | - public function __construct($options = array()) |
|
30 | - { |
|
31 | - $this->_use_break_tags = is_array($options) && isset($options['use_break_tags']) |
|
32 | - ? filter_var($options['use_break_tags'], FILTER_VALIDATE_BOOLEAN) |
|
33 | - : $this->_use_break_tags; |
|
34 | - parent::__construct(); |
|
35 | - } |
|
36 | - |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * Add line break at beginning of form |
|
41 | - * |
|
42 | - * @return string |
|
43 | - */ |
|
44 | - public function layout_form_begin() |
|
45 | - { |
|
46 | - return EEH_HTML::nl(1); |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * Lays out the row for the input, including label and errors |
|
53 | - * |
|
54 | - * @param EE_Form_Input_Base $input |
|
55 | - * @return string |
|
56 | - * @throws \EE_Error |
|
57 | - */ |
|
58 | - public function layout_input($input) |
|
59 | - { |
|
60 | - $html = ''; |
|
61 | - if ($input instanceof EE_Hidden_Input) { |
|
62 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
63 | - } elseif ($input instanceof EE_Submit_Input) { |
|
64 | - $html .= $this->br(); |
|
65 | - $html .= $input->get_html_for_input(); |
|
66 | - } elseif ($input instanceof EE_Select_Input) { |
|
67 | - $html .= $this->br(); |
|
68 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
69 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
70 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
71 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
72 | - $html .= $this->br(); |
|
73 | - } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
|
74 | - $html .= $this->br(); |
|
75 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
76 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
77 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
78 | - } else { |
|
79 | - $html .= $this->br(); |
|
80 | - $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
81 | - $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
82 | - $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
83 | - $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
84 | - } |
|
85 | - $html .= EEH_HTML::nl(-1); |
|
86 | - return $html; |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * Lays out a row for the subsection |
|
93 | - * |
|
94 | - * @param EE_Form_Section_Proper $form_section |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public function layout_subsection($form_section) |
|
98 | - { |
|
99 | - // d( $form_section ); |
|
100 | - return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * Add line break at end of form. |
|
107 | - * |
|
108 | - * @return string |
|
109 | - */ |
|
110 | - public function layout_form_end() |
|
111 | - { |
|
112 | - return EEH_HTML::nl(-1); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * This returns a break tag or an empty string depending on the value of the `_use_break_tags` property. |
|
119 | - * |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - protected function br() |
|
123 | - { |
|
124 | - return $this->_use_break_tags ? EEH_HTML::br() : ''; |
|
125 | - } |
|
13 | + /** |
|
14 | + * This is a flag indicating whether to use '<br>' tags after each input in the layout |
|
15 | + * strategy. |
|
16 | + * |
|
17 | + * @var bool |
|
18 | + */ |
|
19 | + protected $_use_break_tags = true; |
|
20 | + |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * EE_No_Layout constructor. |
|
25 | + * |
|
26 | + * @param array $options Currently if this has a 'use_break_tags' key that is used to set the _use_break_tags |
|
27 | + * property on the class. |
|
28 | + */ |
|
29 | + public function __construct($options = array()) |
|
30 | + { |
|
31 | + $this->_use_break_tags = is_array($options) && isset($options['use_break_tags']) |
|
32 | + ? filter_var($options['use_break_tags'], FILTER_VALIDATE_BOOLEAN) |
|
33 | + : $this->_use_break_tags; |
|
34 | + parent::__construct(); |
|
35 | + } |
|
36 | + |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * Add line break at beginning of form |
|
41 | + * |
|
42 | + * @return string |
|
43 | + */ |
|
44 | + public function layout_form_begin() |
|
45 | + { |
|
46 | + return EEH_HTML::nl(1); |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * Lays out the row for the input, including label and errors |
|
53 | + * |
|
54 | + * @param EE_Form_Input_Base $input |
|
55 | + * @return string |
|
56 | + * @throws \EE_Error |
|
57 | + */ |
|
58 | + public function layout_input($input) |
|
59 | + { |
|
60 | + $html = ''; |
|
61 | + if ($input instanceof EE_Hidden_Input) { |
|
62 | + $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
63 | + } elseif ($input instanceof EE_Submit_Input) { |
|
64 | + $html .= $this->br(); |
|
65 | + $html .= $input->get_html_for_input(); |
|
66 | + } elseif ($input instanceof EE_Select_Input) { |
|
67 | + $html .= $this->br(); |
|
68 | + $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
69 | + $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
70 | + $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
71 | + $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
72 | + $html .= $this->br(); |
|
73 | + } elseif ($input instanceof EE_Form_Input_With_Options_Base) { |
|
74 | + $html .= $this->br(); |
|
75 | + $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
76 | + $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
77 | + $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
78 | + } else { |
|
79 | + $html .= $this->br(); |
|
80 | + $html .= EEH_HTML::nl(1) . $input->get_html_for_label(); |
|
81 | + $html .= EEH_HTML::nl() . $input->get_html_for_errors(); |
|
82 | + $html .= EEH_HTML::nl() . $input->get_html_for_input(); |
|
83 | + $html .= EEH_HTML::nl() . $input->get_html_for_help(); |
|
84 | + } |
|
85 | + $html .= EEH_HTML::nl(-1); |
|
86 | + return $html; |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * Lays out a row for the subsection |
|
93 | + * |
|
94 | + * @param EE_Form_Section_Proper $form_section |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public function layout_subsection($form_section) |
|
98 | + { |
|
99 | + // d( $form_section ); |
|
100 | + return EEH_HTML::nl(1) . $form_section->get_html() . EEH_HTML::nl(-1); |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * Add line break at end of form. |
|
107 | + * |
|
108 | + * @return string |
|
109 | + */ |
|
110 | + public function layout_form_end() |
|
111 | + { |
|
112 | + return EEH_HTML::nl(-1); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * This returns a break tag or an empty string depending on the value of the `_use_break_tags` property. |
|
119 | + * |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + protected function br() |
|
123 | + { |
|
124 | + return $this->_use_break_tags ? EEH_HTML::br() : ''; |
|
125 | + } |
|
126 | 126 | } |
@@ -13,58 +13,58 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Many_Valued_Validation_Strategy extends EE_Validation_Strategy_Base |
15 | 15 | { |
16 | - protected $_individual_item_validation_strategies = array(); |
|
17 | - /** |
|
18 | - * |
|
19 | - * @param EE_Validation_Strategy_Base[] $individual_item_validation_strategies (or a single EE_Validation_Strategy_Base) |
|
20 | - */ |
|
21 | - public function __construct($individual_item_validation_strategies) |
|
22 | - { |
|
23 | - if (! is_array($individual_item_validation_strategies)) { |
|
24 | - $individual_item_validation_strategies = array($individual_item_validation_strategies); |
|
25 | - } |
|
26 | - $this->_individual_item_validation_strategies = $individual_item_validation_strategies; |
|
27 | - parent::__construct(); |
|
28 | - } |
|
16 | + protected $_individual_item_validation_strategies = array(); |
|
17 | + /** |
|
18 | + * |
|
19 | + * @param EE_Validation_Strategy_Base[] $individual_item_validation_strategies (or a single EE_Validation_Strategy_Base) |
|
20 | + */ |
|
21 | + public function __construct($individual_item_validation_strategies) |
|
22 | + { |
|
23 | + if (! is_array($individual_item_validation_strategies)) { |
|
24 | + $individual_item_validation_strategies = array($individual_item_validation_strategies); |
|
25 | + } |
|
26 | + $this->_individual_item_validation_strategies = $individual_item_validation_strategies; |
|
27 | + parent::__construct(); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * Applies all teh individual item validation strategies on each item in the array |
|
34 | - * @param array $normalized_value |
|
35 | - * @return boolean |
|
36 | - */ |
|
37 | - public function validate($normalized_value) |
|
38 | - { |
|
39 | - if (is_array($normalized_value)) { |
|
40 | - $items_to_validate = $normalized_value; |
|
41 | - } else { |
|
42 | - $items_to_validate = array($normalized_value); |
|
43 | - } |
|
44 | - foreach ($items_to_validate as $individual_item) { |
|
45 | - foreach ($this->_individual_item_validation_strategies as $validation_strategy) { |
|
46 | - if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
47 | - $validation_strategy->validate($individual_item); |
|
48 | - } |
|
49 | - } |
|
50 | - } |
|
51 | - return true; |
|
52 | - } |
|
32 | + /** |
|
33 | + * Applies all teh individual item validation strategies on each item in the array |
|
34 | + * @param array $normalized_value |
|
35 | + * @return boolean |
|
36 | + */ |
|
37 | + public function validate($normalized_value) |
|
38 | + { |
|
39 | + if (is_array($normalized_value)) { |
|
40 | + $items_to_validate = $normalized_value; |
|
41 | + } else { |
|
42 | + $items_to_validate = array($normalized_value); |
|
43 | + } |
|
44 | + foreach ($items_to_validate as $individual_item) { |
|
45 | + foreach ($this->_individual_item_validation_strategies as $validation_strategy) { |
|
46 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
47 | + $validation_strategy->validate($individual_item); |
|
48 | + } |
|
49 | + } |
|
50 | + } |
|
51 | + return true; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Extends parent's _construct_finalize so we ALSO set the input |
|
58 | - * on each sub-validation-strategy |
|
59 | - * @param \EE_Form_Input_Base $form_input |
|
60 | - */ |
|
61 | - public function _construct_finalize(\EE_Form_Input_Base $form_input) |
|
62 | - { |
|
63 | - parent::_construct_finalize($form_input); |
|
64 | - foreach ($this->_individual_item_validation_strategies as $item_validation_strategy) { |
|
65 | - if ($item_validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
66 | - $item_validation_strategy->_construct_finalize($form_input); |
|
67 | - } |
|
68 | - } |
|
69 | - } |
|
56 | + /** |
|
57 | + * Extends parent's _construct_finalize so we ALSO set the input |
|
58 | + * on each sub-validation-strategy |
|
59 | + * @param \EE_Form_Input_Base $form_input |
|
60 | + */ |
|
61 | + public function _construct_finalize(\EE_Form_Input_Base $form_input) |
|
62 | + { |
|
63 | + parent::_construct_finalize($form_input); |
|
64 | + foreach ($this->_individual_item_validation_strategies as $item_validation_strategy) { |
|
65 | + if ($item_validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
66 | + $item_validation_strategy->_construct_finalize($form_input); |
|
67 | + } |
|
68 | + } |
|
69 | + } |
|
70 | 70 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct($individual_item_validation_strategies) |
22 | 22 | { |
23 | - if (! is_array($individual_item_validation_strategies)) { |
|
23 | + if ( ! is_array($individual_item_validation_strategies)) { |
|
24 | 24 | $individual_item_validation_strategies = array($individual_item_validation_strategies); |
25 | 25 | } |
26 | 26 | $this->_individual_item_validation_strategies = $individual_item_validation_strategies; |
@@ -11,16 +11,16 @@ |
||
11 | 11 | */ |
12 | 12 | abstract class EE_Sensitive_Data_Removal_Base extends EE_Form_Input_Strategy_Base |
13 | 13 | { |
14 | - /** |
|
15 | - * Removes all the sensitive data from this normalized value. |
|
16 | - * For example, should could 'mask' a credit card from |
|
17 | - * '1234 1234 1234 1234' TO '**** **** **** 1234'. |
|
18 | - * Or turn a ccv number from |
|
19 | - * '123' to '***', |
|
20 | - * or turn a password from |
|
21 | - * 'CantHac7Th15' to '*************', |
|
22 | - * or just leave htevalue as-is |
|
23 | - * @return mixed |
|
24 | - */ |
|
25 | - abstract public function remove_sensitive_data($normalized_value); |
|
14 | + /** |
|
15 | + * Removes all the sensitive data from this normalized value. |
|
16 | + * For example, should could 'mask' a credit card from |
|
17 | + * '1234 1234 1234 1234' TO '**** **** **** 1234'. |
|
18 | + * Or turn a ccv number from |
|
19 | + * '123' to '***', |
|
20 | + * or turn a password from |
|
21 | + * 'CantHac7Th15' to '*************', |
|
22 | + * or just leave htevalue as-is |
|
23 | + * @return mixed |
|
24 | + */ |
|
25 | + abstract public function remove_sensitive_data($normalized_value); |
|
26 | 26 | } |
@@ -11,23 +11,23 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_All_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base |
13 | 13 | { |
14 | - public function remove_sensitive_data($normalized_value) |
|
15 | - { |
|
16 | - switch (gettype($normalized_value)) { |
|
17 | - case "boolean": |
|
18 | - return false; |
|
19 | - case "integer": |
|
20 | - case "double": |
|
21 | - return 0; |
|
22 | - case "string": |
|
23 | - return ''; |
|
24 | - case "array": |
|
25 | - return array(); |
|
26 | - case "object": |
|
27 | - case "resource": |
|
28 | - case "NULL": |
|
29 | - default: |
|
30 | - return null; |
|
31 | - } |
|
32 | - } |
|
14 | + public function remove_sensitive_data($normalized_value) |
|
15 | + { |
|
16 | + switch (gettype($normalized_value)) { |
|
17 | + case "boolean": |
|
18 | + return false; |
|
19 | + case "integer": |
|
20 | + case "double": |
|
21 | + return 0; |
|
22 | + case "string": |
|
23 | + return ''; |
|
24 | + case "array": |
|
25 | + return array(); |
|
26 | + case "object": |
|
27 | + case "resource": |
|
28 | + case "NULL": |
|
29 | + default: |
|
30 | + return null; |
|
31 | + } |
|
32 | + } |
|
33 | 33 | } |
@@ -11,8 +11,8 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_No_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base |
13 | 13 | { |
14 | - public function remove_sensitive_data($normalized_value) |
|
15 | - { |
|
16 | - return $normalized_value; |
|
17 | - } |
|
14 | + public function remove_sensitive_data($normalized_value) |
|
15 | + { |
|
16 | + return $normalized_value; |
|
17 | + } |
|
18 | 18 | } |
@@ -11,11 +11,11 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML |
13 | 13 | { |
14 | - public function __construct($template_file, $args = array(), $options_array = array()) |
|
15 | - { |
|
16 | - $html = EEH_Template::locate_template($template_file, $args); |
|
14 | + public function __construct($template_file, $args = array(), $options_array = array()) |
|
15 | + { |
|
16 | + $html = EEH_Template::locate_template($template_file, $args); |
|
17 | 17 | |
18 | 18 | // echo " filepath:$template_file html $html"; |
19 | - parent::__construct($html, $options_array); |
|
20 | - } |
|
19 | + parent::__construct($html, $options_array); |
|
20 | + } |
|
21 | 21 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | */ |
82 | 82 | public function html_class() |
83 | 83 | { |
84 | - return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
84 | + return ! empty($this->_html_class) ? $this->_html_class.' ee-billing-form' : 'ee-billing-form'; |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | // End of file EE_Billing_Info_Form.form.php |
@@ -14,74 +14,74 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_Billing_Info_Form extends EE_Form_Section_Proper |
16 | 16 | { |
17 | - /** |
|
18 | - * The payment method this billing form is for |
|
19 | - * @var EE_Payment_Method |
|
20 | - */ |
|
21 | - protected $_pm_instance; |
|
22 | - |
|
23 | - |
|
24 | - |
|
25 | - /** |
|
26 | - * |
|
27 | - * @param EE_Payment_Method $payment_method |
|
28 | - * @param array $options_array @see EE_Form_Section_Proper::__construct() |
|
29 | - */ |
|
30 | - public function __construct(EE_Payment_Method $payment_method, $options_array = array()) |
|
31 | - { |
|
32 | - $this->_pm_instance = $payment_method; |
|
33 | - $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
|
34 | - parent::__construct($options_array); |
|
35 | - } |
|
36 | - |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * Sets the payment method for this billing form |
|
41 | - * @param EE_Payment_Method $payment_method |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - public function set_payment_method(EE_Payment_Method $payment_method) |
|
45 | - { |
|
46 | - $this->_pm_instance = $payment_method; |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * Returns the instance of the payment method this billing form is for |
|
53 | - * @return EE_Payment_Method |
|
54 | - */ |
|
55 | - public function payment_method() |
|
56 | - { |
|
57 | - return $this->_pm_instance; |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * payment_fields_autofilled_notice_html |
|
64 | - * @return string |
|
65 | - */ |
|
66 | - public function payment_fields_autofilled_notice_html() |
|
67 | - { |
|
68 | - return new EE_Form_Section_HTML( |
|
69 | - EEH_HTML::p( |
|
70 | - apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', esc_html__('Payment fields have been autofilled because you are in debug mode', 'event_espresso')), |
|
71 | - '', |
|
72 | - 'important-notice' |
|
73 | - ) |
|
74 | - ); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @return string |
|
81 | - */ |
|
82 | - public function html_class() |
|
83 | - { |
|
84 | - return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
85 | - } |
|
17 | + /** |
|
18 | + * The payment method this billing form is for |
|
19 | + * @var EE_Payment_Method |
|
20 | + */ |
|
21 | + protected $_pm_instance; |
|
22 | + |
|
23 | + |
|
24 | + |
|
25 | + /** |
|
26 | + * |
|
27 | + * @param EE_Payment_Method $payment_method |
|
28 | + * @param array $options_array @see EE_Form_Section_Proper::__construct() |
|
29 | + */ |
|
30 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) |
|
31 | + { |
|
32 | + $this->_pm_instance = $payment_method; |
|
33 | + $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
|
34 | + parent::__construct($options_array); |
|
35 | + } |
|
36 | + |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * Sets the payment method for this billing form |
|
41 | + * @param EE_Payment_Method $payment_method |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + public function set_payment_method(EE_Payment_Method $payment_method) |
|
45 | + { |
|
46 | + $this->_pm_instance = $payment_method; |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * Returns the instance of the payment method this billing form is for |
|
53 | + * @return EE_Payment_Method |
|
54 | + */ |
|
55 | + public function payment_method() |
|
56 | + { |
|
57 | + return $this->_pm_instance; |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * payment_fields_autofilled_notice_html |
|
64 | + * @return string |
|
65 | + */ |
|
66 | + public function payment_fields_autofilled_notice_html() |
|
67 | + { |
|
68 | + return new EE_Form_Section_HTML( |
|
69 | + EEH_HTML::p( |
|
70 | + apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', esc_html__('Payment fields have been autofilled because you are in debug mode', 'event_espresso')), |
|
71 | + '', |
|
72 | + 'important-notice' |
|
73 | + ) |
|
74 | + ); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @return string |
|
81 | + */ |
|
82 | + public function html_class() |
|
83 | + { |
|
84 | + return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | // End of file EE_Billing_Info_Form.form.php |
@@ -2,47 +2,47 @@ |
||
2 | 2 | |
3 | 3 | class EE_Validation_Error extends Exception |
4 | 4 | { |
5 | - /** |
|
6 | - * Form Section from which this error originated. |
|
7 | - * @var EE_Form_Section |
|
8 | - */ |
|
9 | - protected $_form_section; |
|
10 | - /** |
|
11 | - * a short string for uniquely identifying the error, which isn't internationalized and |
|
12 | - * machines can use to identify the error |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $_string_code; |
|
5 | + /** |
|
6 | + * Form Section from which this error originated. |
|
7 | + * @var EE_Form_Section |
|
8 | + */ |
|
9 | + protected $_form_section; |
|
10 | + /** |
|
11 | + * a short string for uniquely identifying the error, which isn't internationalized and |
|
12 | + * machines can use to identify the error |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $_string_code; |
|
16 | 16 | |
17 | - /** |
|
18 | - * When creating a validation error, we need to know which field the error relates to. |
|
19 | - * @param string $message message you want to display about this error |
|
20 | - * @param string $string_code a code for uniquely identifying the exception |
|
21 | - * @param EE_Form_Section_Validatable $form_section |
|
22 | - * @param Exception $previous if there was an exception that caused this exception |
|
23 | - */ |
|
24 | - public function __construct($message = null, $string_code = null, $form_section = null, $previous = null) |
|
25 | - { |
|
26 | - $this->_form_section = $form_section; |
|
27 | - $this->_string_code = $string_code; |
|
28 | - parent::__construct($message, 500, $previous); |
|
29 | - } |
|
17 | + /** |
|
18 | + * When creating a validation error, we need to know which field the error relates to. |
|
19 | + * @param string $message message you want to display about this error |
|
20 | + * @param string $string_code a code for uniquely identifying the exception |
|
21 | + * @param EE_Form_Section_Validatable $form_section |
|
22 | + * @param Exception $previous if there was an exception that caused this exception |
|
23 | + */ |
|
24 | + public function __construct($message = null, $string_code = null, $form_section = null, $previous = null) |
|
25 | + { |
|
26 | + $this->_form_section = $form_section; |
|
27 | + $this->_string_code = $string_code; |
|
28 | + parent::__construct($message, 500, $previous); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * returns teh form section which caused the error. |
|
33 | - * @return EE_Form_Section_Validatable |
|
34 | - */ |
|
35 | - public function get_form_section() |
|
36 | - { |
|
37 | - return $this->_form_section; |
|
38 | - } |
|
39 | - /** |
|
40 | - * Sets teh form seciton of the error, in case it wasnt set previously |
|
41 | - * @param EE_Form_Section_Validatable $form_section |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - public function set_form_section($form_section) |
|
45 | - { |
|
46 | - $this->_form_section = $form_section; |
|
47 | - } |
|
31 | + /** |
|
32 | + * returns teh form section which caused the error. |
|
33 | + * @return EE_Form_Section_Validatable |
|
34 | + */ |
|
35 | + public function get_form_section() |
|
36 | + { |
|
37 | + return $this->_form_section; |
|
38 | + } |
|
39 | + /** |
|
40 | + * Sets teh form seciton of the error, in case it wasnt set previously |
|
41 | + * @param EE_Form_Section_Validatable $form_section |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + public function set_form_section($form_section) |
|
45 | + { |
|
46 | + $this->_form_section = $form_section; |
|
47 | + } |
|
48 | 48 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | public function set_settings($settings_array) |
188 | 188 | { |
189 | 189 | foreach ($settings_array as $name => $value) { |
190 | - $property_name = "_" . $name; |
|
190 | + $property_name = "_".$name; |
|
191 | 191 | $this->{$property_name} = $value; |
192 | 192 | } |
193 | 193 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function set_gateway_data_formatter(GatewayDataFormatterInterface $gateway_data_formatter) |
253 | 253 | { |
254 | - if (! $gateway_data_formatter instanceof GatewayDataFormatterInterface) { |
|
254 | + if ( ! $gateway_data_formatter instanceof GatewayDataFormatterInterface) { |
|
255 | 255 | throw new InvalidEntityException( |
256 | 256 | is_object($gateway_data_formatter) |
257 | 257 | ? get_class($gateway_data_formatter) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | protected function _get_gateway_formatter() |
272 | 272 | { |
273 | - if (! $this->_gateway_data_formatter instanceof GatewayDataFormatterInterface) { |
|
273 | + if ( ! $this->_gateway_data_formatter instanceof GatewayDataFormatterInterface) { |
|
274 | 274 | throw new InvalidEntityException( |
275 | 275 | is_object($this->_gateway_data_formatter) |
276 | 276 | ? get_class($this->_gateway_data_formatter) |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function set_unsupported_character_remover(FormatterInterface $formatter) |
293 | 293 | { |
294 | - if (! $formatter instanceof FormatterInterface) { |
|
294 | + if ( ! $formatter instanceof FormatterInterface) { |
|
295 | 295 | throw new InvalidEntityException( |
296 | 296 | is_object($formatter) |
297 | 297 | ? get_class($formatter) |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | protected function _get_unsupported_character_remover() |
312 | 312 | { |
313 | - if (! $this->_unsupported_character_remover instanceof FormatterInterface) { |
|
313 | + if ( ! $this->_unsupported_character_remover instanceof FormatterInterface) { |
|
314 | 314 | throw new InvalidEntityException( |
315 | 315 | is_object($this->_unsupported_character_remover) |
316 | 316 | ? get_class($this->_unsupported_character_remover) |
@@ -23,495 +23,495 @@ |
||
23 | 23 | */ |
24 | 24 | abstract class EE_Gateway |
25 | 25 | { |
26 | - /** |
|
27 | - * a constant used as a possible value for $_currencies_supported to indicate |
|
28 | - * that ALL currencies are supported by this gateway |
|
29 | - */ |
|
30 | - const all_currencies_supported = 'all_currencies_supported'; |
|
31 | - /** |
|
32 | - * Where values are 3-letter currency codes |
|
33 | - * |
|
34 | - * @var array |
|
35 | - */ |
|
36 | - protected $_currencies_supported = array(); |
|
37 | - /** |
|
38 | - * Whether or not this gateway can support SENDING a refund request (ie, initiated by |
|
39 | - * admin in EE's wp-admin page) |
|
40 | - * |
|
41 | - * @var boolean |
|
42 | - */ |
|
43 | - protected $_supports_sending_refunds = false; |
|
44 | - |
|
45 | - /** |
|
46 | - * Whether or not this gateway can support RECEIVING a refund request from the payment |
|
47 | - * provider (ie, initiated by admin on the payment prover's website who sends an IPN to EE) |
|
48 | - * |
|
49 | - * @var boolean |
|
50 | - */ |
|
51 | - protected $_supports_receiving_refunds = false; |
|
52 | - /** |
|
53 | - * Model for querying for existing payments |
|
54 | - * |
|
55 | - * @var EEMI_Payment |
|
56 | - */ |
|
57 | - protected $_pay_model; |
|
58 | - |
|
59 | - /** |
|
60 | - * Model used for adding to the payments log |
|
61 | - * |
|
62 | - * @var EEMI_Payment_Log |
|
63 | - */ |
|
64 | - protected $_pay_log; |
|
65 | - |
|
66 | - /** |
|
67 | - * Used for formatting some input to gateways |
|
68 | - * |
|
69 | - * @var EEHI_Template |
|
70 | - */ |
|
71 | - protected $_template; |
|
72 | - |
|
73 | - /** |
|
74 | - * Concrete class that implements EEHI_Money, used by most gateways |
|
75 | - * |
|
76 | - * @var EEHI_Money |
|
77 | - */ |
|
78 | - protected $_money; |
|
79 | - |
|
80 | - /** |
|
81 | - * Concrete class that implements EEHI_Line_Item, used for manipulating the line item tree |
|
82 | - * |
|
83 | - * @var EEHI_Line_Item |
|
84 | - */ |
|
85 | - protected $_line_item; |
|
86 | - |
|
87 | - /** |
|
88 | - * @var GatewayDataFormatterInterface |
|
89 | - */ |
|
90 | - protected $_gateway_data_formatter; |
|
91 | - |
|
92 | - /** |
|
93 | - * @var FormatterInterface |
|
94 | - */ |
|
95 | - protected $_unsupported_character_remover; |
|
96 | - |
|
97 | - /** |
|
98 | - * The ID of the payment method using this gateway |
|
99 | - * |
|
100 | - * @var int |
|
101 | - */ |
|
102 | - protected $_ID; |
|
103 | - |
|
104 | - /** |
|
105 | - * @var $_debug_mode boolean whether to send requests to teh sandbox site or not |
|
106 | - */ |
|
107 | - protected $_debug_mode; |
|
108 | - /** |
|
109 | - * |
|
110 | - * @var string $_name name to show for this payment method |
|
111 | - */ |
|
112 | - protected $_name; |
|
113 | - /** |
|
114 | - * |
|
115 | - * @var string name to show fir this payment method to admin-type users |
|
116 | - */ |
|
117 | - protected $_admin_name; |
|
118 | - |
|
119 | - /** |
|
120 | - * @return EE_Gateway |
|
121 | - */ |
|
122 | - public function __construct() |
|
123 | - { |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * We don't want to serialize models as they often have circular structures |
|
128 | - * (eg a payment model has a reference to each payment model object; and most |
|
129 | - * payments have a transaction, most transactions have a payment method; |
|
130 | - * most payment methods have a payment method type; most payment method types |
|
131 | - * have a gateway. And if a gateway serializes its models, we start at the |
|
132 | - * beginning again) |
|
133 | - * |
|
134 | - * @return array |
|
135 | - */ |
|
136 | - public function __sleep() |
|
137 | - { |
|
138 | - $properties = get_object_vars($this); |
|
139 | - unset($properties['_pay_model'], $properties['_pay_log']); |
|
140 | - return array_keys($properties); |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Returns whether or not this gateway should support SENDING refunds |
|
145 | - * see $_supports_sending_refunds |
|
146 | - * |
|
147 | - * @return boolean |
|
148 | - */ |
|
149 | - public function supports_sending_refunds() |
|
150 | - { |
|
151 | - return $this->_supports_sending_refunds; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Returns whether or not this gateway should support RECEIVING refunds |
|
156 | - * see $_supports_receiving_refunds |
|
157 | - * |
|
158 | - * @return boolean |
|
159 | - */ |
|
160 | - public function supports_receiving_refunds() |
|
161 | - { |
|
162 | - return $this->_supports_receiving_refunds; |
|
163 | - } |
|
164 | - |
|
165 | - |
|
166 | - /** |
|
167 | - * Tries to refund the payment specified, taking into account the extra |
|
168 | - * refund info. Note that if the gateway's _supports_sending_refunds is false, |
|
169 | - * this should just throw an exception. |
|
170 | - * |
|
171 | - * @param EE_Payment $payment |
|
172 | - * @param array $refund_info |
|
173 | - * @return EE_Payment for the refund |
|
174 | - * @throws EE_Error |
|
175 | - */ |
|
176 | - public function do_direct_refund(EE_Payment $payment, $refund_info = null) |
|
177 | - { |
|
178 | - return null; |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - /** |
|
183 | - * Sets the payment method's settings so the gateway knows where to send the request |
|
184 | - * etc |
|
185 | - * |
|
186 | - * @param array $settings_array |
|
187 | - */ |
|
188 | - public function set_settings($settings_array) |
|
189 | - { |
|
190 | - foreach ($settings_array as $name => $value) { |
|
191 | - $property_name = "_" . $name; |
|
192 | - $this->{$property_name} = $value; |
|
193 | - } |
|
194 | - } |
|
195 | - |
|
196 | - /** |
|
197 | - * See this class description |
|
198 | - * |
|
199 | - * @param EEMI_Payment $payment_model |
|
200 | - */ |
|
201 | - public function set_payment_model($payment_model) |
|
202 | - { |
|
203 | - $this->_pay_model = $payment_model; |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * See this class description |
|
208 | - * |
|
209 | - * @param EEMI_Payment_Log $payment_log_model |
|
210 | - */ |
|
211 | - public function set_payment_log($payment_log_model) |
|
212 | - { |
|
213 | - $this->_pay_log = $payment_log_model; |
|
214 | - } |
|
215 | - |
|
216 | - /** |
|
217 | - * See this class description |
|
218 | - * |
|
219 | - * @param EEHI_Template $template_helper |
|
220 | - */ |
|
221 | - public function set_template_helper($template_helper) |
|
222 | - { |
|
223 | - $this->_template = $template_helper; |
|
224 | - } |
|
225 | - |
|
226 | - /** |
|
227 | - * See this class description |
|
228 | - * |
|
229 | - * @param EEHI_Line_Item $line_item_helper |
|
230 | - */ |
|
231 | - public function set_line_item_helper($line_item_helper) |
|
232 | - { |
|
233 | - $this->_line_item = $line_item_helper; |
|
234 | - } |
|
235 | - |
|
236 | - /** |
|
237 | - * See this class description |
|
238 | - * |
|
239 | - * @param EEHI_Money $money_helper |
|
240 | - */ |
|
241 | - public function set_money_helper($money_helper) |
|
242 | - { |
|
243 | - $this->_money = $money_helper; |
|
244 | - } |
|
245 | - |
|
246 | - |
|
247 | - /** |
|
248 | - * Sets the gateway data formatter helper |
|
249 | - * |
|
250 | - * @param GatewayDataFormatterInterface $gateway_data_formatter |
|
251 | - * @throws InvalidEntityException if it's not set properly |
|
252 | - */ |
|
253 | - public function set_gateway_data_formatter(GatewayDataFormatterInterface $gateway_data_formatter) |
|
254 | - { |
|
255 | - if (! $gateway_data_formatter instanceof GatewayDataFormatterInterface) { |
|
256 | - throw new InvalidEntityException( |
|
257 | - is_object($gateway_data_formatter) |
|
258 | - ? get_class($gateway_data_formatter) |
|
259 | - : esc_html__('Not an object', 'event_espresso'), |
|
260 | - '\\EventEspresso\\core\\services\\payment_methods\\gateways\\GatewayDataFormatterInterface' |
|
261 | - ); |
|
262 | - } |
|
263 | - $this->_gateway_data_formatter = $gateway_data_formatter; |
|
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * Gets the gateway data formatter |
|
268 | - * |
|
269 | - * @return GatewayDataFormatterInterface |
|
270 | - * @throws InvalidEntityException if it's not set properly |
|
271 | - */ |
|
272 | - protected function _get_gateway_formatter() |
|
273 | - { |
|
274 | - if (! $this->_gateway_data_formatter instanceof GatewayDataFormatterInterface) { |
|
275 | - throw new InvalidEntityException( |
|
276 | - is_object($this->_gateway_data_formatter) |
|
277 | - ? get_class($this->_gateway_data_formatter) |
|
278 | - : esc_html__('Not an object', 'event_espresso'), |
|
279 | - '\\EventEspresso\\core\\services\\payment_methods\\gateways\\GatewayDataFormatterInterface' |
|
280 | - ); |
|
281 | - } |
|
282 | - return $this->_gateway_data_formatter; |
|
283 | - } |
|
284 | - |
|
285 | - |
|
286 | - /** |
|
287 | - * Sets the helper which will remove unsupported characters for most gateways |
|
288 | - * |
|
289 | - * @param FormatterInterface $formatter |
|
290 | - * @return FormatterInterface |
|
291 | - * @throws InvalidEntityException |
|
292 | - */ |
|
293 | - public function set_unsupported_character_remover(FormatterInterface $formatter) |
|
294 | - { |
|
295 | - if (! $formatter instanceof FormatterInterface) { |
|
296 | - throw new InvalidEntityException( |
|
297 | - is_object($formatter) |
|
298 | - ? get_class($formatter) |
|
299 | - : esc_html__('Not an object', 'event_espresso'), |
|
300 | - '\\EventEspresso\\core\\services\\formatters\\FormatterInterface' |
|
301 | - ); |
|
302 | - } |
|
303 | - $this->_unsupported_character_remover = $formatter; |
|
304 | - } |
|
305 | - |
|
306 | - /** |
|
307 | - * Gets the helper which removes characters which gateways might not support, like emojis etc. |
|
308 | - * |
|
309 | - * @return FormatterInterface |
|
310 | - * @throws InvalidEntityException |
|
311 | - */ |
|
312 | - protected function _get_unsupported_character_remover() |
|
313 | - { |
|
314 | - if (! $this->_unsupported_character_remover instanceof FormatterInterface) { |
|
315 | - throw new InvalidEntityException( |
|
316 | - is_object($this->_unsupported_character_remover) |
|
317 | - ? get_class($this->_unsupported_character_remover) |
|
318 | - : esc_html__('Not an object', 'event_espresso'), |
|
319 | - '\\EventEspresso\\core\\services\\formatters\\FormatterInterface' |
|
320 | - ); |
|
321 | - } |
|
322 | - return $this->_unsupported_character_remover; |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - /** |
|
327 | - * @param $message |
|
328 | - * @param $payment |
|
329 | - */ |
|
330 | - public function log($message, $object_logged) |
|
331 | - { |
|
332 | - if ($object_logged instanceof EEI_Payment) { |
|
333 | - $type = 'Payment'; |
|
334 | - $id = $object_logged->ID(); |
|
335 | - } elseif ($object_logged instanceof EEI_Transaction) { |
|
336 | - $type = 'Transaction'; |
|
337 | - $id = $object_logged->ID(); |
|
338 | - } else { |
|
339 | - $type = 'Payment_Method'; |
|
340 | - $id = $this->_ID; |
|
341 | - } |
|
342 | - // only log if we're going to store it for longer than the minimum time |
|
343 | - $reg_config = LoaderFactory::getLoader()->load('EE_Registration_Config'); |
|
344 | - if ($reg_config->gateway_log_lifespan !== '1 second') { |
|
345 | - $this->_pay_log->gateway_log($message, $id, $type); |
|
346 | - } |
|
347 | - } |
|
348 | - |
|
349 | - /** |
|
350 | - * Formats the amount so it can generally be sent to gateways |
|
351 | - * |
|
352 | - * @param float $amount |
|
353 | - * @return string |
|
354 | - * @deprecated since 4.9.31 insetad use |
|
355 | - * EventEspresso\core\services\payment_methods\gateways\GatewayDataFormatter::format_currency() |
|
356 | - */ |
|
357 | - public function format_currency($amount) |
|
358 | - { |
|
359 | - return $this->_get_gateway_formatter()->formatCurrency($amount); |
|
360 | - } |
|
361 | - |
|
362 | - /** |
|
363 | - * Returns either an array of all the currency codes supported, |
|
364 | - * or a string indicating they're all supported (EE_gateway::all_currencies_supported) |
|
365 | - * |
|
366 | - * @return mixed array or string |
|
367 | - */ |
|
368 | - public function currencies_supported() |
|
369 | - { |
|
370 | - return $this->_currencies_supported; |
|
371 | - } |
|
372 | - |
|
373 | - /** |
|
374 | - * Returns what a simple summing of items and taxes for this transaction. This |
|
375 | - * can be used to determine if some more complex line items, like promotions, |
|
376 | - * surcharges, or cancellations occurred (in which case we might want to forget |
|
377 | - * about creating an itemized list of purchases and instead only send the total due) |
|
378 | - * |
|
379 | - * @param EE_Transaction $transaction |
|
380 | - * @return float |
|
381 | - */ |
|
382 | - protected function _sum_items_and_taxes(EE_Transaction $transaction) |
|
383 | - { |
|
384 | - $total_line_item = $transaction->total_line_item(); |
|
385 | - $total = 0; |
|
386 | - foreach ($total_line_item->get_items() as $item_line_item) { |
|
387 | - $total += max($item_line_item->total(), 0); |
|
388 | - } |
|
389 | - foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
390 | - $total += max($tax_line_item->total(), 0); |
|
391 | - } |
|
392 | - return $total; |
|
393 | - } |
|
394 | - |
|
395 | - /** |
|
396 | - * Determines whether or not we can easily itemize the transaction using only |
|
397 | - * items and taxes (ie, no promotions or surcharges or cancellations needed) |
|
398 | - * |
|
399 | - * @param EEI_Payment $payment |
|
400 | - * @return boolean |
|
401 | - */ |
|
402 | - protected function _can_easily_itemize_transaction_for(EEI_Payment $payment) |
|
403 | - { |
|
404 | - return $this->_money->compare_floats( |
|
405 | - $this->_sum_items_and_taxes($payment->transaction()), |
|
406 | - $payment->transaction()->total() |
|
407 | - ) |
|
408 | - && $this->_money->compare_floats( |
|
409 | - $payment->amount(), |
|
410 | - $payment->transaction()->total() |
|
411 | - ); |
|
412 | - } |
|
413 | - |
|
414 | - /** |
|
415 | - * Handles updating the transaction and any other related data based on the payment. |
|
416 | - * You may be tempted to do this as part of do_direct_payment or handle_payment_update, |
|
417 | - * but doing so on those functions might be too early. It's possible that the changes |
|
418 | - * you make to teh transaction or registration or line items may just get overwritten |
|
419 | - * at that point. Instead, you should store any info you need on the payment during those |
|
420 | - * functions, and use that information at this step, which client code will decide |
|
421 | - * for you when it should be called. |
|
422 | - * |
|
423 | - * @param EE_Payment $payment |
|
424 | - * @return void |
|
425 | - */ |
|
426 | - public function update_txn_based_on_payment($payment) |
|
427 | - { |
|
428 | - // maybe update the transaction or line items or registrations |
|
429 | - // but most gateways don't need to do this, because they only update the payment |
|
430 | - } |
|
431 | - |
|
432 | - /** |
|
433 | - * Gets the first event for this payment (it's possible that it could be for multiple) |
|
434 | - * |
|
435 | - * @param EEI_Payment $payment |
|
436 | - * @return EEI_Event|null |
|
437 | - * @deprecated since 4.9.31 instead use EEI_Payment::get_first_event() |
|
438 | - */ |
|
439 | - protected function _get_first_event_for_payment(EEI_Payment $payment) |
|
440 | - { |
|
441 | - return $payment->get_first_event(); |
|
442 | - } |
|
443 | - |
|
444 | - /** |
|
445 | - * Gets the name of the first event for which is being paid |
|
446 | - * |
|
447 | - * @param EEI_Payment $payment |
|
448 | - * @return string |
|
449 | - * @deprecated since 4.9.31 instead use EEI_Payment::get_first_event_name() |
|
450 | - */ |
|
451 | - protected function _get_first_event_name_for_payment(EEI_Payment $payment) |
|
452 | - { |
|
453 | - return $payment->get_first_event_name(); |
|
454 | - } |
|
455 | - |
|
456 | - /** |
|
457 | - * Gets the text to use for a gateway's line item name when this is a partial payment |
|
458 | - * |
|
459 | - * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatPartialPaymentLineItemName($payment) |
|
460 | - * @param EE_Payment $payment |
|
461 | - * @return string |
|
462 | - */ |
|
463 | - protected function _format_partial_payment_line_item_name(EEI_Payment $payment) |
|
464 | - { |
|
465 | - return $this->_get_gateway_formatter()->formatPartialPaymentLineItemName($payment); |
|
466 | - } |
|
467 | - |
|
468 | - /** |
|
469 | - * Gets the text to use for a gateway's line item description when this is a partial payment |
|
470 | - * |
|
471 | - * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatPartialPaymentLineItemDesc() |
|
472 | - * @param EEI_Payment $payment |
|
473 | - * @return string |
|
474 | - */ |
|
475 | - protected function _format_partial_payment_line_item_desc(EEI_Payment $payment) |
|
476 | - { |
|
477 | - return $this->_get_gateway_formatter()->formatPartialPaymentLineItemDesc($payment); |
|
478 | - } |
|
479 | - |
|
480 | - /** |
|
481 | - * Gets the name to use for a line item when sending line items to the gateway |
|
482 | - * |
|
483 | - * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatLineItemName($line_item,$payment) |
|
484 | - * @param EEI_Line_Item $line_item |
|
485 | - * @param EEI_Payment $payment |
|
486 | - * @return string |
|
487 | - */ |
|
488 | - protected function _format_line_item_name(EEI_Line_Item $line_item, EEI_Payment $payment) |
|
489 | - { |
|
490 | - return $this->_get_gateway_formatter()->formatLineItemName($line_item, $payment); |
|
491 | - } |
|
492 | - |
|
493 | - /** |
|
494 | - * Gets the description to use for a line item when sending line items to the gateway |
|
495 | - * |
|
496 | - * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatLineItemDesc($line_item, $payment)) |
|
497 | - * @param EEI_Line_Item $line_item |
|
498 | - * @param EEI_Payment $payment |
|
499 | - * @return string |
|
500 | - */ |
|
501 | - protected function _format_line_item_desc(EEI_Line_Item $line_item, EEI_Payment $payment) |
|
502 | - { |
|
503 | - return $this->_get_gateway_formatter()->formatLineItemDesc($line_item, $payment); |
|
504 | - } |
|
505 | - |
|
506 | - /** |
|
507 | - * Gets the order description that should generlly be sent to gateways |
|
508 | - * |
|
509 | - * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatOrderDescription($payment) |
|
510 | - * @param EEI_Payment $payment |
|
511 | - * @return type |
|
512 | - */ |
|
513 | - protected function _format_order_description(EEI_Payment $payment) |
|
514 | - { |
|
515 | - return $this->_get_gateway_formatter()->formatOrderDescription($payment); |
|
516 | - } |
|
26 | + /** |
|
27 | + * a constant used as a possible value for $_currencies_supported to indicate |
|
28 | + * that ALL currencies are supported by this gateway |
|
29 | + */ |
|
30 | + const all_currencies_supported = 'all_currencies_supported'; |
|
31 | + /** |
|
32 | + * Where values are 3-letter currency codes |
|
33 | + * |
|
34 | + * @var array |
|
35 | + */ |
|
36 | + protected $_currencies_supported = array(); |
|
37 | + /** |
|
38 | + * Whether or not this gateway can support SENDING a refund request (ie, initiated by |
|
39 | + * admin in EE's wp-admin page) |
|
40 | + * |
|
41 | + * @var boolean |
|
42 | + */ |
|
43 | + protected $_supports_sending_refunds = false; |
|
44 | + |
|
45 | + /** |
|
46 | + * Whether or not this gateway can support RECEIVING a refund request from the payment |
|
47 | + * provider (ie, initiated by admin on the payment prover's website who sends an IPN to EE) |
|
48 | + * |
|
49 | + * @var boolean |
|
50 | + */ |
|
51 | + protected $_supports_receiving_refunds = false; |
|
52 | + /** |
|
53 | + * Model for querying for existing payments |
|
54 | + * |
|
55 | + * @var EEMI_Payment |
|
56 | + */ |
|
57 | + protected $_pay_model; |
|
58 | + |
|
59 | + /** |
|
60 | + * Model used for adding to the payments log |
|
61 | + * |
|
62 | + * @var EEMI_Payment_Log |
|
63 | + */ |
|
64 | + protected $_pay_log; |
|
65 | + |
|
66 | + /** |
|
67 | + * Used for formatting some input to gateways |
|
68 | + * |
|
69 | + * @var EEHI_Template |
|
70 | + */ |
|
71 | + protected $_template; |
|
72 | + |
|
73 | + /** |
|
74 | + * Concrete class that implements EEHI_Money, used by most gateways |
|
75 | + * |
|
76 | + * @var EEHI_Money |
|
77 | + */ |
|
78 | + protected $_money; |
|
79 | + |
|
80 | + /** |
|
81 | + * Concrete class that implements EEHI_Line_Item, used for manipulating the line item tree |
|
82 | + * |
|
83 | + * @var EEHI_Line_Item |
|
84 | + */ |
|
85 | + protected $_line_item; |
|
86 | + |
|
87 | + /** |
|
88 | + * @var GatewayDataFormatterInterface |
|
89 | + */ |
|
90 | + protected $_gateway_data_formatter; |
|
91 | + |
|
92 | + /** |
|
93 | + * @var FormatterInterface |
|
94 | + */ |
|
95 | + protected $_unsupported_character_remover; |
|
96 | + |
|
97 | + /** |
|
98 | + * The ID of the payment method using this gateway |
|
99 | + * |
|
100 | + * @var int |
|
101 | + */ |
|
102 | + protected $_ID; |
|
103 | + |
|
104 | + /** |
|
105 | + * @var $_debug_mode boolean whether to send requests to teh sandbox site or not |
|
106 | + */ |
|
107 | + protected $_debug_mode; |
|
108 | + /** |
|
109 | + * |
|
110 | + * @var string $_name name to show for this payment method |
|
111 | + */ |
|
112 | + protected $_name; |
|
113 | + /** |
|
114 | + * |
|
115 | + * @var string name to show fir this payment method to admin-type users |
|
116 | + */ |
|
117 | + protected $_admin_name; |
|
118 | + |
|
119 | + /** |
|
120 | + * @return EE_Gateway |
|
121 | + */ |
|
122 | + public function __construct() |
|
123 | + { |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * We don't want to serialize models as they often have circular structures |
|
128 | + * (eg a payment model has a reference to each payment model object; and most |
|
129 | + * payments have a transaction, most transactions have a payment method; |
|
130 | + * most payment methods have a payment method type; most payment method types |
|
131 | + * have a gateway. And if a gateway serializes its models, we start at the |
|
132 | + * beginning again) |
|
133 | + * |
|
134 | + * @return array |
|
135 | + */ |
|
136 | + public function __sleep() |
|
137 | + { |
|
138 | + $properties = get_object_vars($this); |
|
139 | + unset($properties['_pay_model'], $properties['_pay_log']); |
|
140 | + return array_keys($properties); |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Returns whether or not this gateway should support SENDING refunds |
|
145 | + * see $_supports_sending_refunds |
|
146 | + * |
|
147 | + * @return boolean |
|
148 | + */ |
|
149 | + public function supports_sending_refunds() |
|
150 | + { |
|
151 | + return $this->_supports_sending_refunds; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Returns whether or not this gateway should support RECEIVING refunds |
|
156 | + * see $_supports_receiving_refunds |
|
157 | + * |
|
158 | + * @return boolean |
|
159 | + */ |
|
160 | + public function supports_receiving_refunds() |
|
161 | + { |
|
162 | + return $this->_supports_receiving_refunds; |
|
163 | + } |
|
164 | + |
|
165 | + |
|
166 | + /** |
|
167 | + * Tries to refund the payment specified, taking into account the extra |
|
168 | + * refund info. Note that if the gateway's _supports_sending_refunds is false, |
|
169 | + * this should just throw an exception. |
|
170 | + * |
|
171 | + * @param EE_Payment $payment |
|
172 | + * @param array $refund_info |
|
173 | + * @return EE_Payment for the refund |
|
174 | + * @throws EE_Error |
|
175 | + */ |
|
176 | + public function do_direct_refund(EE_Payment $payment, $refund_info = null) |
|
177 | + { |
|
178 | + return null; |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + /** |
|
183 | + * Sets the payment method's settings so the gateway knows where to send the request |
|
184 | + * etc |
|
185 | + * |
|
186 | + * @param array $settings_array |
|
187 | + */ |
|
188 | + public function set_settings($settings_array) |
|
189 | + { |
|
190 | + foreach ($settings_array as $name => $value) { |
|
191 | + $property_name = "_" . $name; |
|
192 | + $this->{$property_name} = $value; |
|
193 | + } |
|
194 | + } |
|
195 | + |
|
196 | + /** |
|
197 | + * See this class description |
|
198 | + * |
|
199 | + * @param EEMI_Payment $payment_model |
|
200 | + */ |
|
201 | + public function set_payment_model($payment_model) |
|
202 | + { |
|
203 | + $this->_pay_model = $payment_model; |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * See this class description |
|
208 | + * |
|
209 | + * @param EEMI_Payment_Log $payment_log_model |
|
210 | + */ |
|
211 | + public function set_payment_log($payment_log_model) |
|
212 | + { |
|
213 | + $this->_pay_log = $payment_log_model; |
|
214 | + } |
|
215 | + |
|
216 | + /** |
|
217 | + * See this class description |
|
218 | + * |
|
219 | + * @param EEHI_Template $template_helper |
|
220 | + */ |
|
221 | + public function set_template_helper($template_helper) |
|
222 | + { |
|
223 | + $this->_template = $template_helper; |
|
224 | + } |
|
225 | + |
|
226 | + /** |
|
227 | + * See this class description |
|
228 | + * |
|
229 | + * @param EEHI_Line_Item $line_item_helper |
|
230 | + */ |
|
231 | + public function set_line_item_helper($line_item_helper) |
|
232 | + { |
|
233 | + $this->_line_item = $line_item_helper; |
|
234 | + } |
|
235 | + |
|
236 | + /** |
|
237 | + * See this class description |
|
238 | + * |
|
239 | + * @param EEHI_Money $money_helper |
|
240 | + */ |
|
241 | + public function set_money_helper($money_helper) |
|
242 | + { |
|
243 | + $this->_money = $money_helper; |
|
244 | + } |
|
245 | + |
|
246 | + |
|
247 | + /** |
|
248 | + * Sets the gateway data formatter helper |
|
249 | + * |
|
250 | + * @param GatewayDataFormatterInterface $gateway_data_formatter |
|
251 | + * @throws InvalidEntityException if it's not set properly |
|
252 | + */ |
|
253 | + public function set_gateway_data_formatter(GatewayDataFormatterInterface $gateway_data_formatter) |
|
254 | + { |
|
255 | + if (! $gateway_data_formatter instanceof GatewayDataFormatterInterface) { |
|
256 | + throw new InvalidEntityException( |
|
257 | + is_object($gateway_data_formatter) |
|
258 | + ? get_class($gateway_data_formatter) |
|
259 | + : esc_html__('Not an object', 'event_espresso'), |
|
260 | + '\\EventEspresso\\core\\services\\payment_methods\\gateways\\GatewayDataFormatterInterface' |
|
261 | + ); |
|
262 | + } |
|
263 | + $this->_gateway_data_formatter = $gateway_data_formatter; |
|
264 | + } |
|
265 | + |
|
266 | + /** |
|
267 | + * Gets the gateway data formatter |
|
268 | + * |
|
269 | + * @return GatewayDataFormatterInterface |
|
270 | + * @throws InvalidEntityException if it's not set properly |
|
271 | + */ |
|
272 | + protected function _get_gateway_formatter() |
|
273 | + { |
|
274 | + if (! $this->_gateway_data_formatter instanceof GatewayDataFormatterInterface) { |
|
275 | + throw new InvalidEntityException( |
|
276 | + is_object($this->_gateway_data_formatter) |
|
277 | + ? get_class($this->_gateway_data_formatter) |
|
278 | + : esc_html__('Not an object', 'event_espresso'), |
|
279 | + '\\EventEspresso\\core\\services\\payment_methods\\gateways\\GatewayDataFormatterInterface' |
|
280 | + ); |
|
281 | + } |
|
282 | + return $this->_gateway_data_formatter; |
|
283 | + } |
|
284 | + |
|
285 | + |
|
286 | + /** |
|
287 | + * Sets the helper which will remove unsupported characters for most gateways |
|
288 | + * |
|
289 | + * @param FormatterInterface $formatter |
|
290 | + * @return FormatterInterface |
|
291 | + * @throws InvalidEntityException |
|
292 | + */ |
|
293 | + public function set_unsupported_character_remover(FormatterInterface $formatter) |
|
294 | + { |
|
295 | + if (! $formatter instanceof FormatterInterface) { |
|
296 | + throw new InvalidEntityException( |
|
297 | + is_object($formatter) |
|
298 | + ? get_class($formatter) |
|
299 | + : esc_html__('Not an object', 'event_espresso'), |
|
300 | + '\\EventEspresso\\core\\services\\formatters\\FormatterInterface' |
|
301 | + ); |
|
302 | + } |
|
303 | + $this->_unsupported_character_remover = $formatter; |
|
304 | + } |
|
305 | + |
|
306 | + /** |
|
307 | + * Gets the helper which removes characters which gateways might not support, like emojis etc. |
|
308 | + * |
|
309 | + * @return FormatterInterface |
|
310 | + * @throws InvalidEntityException |
|
311 | + */ |
|
312 | + protected function _get_unsupported_character_remover() |
|
313 | + { |
|
314 | + if (! $this->_unsupported_character_remover instanceof FormatterInterface) { |
|
315 | + throw new InvalidEntityException( |
|
316 | + is_object($this->_unsupported_character_remover) |
|
317 | + ? get_class($this->_unsupported_character_remover) |
|
318 | + : esc_html__('Not an object', 'event_espresso'), |
|
319 | + '\\EventEspresso\\core\\services\\formatters\\FormatterInterface' |
|
320 | + ); |
|
321 | + } |
|
322 | + return $this->_unsupported_character_remover; |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + /** |
|
327 | + * @param $message |
|
328 | + * @param $payment |
|
329 | + */ |
|
330 | + public function log($message, $object_logged) |
|
331 | + { |
|
332 | + if ($object_logged instanceof EEI_Payment) { |
|
333 | + $type = 'Payment'; |
|
334 | + $id = $object_logged->ID(); |
|
335 | + } elseif ($object_logged instanceof EEI_Transaction) { |
|
336 | + $type = 'Transaction'; |
|
337 | + $id = $object_logged->ID(); |
|
338 | + } else { |
|
339 | + $type = 'Payment_Method'; |
|
340 | + $id = $this->_ID; |
|
341 | + } |
|
342 | + // only log if we're going to store it for longer than the minimum time |
|
343 | + $reg_config = LoaderFactory::getLoader()->load('EE_Registration_Config'); |
|
344 | + if ($reg_config->gateway_log_lifespan !== '1 second') { |
|
345 | + $this->_pay_log->gateway_log($message, $id, $type); |
|
346 | + } |
|
347 | + } |
|
348 | + |
|
349 | + /** |
|
350 | + * Formats the amount so it can generally be sent to gateways |
|
351 | + * |
|
352 | + * @param float $amount |
|
353 | + * @return string |
|
354 | + * @deprecated since 4.9.31 insetad use |
|
355 | + * EventEspresso\core\services\payment_methods\gateways\GatewayDataFormatter::format_currency() |
|
356 | + */ |
|
357 | + public function format_currency($amount) |
|
358 | + { |
|
359 | + return $this->_get_gateway_formatter()->formatCurrency($amount); |
|
360 | + } |
|
361 | + |
|
362 | + /** |
|
363 | + * Returns either an array of all the currency codes supported, |
|
364 | + * or a string indicating they're all supported (EE_gateway::all_currencies_supported) |
|
365 | + * |
|
366 | + * @return mixed array or string |
|
367 | + */ |
|
368 | + public function currencies_supported() |
|
369 | + { |
|
370 | + return $this->_currencies_supported; |
|
371 | + } |
|
372 | + |
|
373 | + /** |
|
374 | + * Returns what a simple summing of items and taxes for this transaction. This |
|
375 | + * can be used to determine if some more complex line items, like promotions, |
|
376 | + * surcharges, or cancellations occurred (in which case we might want to forget |
|
377 | + * about creating an itemized list of purchases and instead only send the total due) |
|
378 | + * |
|
379 | + * @param EE_Transaction $transaction |
|
380 | + * @return float |
|
381 | + */ |
|
382 | + protected function _sum_items_and_taxes(EE_Transaction $transaction) |
|
383 | + { |
|
384 | + $total_line_item = $transaction->total_line_item(); |
|
385 | + $total = 0; |
|
386 | + foreach ($total_line_item->get_items() as $item_line_item) { |
|
387 | + $total += max($item_line_item->total(), 0); |
|
388 | + } |
|
389 | + foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
390 | + $total += max($tax_line_item->total(), 0); |
|
391 | + } |
|
392 | + return $total; |
|
393 | + } |
|
394 | + |
|
395 | + /** |
|
396 | + * Determines whether or not we can easily itemize the transaction using only |
|
397 | + * items and taxes (ie, no promotions or surcharges or cancellations needed) |
|
398 | + * |
|
399 | + * @param EEI_Payment $payment |
|
400 | + * @return boolean |
|
401 | + */ |
|
402 | + protected function _can_easily_itemize_transaction_for(EEI_Payment $payment) |
|
403 | + { |
|
404 | + return $this->_money->compare_floats( |
|
405 | + $this->_sum_items_and_taxes($payment->transaction()), |
|
406 | + $payment->transaction()->total() |
|
407 | + ) |
|
408 | + && $this->_money->compare_floats( |
|
409 | + $payment->amount(), |
|
410 | + $payment->transaction()->total() |
|
411 | + ); |
|
412 | + } |
|
413 | + |
|
414 | + /** |
|
415 | + * Handles updating the transaction and any other related data based on the payment. |
|
416 | + * You may be tempted to do this as part of do_direct_payment or handle_payment_update, |
|
417 | + * but doing so on those functions might be too early. It's possible that the changes |
|
418 | + * you make to teh transaction or registration or line items may just get overwritten |
|
419 | + * at that point. Instead, you should store any info you need on the payment during those |
|
420 | + * functions, and use that information at this step, which client code will decide |
|
421 | + * for you when it should be called. |
|
422 | + * |
|
423 | + * @param EE_Payment $payment |
|
424 | + * @return void |
|
425 | + */ |
|
426 | + public function update_txn_based_on_payment($payment) |
|
427 | + { |
|
428 | + // maybe update the transaction or line items or registrations |
|
429 | + // but most gateways don't need to do this, because they only update the payment |
|
430 | + } |
|
431 | + |
|
432 | + /** |
|
433 | + * Gets the first event for this payment (it's possible that it could be for multiple) |
|
434 | + * |
|
435 | + * @param EEI_Payment $payment |
|
436 | + * @return EEI_Event|null |
|
437 | + * @deprecated since 4.9.31 instead use EEI_Payment::get_first_event() |
|
438 | + */ |
|
439 | + protected function _get_first_event_for_payment(EEI_Payment $payment) |
|
440 | + { |
|
441 | + return $payment->get_first_event(); |
|
442 | + } |
|
443 | + |
|
444 | + /** |
|
445 | + * Gets the name of the first event for which is being paid |
|
446 | + * |
|
447 | + * @param EEI_Payment $payment |
|
448 | + * @return string |
|
449 | + * @deprecated since 4.9.31 instead use EEI_Payment::get_first_event_name() |
|
450 | + */ |
|
451 | + protected function _get_first_event_name_for_payment(EEI_Payment $payment) |
|
452 | + { |
|
453 | + return $payment->get_first_event_name(); |
|
454 | + } |
|
455 | + |
|
456 | + /** |
|
457 | + * Gets the text to use for a gateway's line item name when this is a partial payment |
|
458 | + * |
|
459 | + * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatPartialPaymentLineItemName($payment) |
|
460 | + * @param EE_Payment $payment |
|
461 | + * @return string |
|
462 | + */ |
|
463 | + protected function _format_partial_payment_line_item_name(EEI_Payment $payment) |
|
464 | + { |
|
465 | + return $this->_get_gateway_formatter()->formatPartialPaymentLineItemName($payment); |
|
466 | + } |
|
467 | + |
|
468 | + /** |
|
469 | + * Gets the text to use for a gateway's line item description when this is a partial payment |
|
470 | + * |
|
471 | + * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatPartialPaymentLineItemDesc() |
|
472 | + * @param EEI_Payment $payment |
|
473 | + * @return string |
|
474 | + */ |
|
475 | + protected function _format_partial_payment_line_item_desc(EEI_Payment $payment) |
|
476 | + { |
|
477 | + return $this->_get_gateway_formatter()->formatPartialPaymentLineItemDesc($payment); |
|
478 | + } |
|
479 | + |
|
480 | + /** |
|
481 | + * Gets the name to use for a line item when sending line items to the gateway |
|
482 | + * |
|
483 | + * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatLineItemName($line_item,$payment) |
|
484 | + * @param EEI_Line_Item $line_item |
|
485 | + * @param EEI_Payment $payment |
|
486 | + * @return string |
|
487 | + */ |
|
488 | + protected function _format_line_item_name(EEI_Line_Item $line_item, EEI_Payment $payment) |
|
489 | + { |
|
490 | + return $this->_get_gateway_formatter()->formatLineItemName($line_item, $payment); |
|
491 | + } |
|
492 | + |
|
493 | + /** |
|
494 | + * Gets the description to use for a line item when sending line items to the gateway |
|
495 | + * |
|
496 | + * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatLineItemDesc($line_item, $payment)) |
|
497 | + * @param EEI_Line_Item $line_item |
|
498 | + * @param EEI_Payment $payment |
|
499 | + * @return string |
|
500 | + */ |
|
501 | + protected function _format_line_item_desc(EEI_Line_Item $line_item, EEI_Payment $payment) |
|
502 | + { |
|
503 | + return $this->_get_gateway_formatter()->formatLineItemDesc($line_item, $payment); |
|
504 | + } |
|
505 | + |
|
506 | + /** |
|
507 | + * Gets the order description that should generlly be sent to gateways |
|
508 | + * |
|
509 | + * @deprecated since 4.9.31 instead use $this->_get_gateway_formatter()->formatOrderDescription($payment) |
|
510 | + * @param EEI_Payment $payment |
|
511 | + * @return type |
|
512 | + */ |
|
513 | + protected function _format_order_description(EEI_Payment $payment) |
|
514 | + { |
|
515 | + return $this->_get_gateway_formatter()->formatOrderDescription($payment); |
|
516 | + } |
|
517 | 517 | } |