Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PFW-266 #1228

Merged
merged 27 commits into from Oct 30, 2018
Merged

PFW-266 #1228

Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
58c8444
Merge branch 'release' into dev
angelleye Oct 8, 2018
3321ca6
Merge branch 'release' into dev
angelleye Oct 8, 2018
be4f655
Merge branch 'release' into dev
angelleye Oct 8, 2018
868581b
Merge branch 'PFW-253' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 22, 2018
0857cf7
Merge branch 'PFW-280' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 22, 2018
dbb910a
Merge branch 'PFW-281' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 22, 2018
4cf684a
Merge branch 'PFW-276' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 23, 2018
84df58c
Option for Card Verification Instead of Full Authorization, PFW-272
kcppdevelopers Oct 23, 2018
e67611a
Merge branch 'release' into dev
angelleye Oct 24, 2018
86377f2
Merge branch 'release' into dev
angelleye Oct 24, 2018
e790e0a
Merge branch 'release' into dev
angelleye Oct 24, 2018
f821cf6
Product Level Authorization Option, PFW-273
kcppdevelopers Oct 25, 2018
56f29ac
Product Level Authorization Option, PFW-273
kcppdevelopers Oct 25, 2018
39e4e9b
Merge branch 'release' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 25, 2018
7fc1e5d
Merge branch 'PFW-272' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 25, 2018
42804c7
Product Level Authorization Option, PFW-273
kcppdevelopers Oct 25, 2018
5d5926c
Product Level Authorization Option, PFW-273
kcppdevelopers Oct 25, 2018
c6bcf13
Merge branch 'PFW-272' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 25, 2018
476df70
Merge branch 'PFW-273' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 25, 2018
fe0434e
Merge branch 'PFW-283' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 25, 2018
af176b3
Merge branch 'PFW-284' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 25, 2018
d1fede4
Merge branch 'release' into dev
angelleye Oct 25, 2018
047314a
Merge branch 'release' into dev
angelleye Oct 25, 2018
5fca2b7
Merge branch 'PFW-285' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 26, 2018
9f8bb7a
Mobile checkout issue no last name box, PFW-268
kcppdevelopers Oct 29, 2018
e0441f4
Merge branch 'PFW-268' of https://github.com/angelleye/paypal-woocomm…
kcppdevelopers Oct 29, 2018
2da6b58
Smart button: display issue, PFW-266
kcppdevelopers Oct 30, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -419,4 +419,12 @@ jQuery(document).ready(function ($) {

};
}

