| @@ -398,9 +398,9 @@ | ||
| 398 | 398 | * |
| 399 | 399 | * @return array|false The formatted address array, or false if invalid. |
| 400 | 400 | */ |
| 401 | 401 | private static function format_address_for_paypal( $address, $address_field_id ) { |
| 402 | - if ( ! is_array( $address ) || ! isset( $address['line1'] ) || ! is_callable( 'FrmProAddressesController::get_country_code' ) ) { | |
| 402 | + if ( ! is_array( $address ) || ! isset( $address['line1'] ) ) { | |
| 403 | 403 | return false; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | $address_field = FrmField::getOne( $address_field_id ); |
| @@ -411,9 +411,9 @@ | ||
| 411 | 411 | |
| 412 | 412 | if ( 'us' === $address_field->field_options['address_type'] ) { |
| 413 | 413 | $country_code = 'US'; |
| 414 | 414 | } else { |
| 415 | - $country_code = FrmProAddressesController::get_country_code( $address['country'] ); | |
| 415 | + $country_code = FrmAddressesController::get_country_code( $address['country'] ); | |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | if ( ! $address['line1'] || ! $address['city'] || ! $address['state'] || ! $address['zip'] || ! $country_code ) { |
| 419 | 419 | return false; |
| @@ -461,9 +461,9 @@ | ||
| 461 | 461 | * |
| 462 | 462 | * @return void |
| 463 | 463 | */ |
| 464 | 464 | private static function maybe_add_address_data( &$payer, $address, $address_field_id ) { |
| 465 | - if ( ! is_array( $address ) || ! isset( $address['line1'] ) || ! is_callable( 'FrmProAddressesController::get_country_code' ) ) { | |
| 465 | + if ( ! is_array( $address ) || ! isset( $address['line1'] ) ) { | |
| 466 | 466 | return; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | $address_field = FrmField::getOne( $address_field_id ); |
| @@ -474,9 +474,9 @@ | ||
| 474 | 474 | |
| 475 | 475 | if ( 'us' === $address_field->field_options['address_type'] ) { |
| 476 | 476 | $country_code = 'US'; |
| 477 | 477 | } else { |
| 478 | - $country_code = FrmProAddressesController::get_country_code( $address['country'] ); | |
| 478 | + $country_code = FrmAddressesController::get_country_code( $address['country'] ); | |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | if ( ! $address['line1'] || ! $address['city'] || ! $address['state'] || ! $address['zip'] || ! $country_code ) { |
| 482 | 482 | return; |
| @@ -659,14 +659,8 @@ | ||
| 659 | 659 | 'shipping_preference' => self::get_shipping_preference( $action ), |
| 660 | 660 | 'description' => $description, |
| 661 | 661 | ); |
| 662 | 662 | |
| 663 | - $vault_setup_token = FrmAppHelper::get_post_param( 'vault_setup_token', '', 'sanitize_text_field' ); | |
| 664 | - | |
| 665 | - if ( $vault_setup_token ) { | |
| 666 | - $data['vault_setup_token'] = $vault_setup_token; | |
| 667 | - } | |
| 668 | - | |
| 669 | 663 | $response = FrmPayPalLiteConnectHelper::create_subscription( $data ); |
| 670 | 664 | |
| 671 | 665 | if ( false === $response ) { |
| 672 | 666 | $error = FrmPayPalLiteConnectHelper::get_latest_error_from_paypal_api(); |
| @@ -684,30 +678,8 @@ | ||
| 684 | 678 | |
| 685 | 679 | wp_send_json_success( array( 'subscriptionID' => $response->subscription_id ) ); |
| 686 | 680 | } |
| 687 | 681 | |
| 688 | - public static function create_vault_setup_token() { | |
| 689 | - check_ajax_referer( 'frm_paypal_ajax', 'nonce' ); | |
| 690 | - | |
| 691 | - $payment_source = FrmAppHelper::get_post_param( 'payment_source', 'card', 'sanitize_text_field' ); | |
| 692 | - | |
| 693 | - $data = array( | |
| 694 | - 'payment_source' => $payment_source, | |
| 695 | - ); | |
| 696 | - | |
| 697 | - $response = FrmPayPalLiteConnectHelper::create_vault_setup_token( $data ); | |
| 698 | - | |
| 699 | - if ( false === $response ) { | |
| 700 | - wp_send_json_error( 'Failed to create PayPal vault setup token' ); | |
| 701 | - } | |
| 702 | - | |
| 703 | - if ( ! isset( $response->token ) ) { | |
| 704 | - wp_send_json_error( 'Failed to create PayPal vault setup token' ); | |
| 705 | - } | |
| 706 | - | |
| 707 | - wp_send_json_success( array( 'token' => $response->token ) ); | |
| 708 | - } | |
| 709 | - | |
| 710 | 682 | /** |
| 711 | 683 | * Handle a PayPal error reported by the frontend JavaScript. |
| 712 | 684 | * |
| 713 | 685 | * Logs the debug ID and error details, then returns a display message |
| @@ -873,6 +845,14 @@ | ||
| 873 | 845 | return array( |
| 874 | 846 | 'message' => $clean_message ? $clean_message : $fallback, |
| 875 | 847 | 'debug_id' => $matches[1], |
| 876 | 848 | ); |
| 849 | + } | |
| 850 | + | |
| 851 | + /** | |
| 852 | + * @deprecated 6.32.1 | |
| 853 | + */ | |
| 854 | + public static function create_vault_setup_token() { | |
| 855 | + _deprecated_function( __METHOD__, '6.32.1' ); | |
| 856 | + wp_send_json_error( 'This API endpoint is no longer in use.' ); | |
| 877 | 857 | } |
| 878 | 858 | } |