1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
if (!defined('EVENT_ESPRESSO_VERSION')) |
4
|
|
|
exit('No direct script access allowed'); |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Event Espresso |
8
|
|
|
* |
9
|
|
|
* Event Registration and Management Plugin for WordPress |
10
|
|
|
* |
11
|
|
|
* @ package Event Espresso |
12
|
|
|
* @ author Seth Shoultes |
13
|
|
|
* @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
14
|
|
|
* @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
15
|
|
|
* @ link http://www.eventespresso.com |
16
|
|
|
* @ version 4.3 |
17
|
|
|
* |
18
|
|
|
* ------------------------------------------------------------------------ |
19
|
|
|
* |
20
|
|
|
* EE_PMT_Invoice |
21
|
|
|
* |
22
|
|
|
* @package Event Espresso |
23
|
|
|
* @subpackage |
24
|
|
|
* @author Mike Nelson |
25
|
|
|
* |
26
|
|
|
* ------------------------------------------------------------------------ |
27
|
|
|
*/ |
28
|
|
|
class EE_PMT_Invoice extends EE_PMT_Base{ |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* |
34
|
|
|
* @param EE_Payment_Method $pm_instance |
35
|
|
|
* @return EE_PMT_Invoice |
|
|
|
|
36
|
|
|
*/ |
37
|
|
View Code Duplication |
public function __construct($pm_instance = NULL) { |
|
|
|
|
38
|
|
|
$this->_pretty_name = __("Invoice", 'event_espresso'); |
39
|
|
|
$this->_default_description = __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso' ); |
40
|
|
|
parent::__construct($pm_instance); |
41
|
|
|
$this->_default_button_url = $this->file_url().'lib'.DS.'invoice-logo.png'; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Creates the billing form for this payment method type |
48
|
|
|
* @param \EE_Transaction $transaction |
49
|
|
|
* @return NULL |
50
|
|
|
*/ |
51
|
|
|
public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
52
|
|
|
return NULL; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Gets the form for all the settings related to this payment method type |
59
|
|
|
* @return EE_Payment_Method_Form |
60
|
|
|
*/ |
61
|
|
|
public function generate_new_settings_form() { |
62
|
|
|
$pdf_payee_input_name = 'pdf_payee_name'; |
63
|
|
|
$confirmation_text_input_name = 'page_confirmation_text'; |
64
|
|
|
$form = new EE_Payment_Method_Form(array( |
65
|
|
|
// 'payment_method_type' => $this, |
66
|
|
|
'extra_meta_inputs'=>array( |
67
|
|
|
$pdf_payee_input_name => new EE_Text_Input(array( |
68
|
|
|
'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link()) |
69
|
|
|
)), |
70
|
|
|
'pdf_payee_email' => new EE_Email_Input(array( |
71
|
|
|
'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()), |
72
|
|
|
)), |
73
|
|
|
'pdf_payee_tax_number' => new EE_Text_Input(array( |
74
|
|
|
'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()), |
75
|
|
|
)), |
76
|
|
|
'pdf_payee_address' => new EE_Text_Area_Input( array( |
77
|
|
|
'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ), |
78
|
|
|
'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
79
|
|
|
)), |
80
|
|
|
'pdf_instructions'=>new EE_Text_Area_Input(array( |
81
|
|
|
'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
82
|
|
|
'default'=> __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
83
|
|
|
'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
84
|
|
|
)), |
85
|
|
|
'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array( |
86
|
|
|
'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
87
|
|
|
'default'=> EE_Config::instance()->organization->logo_url, |
88
|
|
|
'html_help_text'=> __("(Logo for the top left of the invoice)", 'event_espresso'), |
89
|
|
|
)), |
90
|
|
|
$confirmation_text_input_name =>new EE_Text_Area_Input(array( |
91
|
|
|
'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
92
|
|
|
'default'=> __("Payment must be received within 48 hours of event date. Details about where to send payment is included on the invoice.", 'event_espresso'), |
93
|
|
|
'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
94
|
|
|
)), |
95
|
|
|
'page_extra_info'=>new EE_Text_Area_Input(array( |
96
|
|
|
'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
97
|
|
|
'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
98
|
|
|
)), |
99
|
|
|
), |
100
|
|
|
'include'=>array( |
101
|
|
|
'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order', |
102
|
|
|
$pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image', |
103
|
|
|
$confirmation_text_input_name, 'page_extra_info'), |
104
|
|
|
)); |
105
|
|
|
$form->add_subsections( |
106
|
|
|
array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )), |
107
|
|
|
$pdf_payee_input_name |
108
|
|
|
); |
109
|
|
|
$form->add_subsections( |
110
|
|
|
array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )), |
111
|
|
|
$confirmation_text_input_name |
112
|
|
|
); |
113
|
|
|
return $form; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
|
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Adds the help tab |
120
|
|
|
* @see EE_PMT_Base::help_tabs_config() |
121
|
|
|
* @return array |
122
|
|
|
*/ |
123
|
|
|
public function help_tabs_config(){ |
124
|
|
|
return array( |
125
|
|
|
$this->get_help_tab_name() => array( |
126
|
|
|
'title' => __('Invoice Settings', 'event_espresso'), |
127
|
|
|
'filename' => 'payment_methods_overview_invoice' |
128
|
|
|
), |
129
|
|
|
); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* For adding any html output above the payment overview. |
135
|
|
|
* Many gateways won't want ot display anything, so this function just returns an empty string. |
136
|
|
|
* Other gateways may want to override this, such as offline gateways. |
137
|
|
|
* |
138
|
|
|
* @param \EE_Payment $payment |
139
|
|
|
* @return string |
140
|
|
|
*/ |
141
|
|
|
public function payment_overview_content( EE_Payment $payment ){ |
142
|
|
|
return EEH_Template::locate_template( |
143
|
|
|
'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php', |
144
|
|
|
array_merge( |
145
|
|
|
array( |
146
|
|
|
'payment_method' => $this->_pm_instance, |
147
|
|
|
'payment' => $payment, |
148
|
|
|
'page_confirmation_text' => '', |
149
|
|
|
'page_extra_info' => '', |
150
|
|
|
'invoice_url' => $payment->transaction()->primary_registration()->invoice_url( 'html' ) |
151
|
|
|
), |
152
|
|
|
$this->_pm_instance->all_extra_meta_array() |
153
|
|
|
) |
154
|
|
|
); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
|
158
|
|
|
|
159
|
|
|
} |
160
|
|
|
// End of file EE_PMT_Invoice.pm.php |
161
|
|
|
|
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.