diff --git a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php index 1be55fdff..de58651ec 100644 --- a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php +++ b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-helper-angelleye.php @@ -231,7 +231,6 @@ public function angelleye_paypal_express_checkout_redirect_to_paypal($data, $err if (empty($_POST['woocommerce_checkout_update_totals']) && 0 === $notice_count) { try { WC()->session->set('post_data', $_POST); - $this->process_customer($_POST); if (isset($_POST['payment_method']) && 'paypal_express' === $_POST['payment_method'] && $this->function_helper->ec_notice_count('error') == 0) { $this->function_helper->ec_redirect_after_checkout(); } @@ -1146,46 +1145,5 @@ public function angelleye_display_custom_message_review_page() { } } } - - public function process_customer( $data ) { - $customer_id = apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ); - if ( ! is_user_logged_in() && ( WC()->checkout->is_registration_required() || ! empty( $data['createaccount'] ) ) ) { - $username = ! empty( $data['account_username'] ) ? $data['account_username'] : ''; - $password = ! empty( $data['account_password'] ) ? $data['account_password'] : ''; - $customer_id = wc_create_new_customer( $data['billing_email'], $username, $password ); - if ( is_wp_error( $customer_id ) ) { - throw new Exception( $customer_id->get_error_message() ); - } - wp_set_current_user( $customer_id ); - wc_set_customer_auth_cookie( $customer_id ); - WC()->session->set( 'reload_checkout', true ); - WC()->cart->calculate_totals(); - } - if ( $customer_id && is_multisite() && is_user_logged_in() && ! is_user_member_of_blog() ) { - add_user_to_blog( get_current_blog_id(), $customer_id, 'customer' ); - } - if ( $customer_id && apply_filters( 'woocommerce_checkout_update_customer_data', true) ) { - $customer = new WC_Customer( $customer_id ); - if ( ! empty( $data['billing_first_name'] ) ) { - $customer->set_first_name( $data['billing_first_name'] ); - } - if ( ! empty( $data['billing_last_name'] ) ) { - $customer->set_last_name( $data['billing_last_name'] ); - } - if ( is_email( $customer->get_display_name() ) ) { - $customer->set_display_name( $data['billing_first_name'] . ' ' . $data['billing_last_name'] ); - } - foreach ( $data as $key => $value ) { - if ( is_callable( array( $customer, "set_{$key}" ) ) ) { - $customer->{"set_{$key}"}( $value ); - } elseif ( 0 === stripos( $key, 'billing_' ) || 0 === stripos( $key, 'shipping_' ) ) { - $customer->update_meta_data( $key, $value ); - } - } - do_action( 'woocommerce_checkout_update_customer', $customer, $data ); - $customer->save(); - } - do_action( 'woocommerce_checkout_update_user_meta', $customer_id, $data ); - } } diff --git a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-request-angelleye.php b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-request-angelleye.php index 8119d98e1..5481f2715 100644 --- a/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-request-angelleye.php +++ b/angelleye-includes/express-checkout/class-wc-gateway-paypal-express-request-angelleye.php @@ -18,7 +18,6 @@ class WC_Gateway_PayPal_Express_Request_AngellEYE { public $confirm_order_id; public $order_param; public $user_email_address; - public $recipient; public function __construct($gateway) { try { @@ -356,17 +355,6 @@ public function angelleye_do_express_checkout_payment() { update_post_meta($order->get_id(), '_express_chekout_transactionid', isset($this->paypal_response['PAYMENTINFO_0_TRANSACTIONID']) ? $this->paypal_response['PAYMENTINFO_0_TRANSACTIONID'] : '' ); update_post_meta($order->get_id(), 'paypal_email', $payeremail); } - - if ($old_wc) { - update_post_meta($order_id, 'PayPal Transaction Fee', isset($this->paypal_response['PAYMENTINFO_0_FEEAMT']) ? $this->paypal_response['PAYMENTINFO_0_FEEAMT'] : ''); - } else { - update_post_meta($order->get_id(), 'PayPal Transaction Fee', isset($this->paypal_response['PAYMENTINFO_0_FEEAMT']) ? $this->paypal_response['PAYMENTINFO_0_FEEAMT'] : ''); - } - if ($old_wc) { - update_post_meta($order_id, 'Payment Type', isset($this->paypal_response['PAYMENTINFO_0_PAYMENTTYPE']) ? $this->paypal_response['PAYMENTINFO_0_PAYMENTTYPE'] : ''); - } else { - update_post_meta($order->get_id(), 'Payment Type', isset($this->paypal_response['PAYMENTINFO_0_PAYMENTTYPE']) ? $this->paypal_response['PAYMENTINFO_0_PAYMENTTYPE'] : ''); - } $order->add_order_note(sprintf(__('%s payment Transaction ID: %s', 'paypal-for-woocommerce'), $this->gateway->title, isset($this->paypal_response['PAYMENTINFO_0_TRANSACTIONID']) ? $this->paypal_response['PAYMENTINFO_0_TRANSACTIONID'] : '')); WC()->cart->empty_cart(); wc_clear_notices(); @@ -670,11 +658,9 @@ public function angelleye_set_express_checkout_request() { ); if (empty($_GET['pay_for_order'])) { + $post_data = WC()->session->get('post_data'); if (!empty($post_data)) { - if( !empty($post_data['billing_email']) ) { - $SECFields['email'] = $post_data['billing_email']; - } $SECFields['addroverride'] = 1; if (!empty($post_data['ship_to_different_address'])) { $shiptoname = ''; @@ -685,12 +671,14 @@ public function angelleye_set_express_checkout_request() { } elseif (!empty($post_data['shipping_last_name'])) { $shiptoname = $post_data['shipping_last_name']; } + if (!empty($post_data['shipping_company'])) { $shipping_company = $post_data['shipping_company']; $Payment['shiptoname'] = wc_clean(stripslashes($shipping_company . ' - ' . $shiptoname)); } else { $Payment['shiptoname'] = wc_clean(stripslashes($shiptoname)); } + $Payment['shiptostreet'] = !empty($post_data['shipping_address_1']) ? $post_data['shipping_address_1'] : ''; $Payment['shiptostreet2'] = !empty($post_data['shipping_address_2']) ? $post_data['shipping_address_2'] : ''; $Payment['shiptocity'] = !empty($post_data['shipping_city']) ? wc_clean(stripslashes($post_data['shipping_city'])) : ''; @@ -1008,9 +996,6 @@ public function angelleye_write_error_log_and_send_email_notification($paypal_ac } if ($this->gateway->error_email_notify) { $mailer = WC()->mailer(); - $recipients = array_map( 'trim', explode( ',', $this->gateway->recipient ) ); - $recipients = array_filter( $recipients, 'is_email' ); - $all_emails = implode( ', ', $recipients ); $error_email_notify_subject = apply_filters('ae_ppec_error_email_subject', 'PayPal Express Checkout Error Notification'); $message = sprintf( "".__('PayPal %s API call failed', 'paypal-for-woocommerce')."" . PHP_EOL .PHP_EOL @@ -1026,7 +1011,7 @@ public function angelleye_write_error_log_and_send_email_notification($paypal_ac ); $message = apply_filters('ae_ppec_error_email_message', $message, $ErrorCode, $ErrorSeverityCode, $ErrorShortMsg, $ErrorLongMsg); $message = $mailer->wrap_message($error_email_notify_subject, $message); - $mailer->send($all_emails, strip_tags($error_email_notify_subject), $message); + $mailer->send(get_option('admin_email'), strip_tags($error_email_notify_subject), $message); } if ($this->gateway->error_display_type == 'detailed') { $sec_error_notice = $ErrorCode . ' - ' . $ErrorLongMsg; @@ -1041,7 +1026,6 @@ public function angelleye_write_error_log_and_send_email_notification($paypal_ac } public function angelleye_write_paypal_request_log($paypal_action_name) { - WC_Gateway_PayPal_Express_AngellEYE::log('Environment: ' . $this->testmode); if ($paypal_action_name == 'SetExpressCheckout') { WC_Gateway_PayPal_Express_AngellEYE::log('Redirecting to PayPal'); WC_Gateway_PayPal_Express_AngellEYE::log(sprintf(__('PayPal for WooCommerce Version: %s', 'paypal-for-woocommerce'), VERSION_PFW)); @@ -1352,7 +1336,7 @@ public function DoReferenceTransaction($order_id) { $PaymentDetails['itemamt'] = AngellEYE_Gateway_Paypal::number_format($this->order_param['itemamt']); $PayPalRequestData['PaymentDetails'] = $PaymentDetails; $this->paypal_response = $this->paypal->DoReferenceTransaction($PayPalRequestData); - AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($this->paypal_response, $methos_name = 'DoExpressCheckoutPayment', $gateway = 'PayPal Express Checkout', $this->gateway->error_email_notify, $this->gateway->recipient); + AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($this->paypal_response, $methos_name = 'DoExpressCheckoutPayment', $gateway = 'PayPal Express Checkout', $this->gateway->error_email_notify); WC_Gateway_PayPal_Express_AngellEYE::log('Test Mode: ' . $this->testmode); WC_Gateway_PayPal_Express_AngellEYE::log('Endpoint: ' . $this->gateway->API_Endpoint); $PayPalRequest = isset($this->paypal_response['RAWREQUEST']) ? $this->paypal_response['RAWREQUEST'] : ''; @@ -1448,7 +1432,7 @@ public function angelleye_process_refund($order_id, $amount = null, $reason = '' $this->paypal_response = $this->paypal->RefundTransaction($PayPalRequestData); - AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($this->paypal_response, $methos_name = 'RefundTransaction', $gateway = 'PayPal Express Checkout', $this->gateway->error_email_notify, $this->gateway->recipient); + AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($this->paypal_response, $methos_name = 'RefundTransaction', $gateway = 'PayPal Express Checkout', $this->gateway->error_email_notify); WC_Gateway_PayPal_Express_AngellEYE::log('Test Mode: ' . $this->testmode); WC_Gateway_PayPal_Express_AngellEYE::log('Endpoint: ' . $this->gateway->API_Endpoint); $PayPalRequest = isset($this->paypal_response['RAWREQUEST']) ? $this->paypal_response['RAWREQUEST'] : ''; diff --git a/assets/css/checkout.css b/assets/css/checkout.css index 81e7f67cc..a0fcf5a6a 100644 --- a/assets/css/checkout.css +++ b/assets/css/checkout.css @@ -117,4 +117,7 @@ p.woocommerce-SavedPaymentMethods-saveNew label { margin-left: 0px; margin-top: 12px; } + .woocommerce form .form-row-last, .woocommerce-page form .form-row-last { + float: left; + } } \ No newline at end of file diff --git a/classes/wc-gateway-braintree-angelleye.php b/classes/wc-gateway-braintree-angelleye.php index 73f744976..f6d88650a 100644 --- a/classes/wc-gateway-braintree-angelleye.php +++ b/classes/wc-gateway-braintree-angelleye.php @@ -728,7 +728,6 @@ public function angelleye_do_payment($order) { } if ($this->debug) { - $this->add_log('Environment: ' . $this->environment); $this->add_log('Begin Braintree_Transaction::sale request'); $this->add_log('Order: ' . print_r($order->get_order_number(), true)); $log = $request_data; diff --git a/classes/wc-gateway-paypal-advanced-angelleye.php b/classes/wc-gateway-paypal-advanced-angelleye.php index 1db39c557..16616f4f7 100644 --- a/classes/wc-gateway-paypal-advanced-angelleye.php +++ b/classes/wc-gateway-paypal-advanced-angelleye.php @@ -1144,10 +1144,9 @@ public function receipt_page($order_id) { $this->securetoken = $old_wc ? get_post_meta($order->id, '_secure_token', true) : get_post_meta($order->get_id(), '_secure_token', true); //Log the browser and its version - if ($this->debug == 'yes') { - $this->add_log('Environment: ' . $PF_MODE); + if ($this->debug == 'yes') $this->log->add('paypal_advanced', sprintf(__('Browser Info: %s', 'paypal-for-woocommerce'), $_SERVER['HTTP_USER_AGENT'])); - } + //display the form in IFRAME, if it is layout C, otherwise redirect to paypal site if ($this->layout == 'MINLAYOUT' || $this->layout == 'C') { //define the url diff --git a/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php b/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php index eda94d49b..2b88eb8ee 100644 --- a/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php +++ b/classes/wc-gateway-paypal-credit-cards-rest-angelleye.php @@ -88,8 +88,8 @@ public function admin_options() {
' . __('PayPal for WooCommerce requires PHP version 5.4 or higher.','paypal-for-woocommerce') . '
'; + } elseif (version_compare(phpversion(), '5.3.0', '<')) { + echo ''; } else { $this->generate_settings_html(); } diff --git a/classes/wc-gateway-paypal-express-angelleye.php b/classes/wc-gateway-paypal-express-angelleye.php index bf6bce3fa..f8fbe5a8e 100644 --- a/classes/wc-gateway-paypal-express-angelleye.php +++ b/classes/wc-gateway-paypal-express-angelleye.php @@ -84,7 +84,6 @@ public function __construct() { $this->save_abandoned_checkout = 'yes' === $this->get_option('save_abandoned_checkout', 'no'); self::$log_enabled = $this->debug; $this->error_email_notify = 'yes' === $this->get_option('error_email_notify', 'no'); - $this->recipient = $this->get_option('recipient', get_option( 'admin_email' )); $this->show_on_checkout = $this->get_option('show_on_checkout', 'top'); $this->paypal_account_optional = $this->get_option('paypal_account_optional', 'no'); $this->error_display_type = $this->get_option('error_display_type', 'detailed'); @@ -433,15 +432,6 @@ function is_funding_icon_should_show_php() { } }).change(); - jQuery('#woocommerce_paypal_express_error_email_notify').change(function () { - var paypal_express_recipient = jQuery('#woocommerce_paypal_express_recipient').closest('tr'); - if (jQuery(this).is(':checked')) { - paypal_express_recipient.show(); - } else { - paypal_express_recipient.hide(); - } - }).change(); - testmode = 'yes' === $this->get_option('testmode', 'yes'); $this->paypal_marketing_solutions_cid_production = $this->get_option('paypal_marketing_solutions_cid_production', ''); $this->form_fields = array( + 'general' => array( + 'title' => __( 'General', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', + ), 'enabled' => array( 'title' => __('Enable/Disable', 'paypal-for-woocommerce'), 'label' => __('Enable PayPal Express', 'paypal-for-woocommerce'), @@ -556,6 +551,11 @@ public function init_form_fields() { 'default' => __("Pay via PayPal; you can pay with your credit card if you don't have a PayPal account", 'paypal-for-woocommerce'), 'desc_tip' => true, ), + 'api_details' => array( + 'title' => __( 'API Credentials', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', + ), 'testmode' => array( 'title' => __('PayPal Sandbox', 'paypal-for-woocommerce'), 'type' => 'checkbox', @@ -601,28 +601,10 @@ public function init_form_fields() { 'default' => '', 'custom_attributes' => array( 'autocomplete' => 'off'), ), - 'error_email_notify' => array( - 'title' => __('Error Email Notifications', 'paypal-for-woocommerce'), - 'type' => 'checkbox', - 'label' => __('Enable email notifications for errors.', 'paypal-for-woocommerce'), - 'default' => 'yes', - 'description' => __('This will send a detailed error email to specified recipient(s) when PayPal API error occurs.', 'paypal-for-woocommerce'), - 'desc_tip' => true - ), - 'recipient' => array( - 'title' => __( 'Recipient(s)', 'woocommerce' ), - 'type' => 'text', - 'description' => sprintf( __( 'Enter recipients (comma separated) for this email. Defaults to %s.', 'woocommerce' ), '' . esc_attr( get_option( 'admin_email' ) ) . '' ), - 'placeholder' => '', - 'default' => get_option( 'admin_email' ), - 'desc_tip' => true, - ), - 'invoice_id_prefix' => array( - 'title' => __('Invoice ID Prefix', 'paypal-for-woocommerce'), - 'type' => 'text', - 'description' => __('Add a prefix to the invoice ID sent to PayPal. This can resolve duplicate invoice problems when working with multiple websites on the same PayPal account.', 'paypal-for-woocommerce'), - 'desc_tip' => true, - 'default' => 'WC-EC' + 'shopping_cart_checkout_page_display' => array( + 'title' => __( 'Shopping Cart, Checkout and Product Page Display', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', ), 'review_title_page' => array( 'title' => __('Order Review Page Title', 'paypal-for-woocommerce'), @@ -701,6 +683,13 @@ public function init_form_fields() { 'description' => __('Displaying the checkout button at the top of the checkout page will allow users to skip filling out the forms and can potentially increase conversion rates.'), 'desc_tip' => true, ), + 'angelleye_skip_text' => array( + 'title' => __('Express Checkout Message', 'paypal-for-woocommerce'), + 'type' => 'text', + 'description' => __('This message will be displayed next to the PayPal Express Checkout button at the top of the checkout page.'), + 'default' => __('Skip the forms and pay faster with PayPal!', 'paypal-for-woocommerce'), + 'desc_tip' => true, + ), 'show_on_product_page' => array( 'title' => __('Product Page', 'paypal-for-woocommerce'), 'type' => 'checkbox', @@ -710,6 +699,19 @@ public function init_form_fields() { 'desc_tip' => false, ), + 'show_paypal_credit' => array( + 'title' => __('Enable PayPal Credit', 'paypal-for-woocommerce'), + 'type' => 'checkbox', + 'label' => __('Show the PayPal Credit button next to the Express Checkout button.', 'paypal-for-woocommerce'), + 'default' => 'yes', + 'description' => ($this->is_paypal_credit_enable == false) ? __('Currently disabled because PayPal Credit is only available for U.S.', 'paypal-for-woocommerce') : "", + 'desc_tip' => ($this->is_paypal_credit_enable) ? true : false, + ), + 'branding' => array( + 'title' => __( 'Branding', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', + ), 'paypal_account_optional' => array( 'title' => __('PayPal Account Optional', 'paypal-for-woocommerce'), 'type' => 'checkbox', @@ -741,14 +743,7 @@ public function init_form_fields() { 'default' => 'detailed', 'desc_tip' => true, ), - 'show_paypal_credit' => array( - 'title' => __('Enable PayPal Credit', 'paypal-for-woocommerce'), - 'type' => 'checkbox', - 'label' => __('Show the PayPal Credit button next to the Express Checkout button.', 'paypal-for-woocommerce'), - 'default' => 'yes', - 'description' => ($this->is_paypal_credit_enable == false) ? __('Currently disabled because PayPal Credit is only available for U.S.', 'paypal-for-woocommerce') : "", - 'desc_tip' => ($this->is_paypal_credit_enable) ? true : false, - ), + 'use_wp_locale_code' => array( 'title' => __('Use WordPress Locale Code', 'paypal-for-woocommerce'), 'type' => 'checkbox', @@ -796,12 +791,93 @@ public function init_form_fields() { 'default' => '', 'desc_tip' => true, ), - 'angelleye_skip_text' => array( - 'title' => __('Express Checkout Message', 'paypal-for-woocommerce'), + 'tokenization_subscriptions' => array( + 'title' => __( 'Tokenization / Subscriptions', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', + ), + 'enable_tokenized_payments' => array( + 'title' => __('Enable Tokenized Payments', 'paypal-for-woocommerce'), + 'label' => __('Enable Tokenized Payments', 'paypal-for-woocommerce'), + 'type' => 'checkbox', + 'description' => __('Allow buyers to securely save payment details to their account for quick checkout / auto-ship orders in the future. (Currently considered BETA for Express Checkout.)', 'paypal-for-woocommerce'), + 'default' => 'no', + 'class' => 'enable_tokenized_payments' + ), + 'fraud_management' => array( + 'title' => __( 'Fraud Management', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', + ), + 'fraud_management_filters' => array( + 'title' => __('Fraud Management Filters ', 'paypal-for-woocommerce'), + 'label' => '', + 'description' => __('Choose how you would like to handle orders when Fraud Management Filters are flagged.', 'paypal-for-woocommerce'), + 'type' => 'select', + 'class' => 'wc-enhanced-select', + 'options' => array( + 'ignore_warnings_and_proceed_as_usual' => __('Ignore warnings and proceed as usual.', 'paypal-for-woocommerce'), + 'place_order_on_hold_for_further_review' => __('Place order On Hold for further review.', 'paypal-for-woocommerce'), + ), + 'default' => 'place_order_on_hold_for_further_review', + 'desc_tip' => true, + ), + 'email_notify_order_cancellations' => array( + 'title' => __('Order canceled/refunded Email Notifications', 'paypal-for-woocommerce'), + 'label' => __('Enable buyer email notifications for Order canceled/refunded', 'paypal-for-woocommerce'), + 'type' => 'checkbox', + 'description' => __('This will send buyer email notifications for Order canceled/refunded when Auto Cancel / Refund Orders option is selected.', 'paypal-for-woocommerce'), + 'default' => 'no', + 'class' => 'email_notify_order_cancellations', + 'desc_tip' => true, + ), + 'seller_protection' => array( + 'title' => __( 'Seller Protection', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', + ), + 'order_cancellations' => array( + 'title' => __('Auto Cancel / Refund Orders ', 'paypal-for-woocommerce'), + 'label' => '', + 'description' => __('Allows you to cancel and refund orders that do not meet PayPal\'s Seller Protection criteria.', 'paypal-for-woocommerce'), + 'type' => 'select', + 'class' => 'order_cancellations wc-enhanced-select', + 'options' => array( + 'no_seller_protection' => __('Do *not* have PayPal Seller Protection', 'paypal-for-woocommerce'), + 'no_unauthorized_payment_protection' => __('Do *not* have PayPal Unauthorized Payment Protection', 'paypal-for-woocommerce'), + 'disabled' => __('Do not cancel any orders', 'paypal-for-woocommerce'), + ), + 'default' => 'disabled', + 'desc_tip' => true, + ), + 'email_notify_order_cancellations' => array( + 'title' => __('Order Cancelled / Refunded Email Notifications', 'paypal-for-woocommerce'), + 'label' => __('Enable buyer email notifications for Order cancelled/refunded', 'paypal-for-woocommerce'), + 'type' => 'checkbox', + 'description' => __('This will send buyer email notifications for Order canceled/refunded when Auto Cancel / Refund Orders option is selected.', 'paypal-for-woocommerce'), + 'default' => 'no', + 'class' => 'email_notify_order_cancellations', + 'desc_tip' => true, + ), + 'advanced' => array( + 'title' => __( 'Advanced Options', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', + ), + 'error_email_notify' => array( + 'title' => __('Error Email Notifications', 'paypal-for-woocommerce'), + 'type' => 'checkbox', + 'label' => __('Enable admin email notifications for errors.', 'paypal-for-woocommerce'), + 'default' => 'yes', + 'description' => __('This will send a detailed error email to the WordPress site administrator if a PayPal API error occurs.', 'paypal-for-woocommerce'), + 'desc_tip' => true + ), + 'invoice_id_prefix' => array( + 'title' => __('Invoice ID Prefix', 'paypal-for-woocommerce'), 'type' => 'text', - 'description' => __('This message will be displayed next to the PayPal Express Checkout button at the top of the checkout page.'), - 'default' => __('Skip the forms and pay faster with PayPal!', 'paypal-for-woocommerce'), + 'description' => __('Add a prefix to the invoice ID sent to PayPal. This can resolve duplicate invoice problems when working with multiple websites on the same PayPal account.', 'paypal-for-woocommerce'), 'desc_tip' => true, + 'default' => 'WC-EC' ), 'skip_final_review' => array( 'title' => __('Skip Final Review', 'paypal-for-woocommerce'), @@ -869,14 +945,6 @@ public function init_form_fields() { 'default' => 'yes', 'desc_tip' => true, ), - 'enable_tokenized_payments' => array( - 'title' => __('Enable Tokenized Payments', 'paypal-for-woocommerce'), - 'label' => __('Enable Tokenized Payments', 'paypal-for-woocommerce'), - 'type' => 'checkbox', - 'description' => __('Allow buyers to securely save payment details to their account for quick checkout / auto-ship orders in the future. (Currently considered BETA for Express Checkout.)', 'paypal-for-woocommerce'), - 'default' => 'no', - 'class' => 'enable_tokenized_payments' - ), 'enable_notifyurl' => array( 'title' => __('Enable PayPal IPN', 'paypal-for-woocommerce'), 'label' => __('Configure an IPN URL to be included with Express Checkout payments.', 'paypal-for-woocommerce'), @@ -902,42 +970,7 @@ public function init_form_fields() { 'class' => '', 'desc_tip' => true, ), - 'order_cancellations' => array( - 'title' => __('Auto Cancel / Refund Orders ', 'paypal-for-woocommerce'), - 'label' => '', - 'description' => __('Allows you to cancel and refund orders that do not meet PayPal\'s Seller Protection criteria.', 'paypal-for-woocommerce'), - 'type' => 'select', - 'class' => 'order_cancellations wc-enhanced-select', - 'options' => array( - 'no_seller_protection' => __('Do *not* have PayPal Seller Protection', 'paypal-for-woocommerce'), - 'no_unauthorized_payment_protection' => __('Do *not* have PayPal Unauthorized Payment Protection', 'paypal-for-woocommerce'), - 'disabled' => __('Do not cancel any orders', 'paypal-for-woocommerce'), - ), - 'default' => 'disabled', - 'desc_tip' => true, - ), - 'fraud_management_filters' => array( - 'title' => __('Fraud Management Filters ', 'paypal-for-woocommerce'), - 'label' => '', - 'description' => __('Choose how you would like to handle orders when Fraud Management Filters are flagged.', 'paypal-for-woocommerce'), - 'type' => 'select', - 'class' => 'wc-enhanced-select', - 'options' => array( - 'ignore_warnings_and_proceed_as_usual' => __('Ignore warnings and proceed as usual.', 'paypal-for-woocommerce'), - 'place_order_on_hold_for_further_review' => __('Place order On Hold for further review.', 'paypal-for-woocommerce'), - ), - 'default' => 'place_order_on_hold_for_further_review', - 'desc_tip' => true, - ), - 'email_notify_order_cancellations' => array( - 'title' => __('Order canceled/refunded Email Notifications', 'paypal-for-woocommerce'), - 'label' => __('Enable buyer email notifications for Order canceled/refunded', 'paypal-for-woocommerce'), - 'type' => 'checkbox', - 'description' => __('This will send buyer email notifications for Order canceled/refunded when Auto Cancel / Refund Orders option is selected.', 'paypal-for-woocommerce'), - 'default' => 'no', - 'class' => 'email_notify_order_cancellations', - 'desc_tip' => true, - ), + 'save_abandoned_checkout' => array( 'title' => __('Save Abandoned Checkouts', 'paypal-for-woocommerce'), 'type' => 'checkbox', @@ -963,12 +996,18 @@ public function init_form_fields() { 'class' => '', 'description' => __('', 'paypal-for-woocommerce'), ), + 'smart_buttons' => array( + 'title' => __( 'Smart Payment Buttons', 'paypal-for-woocommerce' ), + 'type' => 'title', + 'description' => '', + ), 'enable_in_context_checkout_flow' => array( 'title' => __('Enable Smart Buttons', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('The enhanced PayPal Express Checkout with In-Context gives your customers a simplified checkout experience that keeps them at your website throughout the payment authorization process.', 'paypal-for-woocommerce'), 'default' => 'yes' ), + 'button_styles' => array( 'title' => __('', 'paypal-for-woocommerce'), 'type' => 'title', @@ -1372,12 +1411,6 @@ public function handle_wc_api() { $paypal_express_request->angelleye_get_express_checkout_details(); $order_id = absint(WC()->session->get('order_awaiting_payment')); if( !empty($_GET['pay_for_order']) && $_GET['pay_for_order'] == true ) { - $paypal_express_checkout = WC()->session->get( 'paypal_express_checkout' ); - $shipping_details = isset($paypal_express_checkout['shipping_details']) ? $paypal_express_checkout['shipping_details'] : array(); - AngellEYE_Utility::angelleye_set_address($order_id, $shipping_details, 'shipping'); - if ($this->billing_address && !empty($shipping_details)) { - AngellEYE_Utility::angelleye_set_address($order_id, $shipping_details, 'billing'); - } } else { if ( $order_id > 0 && ( $order = wc_get_order( $order_id ) ) && $order->has_status( array( 'pending', 'failed' ) ) ) { $_POST = WC()->session->get( 'post_data' ); @@ -1606,7 +1639,7 @@ public function paypal_express_checkout_token_request_handler($PayPalRequest = a if (!empty($PayPalRequest) && !empty($action_name)) { if ('SetExpressCheckout' == $action_name) { $PayPalResult = $PayPal->SetExpressCheckout(apply_filters('angelleye_woocommerce_express_set_express_checkout_request_args', $PayPalRequest)); - AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'SetExpressCheckout', $gateway = 'PayPal Express Checkout', $this->error_email_notify, $this->recipient); + AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'SetExpressCheckout', $gateway = 'PayPal Express Checkout', $this->error_email_notify); self::log('Test Mode: ' . $this->testmode); self::log('Endpoint: ' . $this->API_Endpoint); $PayPalRequest = isset($PayPalResult['RAWREQUEST']) ? $PayPalResult['RAWREQUEST'] : ''; @@ -1666,9 +1699,7 @@ public function paypal_express_checkout_error_handler($request_name = '', $redir self::log(__('Error Severity Code: ', 'paypal-for-woocommerce') . $ErrorSeverityCode); $message = ''; if ($this->error_email_notify) { - $recipients = array_map( 'trim', explode( ',', $this->recipient ) ); - $recipients = array_filter( $recipients, 'is_email' ); - $all_emails = implode( ', ', $recipients ); + $admin_email = get_option("admin_email"); $message .= __($request_name . " API call failed.", "paypal-for-woocommerce") . "\n\n"; $message .= __('Error Code: ', 'paypal-for-woocommerce') . $ErrorCode . "\n"; $message .= __('Error Severity Code: ', 'paypal-for-woocommerce') . $ErrorSeverityCode . "\n"; @@ -1678,7 +1709,7 @@ public function paypal_express_checkout_error_handler($request_name = '', $redir $error_email_notify_mes = apply_filters('ae_ppec_error_email_message', $message, $ErrorCode, $ErrorSeverityCode, $ErrorShortMsg, $ErrorLongMsg); $subject = "PayPal Express Checkout Error Notification"; $error_email_notify_subject = apply_filters('ae_ppec_error_email_subject', $subject); - wp_mail($all_emails, $error_email_notify_subject, $error_email_notify_mes); + wp_mail($admin_email, $error_email_notify_subject, $error_email_notify_mes); } if ($this->error_display_type == 'detailed') { $sec_error_notice = $ErrorCode . ' - ' . $ErrorLongMsg; diff --git a/classes/wc-gateway-paypal-pro-angelleye.php b/classes/wc-gateway-paypal-pro-angelleye.php index ac4a26f4a..ae98e37d2 100644 --- a/classes/wc-gateway-paypal-pro-angelleye.php +++ b/classes/wc-gateway-paypal-pro-angelleye.php @@ -85,7 +85,6 @@ function __construct() { } $this->invoice_id_prefix = $this->get_option('invoice_id_prefix'); $this->error_email_notify = $this->get_option('error_email_notify'); - $this->recipient = $this->get_option('recipient', get_option( 'admin_email' )); $this->error_display_type = $this->get_option('error_display_type'); //$this->enable_3dsecure = 'yes' === $this->get_option('enable_3dsecure', 'no'); $this->enable_3dsecure = false; @@ -219,18 +218,9 @@ function init_form_fields() { 'error_email_notify' => array( 'title' => __('Error Email Notifications', 'paypal-for-woocommerce'), 'type' => 'checkbox', - 'label' => __('Enable email notifications for errors.', 'paypal-for-woocommerce'), + 'label' => __('Enable admin email notifications for errors.', 'paypal-for-woocommerce'), 'default' => 'yes', - 'description' => __('This will send a detailed error emails are sent to chosen recipient(s) when PayPal API error occurs.', 'paypal-for-woocommerce'), - 'desc_tip' => true - ), - 'recipient' => array( - 'title' => __( 'Recipient(s)', 'woocommerce' ), - 'type' => 'text', - 'description' => sprintf( __( 'Enter recipients (comma separated) for this email. Defaults to %s.', 'woocommerce' ), '' . esc_attr( get_option( 'admin_email' ) ) . '' ), - 'placeholder' => '', - 'default' => get_option( 'admin_email' ), - 'desc_tip' => true, + 'description' => __('This will send a detailed error email to the WordPress site administrator if a PayPal API error occurs.', 'paypal-for-woocommerce') ), 'testmode' => array( 'title' => __('Test Mode', 'paypal-for-woocommerce'), @@ -460,14 +450,6 @@ public function admin_options() { production.show(); } }).change(); - jQuery('#woocommerce_paypal_pro_error_email_notify').change(function () { - var paypal_pro_recipient = jQuery('#woocommerce_paypal_pro_recipient').closest('tr'); - if (jQuery(this).is(':checked')) { - paypal_pro_recipient.show(); - } else { - paypal_pro_recipient.hide(); - } - }).change(); error_email_notify, $this->recipient); + AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'DoDirectPayment', $gateway = 'PayPal Website Payments Pro (DoDirectPayment)', $this->error_email_notify); $PayPalRequest = isset($PayPalResult['RAWREQUEST']) ? $PayPalResult['RAWREQUEST'] : ''; $PayPalResponse = isset($PayPalResult['RAWRESPONSE']) ? $PayPalResult['RAWRESPONSE'] : ''; - $this->log('Environment: ' . $this->testmode); + $this->log('Request: ' . print_r($PayPal->NVPToArray($PayPal->MaskAPIResult($PayPalRequest)), true)); $this->log('Response: ' . print_r($PayPal->NVPToArray($PayPal->MaskAPIResult($PayPalResponse)), true)); @@ -1362,7 +1344,7 @@ function do_payment($order, $card_number, $card_type, $card_exp_month, $card_exp wp_mail($admin_email, $pc_error_email_subject, $pc_error_email_message); } - $this->log('Environment: ' . $this->testmode); + $this->log('Error ' . print_r($PayPalResult['ERRORS'], true)); @@ -1475,11 +1457,11 @@ public function process_refund($order_id, $amount = null, $reason = '') { * @since 1.1.8 */ - AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'RefundTransaction', $gateway = 'PayPal Website Payments Pro (DoDirectPayment)', $this->error_email_notify, $this->recipient); + AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'RefundTransaction', $gateway = 'PayPal Website Payments Pro (DoDirectPayment)', $this->error_email_notify); $PayPalRequest = isset($PayPalResult['RAWREQUEST']) ? $PayPalResult['RAWREQUEST'] : ''; $PayPalResponse = isset($PayPalResult['RAWRESPONSE']) ? $PayPalResult['RAWRESPONSE'] : ''; - $this->log('Environment: ' . $this->testmode); + $this->log('Refund Request: ' . print_r($PayPal->NVPToArray($PayPal->MaskAPIResult($PayPalRequest)), true)); $this->log('Refund Response: ' . print_r($PayPal->NVPToArray($PayPal->MaskAPIResult($PayPalResponse)), true)); @@ -1604,9 +1586,7 @@ public function paypal_pro_error_handler($request_name = '', $redirect_url = '', $this->log(__('Error Severity Code: ', 'paypal-for-woocommerce') . $ErrorSeverityCode); $message = ''; if ($this->error_email_notify) { - $recipients = array_map( 'trim', explode( ',', $this->recipient ) ); - $recipients = array_filter( $recipients, 'is_email' ); - $all_emails = implode( ', ', $recipients ); + $admin_email = get_option("admin_email"); $message .= __($request_name . " API call failed.", "paypal-for-woocommerce") . "\n\n"; $message .= __('Error Code: ', 'paypal-for-woocommerce') . $ErrorCode . "\n"; $message .= __('Error Severity Code: ', 'paypal-for-woocommerce') . $ErrorSeverityCode . "\n"; @@ -1616,7 +1596,7 @@ public function paypal_pro_error_handler($request_name = '', $redirect_url = '', $error_email_notify_mes = apply_filters('ae_ppec_error_email_message', $message, $ErrorCode, $ErrorSeverityCode, $ErrorShortMsg, $ErrorLongMsg); $subject = "PayPal Pro Error Notification"; $error_email_notify_subject = apply_filters('ae_ppec_error_email_subject', $subject); - wp_mail($all_emails, $error_email_notify_subject, $error_email_notify_mes); + wp_mail($admin_email, $error_email_notify_subject, $error_email_notify_mes); } if ($this->error_display_type == 'detailed') { $sec_error_notice = $ErrorCode . ' - ' . $ErrorLongMsg; @@ -1685,7 +1665,6 @@ public function add_payment_method() { $token->set_user_id( $customer_id ); if( $token->validate() ) { $save_result = $token->save(); - $this->log('Environment: ' . $this->testmode); return array( 'result' => 'success', 'redirect' => wc_get_account_endpoint_url('payment-methods') @@ -1932,10 +1911,9 @@ public function process_subscription_payment($order) { 'softdescriptor' => '' ); $PayPalResult = $PayPal->DoReferenceTransaction($PayPalRequestData); - AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'DoReferenceTransaction', $gateway = 'PayPal Website Payments Pro (DoDirectPayment)', $this->error_email_notify, $this->recipient); + AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'DoReferenceTransaction', $gateway = 'PayPal Website Payments Pro (DoDirectPayment)', $this->error_email_notify); $PayPalRequest = isset($PayPalResult['RAWREQUEST']) ? $PayPalResult['RAWREQUEST'] : ''; $PayPalResponse = isset($PayPalResult['RAWRESPONSE']) ? $PayPalResult['RAWRESPONSE'] : ''; - $this->log('Environment: ' . $this->testmode); $this->log('Request: ' . print_r($PayPal->NVPToArray($PayPal->MaskAPIResult($PayPalRequest)), true)); $this->log('Response: ' . print_r($PayPal->NVPToArray($PayPal->MaskAPIResult($PayPalResponse)), true)); if (empty($PayPalResult['RAWRESPONSE'])) { diff --git a/classes/wc-gateway-paypal-pro-payflow-angelleye.php b/classes/wc-gateway-paypal-pro-payflow-angelleye.php index 0c33644a9..dfce15015 100644 --- a/classes/wc-gateway-paypal-pro-payflow-angelleye.php +++ b/classes/wc-gateway-paypal-pro-payflow-angelleye.php @@ -41,7 +41,6 @@ function __construct() { $this->invoice_id_prefix = $this->get_option('invoice_id_prefix', ''); $this->debug = 'yes' === $this->get_option('debug', 'no'); $this->error_email_notify = 'yes' === $this->get_option('error_email_notify', 'no'); - $this->recipient = $this->get_option('recipient', get_option( 'admin_email' )); $this->error_display_type = $this->get_option('error_display_type', 'no'); $this->send_items = 'yes' === $this->get_option('send_items', 'yes'); $this->payment_action = $this->get_option('payment_action', 'Sale'); @@ -182,16 +181,7 @@ function init_form_fields() { 'type' => 'checkbox', 'label' => __('Enable admin email notifications for errors.', 'paypal-for-woocommerce'), 'default' => 'yes', - 'description' => __('This will send a detailed error email to specified recipient(s) when PayPal API errors occur.', 'paypal-for-woocommerce'), - 'desc_tip' => true - ), - 'recipient' => array( - 'title' => __( 'Recipient(s)', 'woocommerce' ), - 'type' => 'text', - 'description' => sprintf( __( 'Enter recipients (comma separated) for this email. Defaults to %s.', 'woocommerce' ), '' . esc_attr( get_option( 'admin_email' ) ) . '' ), - 'placeholder' => '', - 'default' => get_option( 'admin_email' ), - 'desc_tip' => true, + 'description' => __('This will send a detailed error email to the WordPress site administrator if a PayPal API error occurs.', 'paypal-for-woocommerce') ), 'error_display_type' => array( 'title' => __('Error Display Type', 'paypal-for-woocommerce'), @@ -453,14 +443,6 @@ public function admin_options() { production.show(); } }).change(); - jQuery('#woocommerce_paypal_pro_payflow_error_email_notify').change(function () { - var paypal_pro_payflow_recipient = jQuery('#woocommerce_paypal_pro_payflow_recipient').closest('tr'); - if (jQuery(this).is(':checked')) { - paypal_pro_payflow_recipient.show(); - } else { - paypal_pro_payflow_recipient.hide(); - } - }).change(); billing_postcode : $order->get_billing_postcode(); $billing_country = version_compare(WC_VERSION, '3.0', '<') ? $order->billing_country : $order->get_billing_country(); $billing_state = version_compare(WC_VERSION, '3.0', '<') ? $order->billing_state : $order->get_billing_state(); - $billing_phone = version_compare( WC_VERSION, '3.0', '<' ) ? $order->billing_phone : $order->get_billing_phone(); - $billing_email = version_compare( WC_VERSION, '3.0', '<' ) ? $order->billing_email : $order->get_billing_email(); - + $billing_email = version_compare(WC_VERSION, '3.0', '<') ? $order->billing_email : $order->get_billing_email(); + if (!empty($_POST['paypal_pro_payflow-card-cardholder-first'])) { $firstname = wc_clean($_POST['paypal_pro_payflow-card-cardholder-first']); } else { @@ -603,7 +584,7 @@ function do_payment($order, $card_number, $card_exp, $card_csc) { 'orderid' => $this->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", $order->get_order_number()), // Checks for duplicate order. If you pass orderid in a request and pass it again in the future the response returns DUPLICATE=2 along with the orderid 'orderdesc' => 'Order ' . $order->get_order_number() . ' on ' . get_bloginfo('name'), // 'billtoemail' => $billing_email, // Account holder's email address. - 'billtophonenum' => $billing_phone, // Account holder's phone number. + 'billtophonenum' => '', // Account holder's phone number. 'billtofirstname' => $firstname, // Account holder's first name. 'billtomiddlename' => '', // Account holder's middle name. 'billtolastname' => $lastname, // Account holder's last name. @@ -696,7 +677,6 @@ function do_payment($order, $card_number, $card_exp, $card_csc) { $PayPalRequestData['origid'] = get_post_meta($order_id, '_payment_tokens', true); $log['origid'] = get_post_meta($order_id, '_payment_tokens', true); } - $this->add_log('Environment: ' . $this->testmode); $this->add_log('PayFlow Request: ' . print_r($log, true)); $PayPalResult = $PayPal->ProcessTransaction(apply_filters('angelleye_woocommerce_paypal_pro_payflow_process_transaction_request_args', $PayPalRequestData)); @@ -704,7 +684,7 @@ function do_payment($order, $card_number, $card_exp, $card_csc) { * cURL Error Handling #146 * @since 1.1.8 */ - AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'do_payment', $gateway = 'PayPal Payments Pro 2.0 (PayFlow)', $this->error_email_notify, $this->recipient); + AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'do_payment', $gateway = 'PayPal Payments Pro 2.0 (PayFlow)', $this->error_email_notify); $this->add_log('PayFlow Endpoint: ' . $PayPal->APIEndPoint); @@ -1028,7 +1008,6 @@ public function process_refund($order_id, $amount = null, $reason = '') { do_action('angelleye_before_fc_refund', $order_id, $amount, $reason); $order = wc_get_order($order_id); - $this->add_log('Environment: ' . $this->testmode); $this->add_log('Begin Refund'); $this->add_log('Order ID: ' . print_r($order_id, true)); $this->add_log('Transaction ID: ' . print_r($order->get_transaction_id(), true)); @@ -1078,7 +1057,7 @@ public function process_refund($order_id, $amount = null, $reason = '') { * cURL Error Handling #146 * @since 1.1.8 */ - AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'Refund Request', $gateway = 'PayPal Payments Pro 2.0 (PayFlow)', $this->error_email_notify, $this->recipient); + AngellEYE_Gateway_Paypal::angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = 'Refund Request', $gateway = 'PayPal Payments Pro 2.0 (PayFlow)', $this->error_email_notify); add_action('angelleye_after_refund', $PayPalResult, $order, $amount, $reason); if (isset($PayPalResult['RESULT']) && ($PayPalResult['RESULT'] == 0 || in_array($PayPalResult['RESULT'], $this->fraud_error_codes))) { @@ -1248,8 +1227,7 @@ public function add_payment_method() { $billtostate = (get_user_meta($customer_id, 'billing_state', true)) ? get_user_meta($customer_id, 'billing_state', true) : get_user_meta($customer_id, 'shipping_state', true); $billtocountry = (get_user_meta($customer_id, 'billing_country', true)) ? get_user_meta($customer_id, 'billing_country', true) : get_user_meta($customer_id, 'shipping_country', true); $billtozip = (get_user_meta($customer_id, 'billing_postcode', true)) ? get_user_meta($customer_id, 'billing_postcode', true) : get_user_meta($customer_id, 'shipping_postcode', true); - $billing_phone = (get_user_meta($customer_id, 'billing_phone', true)) ? get_user_meta($customer_id, 'billing_phone', true) : ''; - + $PayPalRequestData = array( 'tender' => 'C', 'trxtype' => 'A', @@ -1261,7 +1239,7 @@ public function add_payment_method() { 'orderid' => '', 'orderdesc' => '', 'billtoemail' => '', - 'billtophonenum' => $billing_phone, + 'billtophonenum' => '', 'billtofirstname' => $billtofirstname, 'billtomiddlename' => '', 'billtolastname' => $billtolastname, @@ -1282,7 +1260,6 @@ public function add_payment_method() { 'partialauth' => '', 'authcode' => '' ); - $this->add_log('Environment: ' . $this->testmode); $PayPalResult = $PayPal->ProcessTransaction(apply_filters('angelleye_woocommerce_paypal_express_set_express_checkout_request_args', $PayPalRequestData)); if (isset($PayPalResult['RESULT']) && ($PayPalResult['RESULT'] == 0 || in_array($PayPalResult['RESULT'], $this->fraud_error_codes))) { if (in_array($PayPalResult['RESULT'], $this->fraud_error_codes)) { @@ -1365,8 +1342,6 @@ public function process_subscription_payment($order, $amount, $payment_token = n $billing_email = version_compare(WC_VERSION, '3.0', '<') ? $billing_email : $order->get_billing_email(); $customer_note_value = version_compare(WC_VERSION, '3.0', '<') ? wptexturize($order->customer_note) : wptexturize($order->get_customer_note()); $customer_note = $customer_note_value ? substr(preg_replace("/[^A-Za-z0-9 ]/", "", $customer_note_value), 0, 256) : ''; - $billing_phone = version_compare( WC_VERSION, '3.0', '<' ) ? $order->billing_phone : $order->get_billing_phone(); - $PayPalRequestData = array( 'tender' => 'C', // Required. The method of payment. Values are: A = ACH, C = Credit Card, D = Pinless Debit, K = Telecheck, P = PayPal 'trxtype' => ($this->payment_action == 'Authorization' || $order->get_total() == 0 ) ? 'A' : 'S', // Required. Indicates the type of transaction to perform. Values are: A = Authorization, B = Balance Inquiry, C = Credit, D = Delayed Capture, F = Voice Authorization, I = Inquiry, L = Data Upload, N = Duplicate Transaction, S = Sale, V = Void @@ -1379,7 +1354,7 @@ public function process_subscription_payment($order, $amount, $payment_token = n 'orderid' => $this->invoice_id_prefix . preg_replace("/[^a-zA-Z0-9]/", "", $order->get_order_number()), // Checks for duplicate order. If you pass orderid in a request and pass it again in the future the response returns DUPLICATE=2 along with the orderid 'orderdesc' => 'Order ' . $order->get_order_number() . ' on ' . get_bloginfo('name'), // 'billtoemail' => $billing_email, // Account holder's email address. - 'billtophonenum' => $billing_phone, // Account holder's phone number. + 'billtophonenum' => '', // Account holder's phone number. 'billtostreet' => $billing_address_1 . ' ' . $billing_address_2, // The cardholder's street address (number and street name). 150 char max 'billtocity' => $billing_city, // Bill to city. 45 char max 'billtostate' => $billing_state, // Bill to state. @@ -1451,7 +1426,7 @@ public function process_subscription_payment($order, $amount, $payment_token = n $PayPalRequestData['origid'] = $payment_token; } $PayPalResult = $PayPal->ProcessTransaction($PayPalRequestData); - $this->add_log('Environment: ' . $this->testmode); + $this->add_log('PayFlow Endpoint: ' . $PayPal->APIEndPoint); $this->add_log('PayFlow Response: ' . print_r($PayPalResult, true)); @@ -1581,8 +1556,6 @@ public function are_reference_transactions_enabled($token_id) { $billtostate = (get_user_meta($customer_id, 'billing_state', true)) ? get_user_meta($customer_id, 'billing_state', true) : get_user_meta($customer_id, 'shipping_state', true); $billtocountry = (get_user_meta($customer_id, 'billing_country', true)) ? get_user_meta($customer_id, 'billing_country', true) : get_user_meta($customer_id, 'shipping_country', true); $billtozip = (get_user_meta($customer_id, 'billing_postcode', true)) ? get_user_meta($customer_id, 'billing_postcode', true) : get_user_meta($customer_id, 'shipping_postcode', true); - $billing_phone = (get_user_meta($customer_id, 'billing_phone', true)) ? get_user_meta($customer_id, 'billing_phone', true) : ''; - $PayPalRequestData = array( 'tender' => 'C', 'trxtype' => 'A', @@ -1594,7 +1567,7 @@ public function are_reference_transactions_enabled($token_id) { 'orderid' => '', 'orderdesc' => '', 'billtoemail' => '', - 'billtophonenum' => $billing_phone, + 'billtophonenum' => '', 'billtofirstname' => $billtofirstname, 'billtomiddlename' => '', 'billtolastname' => $billtolastname, @@ -1615,7 +1588,6 @@ public function are_reference_transactions_enabled($token_id) { 'partialauth' => '', 'authcode' => '' ); - $this->add_log('Environment: ' . $this->testmode); $PayPalResult = $PayPal->ProcessTransaction($PayPalRequestData); if (isset($PayPalResult['RESULT']) && ($PayPalResult['RESULT'] == 117)) { $admin_email = get_option("admin_email"); diff --git a/paypal-for-woocommerce.php b/paypal-for-woocommerce.php index d2c16fac0..a5b0913f4 100644 --- a/paypal-for-woocommerce.php +++ b/paypal-for-woocommerce.php @@ -92,9 +92,8 @@ public function __construct() add_action( 'plugins_loaded', array($this, 'init')); register_activation_hook( __FILE__, array($this, 'activate_paypal_for_woocommerce' )); register_deactivation_hook( __FILE__,array($this,'deactivate_paypal_for_woocommerce' )); - if(is_admin()) { - add_action( 'admin_notices', array($this, 'admin_notices') ); - } + + add_action( 'admin_notices', array($this, 'admin_notices') ); add_action( 'admin_init', array($this, 'set_ignore_tag')); add_filter( 'woocommerce_product_title' , array($this, 'woocommerce_product_title') ); add_action( 'woocommerce_sections_checkout', array( $this, 'donate_message' ), 11 ); @@ -213,9 +212,6 @@ function set_ignore_tag(){ function admin_notices() { global $current_user, $pp_settings ; $user_id = $current_user->ID; - if ( !current_user_can( 'manage_woocommerce' ) ) { - return false; - } $pp_pro = get_option('woocommerce_paypal_pro_settings'); $pp_payflow = get_option('woocommerce_paypal_pro_payflow_settings'); $pp_standard = get_option('woocommerce_paypal_settings'); @@ -231,10 +227,6 @@ function admin_notices() { $pp_standard['enabled'] = !empty($pp_standard['enabled']) ? $pp_standard['enabled'] : ''; $pp_settings['paypal_marketing_solutions_cid_production'] = !empty($pp_settings['paypal_marketing_solutions_cid_production']) ? $pp_settings['paypal_marketing_solutions_cid_production'] : ''; - if (version_compare(phpversion(), '5.4', '<')) { - echo ''; - } - if ((!empty($pp_pro['enabled']) && $pp_pro['enabled'] == 'yes') || ( !empty($pp_payflow['enabled']) && $pp_payflow['enabled']=='yes' )) { // Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected if ( get_option('woocommerce_force_ssl_checkout')=='no' && ! class_exists( 'WordPressHTTPS' ) && !get_user_meta($user_id, 'ignore_pp_ssl') ) @@ -546,17 +538,15 @@ function angelleye_woocommerce_process_product_meta_own( $post_id ){ update_post_meta( $post_id, '_enable_ec_button', $_enable_ec_button ); } - public static function angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = null, $gateway = null, $error_email_notify = true, $recipient) { + public static function angelleye_paypal_for_woocommerce_curl_error_handler($PayPalResult, $methos_name = null, $gateway = null, $error_email_notify = true) { if( isset( $PayPalResult['CURL_ERROR'] ) ){ try { if($error_email_notify == true) { - $recipients = array_map( 'trim', explode( ',', $recipient ) ); - $recipients = array_filter( $recipients, 'is_email' ); - $all_emails = implode( ', ', $recipients ); + $admin_email = get_option("admin_email"); $message = __( $methos_name . " call failed." , "paypal-for-woocommerce" )."\n\n"; $message .= __( 'Error Code: 0' ,'paypal-for-woocommerce' ) . "\n"; $message .= __( 'Detailed Error Message: ' , 'paypal-for-woocommerce') . $PayPalResult['CURL_ERROR']; - wp_mail($all_emails, $gateway . " Error Notification",$message); + wp_mail($admin_email, $gateway . " Error Notification",$message); } $display_error = 'There was a problem connecting to the payment gateway.'; wc_add_notice($display_error, 'error'); diff --git a/readme.txt b/readme.txt index 12c9b53dd..bb6250f78 100644 --- a/readme.txt +++ b/readme.txt @@ -125,23 +125,8 @@ Automatic updates should work great for you. As always, though, we recommend ba * If you have a PayPal Manager account at http://manager.paypal.com as well as your regular PayPal account at http://www.paypal.com, then you are on Payments Pro 2.0. * If you are unsure, you may need to [contact PayPal](https://www.paypal.com/us/webapps/helpcenter/helphub/home/) and request the information. Just let them know you need to enable a Payments Pro plugin on your website, but you're unsure whether you should use Website Payments Pro 3.0(DoDirectPayment) or Payments Pro 2.0 (PayFlow). They can confirm which one you need to use. -= Does PayPal for WooCommerce support latest PHP version? -* Yes PayPal for WooCommerce supports PHP 5.6+, PHP 7.0+ - == Changelog == -= 1.4.10 - xx.xx.2018 = -* Feature - Adds PayPal Payment Type and Transaction Fee to order meta data for Express Checkout orders. ([PFW-74](https://github.com/angelleye/paypal-woocommerce/pull/1146)) -* Feature - Adds ability to specify one or more email addresses to use for PayPal API error notifications. ([PFW-19](https://github.com/angelleye/paypal-woocommerce/pull/1138)) -* Tweak - Hides admin notices from non-admin user roles. ([PFW-7](https://github.com/angelleye/paypal-woocommerce/pull/1136)) -* Tweak - Adds billing phone number to PayFlow requests. ([PFW-2](https://github.com/angelleye/paypal-woocommerce/pull/1145/)) -* Tweak - Adds an admin notice to inform users when the PHP version on the server does not support plugin functionality. ([PFW-40](https://github.com/angelleye/paypal-woocommerce/pull/1135)) -* Tweak - Adds environment label (sandbox or production) to API logs. ([PFW-48](https://github.com/angelleye/paypal-woocommerce/pull/1140)) -* Tweak - Adds email address to Express Checkout requests when available. ([PFW-55](https://github.com/angelleye/paypal-woocommerce/pull/1133)) -* Fix - Resolves issues with some account creation options during checkout with Express Checkout. ([PFW-21](https://github.com/angelleye/paypal-woocommerce/pull/1137)) -* Fix - Resolves an issue where the shipping address was sometimes not updated in the WooCommerce order. ([PFW-57](https://github.com/angelleye/paypal-woocommerce/pull/1139)) -* Fix - Resolves a problem in some mobile browsers where the last name field was getting hidden during checkout. ([PFW-126](https://github.com/angelleye/paypal-woocommerce/pull/1141)) - = 1.4.9 - 05.23.2018 = * Compatibility - Check for compatibility with WooCommerce 3.4. ([#1126](https://github.com/angelleye/paypal-woocommerce/issues/1126)) * Feature - Upgrades Braintree SDK from v2 to v3. ([#1101](https://github.com/angelleye/paypal-woocommerce/issues/1101)) ([#1122](https://github.com/angelleye/paypal-woocommerce/issues/1122))