@@ -19,117 +19,117 @@ |
||
| 19 | 19 | class EE_Billing_Info_Form extends EE_Form_Section_Proper |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * The payment method this billing form is for |
|
| 24 | - * @var EE_Payment_Method |
|
| 25 | - */ |
|
| 26 | - protected $_pm_instance; |
|
| 27 | - |
|
| 28 | - |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * |
|
| 32 | - * @param EE_Payment_Method $payment_method |
|
| 33 | - * @param array $options_array @see EE_Form_Section_Proper::__construct() |
|
| 34 | - */ |
|
| 35 | - public function __construct(EE_Payment_Method $payment_method, $options_array = array()) |
|
| 36 | - { |
|
| 37 | - $this->_pm_instance = $payment_method; |
|
| 38 | - $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
|
| 39 | - parent::__construct($options_array); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Sets the payment method for this billing form |
|
| 46 | - * @param EE_Payment_Method $payment_method |
|
| 47 | - * @return void |
|
| 48 | - */ |
|
| 49 | - public function set_payment_method(EE_Payment_Method $payment_method) |
|
| 50 | - { |
|
| 51 | - $this->_pm_instance = $payment_method; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Returns the instance of the payment method this billing form is for |
|
| 58 | - * @return EE_Payment_Method |
|
| 59 | - */ |
|
| 60 | - public function payment_method() |
|
| 61 | - { |
|
| 62 | - return $this->_pm_instance; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * payment_fields_autofilled_notice_html |
|
| 69 | - * @return string |
|
| 70 | - */ |
|
| 71 | - public function payment_fields_autofilled_notice_html() |
|
| 72 | - { |
|
| 73 | - return new EE_Form_Section_HTML( |
|
| 74 | - EEH_HTML::p( |
|
| 75 | - apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __('Payment fields have been autofilled because you are in debug mode', 'event_espresso')), |
|
| 76 | - '', |
|
| 77 | - 'important-notice' |
|
| 78 | - ) |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @return string |
|
| 86 | - */ |
|
| 87 | - public function html_class() |
|
| 88 | - { |
|
| 89 | - return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - public function enqueue_js() |
|
| 95 | - { |
|
| 96 | - parent::enqueue_js(); |
|
| 97 | - // In the future this feature may be available to other payment methods, but for now it's only PayPal Pro. |
|
| 98 | - if ($this->_pm_instance->type() === 'Paypal_Pro') { |
|
| 99 | - $this->enqueueCardinalCommerceJs(); |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Enqueues JS for Cardinal Commerce to do 3D Secure Authorization. |
|
| 105 | - * @since $VID:$ |
|
| 106 | - */ |
|
| 107 | - protected function enqueueCardinalCommerceJs() |
|
| 108 | - { |
|
| 109 | - $on_staging = $this->_pm_instance->debug_mode(); |
|
| 110 | - if ($on_staging) { |
|
| 111 | - $songbird_domain = 'songbirdstag.cardinalcommerce.com'; |
|
| 112 | - } else { |
|
| 113 | - $songbird_domain = 'songbird.cardinalcommerce.com'; |
|
| 114 | - } |
|
| 115 | - wp_register_script( |
|
| 116 | - 'ee-cardinal-commerce-songbird', |
|
| 117 | - "https://{$songbird_domain}/edge/v1/songbird.js"); |
|
| 118 | - if( ! did_action('wp_enqueue_scripts')){ |
|
| 119 | - // This was called too early. |
|
| 120 | - return; |
|
| 121 | - } |
|
| 122 | - $registry = LoaderFactory::getLoader()->getShared('EventEspresso\core\services\assets\Registry'); |
|
| 123 | - $domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain'); |
|
| 124 | - $url = $registry->getJsUrl( |
|
| 125 | - $domain->assetNamespace(), |
|
| 126 | - 'eventespresso-payment-methods-cardinal-commerce' |
|
| 127 | - ); |
|
| 128 | - wp_enqueue_script( |
|
| 129 | - 'eventespresso-payment-methods-cardinal-commerce', |
|
| 130 | - $url, |
|
| 131 | - ['ee-cardinal-commerce-songbird'] |
|
| 132 | - ); |
|
| 133 | - } |
|
| 22 | + /** |
|
| 23 | + * The payment method this billing form is for |
|
| 24 | + * @var EE_Payment_Method |
|
| 25 | + */ |
|
| 26 | + protected $_pm_instance; |
|
| 27 | + |
|
| 28 | + |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * |
|
| 32 | + * @param EE_Payment_Method $payment_method |
|
| 33 | + * @param array $options_array @see EE_Form_Section_Proper::__construct() |
|
| 34 | + */ |
|
| 35 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) |
|
| 36 | + { |
|
| 37 | + $this->_pm_instance = $payment_method; |
|
| 38 | + $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
|
| 39 | + parent::__construct($options_array); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Sets the payment method for this billing form |
|
| 46 | + * @param EE_Payment_Method $payment_method |
|
| 47 | + * @return void |
|
| 48 | + */ |
|
| 49 | + public function set_payment_method(EE_Payment_Method $payment_method) |
|
| 50 | + { |
|
| 51 | + $this->_pm_instance = $payment_method; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Returns the instance of the payment method this billing form is for |
|
| 58 | + * @return EE_Payment_Method |
|
| 59 | + */ |
|
| 60 | + public function payment_method() |
|
| 61 | + { |
|
| 62 | + return $this->_pm_instance; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * payment_fields_autofilled_notice_html |
|
| 69 | + * @return string |
|
| 70 | + */ |
|
| 71 | + public function payment_fields_autofilled_notice_html() |
|
| 72 | + { |
|
| 73 | + return new EE_Form_Section_HTML( |
|
| 74 | + EEH_HTML::p( |
|
| 75 | + apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __('Payment fields have been autofilled because you are in debug mode', 'event_espresso')), |
|
| 76 | + '', |
|
| 77 | + 'important-notice' |
|
| 78 | + ) |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @return string |
|
| 86 | + */ |
|
| 87 | + public function html_class() |
|
| 88 | + { |
|
| 89 | + return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + public function enqueue_js() |
|
| 95 | + { |
|
| 96 | + parent::enqueue_js(); |
|
| 97 | + // In the future this feature may be available to other payment methods, but for now it's only PayPal Pro. |
|
| 98 | + if ($this->_pm_instance->type() === 'Paypal_Pro') { |
|
| 99 | + $this->enqueueCardinalCommerceJs(); |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Enqueues JS for Cardinal Commerce to do 3D Secure Authorization. |
|
| 105 | + * @since $VID:$ |
|
| 106 | + */ |
|
| 107 | + protected function enqueueCardinalCommerceJs() |
|
| 108 | + { |
|
| 109 | + $on_staging = $this->_pm_instance->debug_mode(); |
|
| 110 | + if ($on_staging) { |
|
| 111 | + $songbird_domain = 'songbirdstag.cardinalcommerce.com'; |
|
| 112 | + } else { |
|
| 113 | + $songbird_domain = 'songbird.cardinalcommerce.com'; |
|
| 114 | + } |
|
| 115 | + wp_register_script( |
|
| 116 | + 'ee-cardinal-commerce-songbird', |
|
| 117 | + "https://{$songbird_domain}/edge/v1/songbird.js"); |
|
| 118 | + if( ! did_action('wp_enqueue_scripts')){ |
|
| 119 | + // This was called too early. |
|
| 120 | + return; |
|
| 121 | + } |
|
| 122 | + $registry = LoaderFactory::getLoader()->getShared('EventEspresso\core\services\assets\Registry'); |
|
| 123 | + $domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain'); |
|
| 124 | + $url = $registry->getJsUrl( |
|
| 125 | + $domain->assetNamespace(), |
|
| 126 | + 'eventespresso-payment-methods-cardinal-commerce' |
|
| 127 | + ); |
|
| 128 | + wp_enqueue_script( |
|
| 129 | + 'eventespresso-payment-methods-cardinal-commerce', |
|
| 130 | + $url, |
|
| 131 | + ['ee-cardinal-commerce-songbird'] |
|
| 132 | + ); |
|
| 133 | + } |
|
| 134 | 134 | } |
| 135 | 135 | // End of file EE_Billing_Info_Form.form.php |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function html_class() |
| 88 | 88 | { |
| 89 | - return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
| 89 | + return ! empty($this->_html_class) ? $this->_html_class.' ee-billing-form' : 'ee-billing-form'; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | wp_register_script( |
| 116 | 116 | 'ee-cardinal-commerce-songbird', |
| 117 | 117 | "https://{$songbird_domain}/edge/v1/songbird.js"); |
| 118 | - if( ! did_action('wp_enqueue_scripts')){ |
|
| 118 | + if ( ! did_action('wp_enqueue_scripts')) { |
|
| 119 | 119 | // This was called too early. |
| 120 | 120 | return; |
| 121 | 121 | } |