Skip to content
Permalink
Browse files

Merge pull request #1233 from angelleye/PFW-106

PFW-106
  • Loading branch information...
angelleye committed Nov 3, 2018
2 parents 1c94495 + bf65b29 commit 2d1820e07ab0950f22701649713273fbd0038f80
Showing with 67 additions and 0 deletions.
  1. +67 −0 classes/wc-gateway-braintree-angelleye.php
@@ -62,6 +62,15 @@ function __construct() {
$this->softdescriptor = $this->get_softdescriptor();
$this->fraud_tool = $this->get_option('fraud_tool', 'basic');
$this->payment_action = $this->get_option('payment_action', 'Sale');
$this->enable_google_pay = $this->get_option('enable_google_pay', 'no');
$this->enable_apple_pay = $this->get_option('enable_apple_pay', 'no');
if($this->enable_google_pay == 'yes') {
$this->merchant_id_google_pay = $this->get_option('merchant_id_google_pay', '');
if(empty($this->merchant_id_google_pay) && $this->environment == 'production') {
$this->enable_google_pay = 'no';
}
}
add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
add_filter('woocommerce_settings_api_sanitized_fields_' . $this->id, array($this, 'angelleye_braintree_encrypt_gateway_api'), 10, 1);
$this->response = '';
@@ -104,6 +113,7 @@ public function admin_options() {
jQuery('#woocommerce_braintree_sandbox').change(function () {
sandbox = jQuery('#woocommerce_braintree_sandbox_public_key, #woocommerce_braintree_sandbox_private_key, #woocommerce_braintree_sandbox_merchant_id').closest('tr'),
production = jQuery('#woocommerce_braintree_public_key, #woocommerce_braintree_private_key, #woocommerce_braintree_merchant_id').closest('tr');
if (jQuery(this).is(':checked')) {
sandbox.show();
production.hide();
@@ -112,6 +122,13 @@ public function admin_options() {
production.show();
}
}).change();
jQuery('#woocommerce_braintree_enable_google_pay').change(function () {
if (jQuery('#woocommerce_braintree_enable_google_pay').is(':checked')) {
jQuery('#woocommerce_braintree_merchant_id_google_pay').closest('tr').show();
} else {
jQuery('#woocommerce_braintree_merchant_id_google_pay').closest('tr').hide();
}
}).change();
jQuery('.js-add-merchant-account-id').click(function (e) {
e.preventDefault();
var row_fragment = '<?php echo $this->generate_merchant_account_id_html(); ?>',
@@ -318,6 +335,27 @@ public function init_form_fields() {
'default' => '',
'desc_tip' => true,
),
'enable_apple_pay' => array(
'title' => __('Enable Apple Pay', 'paypal-for-woocommerce'),
'type' => 'checkbox',
'label' => __('Enable Apple Pay', 'paypal-for-woocommerce'),
'default' => 'no',
'description' => ''
),
'enable_google_pay' => array(
'title' => __('Enable Google Pay', 'paypal-for-woocommerce'),
'type' => 'checkbox',
'label' => __('Enable Google Pay', 'paypal-for-woocommerce'),
'default' => 'no',
'description' => ''
),
'merchant_id_google_pay' => array(
'title' => __('Google Pay Merchant ID', 'paypal-for-woocommerce'),
'type' => 'text',
'description' => __('Enter your Google Pay Merchant ID provided by Google.( optional for sandbox mode )', 'paypal-for-woocommerce'),
'default' => '',
'desc_tip' => true
),
'card_icon' => array(
'title' => __('Card Icon', 'paypal-for-woocommerce'),
'type' => 'text',
@@ -512,6 +550,35 @@ function is_angelleye_braintree_selected() {
locale: '<?php echo AngellEYE_Utility::get_button_locale_code(); ?>',
paypal: {
flow: 'vault'
},
<?php if($this->enable_google_pay == 'yes') { ?>
googlePay: {
<?php if($this->environment == 'production') { ?>
merchantId: '<?php echo $this->merchant_id_google_pay; ?>'
<?php } ?>
transactionInfo: {
totalPriceStatus: 'FINAL',
totalPrice: '<?php echo $this->get_order_total(); ?>',
currencyCode: '<?php echo get_woocommerce_currency(); ?>'
},
cardRequirements: {
billingAddressRequired: true,
allowedCardNetworks: ["AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA"]
}
},
<?php } if($this->enable_apple_pay == 'yes') { ?>
applePay: {
displayName: '<?php echo get_bloginfo('name'); ?>',
paymentRequest: {
total: {
label: '<?php echo __('My Store', 'paypal-for-woocommerce'); ?>',
amount: '<?php echo $this->get_order_total(); ?>'
}
}
},
<?php } ?>
venmo: {
allowNewBrowserTab: false
}
<?php if($this->fraud_tool != 'basic') { ?>
, dataCollector: {

0 comments on commit 2d1820e

Please sign in to comment.
You can’t perform that action at this time.