Changeset 3162067
- Timestamp:
- 10/03/2024 11:41:22 AM (15 months ago)
- Location:
- pmpro-payfast
- Files:
-
- 6 edited
- 1 copied
-
tags/1.5.4 (copied) (copied from pmpro-payfast/trunk)
-
tags/1.5.4/classes/class.pmprogateway_payfast.php (modified) (7 diffs)
-
tags/1.5.4/pmpro-payfast.php (modified) (1 diff)
-
tags/1.5.4/readme.txt (modified) (2 diffs)
-
trunk/classes/class.pmprogateway_payfast.php (modified) (7 diffs)
-
trunk/pmpro-payfast.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pmpro-payfast/tags/1.5.4/classes/class.pmprogateway_payfast.php
r3159730 r3162067 16 16 class PMProGateway_PayFast extends PMProGateway { 17 17 18 function __construct( $gateway = null ) { 19 return parent::__construct( $gateway ); 18 function __construct( $gateway = NULL ) { 19 $this->gateway = $gateway; 20 $this->gateway_environment = get_option( 'pmpro_gateway_environment' ); 21 22 return $this->gateway; 20 23 } 21 24 … … 325 328 $order->ProfileStartDate = date_i18n( 'Y-m-d', current_time( 'timestamp' ) ); 326 329 330 // Get the level amount so we can set the initial payment amount. 331 $level = $order->getMembershipLevelAtCheckout(); 332 327 333 // taxes on initial payment 328 $initial_payment = $order-> InitialPayment;334 $initial_payment = $order->subtotal; 329 335 $initial_payment_tax = $order->getTaxForPrice( $initial_payment ); 330 336 $initial_payment = round( (float) $initial_payment + (float) $initial_payment_tax, 2 ); 331 337 332 338 // taxes on the amount 333 $amount = $order->PaymentAmount;339 $amount = empty( $level->billing_amount ) ? 0 : $level->billing_amount; 334 340 $amount_tax = $order->getTaxForPrice( $amount ); 335 341 $order->subtotal = $amount; … … 348 354 } 349 355 356 $user = get_userdata( $order->user_id ); 357 $nameparts = pnp_split_full_name( $order->billing->name ); 358 350 359 $data = array( 351 360 'merchant_id' => $merchant_id, … … 354 363 'cancel_url' => pmpro_url( 'levels' ), 355 364 'notify_url' => admin_url( 'admin-ajax.php' ) . '?action=pmpro_payfast_itn_handler', 356 'name_first' => $order->FirstName,357 'name_last' => $order->LastName,358 'email_address' => $ order->Email,365 'name_first' => empty( $nameparts['fname'] ) ? '' : $nameparts['fname'], 366 'name_last' => empty( $nameparts['lname'] ) ? '' : $nameparts['lname'], 367 'email_address' => $user->user_email, 359 368 'm_payment_id' => $order->code, 360 369 'amount' => $initial_payment, … … 364 373 365 374 $cycles = $order->membership_level->billing_limit; 366 367 if( ! empty( $order->BillingFrequency ) ) { 375 if( ! empty( $level->cycle_number ) ) { 368 376 // convert PMPro cycle_number and period into a PayFast frequency 369 switch ( $ order->BillingPeriod ) {377 switch ( $level->cycle_period ) { 370 378 case 'Day': 371 379 $frequency = '1'; … … 385 393 // Add subscription data 386 394 if ( ! empty( $frequency ) ) { 387 // $data['m_subscription_id'] = /*$order->getRandomCode()*/$order->code; 388 $data['custom_str1'] = $order->ProfileStartDate; 395 $data['custom_str1'] = pmpro_calculate_profile_start_date( $order, 'Y-m-d' ); 389 396 $data['subscription_type'] = 1; 390 $data['billing_date'] = apply_filters( 'pmpro_profile_start_date', $ order->ProfileStartDate, $order );397 $data['billing_date'] = apply_filters( 'pmpro_profile_start_date', $data['custom_str1'], $order ); 391 398 $data['recurring_amount'] = $amount; 392 399 $data['frequency'] = $frequency; … … 405 412 $order->payment_transaction_id = $order->code; 406 413 $order->subscription_transaction_id = $order->code; 407 $order->subtotal = $order->InitialPayment;408 414 $order->tax = $initial_payment_tax; 409 415 $order->total = $initial_payment; -
pmpro-payfast/tags/1.5.4/pmpro-payfast.php
r3159730 r3162067 4 4 Plugin URI: https://www.paidmembershipspro.com/add-ons/payfast-payment-gateway/ 5 5 Description: Adds PayFast as a gateway option for Paid Memberships Pro. 6 Version: 1.5. 36 Version: 1.5.4 7 7 Author: Paid Memberships Pro 8 8 Author URI: https://www.paidmembershipspro.com -
pmpro-payfast/tags/1.5.4/readme.txt
r3159750 r3162067 4 4 Requires at least: 5.0 5 5 Tested up to: 6.6 6 Stable tag: 1.5. 36 Stable tag: 1.5.4 7 7 License: GPLv2 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 53 53 54 54 == Changelog == 55 = 1.5.4 - 2024-10-03 = 56 * BUG FIX: Fixed a fatal issue with Paid Memberships Pro V3.2+ and improved compatibility with 3.2+. 57 55 58 = 1.5.3 - 2024-09-30 = 56 59 * BUG FIX/ENHANCEMENT: Added better support for User Fields not saving correctly during checkout. (@andrewlimaza) -
pmpro-payfast/trunk/classes/class.pmprogateway_payfast.php
r3159730 r3162067 16 16 class PMProGateway_PayFast extends PMProGateway { 17 17 18 function __construct( $gateway = null ) { 19 return parent::__construct( $gateway ); 18 function __construct( $gateway = NULL ) { 19 $this->gateway = $gateway; 20 $this->gateway_environment = get_option( 'pmpro_gateway_environment' ); 21 22 return $this->gateway; 20 23 } 21 24 … … 325 328 $order->ProfileStartDate = date_i18n( 'Y-m-d', current_time( 'timestamp' ) ); 326 329 330 // Get the level amount so we can set the initial payment amount. 331 $level = $order->getMembershipLevelAtCheckout(); 332 327 333 // taxes on initial payment 328 $initial_payment = $order-> InitialPayment;334 $initial_payment = $order->subtotal; 329 335 $initial_payment_tax = $order->getTaxForPrice( $initial_payment ); 330 336 $initial_payment = round( (float) $initial_payment + (float) $initial_payment_tax, 2 ); 331 337 332 338 // taxes on the amount 333 $amount = $order->PaymentAmount;339 $amount = empty( $level->billing_amount ) ? 0 : $level->billing_amount; 334 340 $amount_tax = $order->getTaxForPrice( $amount ); 335 341 $order->subtotal = $amount; … … 348 354 } 349 355 356 $user = get_userdata( $order->user_id ); 357 $nameparts = pnp_split_full_name( $order->billing->name ); 358 350 359 $data = array( 351 360 'merchant_id' => $merchant_id, … … 354 363 'cancel_url' => pmpro_url( 'levels' ), 355 364 'notify_url' => admin_url( 'admin-ajax.php' ) . '?action=pmpro_payfast_itn_handler', 356 'name_first' => $order->FirstName,357 'name_last' => $order->LastName,358 'email_address' => $ order->Email,365 'name_first' => empty( $nameparts['fname'] ) ? '' : $nameparts['fname'], 366 'name_last' => empty( $nameparts['lname'] ) ? '' : $nameparts['lname'], 367 'email_address' => $user->user_email, 359 368 'm_payment_id' => $order->code, 360 369 'amount' => $initial_payment, … … 364 373 365 374 $cycles = $order->membership_level->billing_limit; 366 367 if( ! empty( $order->BillingFrequency ) ) { 375 if( ! empty( $level->cycle_number ) ) { 368 376 // convert PMPro cycle_number and period into a PayFast frequency 369 switch ( $ order->BillingPeriod ) {377 switch ( $level->cycle_period ) { 370 378 case 'Day': 371 379 $frequency = '1'; … … 385 393 // Add subscription data 386 394 if ( ! empty( $frequency ) ) { 387 // $data['m_subscription_id'] = /*$order->getRandomCode()*/$order->code; 388 $data['custom_str1'] = $order->ProfileStartDate; 395 $data['custom_str1'] = pmpro_calculate_profile_start_date( $order, 'Y-m-d' ); 389 396 $data['subscription_type'] = 1; 390 $data['billing_date'] = apply_filters( 'pmpro_profile_start_date', $ order->ProfileStartDate, $order );397 $data['billing_date'] = apply_filters( 'pmpro_profile_start_date', $data['custom_str1'], $order ); 391 398 $data['recurring_amount'] = $amount; 392 399 $data['frequency'] = $frequency; … … 405 412 $order->payment_transaction_id = $order->code; 406 413 $order->subscription_transaction_id = $order->code; 407 $order->subtotal = $order->InitialPayment;408 414 $order->tax = $initial_payment_tax; 409 415 $order->total = $initial_payment; -
pmpro-payfast/trunk/pmpro-payfast.php
r3159730 r3162067 4 4 Plugin URI: https://www.paidmembershipspro.com/add-ons/payfast-payment-gateway/ 5 5 Description: Adds PayFast as a gateway option for Paid Memberships Pro. 6 Version: 1.5. 36 Version: 1.5.4 7 7 Author: Paid Memberships Pro 8 8 Author URI: https://www.paidmembershipspro.com -
pmpro-payfast/trunk/readme.txt
r3159750 r3162067 4 4 Requires at least: 5.0 5 5 Tested up to: 6.6 6 Stable tag: 1.5. 36 Stable tag: 1.5.4 7 7 License: GPLv2 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 53 53 54 54 == Changelog == 55 = 1.5.4 - 2024-10-03 = 56 * BUG FIX: Fixed a fatal issue with Paid Memberships Pro V3.2+ and improved compatibility with 3.2+. 57 55 58 = 1.5.3 - 2024-09-30 = 56 59 * BUG FIX/ENHANCEMENT: Added better support for User Fields not saving correctly during checkout. (@andrewlimaza)
Note: See TracChangeset
for help on using the changeset viewer.