@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @param MeprTransaction $transaction MemberPress transaction object. |
| 68 | 68 | * @param Gateway $gateway MemberPress gateway object. |
| 69 | 69 | */ |
| 70 | - public function __construct( MeprTransaction $transaction, Gateway $gateway ) { |
|
| 70 | + public function __construct(MeprTransaction $transaction, Gateway $gateway) { |
|
| 71 | 71 | parent::__construct(); |
| 72 | 72 | |
| 73 | 73 | $this->transaction = $transaction; |
@@ -135,12 +135,12 @@ discard block |
||
| 135 | 135 | $items = new Items(); |
| 136 | 136 | |
| 137 | 137 | $item = new Item(); |
| 138 | - $item->setNumber( $this->get_order_id() ); |
|
| 139 | - $item->setDescription( $this->get_description() ); |
|
| 140 | - $item->setPrice( $this->transaction->total ); |
|
| 141 | - $item->setQuantity( 1 ); |
|
| 138 | + $item->setNumber($this->get_order_id()); |
|
| 139 | + $item->setDescription($this->get_description()); |
|
| 140 | + $item->setPrice($this->transaction->total); |
|
| 141 | + $item->setQuantity(1); |
|
| 142 | 142 | |
| 143 | - $items->addItem( $item ); |
|
| 143 | + $items->addItem($item); |
|
| 144 | 144 | |
| 145 | 145 | return $items; |
| 146 | 146 | } |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | * @return string|null |
| 217 | 217 | */ |
| 218 | 218 | public function get_address() { |
| 219 | - $value = $this->user->address( 'one', false ); |
|
| 219 | + $value = $this->user->address('one', false); |
|
| 220 | 220 | |
| 221 | - if ( false === $value ) { |
|
| 221 | + if (false === $value) { |
|
| 222 | 222 | return null; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | * @return string|null |
| 234 | 234 | */ |
| 235 | 235 | public function get_city() { |
| 236 | - $value = $this->user->address( 'city', false ); |
|
| 236 | + $value = $this->user->address('city', false); |
|
| 237 | 237 | |
| 238 | - if ( false === $value ) { |
|
| 238 | + if (false === $value) { |
|
| 239 | 239 | return null; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | * @return string|null |
| 251 | 251 | */ |
| 252 | 252 | public function get_zip() { |
| 253 | - $value = $this->user->address( 'zip', false ); |
|
| 253 | + $value = $this->user->address('zip', false); |
|
| 254 | 254 | |
| 255 | - if ( false === $value ) { |
|
| 255 | + if (false === $value) { |
|
| 256 | 256 | return null; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | * @return string|null |
| 268 | 268 | */ |
| 269 | 269 | public function get_country() { |
| 270 | - $value = $this->user->address( 'country', false ); |
|
| 270 | + $value = $this->user->address('country', false); |
|
| 271 | 271 | |
| 272 | - if ( false === $value ) { |
|
| 272 | + if (false === $value) { |
|
| 273 | 273 | return null; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | // @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprOptions.php#L768-782 |
| 290 | 290 | // @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/models/MeprOptions.php#L806-L835 |
| 291 | - return $mepr_options->thankyou_page_url( 'trans_num=' . $this->transaction->id ); |
|
| 291 | + return $mepr_options->thankyou_page_url('trans_num=' . $this->transaction->id); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -300,19 +300,19 @@ discard block |
||
| 300 | 300 | * @return string |
| 301 | 301 | */ |
| 302 | 302 | public function get_cancel_url() { |
| 303 | - if ( isset( $this->transaction->product_id ) && $this->transaction->product_id > 0 ) { |
|
| 304 | - $product = new MeprProduct( $this->transaction->product_id ); |
|
| 303 | + if (isset($this->transaction->product_id) && $this->transaction->product_id > 0) { |
|
| 304 | + $product = new MeprProduct($this->transaction->product_id); |
|
| 305 | 305 | |
| 306 | - $url = $this->gateway->message_page_url( $product, 'cancel' ); |
|
| 306 | + $url = $this->gateway->message_page_url($product, 'cancel'); |
|
| 307 | 307 | |
| 308 | - if ( false !== $url ) { |
|
| 308 | + if (false !== $url) { |
|
| 309 | 309 | return $url; |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | $mepr_options = MeprOptions::fetch(); |
| 314 | 314 | |
| 315 | - return $mepr_options->account_page_url( 'action=subscriptions' ); |
|
| 315 | + return $mepr_options->account_page_url('action=subscriptions'); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | public function get_error_url() { |
| 333 | 333 | $mepr_options = MeprOptions::fetch(); |
| 334 | 334 | |
| 335 | - return $mepr_options->account_page_url( 'action=subscriptions' ) |
|
| 335 | + return $mepr_options->account_page_url('action=subscriptions') |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /** |
@@ -345,36 +345,36 @@ discard block |
||
| 345 | 345 | public function get_subscription() { |
| 346 | 346 | $product = $this->transaction->product(); |
| 347 | 347 | |
| 348 | - if ( $product->is_one_time_payment() ) { |
|
| 348 | + if ($product->is_one_time_payment()) { |
|
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | $mp_subscription = $this->transaction->subscription(); |
| 353 | 353 | |
| 354 | - if ( ! $mp_subscription ) { |
|
| 354 | + if ( ! $mp_subscription) { |
|
| 355 | 355 | return false; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | $frequency = ''; |
| 359 | 359 | |
| 360 | - if ( $mp_subscription->limit_cycles ) { |
|
| 360 | + if ($mp_subscription->limit_cycles) { |
|
| 361 | 361 | $frequency = $mp_subscription->limit_cycles; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | $subscription = new Subscription(); |
| 365 | 365 | $subscription->frequency = $frequency; |
| 366 | 366 | $subscription->interval = $product->period; |
| 367 | - $subscription->interval_period = Core_Util::to_period( $product->period_type ); |
|
| 367 | + $subscription->interval_period = Core_Util::to_period($product->period_type); |
|
| 368 | 368 | $subscription->description = sprintf( |
| 369 | 369 | 'Order #%s - %s', |
| 370 | 370 | $this->get_source_id(), |
| 371 | 371 | $this->get_description() |
| 372 | 372 | ); |
| 373 | 373 | |
| 374 | - $subscription->set_amount( new Money( |
|
| 374 | + $subscription->set_amount(new Money( |
|
| 375 | 375 | $this->transaction->total, |
| 376 | 376 | $this->get_currency_alphabetic_code() |
| 377 | - ) ); |
|
| 377 | + )); |
|
| 378 | 378 | |
| 379 | 379 | return $subscription; |
| 380 | 380 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | public function get_subscription_source_id() { |
| 389 | 389 | $subscription = $this->get_subscription(); |
| 390 | 390 | |
| 391 | - if ( ! $subscription ) { |
|
| 391 | + if ( ! $subscription) { |
|
| 392 | 392 | return false; |
| 393 | 393 | } |
| 394 | 394 | |