jQuery('#woo_product_payment_action').change(function () {
if ( this.value === 'Authorization' ) {
jQuery('#woo_product_payment_action_authorization').closest('p').show();
} else {
jQuery('#woo_product_payment_action_authorization').closest('p').hide();
}
}).change();
});
@@ -130,7 +130,10 @@ public function __construct()
add_filter( "pre_option_woocommerce_enable_guest_checkout", array($this, 'angelleye_express_checkout_woocommerce_enable_guest_checkout'), 10, 1);
add_filter( 'woocommerce_get_checkout_order_received_url', array($this, 'angelleye_woocommerce_get_checkout_order_received_url'), 10, 2);
add_action('wp_ajax_wp_paypal_paypal_marketing_solutions_express_checkout_save', array($this, 'wp_paypal_paypal_marketing_solutions_express_checkout_save'));
add_action('woocommerce_product_data_tabs', array( $this, 'angelleye_paypal_for_woo_woocommerce_product_data_tabs' ), 99, 1);
add_action('woocommerce_product_data_panels', array( $this, 'angelleye_paypal_for_woo_product_date_panels' ));
add_action('woocommerce_process_product_meta', array( $this, 'angelleye_paypal_for_woo_product_process_product_meta' ));
add_action('angelleye_paypal_for_woocommerce_multi_account_api_paypal_payflow', array( $this, 'angelleye_paypal_for_woo_product_level_payment_action' ), 10, 3);
add_action( 'wp_head', array( $this, 'paypal_for_woo_head_mark' ), 1 );
$this->customer_id;
}
@@ -1030,7 +1033,99 @@ public function angelleye_dismiss_notice() {
}
}
}
public function angelleye_paypal_for_woo_woocommerce_product_data_tabs($product_data_tabs) {
$product_data_tabs['angelleye_paypal_for_woo_payment_action'] = array(
'label' => __( 'Payment Action', 'paypal-for-woocommerce' ),
'target' => 'angelleye_paypal_for_woo_payment_action',
);
return $product_data_tabs;
}
public function angelleye_paypal_for_woo_product_date_panels() {
global $woocommerce, $post;
?>
<div id="angelleye_paypal_for_woo_payment_action" class="panel woocommerce_options_panel">
<?php
woocommerce_wp_select(
array(
'id' => 'woo_product_payment_action',
'label' => __( 'Payment Action', 'woocommerce' ),
'options' => array(
'' => 'Select Payment Action',
'Sale' => 'Sale',
'Authorization' => 'Authorization',
),
'desc_tip' => 'true',
'description' => __('Sale will capture the funds immediately when the order is placed. Authorization will authorize the payment but will not capture the funds. You would need to capture funds through your PayPal account when you are ready to deliver.'),
)
);
woocommerce_wp_select(
array(
'id' => 'woo_product_payment_action_authorization',
'label' => __( 'Authorization Type', 'woocommerce' ),
'options' => array(
'Full Authorization' => 'Full Authorization',
'Card Verification' => 'Card Verification',
),
'desc_tip' => 'true',
'description' => __(''),
)
);
?>
</div>
<?php
}
public function angelleye_paypal_for_woo_product_process_product_meta($post_id) {
$woo_product_payment_action = !empty( $_POST['woo_product_payment_action'] ) ? wc_clean($_POST['woo_product_payment_action']) : '';
update_post_meta( $post_id, 'woo_product_payment_action', $woo_product_payment_action );
if( !empty($woo_product_payment_action) && 'Authorization' == $woo_product_payment_action) {
$woo_product_payment_action_authorization = !empty( $_POST['woo_product_payment_action_authorization'] ) ? wc_clean($_POST['woo_product_payment_action_authorization']) : '';
update_post_meta( $post_id, 'woo_product_payment_action_authorization', $woo_product_payment_action_authorization );
} else {
update_post_meta( $post_id, 'woo_product_payment_action_authorization', '' );
}
}
public function angelleye_paypal_for_woo_product_level_payment_action($gateways, $request = null, $order_id = null) {
if( is_null( WC()->cart ) ) {
return true;
}
if ($request == null) {
$gateway_setting = $gateways;
} else {
$gateway_setting = $request;
}
$payment_action = array();
if ( WC()->cart->is_empty() ) {
return true;
} else {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
$woo_product_payment_action = get_post_meta( $product_id, 'woo_product_payment_action', true );
if( !empty($woo_product_payment_action)) {
$payment_action[$woo_product_payment_action] = $woo_product_payment_action;
$woo_product_payment_action_authorization = get_post_meta( $product_id, 'woo_product_payment_action_authorization', true );
if( !empty($woo_product_payment_action_authorization) ) {
$payment_action[$woo_product_payment_action] = $woo_product_payment_action_authorization;
}
}
}
if( !empty($payment_action) ) {
if( isset($payment_action['Authorization']) && !empty($payment_action['Authorization'])) {
$gateway_setting->payment_action = 'Authorization';
if($payment_action['Authorization'] == 'Full Authorization') {
$gateway_setting->payment_action_authorization = 'Full Authorization';
} elseif($payment_action['Authorization'] == 'Card Verification') {
$gateway_setting->payment_action_authorization = 'Card Verification';
}
} elseif(isset($payment_action['Sale']) && !empty($payment_action['Sale'])) {
$gateway_setting->payment_action = 'Sale';
}
}
}
}
}
}
new AngellEYE_Gateway_Paypal();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.