@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @return Ambigous <string, NULL> |
| 221 | 221 | */ |
| 222 | 222 | public function get_currency_numeric_code() { |
| 223 | - return Currency::transform_code_to_number( $this->get_currency_alphabetic_code() ); |
|
| 223 | + return Currency::transform_code_to_number($this->get_currency_alphabetic_code()); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | * @param string $payment_method Payment method identifier. |
| 268 | 268 | * @return string |
| 269 | 269 | */ |
| 270 | - public function get_issuer( $payment_method = null ) { |
|
| 271 | - if ( PaymentMethods::CREDIT_CARD === $payment_method ) { |
|
| 270 | + public function get_issuer($payment_method = null) { |
|
| 271 | + if (PaymentMethods::CREDIT_CARD === $payment_method) { |
|
| 272 | 272 | return $this->get_credit_card_issuer_id(); |
| 273 | 273 | } |
| 274 | 274 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @return string |
| 282 | 282 | */ |
| 283 | 283 | public function get_issuer_id() { |
| 284 | - return filter_input( INPUT_POST, 'pronamic_ideal_issuer_id', FILTER_SANITIZE_STRING ); |
|
| 284 | + return filter_input(INPUT_POST, 'pronamic_ideal_issuer_id', FILTER_SANITIZE_STRING); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @return string |
| 291 | 291 | */ |
| 292 | 292 | public function get_credit_card_issuer_id() { |
| 293 | - return filter_input( INPUT_POST, 'pronamic_credit_card_issuer_id', FILTER_SANITIZE_STRING ); |
|
| 293 | + return filter_input(INPUT_POST, 'pronamic_credit_card_issuer_id', FILTER_SANITIZE_STRING); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | * |
| 333 | 333 | * @param boolean $recurring Boolean flag which indicates recurring. |
| 334 | 334 | */ |
| 335 | - public function set_recurring( $recurring ) { |
|
| 335 | + public function set_recurring($recurring) { |
|
| 336 | 336 | $this->recurring = $recurring; |
| 337 | 337 | } |
| 338 | 338 | } |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @see https://github.com/WordPress/WordPress/blob/4.0/wp-includes/post.php#L167 |
| 35 | 35 | */ |
| 36 | - add_action( 'init', array( $this, 'register_payment_post_type' ), 0 ); // Highest priority. |
|
| 37 | - add_action( 'init', array( $this, 'register_post_status' ), 9 ); |
|
| 36 | + add_action('init', array($this, 'register_payment_post_type'), 0); // Highest priority. |
|
| 37 | + add_action('init', array($this, 'register_post_status'), 9); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -45,23 +45,23 @@ discard block |
||
| 45 | 45 | public function register_payment_post_type() { |
| 46 | 46 | register_post_type( |
| 47 | 47 | 'pronamic_payment', array( |
| 48 | - 'label' => __( 'Payments', 'pronamic_ideal' ), |
|
| 48 | + 'label' => __('Payments', 'pronamic_ideal'), |
|
| 49 | 49 | 'labels' => array( |
| 50 | - 'name' => __( 'Payments', 'pronamic_ideal' ), |
|
| 51 | - 'singular_name' => __( 'Payment', 'pronamic_ideal' ), |
|
| 52 | - 'add_new' => __( 'Add New', 'pronamic_ideal' ), |
|
| 53 | - 'add_new_item' => __( 'Add New Payment', 'pronamic_ideal' ), |
|
| 54 | - 'edit_item' => __( 'Edit Payment', 'pronamic_ideal' ), |
|
| 55 | - 'new_item' => __( 'New Payment', 'pronamic_ideal' ), |
|
| 56 | - 'all_items' => __( 'All Payments', 'pronamic_ideal' ), |
|
| 57 | - 'view_item' => __( 'View Payment', 'pronamic_ideal' ), |
|
| 58 | - 'search_items' => __( 'Search Payments', 'pronamic_ideal' ), |
|
| 59 | - 'not_found' => __( 'No payments found.', 'pronamic_ideal' ), |
|
| 60 | - 'not_found_in_trash' => __( 'No payments found in Trash.', 'pronamic_ideal' ), |
|
| 61 | - 'menu_name' => __( 'Payments', 'pronamic_ideal' ), |
|
| 62 | - 'filter_items_list' => __( 'Filter payments list', 'pronamic_ideal' ), |
|
| 63 | - 'items_list_navigation' => __( 'Payments list navigation', 'pronamic_ideal' ), |
|
| 64 | - 'items_list' => __( 'Payments list', 'pronamic_ideal' ), |
|
| 50 | + 'name' => __('Payments', 'pronamic_ideal'), |
|
| 51 | + 'singular_name' => __('Payment', 'pronamic_ideal'), |
|
| 52 | + 'add_new' => __('Add New', 'pronamic_ideal'), |
|
| 53 | + 'add_new_item' => __('Add New Payment', 'pronamic_ideal'), |
|
| 54 | + 'edit_item' => __('Edit Payment', 'pronamic_ideal'), |
|
| 55 | + 'new_item' => __('New Payment', 'pronamic_ideal'), |
|
| 56 | + 'all_items' => __('All Payments', 'pronamic_ideal'), |
|
| 57 | + 'view_item' => __('View Payment', 'pronamic_ideal'), |
|
| 58 | + 'search_items' => __('Search Payments', 'pronamic_ideal'), |
|
| 59 | + 'not_found' => __('No payments found.', 'pronamic_ideal'), |
|
| 60 | + 'not_found_in_trash' => __('No payments found in Trash.', 'pronamic_ideal'), |
|
| 61 | + 'menu_name' => __('Payments', 'pronamic_ideal'), |
|
| 62 | + 'filter_items_list' => __('Filter payments list', 'pronamic_ideal'), |
|
| 63 | + 'items_list_navigation' => __('Payments list navigation', 'pronamic_ideal'), |
|
| 64 | + 'items_list' => __('Payments list', 'pronamic_ideal'), |
|
| 65 | 65 | ), |
| 66 | 66 | 'public' => false, |
| 67 | 67 | 'publicly_queryable' => false, |
@@ -87,89 +87,89 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | register_post_status( |
| 89 | 89 | 'payment_pending', array( |
| 90 | - 'label' => _x( 'Pending', 'Payment status', 'pronamic_ideal' ), |
|
| 90 | + 'label' => _x('Pending', 'Payment status', 'pronamic_ideal'), |
|
| 91 | 91 | 'public' => false, |
| 92 | 92 | 'exclude_from_search' => false, |
| 93 | 93 | 'show_in_admin_all_list' => true, |
| 94 | 94 | 'show_in_admin_status_list' => true, |
| 95 | - 'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'pronamic_ideal' ), |
|
| 95 | + 'label_count' => _n_noop('Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>', 'pronamic_ideal'), |
|
| 96 | 96 | ) |
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | register_post_status( |
| 100 | 100 | 'payment_processing', array( |
| 101 | - 'label' => _x( 'Processing', 'Payment status', 'pronamic_ideal' ), |
|
| 101 | + 'label' => _x('Processing', 'Payment status', 'pronamic_ideal'), |
|
| 102 | 102 | 'public' => false, |
| 103 | 103 | 'exclude_from_search' => false, |
| 104 | 104 | 'show_in_admin_all_list' => true, |
| 105 | 105 | 'show_in_admin_status_list' => true, |
| 106 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'pronamic_ideal' ), |
|
| 106 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'pronamic_ideal'), |
|
| 107 | 107 | ) |
| 108 | 108 | ); |
| 109 | 109 | |
| 110 | 110 | register_post_status( |
| 111 | 111 | 'payment_on_hold', array( |
| 112 | - 'label' => _x( 'On Hold', 'Payment status', 'pronamic_ideal' ), |
|
| 112 | + 'label' => _x('On Hold', 'Payment status', 'pronamic_ideal'), |
|
| 113 | 113 | 'public' => false, |
| 114 | 114 | 'exclude_from_search' => false, |
| 115 | 115 | 'show_in_admin_all_list' => true, |
| 116 | 116 | 'show_in_admin_status_list' => true, |
| 117 | - 'label_count' => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'pronamic_ideal' ), |
|
| 117 | + 'label_count' => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'pronamic_ideal'), |
|
| 118 | 118 | ) |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | 121 | register_post_status( |
| 122 | 122 | 'payment_completed', array( |
| 123 | - 'label' => _x( 'Completed', 'Payment status', 'pronamic_ideal' ), |
|
| 123 | + 'label' => _x('Completed', 'Payment status', 'pronamic_ideal'), |
|
| 124 | 124 | 'public' => false, |
| 125 | 125 | 'exclude_from_search' => false, |
| 126 | 126 | 'show_in_admin_all_list' => true, |
| 127 | 127 | 'show_in_admin_status_list' => true, |
| 128 | - 'label_count' => _n_noop( 'Completed <span class="count">(%s)</span>', 'Completed <span class="count">(%s)</span>', 'pronamic_ideal' ), |
|
| 128 | + 'label_count' => _n_noop('Completed <span class="count">(%s)</span>', 'Completed <span class="count">(%s)</span>', 'pronamic_ideal'), |
|
| 129 | 129 | ) |
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | 132 | register_post_status( |
| 133 | 133 | 'payment_cancelled', array( |
| 134 | - 'label' => _x( 'Cancelled', 'Payment status', 'pronamic_ideal' ), |
|
| 134 | + 'label' => _x('Cancelled', 'Payment status', 'pronamic_ideal'), |
|
| 135 | 135 | 'public' => false, |
| 136 | 136 | 'exclude_from_search' => false, |
| 137 | 137 | 'show_in_admin_all_list' => true, |
| 138 | 138 | 'show_in_admin_status_list' => true, |
| 139 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'pronamic_ideal' ), |
|
| 139 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'pronamic_ideal'), |
|
| 140 | 140 | ) |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | 143 | register_post_status( |
| 144 | 144 | 'payment_refunded', array( |
| 145 | - 'label' => _x( 'Refunded', 'Payment status', 'pronamic_ideal' ), |
|
| 145 | + 'label' => _x('Refunded', 'Payment status', 'pronamic_ideal'), |
|
| 146 | 146 | 'public' => false, |
| 147 | 147 | 'exclude_from_search' => false, |
| 148 | 148 | 'show_in_admin_all_list' => true, |
| 149 | 149 | 'show_in_admin_status_list' => true, |
| 150 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'pronamic_ideal' ), |
|
| 150 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'pronamic_ideal'), |
|
| 151 | 151 | ) |
| 152 | 152 | ); |
| 153 | 153 | |
| 154 | 154 | register_post_status( |
| 155 | 155 | 'payment_failed', array( |
| 156 | - 'label' => _x( 'Failed', 'Payment status', 'pronamic_ideal' ), |
|
| 156 | + 'label' => _x('Failed', 'Payment status', 'pronamic_ideal'), |
|
| 157 | 157 | 'public' => false, |
| 158 | 158 | 'exclude_from_search' => false, |
| 159 | 159 | 'show_in_admin_all_list' => true, |
| 160 | 160 | 'show_in_admin_status_list' => true, |
| 161 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'pronamic_ideal' ), |
|
| 161 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'pronamic_ideal'), |
|
| 162 | 162 | ) |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | 165 | register_post_status( |
| 166 | 166 | 'payment_expired', array( |
| 167 | - 'label' => _x( 'Expired', 'Payment status', 'pronamic_ideal' ), |
|
| 167 | + 'label' => _x('Expired', 'Payment status', 'pronamic_ideal'), |
|
| 168 | 168 | 'public' => false, |
| 169 | 169 | 'exclude_from_search' => false, |
| 170 | 170 | 'show_in_admin_all_list' => true, |
| 171 | 171 | 'show_in_admin_status_list' => true, |
| 172 | - 'label_count' => _n_noop( 'Expired <span class="count">(%s)</span>', 'Expired <span class="count">(%s)</span>', 'pronamic_ideal' ), |
|
| 172 | + 'label_count' => _n_noop('Expired <span class="count">(%s)</span>', 'Expired <span class="count">(%s)</span>', 'pronamic_ideal'), |
|
| 173 | 173 | ) |
| 174 | 174 | ); |
| 175 | 175 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function get_language() { |
| 46 | 46 | $locale = get_locale(); |
| 47 | 47 | |
| 48 | - return substr( $locale, 0, 2 ); |
|
| 48 | + return substr($locale, 0, 2); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | public function get_email() { |
| 67 | 67 | $email = null; |
| 68 | 68 | |
| 69 | - if ( is_user_logged_in() ) { |
|
| 69 | + if (is_user_logged_in()) { |
|
| 70 | 70 | $email = $this->user->user_email; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return string |
| 80 | 80 | */ |
| 81 | 81 | public function get_first_name() { |
| 82 | - if ( is_user_logged_in() ) { |
|
| 82 | + if (is_user_logged_in()) { |
|
| 83 | 83 | return $this->user->user_firstname; |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @return string |
| 91 | 91 | */ |
| 92 | 92 | public function get_last_name() { |
| 93 | - if ( is_user_logged_in() ) { |
|
| 93 | + if (is_user_logged_in()) { |
|
| 94 | 94 | return $this->user->user_lastname; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | $this->get_last_name(), |
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | - $parts = array_filter( $parts ); |
|
| 109 | + $parts = array_filter($parts); |
|
| 110 | 110 | |
| 111 | - if ( empty( $parts ) ) { |
|
| 111 | + if (empty($parts)) { |
|
| 112 | 112 | return $this->user->display_name; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $name = trim( implode( ' ', $parts ) ); |
|
| 115 | + $name = trim(implode(' ', $parts)); |
|
| 116 | 116 | |
| 117 | 117 | return $name; |
| 118 | 118 | } |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | * @return string |
| 124 | 124 | */ |
| 125 | 125 | public function get_analytics_client_id() { |
| 126 | - $property_id = get_option( 'pronamic_pay_google_analytics_property' ); |
|
| 126 | + $property_id = get_option('pronamic_pay_google_analytics_property'); |
|
| 127 | 127 | |
| 128 | 128 | // Only use Client ID if Analytics property has been set. |
| 129 | - if ( empty( $property_id ) ) { |
|
| 129 | + if (empty($property_id)) { |
|
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | * @param string $name The name to get the URL for. |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | - private function get_url( $name ) { |
|
| 143 | - $url = home_url( '/' ); |
|
| 142 | + private function get_url($name) { |
|
| 143 | + $url = home_url('/'); |
|
| 144 | 144 | |
| 145 | - $permalink = get_permalink( pronamic_pay_get_page_id( $name ) ); |
|
| 145 | + $permalink = get_permalink(pronamic_pay_get_page_id($name)); |
|
| 146 | 146 | |
| 147 | - if ( $permalink ) { |
|
| 147 | + if ($permalink) { |
|
| 148 | 148 | $url = $permalink; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return string |
| 158 | 158 | */ |
| 159 | 159 | public function get_normal_return_url() { |
| 160 | - return $this->get_url( 'unknown' ); |
|
| 160 | + return $this->get_url('unknown'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return string |
| 167 | 167 | */ |
| 168 | 168 | public function get_cancel_url() { |
| 169 | - return $this->get_url( 'cancel' ); |
|
| 169 | + return $this->get_url('cancel'); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @return string |
| 176 | 176 | */ |
| 177 | 177 | public function get_success_url() { |
| 178 | - return $this->get_url( 'completed' ); |
|
| 178 | + return $this->get_url('completed'); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @return string |
| 185 | 185 | */ |
| 186 | 186 | public function get_error_url() { |
| 187 | - return $this->get_url( 'error' ); |
|
| 187 | + return $this->get_url('error'); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | * @return string |
| 194 | 194 | */ |
| 195 | 195 | public function get_blogname() { |
| 196 | - $blogname = get_option( 'blogname' ); |
|
| 196 | + $blogname = get_option('blogname'); |
|
| 197 | 197 | |
| 198 | 198 | // @see https://github.com/WordPress/WordPress/blob/3.8.1/wp-includes/pluggable.php#L1085 |
| 199 | 199 | // The blogname option is escaped with esc_html on the way into the database in sanitize_option |
| 200 | 200 | // we want to reverse this for the gateways. |
| 201 | - $blogname = wp_specialchars_decode( $blogname, ENT_QUOTES ); |
|
| 201 | + $blogname = wp_specialchars_decode($blogname, ENT_QUOTES); |
|
| 202 | 202 | |
| 203 | 203 | return $blogname; |
| 204 | 204 | } |
@@ -219,16 +219,16 @@ discard block |
||
| 219 | 219 | * @return string |
| 220 | 220 | */ |
| 221 | 221 | public function get_subscription_id() { |
| 222 | - if ( ! $this->get_subscription() ) { |
|
| 222 | + if ( ! $this->get_subscription()) { |
|
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $payment = get_pronamic_payment_by_meta( '_pronamic_payment_source_id', $this->get_subscription_source_id() ); |
|
| 226 | + $payment = get_pronamic_payment_by_meta('_pronamic_payment_source_id', $this->get_subscription_source_id()); |
|
| 227 | 227 | |
| 228 | - if ( ! $payment ) { |
|
| 228 | + if ( ! $payment) { |
|
| 229 | 229 | return; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - return $payment->get_meta( 'subscription_id' ); |
|
| 232 | + return $payment->get_meta('subscription_id'); |
|
| 233 | 233 | } |
| 234 | 234 | } |
@@ -34,36 +34,36 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @return bool |
| 36 | 36 | */ |
| 37 | - public function create( Payment $payment ) { |
|
| 37 | + public function create(Payment $payment) { |
|
| 38 | 38 | $title = $payment->title; |
| 39 | 39 | |
| 40 | - if ( empty( $title ) ) { |
|
| 40 | + if (empty($title)) { |
|
| 41 | 41 | $title = sprintf( |
| 42 | 42 | 'Payment – %s', |
| 43 | - date_i18n( _x( '@todo', 'Payment title date format parsed by `date_i18n`.', 'pronamic_ideal' ) ) |
|
| 43 | + date_i18n(_x('@todo', 'Payment title date format parsed by `date_i18n`.', 'pronamic_ideal')) |
|
| 44 | 44 | ); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $result = wp_insert_post( |
| 48 | 48 | array( |
| 49 | 49 | 'post_type' => 'pronamic_payment', |
| 50 | - 'post_date_gmt' => $payment->date->format( 'Y-m-d H:i:s' ), |
|
| 50 | + 'post_date_gmt' => $payment->date->format('Y-m-d H:i:s'), |
|
| 51 | 51 | 'post_title' => $title, |
| 52 | - 'post_status' => $this->get_post_status( $payment ), |
|
| 52 | + 'post_status' => $this->get_post_status($payment), |
|
| 53 | 53 | 'post_author' => $payment->user_id, |
| 54 | 54 | ), true |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | - if ( is_wp_error( $result ) ) { |
|
| 57 | + if (is_wp_error($result)) { |
|
| 58 | 58 | return false; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $payment->set_id( $result ); |
|
| 62 | - $payment->post = get_post( $result ); |
|
| 61 | + $payment->set_id($result); |
|
| 62 | + $payment->post = get_post($result); |
|
| 63 | 63 | |
| 64 | - $this->update_post_meta( $payment ); |
|
| 64 | + $this->update_post_meta($payment); |
|
| 65 | 65 | |
| 66 | - do_action( 'pronamic_pay_new_payment', $payment ); |
|
| 66 | + do_action('pronamic_pay_new_payment', $payment); |
|
| 67 | 67 | |
| 68 | 68 | return true; |
| 69 | 69 | } |
@@ -79,13 +79,13 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param Payment $payment The payment to read from this data store. |
| 81 | 81 | */ |
| 82 | - public function read( Payment $payment ) { |
|
| 83 | - $payment->post = get_post( $payment->get_id() ); |
|
| 84 | - $payment->title = get_the_title( $payment->get_id() ); |
|
| 85 | - $payment->date = new \DateTime( get_post_field( 'post_date_gmt', $payment->get_id(), 'raw' ) ); |
|
| 86 | - $payment->user_id = get_post_field( 'post_author', $payment->get_id(), 'raw' ); |
|
| 82 | + public function read(Payment $payment) { |
|
| 83 | + $payment->post = get_post($payment->get_id()); |
|
| 84 | + $payment->title = get_the_title($payment->get_id()); |
|
| 85 | + $payment->date = new \DateTime(get_post_field('post_date_gmt', $payment->get_id(), 'raw')); |
|
| 86 | + $payment->user_id = get_post_field('post_author', $payment->get_id(), 'raw'); |
|
| 87 | 87 | |
| 88 | - $this->read_post_meta( $payment ); |
|
| 88 | + $this->read_post_meta($payment); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | * @see https://github.com/woocommerce/woocommerce/blob/3.2.6/includes/data-stores/class-wc-order-data-store-cpt.php#L154-L257 |
| 96 | 96 | * @param Payment $payment The payment to update in this data store. |
| 97 | 97 | */ |
| 98 | - public function update( Payment $payment ) { |
|
| 98 | + public function update(Payment $payment) { |
|
| 99 | 99 | $data = array( |
| 100 | 100 | 'ID' => $payment->get_id(), |
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | - $post_status = $this->get_post_status( $payment, null ); |
|
| 103 | + $post_status = $this->get_post_status($payment, null); |
|
| 104 | 104 | |
| 105 | - if ( null !== $post_status ) { |
|
| 105 | + if (null !== $post_status) { |
|
| 106 | 106 | $data['post_status'] = $post_status; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - wp_update_post( $data ); |
|
| 109 | + wp_update_post($data); |
|
| 110 | 110 | |
| 111 | - $this->update_post_meta( $payment ); |
|
| 111 | + $this->update_post_meta($payment); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @return string |
| 121 | 121 | */ |
| 122 | - private function get_post_status( $payment, $default = 'payment_pending' ) { |
|
| 123 | - switch ( $payment->status ) { |
|
| 122 | + private function get_post_status($payment, $default = 'payment_pending') { |
|
| 123 | + switch ($payment->status) { |
|
| 124 | 124 | case Statuses::CANCELLED: |
| 125 | 125 | return 'payment_cancelled'; |
| 126 | 126 | case Statuses::EXPIRED: |
@@ -142,58 +142,58 @@ discard block |
||
| 142 | 142 | * @see https://github.com/woocommerce/woocommerce/blob/3.2.6/includes/abstracts/abstract-wc-data.php#L462-L507 |
| 143 | 143 | * @param Payment $payment The payment to read. |
| 144 | 144 | */ |
| 145 | - private function read_post_meta( $payment ) { |
|
| 145 | + private function read_post_meta($payment) { |
|
| 146 | 146 | $prefix = '_pronamic_payment_'; |
| 147 | 147 | |
| 148 | 148 | $id = $payment->get_id(); |
| 149 | 149 | |
| 150 | - $payment->config_id = get_post_meta( $id, $prefix . 'config_id', true ); |
|
| 151 | - $payment->key = get_post_meta( $id, $prefix . 'key', true ); |
|
| 150 | + $payment->config_id = get_post_meta($id, $prefix . 'config_id', true); |
|
| 151 | + $payment->key = get_post_meta($id, $prefix . 'key', true); |
|
| 152 | 152 | |
| 153 | - $payment->amount = (float) get_post_meta( $id, $prefix . 'amount', true ); |
|
| 154 | - $payment->currency = get_post_meta( $id, $prefix . 'currency', true ); |
|
| 155 | - $payment->method = get_post_meta( $id, $prefix . 'method', true ); |
|
| 156 | - $payment->issuer = get_post_meta( $id, $prefix . 'issuer', true ); |
|
| 153 | + $payment->amount = (float) get_post_meta($id, $prefix . 'amount', true); |
|
| 154 | + $payment->currency = get_post_meta($id, $prefix . 'currency', true); |
|
| 155 | + $payment->method = get_post_meta($id, $prefix . 'method', true); |
|
| 156 | + $payment->issuer = get_post_meta($id, $prefix . 'issuer', true); |
|
| 157 | 157 | |
| 158 | - $payment->order_id = get_post_meta( $id, $prefix . 'order_id', true ); |
|
| 159 | - $payment->transaction_id = get_post_meta( $id, $prefix . 'transaction_id', true ); |
|
| 160 | - $payment->entrance_code = get_post_meta( $id, $prefix . 'entrance_code', true ); |
|
| 161 | - $payment->action_url = get_post_meta( $id, $prefix . 'action_url', true ); |
|
| 158 | + $payment->order_id = get_post_meta($id, $prefix . 'order_id', true); |
|
| 159 | + $payment->transaction_id = get_post_meta($id, $prefix . 'transaction_id', true); |
|
| 160 | + $payment->entrance_code = get_post_meta($id, $prefix . 'entrance_code', true); |
|
| 161 | + $payment->action_url = get_post_meta($id, $prefix . 'action_url', true); |
|
| 162 | 162 | |
| 163 | - $payment->source = get_post_meta( $id, $prefix . 'source', true ); |
|
| 164 | - $payment->source_id = get_post_meta( $id, $prefix . 'source_id', true ); |
|
| 165 | - $payment->description = get_post_meta( $id, $prefix . 'description', true ); |
|
| 163 | + $payment->source = get_post_meta($id, $prefix . 'source', true); |
|
| 164 | + $payment->source_id = get_post_meta($id, $prefix . 'source_id', true); |
|
| 165 | + $payment->description = get_post_meta($id, $prefix . 'description', true); |
|
| 166 | 166 | |
| 167 | - $payment->language = get_post_meta( $id, $prefix . 'language', true ); |
|
| 168 | - $payment->locale = get_post_meta( $id, $prefix . 'locale', true ); |
|
| 169 | - $payment->email = get_post_meta( $id, $prefix . 'email', true ); |
|
| 167 | + $payment->language = get_post_meta($id, $prefix . 'language', true); |
|
| 168 | + $payment->locale = get_post_meta($id, $prefix . 'locale', true); |
|
| 169 | + $payment->email = get_post_meta($id, $prefix . 'email', true); |
|
| 170 | 170 | |
| 171 | - $payment->status = get_post_meta( $id, $prefix . 'status', true ); |
|
| 171 | + $payment->status = get_post_meta($id, $prefix . 'status', true); |
|
| 172 | 172 | |
| 173 | - $payment->customer_name = get_post_meta( $id, $prefix . 'customer_name', true ); |
|
| 174 | - $payment->address = get_post_meta( $id, $prefix . 'address', true ); |
|
| 175 | - $payment->zip = get_post_meta( $id, $prefix . 'zip', true ); |
|
| 176 | - $payment->city = get_post_meta( $id, $prefix . 'city', true ); |
|
| 177 | - $payment->country = get_post_meta( $id, $prefix . 'country', true ); |
|
| 178 | - $payment->telephone_number = get_post_meta( $id, $prefix . 'telephone_number', true ); |
|
| 179 | - $payment->analytics_client_id = get_post_meta( $id, $prefix . 'analytics_client_id', true ); |
|
| 173 | + $payment->customer_name = get_post_meta($id, $prefix . 'customer_name', true); |
|
| 174 | + $payment->address = get_post_meta($id, $prefix . 'address', true); |
|
| 175 | + $payment->zip = get_post_meta($id, $prefix . 'zip', true); |
|
| 176 | + $payment->city = get_post_meta($id, $prefix . 'city', true); |
|
| 177 | + $payment->country = get_post_meta($id, $prefix . 'country', true); |
|
| 178 | + $payment->telephone_number = get_post_meta($id, $prefix . 'telephone_number', true); |
|
| 179 | + $payment->analytics_client_id = get_post_meta($id, $prefix . 'analytics_client_id', true); |
|
| 180 | 180 | |
| 181 | - $payment->subscription_id = get_post_meta( $id, $prefix . 'subscription_id', true ); |
|
| 182 | - $payment->recurring_type = get_post_meta( $id, $prefix . 'recurring_type', true ); |
|
| 183 | - $payment->recurring = get_post_meta( $id, $prefix . 'recurring', true ); |
|
| 181 | + $payment->subscription_id = get_post_meta($id, $prefix . 'subscription_id', true); |
|
| 182 | + $payment->recurring_type = get_post_meta($id, $prefix . 'recurring_type', true); |
|
| 183 | + $payment->recurring = get_post_meta($id, $prefix . 'recurring', true); |
|
| 184 | 184 | |
| 185 | 185 | // Start Date. |
| 186 | - $start_date_string = get_post_meta( $id, $prefix . 'start_date', true ); |
|
| 186 | + $start_date_string = get_post_meta($id, $prefix . 'start_date', true); |
|
| 187 | 187 | |
| 188 | - if ( ! empty( $start_date_string ) ) { |
|
| 189 | - $payment->start_date = date_create( $start_date_string ); |
|
| 188 | + if ( ! empty($start_date_string)) { |
|
| 189 | + $payment->start_date = date_create($start_date_string); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // End Date. |
| 193 | - $end_date_string = get_post_meta( $id, $prefix . 'end_date', true ); |
|
| 193 | + $end_date_string = get_post_meta($id, $prefix . 'end_date', true); |
|
| 194 | 194 | |
| 195 | - if ( ! empty( $end_date_string ) ) { |
|
| 196 | - $payment->end_date = date_create( $end_date_string ); |
|
| 195 | + if ( ! empty($end_date_string)) { |
|
| 196 | + $payment->end_date = date_create($end_date_string); |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | * @see https://github.com/woocommerce/woocommerce/blob/3.2.6/includes/data-stores/class-wc-order-data-store-cpt.php#L154-L257 |
| 204 | 204 | * @param Payment $payment The payment to update. |
| 205 | 205 | */ |
| 206 | - private function update_post_meta( $payment ) { |
|
| 206 | + private function update_post_meta($payment) { |
|
| 207 | 207 | $prefix = '_pronamic_payment_'; |
| 208 | 208 | |
| 209 | - $previous_status = get_post_meta( $payment->get_id(), '_pronamic_payment_status', true ); |
|
| 210 | - $previous_status = strtolower( $previous_status ); |
|
| 211 | - $previous_status = empty( $previous_status ) ? 'unknown' : $previous_status; |
|
| 209 | + $previous_status = get_post_meta($payment->get_id(), '_pronamic_payment_status', true); |
|
| 210 | + $previous_status = strtolower($previous_status); |
|
| 211 | + $previous_status = empty($previous_status) ? 'unknown' : $previous_status; |
|
| 212 | 212 | |
| 213 | 213 | $data = array( |
| 214 | 214 | 'config_id' => $payment->config_id, |
@@ -248,30 +248,30 @@ discard block |
||
| 248 | 248 | 'action_url' => $payment->get_action_url(), |
| 249 | 249 | ); |
| 250 | 250 | |
| 251 | - if ( isset( $payment->start_date ) ) { |
|
| 252 | - $data['start_date'] = $payment->start_date->format( 'Y-m-d H:i:s' ); |
|
| 251 | + if (isset($payment->start_date)) { |
|
| 252 | + $data['start_date'] = $payment->start_date->format('Y-m-d H:i:s'); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if ( isset( $payment->end_date ) ) { |
|
| 256 | - $data['end_date'] = $payment->end_date->format( 'Y-m-d H:i:s' ); |
|
| 255 | + if (isset($payment->end_date)) { |
|
| 256 | + $data['end_date'] = $payment->end_date->format('Y-m-d H:i:s'); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $data = array_merge( $payment->meta, $data ); |
|
| 259 | + $data = array_merge($payment->meta, $data); |
|
| 260 | 260 | |
| 261 | - foreach ( $data as $key => $value ) { |
|
| 262 | - if ( ! empty( $value ) ) { |
|
| 261 | + foreach ($data as $key => $value) { |
|
| 262 | + if ( ! empty($value)) { |
|
| 263 | 263 | $meta_key = $prefix . $key; |
| 264 | 264 | |
| 265 | - update_post_meta( $payment->get_id(), $meta_key, $value ); |
|
| 265 | + update_post_meta($payment->get_id(), $meta_key, $value); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - if ( $previous_status !== $payment->status ) { |
|
| 269 | + if ($previous_status !== $payment->status) { |
|
| 270 | 270 | $can_redirect = false; |
| 271 | 271 | |
| 272 | - do_action( 'pronamic_payment_status_update_' . $payment->source . '_' . $previous_status . '_to_' . $payment->status, $payment, $can_redirect ); |
|
| 273 | - do_action( 'pronamic_payment_status_update_' . $payment->source, $payment, $can_redirect ); |
|
| 274 | - do_action( 'pronamic_payment_status_update', $payment, $can_redirect ); |
|
| 272 | + do_action('pronamic_payment_status_update_' . $payment->source . '_' . $previous_status . '_to_' . $payment->status, $payment, $can_redirect); |
|
| 273 | + do_action('pronamic_payment_status_update_' . $payment->source, $payment, $can_redirect); |
|
| 274 | + do_action('pronamic_payment_status_update', $payment, $can_redirect); |
|
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -345,15 +345,15 @@ discard block |
||
| 345 | 345 | * |
| 346 | 346 | * @param int $post_id A payment post ID or null. |
| 347 | 347 | */ |
| 348 | - public function __construct( $post_id = null ) { |
|
| 348 | + public function __construct($post_id = null) { |
|
| 349 | 349 | $this->id = $post_id; |
| 350 | 350 | $this->date = new \DateTime(); |
| 351 | 351 | $this->meta = array(); |
| 352 | 352 | |
| 353 | - if ( null !== $post_id ) { |
|
| 353 | + if (null !== $post_id) { |
|
| 354 | 354 | global $pronamic_ideal; |
| 355 | 355 | |
| 356 | - $pronamic_ideal->payments_data_store->read( $this ); |
|
| 356 | + $pronamic_ideal->payments_data_store->read($this); |
|
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | * |
| 372 | 372 | * @param string $id Unique ID. |
| 373 | 373 | */ |
| 374 | - public function set_id( $id ) { |
|
| 374 | + public function set_id($id) { |
|
| 375 | 375 | $this->id = $id; |
| 376 | 376 | } |
| 377 | 377 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | * |
| 381 | 381 | * @param string $note The note to add. |
| 382 | 382 | */ |
| 383 | - public function add_note( $note ) { |
|
| 383 | + public function add_note($note) { |
|
| 384 | 384 | $commentdata = array( |
| 385 | 385 | 'comment_post_ID' => $this->id, |
| 386 | 386 | 'comment_author' => 'admin', |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | 'comment_approved' => 1, |
| 394 | 394 | ); |
| 395 | 395 | |
| 396 | - $comment_id = wp_insert_comment( $commentdata ); |
|
| 396 | + $comment_id = wp_insert_comment($commentdata); |
|
| 397 | 397 | |
| 398 | 398 | return $comment_id; |
| 399 | 399 | } |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | public function get_source_text() { |
| 425 | 425 | $text = $this->get_source() . '<br />' . $this->get_source_id(); |
| 426 | 426 | |
| 427 | - $text = apply_filters( 'pronamic_payment_source_text_' . $this->get_source(), $text, $this ); |
|
| 428 | - $text = apply_filters( 'pronamic_payment_source_text', $text, $this ); |
|
| 427 | + $text = apply_filters('pronamic_payment_source_text_' . $this->get_source(), $text, $this); |
|
| 428 | + $text = apply_filters('pronamic_payment_source_text', $text, $this); |
|
| 429 | 429 | |
| 430 | 430 | return $text; |
| 431 | 431 | } |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * @return Ambigous <string, NULL> |
| 464 | 464 | */ |
| 465 | 465 | public function get_currency_numeric_code() { |
| 466 | - return Currency::transform_code_to_number( $this->get_currency() ); |
|
| 466 | + return Currency::transform_code_to_number($this->get_currency()); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /** |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | * |
| 518 | 518 | * @param string $transaction_id Transaction ID. |
| 519 | 519 | */ |
| 520 | - public function set_transaction_id( $transaction_id ) { |
|
| 520 | + public function set_transaction_id($transaction_id) { |
|
| 521 | 521 | $this->transaction_id = $transaction_id; |
| 522 | 522 | } |
| 523 | 523 | |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | * |
| 546 | 546 | * @param string $status Status. |
| 547 | 547 | */ |
| 548 | - public function set_status( $status ) { |
|
| 548 | + public function set_status($status) { |
|
| 549 | 549 | $this->status = $status; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -555,10 +555,10 @@ discard block |
||
| 555 | 555 | * @param string $key Meta key. |
| 556 | 556 | * @return mixed |
| 557 | 557 | */ |
| 558 | - public function get_meta( $key ) { |
|
| 558 | + public function get_meta($key) { |
|
| 559 | 559 | $key = '_pronamic_payment_' . $key; |
| 560 | 560 | |
| 561 | - return get_post_meta( $this->id, $key, true ); |
|
| 561 | + return get_post_meta($this->id, $key, true); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | /** |
@@ -567,8 +567,8 @@ discard block |
||
| 567 | 567 | * @param string $key Meta key. |
| 568 | 568 | * @param string $value Meta value. |
| 569 | 569 | */ |
| 570 | - public function set_meta( $key, $value ) { |
|
| 571 | - $this->meta[ $key ] = $value; |
|
| 570 | + public function set_meta($key, $value) { |
|
| 571 | + $this->meta[$key] = $value; |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /** |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | * @return string |
| 578 | 578 | */ |
| 579 | 579 | public function get_pay_redirect_url() { |
| 580 | - return add_query_arg( 'payment_redirect', $this->id, home_url( '/' ) ); |
|
| 580 | + return add_query_arg('payment_redirect', $this->id, home_url('/')); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | /** |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | 'payment' => $this->id, |
| 593 | 593 | 'key' => $this->key, |
| 594 | 594 | ), |
| 595 | - home_url( '/' ) |
|
| 595 | + home_url('/') |
|
| 596 | 596 | ); |
| 597 | 597 | |
| 598 | 598 | return $url; |
@@ -604,8 +604,8 @@ discard block |
||
| 604 | 604 | * @return string |
| 605 | 605 | */ |
| 606 | 606 | public function get_action_url() { |
| 607 | - if ( '' === $this->get_amount() || 0.0 === $this->get_amount() ) { |
|
| 608 | - $this->set_status( Statuses::SUCCESS ); |
|
| 607 | + if ('' === $this->get_amount() || 0.0 === $this->get_amount()) { |
|
| 608 | + $this->set_status(Statuses::SUCCESS); |
|
| 609 | 609 | |
| 610 | 610 | return $this->get_return_redirect_url(); |
| 611 | 611 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | * |
| 619 | 619 | * @param string $action_url Action URL. |
| 620 | 620 | */ |
| 621 | - public function set_action_url( $action_url ) { |
|
| 621 | + public function set_action_url($action_url) { |
|
| 622 | 622 | $this->action_url = $action_url; |
| 623 | 623 | } |
| 624 | 624 | |
@@ -630,10 +630,10 @@ discard block |
||
| 630 | 630 | * @return string |
| 631 | 631 | */ |
| 632 | 632 | public function get_return_redirect_url() { |
| 633 | - $url = home_url( '/' ); |
|
| 633 | + $url = home_url('/'); |
|
| 634 | 634 | |
| 635 | - $url = apply_filters( 'pronamic_payment_redirect_url', $url, $this ); |
|
| 636 | - $url = apply_filters( 'pronamic_payment_redirect_url_' . $this->source, $url, $this ); |
|
| 635 | + $url = apply_filters('pronamic_payment_redirect_url', $url, $this); |
|
| 636 | + $url = apply_filters('pronamic_payment_redirect_url_' . $this->source, $url, $this); |
|
| 637 | 637 | |
| 638 | 638 | return $url; |
| 639 | 639 | } |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | * @return string |
| 646 | 646 | */ |
| 647 | 647 | public function get_redirect_url() { |
| 648 | - _deprecated_function( __FUNCTION__, '4.1.2', 'get_return_redirect_url()' ); |
|
| 648 | + _deprecated_function(__FUNCTION__, '4.1.2', 'get_return_redirect_url()'); |
|
| 649 | 649 | |
| 650 | 650 | return $this->get_return_redirect_url(); |
| 651 | 651 | } |
@@ -658,8 +658,8 @@ discard block |
||
| 658 | 658 | public function get_source_description() { |
| 659 | 659 | $description = $this->source; |
| 660 | 660 | |
| 661 | - $description = apply_filters( 'pronamic_payment_source_description', $description, $this ); |
|
| 662 | - $description = apply_filters( 'pronamic_payment_source_description_' . $this->source, $description, $this ); |
|
| 661 | + $description = apply_filters('pronamic_payment_source_description', $description, $this); |
|
| 662 | + $description = apply_filters('pronamic_payment_source_description_' . $this->source, $description, $this); |
|
| 663 | 663 | |
| 664 | 664 | return $description; |
| 665 | 665 | } |
@@ -672,8 +672,8 @@ discard block |
||
| 672 | 672 | public function get_source_link() { |
| 673 | 673 | $url = null; |
| 674 | 674 | |
| 675 | - $url = apply_filters( 'pronamic_payment_source_url', $url, $this ); |
|
| 676 | - $url = apply_filters( 'pronamic_payment_source_url_' . $this->source, $url, $this ); |
|
| 675 | + $url = apply_filters('pronamic_payment_source_url', $url, $this); |
|
| 676 | + $url = apply_filters('pronamic_payment_source_url_' . $this->source, $url, $this); |
|
| 677 | 677 | |
| 678 | 678 | return $url; |
| 679 | 679 | } |
@@ -686,11 +686,11 @@ discard block |
||
| 686 | 686 | public function get_provider_link() { |
| 687 | 687 | $url = null; |
| 688 | 688 | |
| 689 | - $config_id = get_post_meta( $this->id, '_pronamic_payment_config_id', true ); |
|
| 690 | - $gateway_id = get_post_meta( $config_id, '_pronamic_gateway_id', true ); |
|
| 689 | + $config_id = get_post_meta($this->id, '_pronamic_payment_config_id', true); |
|
| 690 | + $gateway_id = get_post_meta($config_id, '_pronamic_gateway_id', true); |
|
| 691 | 691 | |
| 692 | - $url = apply_filters( 'pronamic_payment_provider_url', $url, $this ); |
|
| 693 | - $url = apply_filters( 'pronamic_payment_provider_url_' . $gateway_id, $url, $this ); |
|
| 692 | + $url = apply_filters('pronamic_payment_provider_url', $url, $this); |
|
| 693 | + $url = apply_filters('pronamic_payment_provider_url_' . $gateway_id, $url, $this); |
|
| 694 | 694 | |
| 695 | 695 | return $url; |
| 696 | 696 | } |
@@ -701,15 +701,15 @@ discard block |
||
| 701 | 701 | * @return Subscription |
| 702 | 702 | */ |
| 703 | 703 | public function get_subscription() { |
| 704 | - if ( is_object( $this->subscription ) ) { |
|
| 704 | + if (is_object($this->subscription)) { |
|
| 705 | 705 | return $this->subscription; |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - if ( empty( $this->subscription_id ) ) { |
|
| 708 | + if (empty($this->subscription_id)) { |
|
| 709 | 709 | return false; |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - $this->subscription = new Subscription( $this->subscription_id ); |
|
| 712 | + $this->subscription = new Subscription($this->subscription_id); |
|
| 713 | 713 | |
| 714 | 714 | return $this->subscription; |
| 715 | 715 | } |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | * @param string $string The string to format. |
| 723 | 723 | * @return string |
| 724 | 724 | */ |
| 725 | - public function format_string( $string ) { |
|
| 725 | + public function format_string($string) { |
|
| 726 | 726 | // Replacements definition. |
| 727 | 727 | $replacements = array( |
| 728 | 728 | '{order_id}' => $this->get_order_id(), |
@@ -731,15 +731,15 @@ discard block |
||
| 731 | 731 | |
| 732 | 732 | // Find and replace. |
| 733 | 733 | $string = str_replace( |
| 734 | - array_keys( $replacements ), |
|
| 735 | - array_values( $replacements ), |
|
| 734 | + array_keys($replacements), |
|
| 735 | + array_values($replacements), |
|
| 736 | 736 | $string, |
| 737 | 737 | $count |
| 738 | 738 | ); |
| 739 | 739 | |
| 740 | 740 | // Make sure there is an dynamic part in the order ID. |
| 741 | 741 | // @see https://secure.ogone.com/ncol/param_cookbook.asp. |
| 742 | - if ( 0 === $count ) { |
|
| 742 | + if (0 === $count) { |
|
| 743 | 743 | $string .= $this->get_id(); |
| 744 | 744 | } |
| 745 | 745 | |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | * |
| 752 | 752 | * @param string $name Name. |
| 753 | 753 | */ |
| 754 | - public function set_consumer_name( $name ) { |
|
| 754 | + public function set_consumer_name($name) { |
|
| 755 | 755 | $this->consumer_name = $name; |
| 756 | 756 | } |
| 757 | 757 | |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | * |
| 761 | 761 | * @param string $account_number Account number. |
| 762 | 762 | */ |
| 763 | - public function set_consumer_account_number( $account_number ) { |
|
| 763 | + public function set_consumer_account_number($account_number) { |
|
| 764 | 764 | $this->consumer_account_number = $account_number; |
| 765 | 765 | } |
| 766 | 766 | |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | * |
| 770 | 770 | * @param string $iban IBAN. |
| 771 | 771 | */ |
| 772 | - public function set_consumer_iban( $iban ) { |
|
| 772 | + public function set_consumer_iban($iban) { |
|
| 773 | 773 | $this->consumer_iban = $iban; |
| 774 | 774 | } |
| 775 | 775 | |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | * |
| 779 | 779 | * @param string $bic BIC. |
| 780 | 780 | */ |
| 781 | - public function set_consumer_bic( $bic ) { |
|
| 781 | + public function set_consumer_bic($bic) { |
|
| 782 | 782 | $this->consumer_bic = $bic; |
| 783 | 783 | } |
| 784 | 784 | |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | * |
| 788 | 788 | * @param string $city City. |
| 789 | 789 | */ |
| 790 | - public function set_consumer_city( $city ) { |
|
| 790 | + public function set_consumer_city($city) { |
|
| 791 | 791 | $this->consumer_city = $city; |
| 792 | 792 | } |
| 793 | 793 | |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | * |
| 896 | 896 | * @param CreditCard $credit_card Credit Card. |
| 897 | 897 | */ |
| 898 | - public function set_credit_card( $credit_card ) { |
|
| 898 | + public function set_credit_card($credit_card) { |
|
| 899 | 899 | $this->credit_card = $credit_card; |
| 900 | 900 | } |
| 901 | 901 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function __construct() { |
| 31 | 31 | // The 'pronamic_ideal_check_transaction_status' hook is scheduled to request the payment status. |
| 32 | - add_action( 'pronamic_ideal_check_transaction_status', array( $this, 'check_status' ), 10, 3 ); |
|
| 32 | + add_action('pronamic_ideal_check_transaction_status', array($this, 'check_status'), 10, 3); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param Payment $payment The payment to schedule the status check event. |
| 39 | 39 | */ |
| 40 | - public static function schedule_event( $payment ) { |
|
| 40 | + public static function schedule_event($payment) { |
|
| 41 | 41 | /* |
| 42 | 42 | * Schedule status requests |
| 43 | 43 | * http://pronamic.nl/wp-content/uploads/2011/12/iDEAL_Advanced_PHP_EN_V2.2.pdf (page 19) |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @return int |
| 79 | 79 | */ |
| 80 | - private function get_delay_seconds( $number_tries ) { |
|
| 81 | - switch ( $number_tries ) { |
|
| 80 | + private function get_delay_seconds($number_tries) { |
|
| 81 | + switch ($number_tries) { |
|
| 82 | 82 | case 0: |
| 83 | 83 | // 15 minutes after a transaction request is sent. |
| 84 | 84 | return 15 * MINUTE_IN_SECONDS; |
@@ -103,29 +103,29 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @internal param string $paymentId |
| 105 | 105 | */ |
| 106 | - public function check_status( $payment_id = null, $seconds = null, $number_tries = 1 ) { |
|
| 107 | - $payment = new Payment( $payment_id ); |
|
| 106 | + public function check_status($payment_id = null, $seconds = null, $number_tries = 1) { |
|
| 107 | + $payment = new Payment($payment_id); |
|
| 108 | 108 | |
| 109 | 109 | // Empty payment. |
| 110 | - if ( null === $payment ) { |
|
| 110 | + if (null === $payment) { |
|
| 111 | 111 | // Payment with the specified ID could not be found, can't check the status. |
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Limit number tries. |
| 116 | - if ( $number_tries >= 4 ) { |
|
| 116 | + if ($number_tries >= 4) { |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // http://pronamic.nl/wp-content/uploads/2011/12/iDEAL_Advanced_PHP_EN_V2.2.pdf (page 19) |
| 121 | 121 | // - No status request after a final status has been received for a transaction. |
| 122 | - if ( empty( $payment->status ) || Statuses::OPEN === $payment->status ) { |
|
| 123 | - Plugin::update_payment( $payment ); |
|
| 122 | + if (empty($payment->status) || Statuses::OPEN === $payment->status) { |
|
| 123 | + Plugin::update_payment($payment); |
|
| 124 | 124 | |
| 125 | - if ( empty( $payment->status ) || Statuses::OPEN === $payment->status ) { |
|
| 125 | + if (empty($payment->status) || Statuses::OPEN === $payment->status) { |
|
| 126 | 126 | $time = time(); |
| 127 | 127 | |
| 128 | - $seconds = $this->get_delay_seconds( $number_tries ); |
|
| 128 | + $seconds = $this->get_delay_seconds($number_tries); |
|
| 129 | 129 | |
| 130 | 130 | wp_schedule_single_event( |
| 131 | 131 | $time + $seconds, 'pronamic_ideal_check_transaction_status', array( |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param WP_User $user A WordPress user. |
| 43 | 43 | * @param float $amount The amount to test. |
| 44 | 44 | */ |
| 45 | - public function __construct( WP_User $user, $amount ) { |
|
| 45 | + public function __construct(WP_User $user, $amount) { |
|
| 46 | 46 | parent::__construct(); |
| 47 | 47 | |
| 48 | 48 | $this->user = $user; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @return string |
| 67 | 67 | */ |
| 68 | 68 | public function get_description() { |
| 69 | - return sprintf( __( 'Test %s', 'pronamic_ideal' ), $this->get_order_id() ); |
|
| 69 | + return sprintf(__('Test %s', 'pronamic_ideal'), $this->get_order_id()); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | // Item. |
| 93 | 93 | $item = new Item(); |
| 94 | - $item->setNumber( $this->get_order_id() ); |
|
| 95 | - $item->setDescription( sprintf( __( 'Test %s', 'pronamic_ideal' ), $this->get_order_id() ) ); |
|
| 96 | - $item->setPrice( $this->amount ); |
|
| 97 | - $item->setQuantity( 1 ); |
|
| 94 | + $item->setNumber($this->get_order_id()); |
|
| 95 | + $item->setDescription(sprintf(__('Test %s', 'pronamic_ideal'), $this->get_order_id())); |
|
| 96 | + $item->setPrice($this->amount); |
|
| 97 | + $item->setQuantity(1); |
|
| 98 | 98 | |
| 99 | - $items->addItem( $item ); |
|
| 99 | + $items->addItem($item); |
|
| 100 | 100 | |
| 101 | 101 | return $items; |
| 102 | 102 | } |
@@ -147,27 +147,27 @@ discard block |
||
| 147 | 147 | * @return string|bool |
| 148 | 148 | */ |
| 149 | 149 | public function get_subscription() { |
| 150 | - $test_subscription = filter_input( INPUT_POST, 'pronamic_pay_test_subscription', FILTER_VALIDATE_BOOLEAN ); |
|
| 150 | + $test_subscription = filter_input(INPUT_POST, 'pronamic_pay_test_subscription', FILTER_VALIDATE_BOOLEAN); |
|
| 151 | 151 | |
| 152 | - if ( ! $test_subscription ) { |
|
| 152 | + if ( ! $test_subscription) { |
|
| 153 | 153 | return false; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $times = filter_input( INPUT_POST, 'pronamic_pay_ends_on_count', FILTER_VALIDATE_INT ); |
|
| 156 | + $times = filter_input(INPUT_POST, 'pronamic_pay_ends_on_count', FILTER_VALIDATE_INT); |
|
| 157 | 157 | |
| 158 | - if ( empty( $times ) ) { |
|
| 158 | + if (empty($times)) { |
|
| 159 | 159 | return false; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $interval = filter_input( INPUT_POST, 'pronamic_pay_test_repeat_interval', FILTER_VALIDATE_INT ); |
|
| 162 | + $interval = filter_input(INPUT_POST, 'pronamic_pay_test_repeat_interval', FILTER_VALIDATE_INT); |
|
| 163 | 163 | |
| 164 | - if ( empty( $interval ) ) { |
|
| 164 | + if (empty($interval)) { |
|
| 165 | 165 | return false; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $interval_period = filter_input( INPUT_POST, 'pronamic_pay_test_repeat_frequency', FILTER_SANITIZE_STRING ); |
|
| 168 | + $interval_period = filter_input(INPUT_POST, 'pronamic_pay_test_repeat_frequency', FILTER_SANITIZE_STRING); |
|
| 169 | 169 | |
| 170 | - if ( empty( $interval_period ) ) { |
|
| 170 | + if (empty($interval_period)) { |
|
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $subscription->amount = $this->get_amount(); |
| 180 | 180 | $subscription->frequency = $times; |
| 181 | 181 | $subscription->interval = $interval; |
| 182 | - $subscription->interval_period = Core_Util::to_period( $interval_period ); |
|
| 182 | + $subscription->interval_period = Core_Util::to_period($interval_period); |
|
| 183 | 183 | |
| 184 | 184 | return $subscription; |
| 185 | 185 | } |
@@ -197,15 +197,15 @@ discard block |
||
| 197 | 197 | // $credit_card->set_number( '5555555555554444' ); |
| 198 | 198 | // $credit_card->set_number( '4111111111111111' ); |
| 199 | 199 | // $credit_card->set_number( '4000000000000002' ); |
| 200 | - $credit_card->set_number( '5300000000000006' ); |
|
| 200 | + $credit_card->set_number('5300000000000006'); |
|
| 201 | 201 | |
| 202 | - $credit_card->set_expiration_month( 12 ); |
|
| 202 | + $credit_card->set_expiration_month(12); |
|
| 203 | 203 | |
| 204 | - $credit_card->set_expiration_year( date( 'Y' ) + 5 ); |
|
| 204 | + $credit_card->set_expiration_year(date('Y') + 5); |
|
| 205 | 205 | |
| 206 | - $credit_card->set_security_code( '123' ); |
|
| 206 | + $credit_card->set_security_code('123'); |
|
| 207 | 207 | |
| 208 | - $credit_card->set_name( 'Pronamic' ); |
|
| 208 | + $credit_card->set_name('Pronamic'); |
|
| 209 | 209 | |
| 210 | 210 | return $credit_card; |
| 211 | 211 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @param string $number Number. |
| 71 | 71 | */ |
| 72 | - public function setNumber( $number ) { |
|
| 72 | + public function setNumber($number) { |
|
| 73 | 73 | $this->number = $number; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param string $description Description. |
| 90 | 90 | */ |
| 91 | - public function setDescription( $description ) { |
|
| 92 | - $this->description = substr( $description, 0, 32 ); |
|
| 91 | + public function setDescription($description) { |
|
| 92 | + $this->description = substr($description, 0, 32); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @param int $quantity Quantity. |
| 108 | 108 | */ |
| 109 | - public function setQuantity( $quantity ) { |
|
| 109 | + public function setQuantity($quantity) { |
|
| 110 | 110 | $this->quantity = $quantity; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @param float $price Price. |
| 126 | 126 | */ |
| 127 | - public function setPrice( $price ) { |
|
| 127 | + public function setPrice($price) { |
|
| 128 | 128 | $this->price = $price; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @see IteratorAggregate::getIterator() |
| 41 | 41 | */ |
| 42 | 42 | public function getIterator() { |
| 43 | - return new ArrayIterator( $this->items ); |
|
| 43 | + return new ArrayIterator($this->items); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @param Item $item The item to add. |
| 50 | 50 | */ |
| 51 | - public function addItem( Item $item ) { |
|
| 51 | + public function addItem(Item $item) { |
|
| 52 | 52 | $this->items[] = $item; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function get_amount() { |
| 61 | 61 | $amount = 0; |
| 62 | 62 | |
| 63 | - foreach ( $this->items as $item ) { |
|
| 63 | + foreach ($this->items as $item) { |
|
| 64 | 64 | $amount += $item->get_amount(); |
| 65 | 65 | } |
| 66 | 66 | |