Skip to content

Commit 0e9aaac

Browse files
author
MemberPress
committed
Updates to 1.9.48
1 parent 6a37900 commit 0e9aaac

File tree

16 files changed

+171
-73
lines changed

16 files changed

+171
-73
lines changed

app/gateways/MeprArtificialGateway.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ public function display_payment_form($amount, $user, $product_id, $txn_id) {
387387

388388
$invoice = MeprTransactionsHelper::get_invoice($txn);
389389
echo $invoice;
390+
echo MeprOptionsHelper::payment_method_description( $this );
390391

391392
?>
392393
<div class="mp_wrapper mp_payment_form_wrapper">

app/gateways/MeprPayPalCommerceGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ protected function set_defaults() {
130130
$this->debug = defined( 'WP_MEPR_DEBUG' ) && WP_MEPR_DEBUG === true;
131131

132132
if ( $this->is_test_mode() ) {
133-
$this->settings->url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
133+
$this->settings->url = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';
134134
$this->settings->api_url = 'https://api-3t.sandbox.paypal.com/nvp';
135135
$this->settings->rest_api_url = 'https://api-m.sandbox.paypal.com';
136136
} else {
137-
$this->settings->url = 'https://www.paypal.com/cgi-bin/webscr';
137+
$this->settings->url = 'https://ipnpb.paypal.com/cgi-bin/webscr';
138138
$this->settings->api_url = 'https://api-3t.paypal.com/nvp';
139139
$this->settings->rest_api_url = 'https://api-m.paypal.com';
140140
}

app/gateways/MeprPayPalGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ protected function set_defaults() {
7171
$this->use_desc = $this->settings->use_desc;
7272

7373
if($this->is_test_mode()) {
74-
$this->settings->url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
74+
$this->settings->url = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';
7575
$this->settings->api_url = 'https://api-3t.sandbox.paypal.com/nvp';
7676
}
7777
else {
78-
$this->settings->url = 'https://www.paypal.com/cgi-bin/webscr';
78+
$this->settings->url = 'https://ipnpb.paypal.com/cgi-bin/webscr';
7979
$this->settings->api_url = 'https://api-3t.paypal.com/nvp';
8080
}
8181

app/gateways/MeprPayPalProGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ protected function set_defaults() {
7272
$this->use_desc = $this->settings->use_desc;
7373

7474
if($this->is_test_mode()) {
75-
$this->settings->url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
75+
$this->settings->url = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';
7676
$this->settings->api_url = 'https://api-3t.sandbox.paypal.com/nvp';
7777
}
7878
else {
79-
$this->settings->url = 'https://www.paypal.com/cgi-bin/webscr';
79+
$this->settings->url = 'https://ipnpb.paypal.com/cgi-bin/webscr';
8080
$this->settings->api_url = 'https://api-3t.paypal.com/nvp';
8181
}
8282

app/gateways/MeprStripeGateway.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,13 +1628,18 @@ public function enqueue_payment_form_scripts() {
16281628
return;
16291629
}
16301630

1631+
$mepr_options = MeprOptions::fetch();
1632+
16311633
wp_enqueue_script('stripe-js', 'https://js.stripe.com/v3/', array(), MEPR_VERSION);
16321634
wp_enqueue_script('mepr-stripe-form', MEPR_GATEWAYS_URL . '/stripe/form.js', array('stripe-js', 'mepr-checkout-js', 'jquery.payment'), MEPR_VERSION);
16331635

16341636
$l10n = [
16351637
'api_version' => self::STRIPE_API_VERSION,
16361638
'taxes_enabled' => (bool) get_option('mepr_calculate_taxes'),
16371639
'payment_information_incomplete' => __('Please complete payment information', 'memberpress'),
1640+
'placeholder_text_email_address' => __('Please enter your email and address to view the payment form.', 'memberpress'),
1641+
'placeholder_text_email' => __('Please enter your email to view the payment form.', 'memberpress'),
1642+
'address_fields_required' => ($mepr_options->show_address_fields && $mepr_options->require_address_fields),
16381643
'elements_appearance' => $this->get_elements_appearance(),
16391644
'ajax_url' => admin_url('admin-ajax.php'),
16401645
'ajax_error' => __('An error occurred, please DO NOT submit the form again as you may be double charged. Please contact us for further assistance instead.', 'memberpress'),

app/gateways/stripe/form.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
);
2626
this.$selectFields = this.$form.find('select[data-fieldname="mepr-address-state"], select[name="mepr-address-country"]');
2727
this.initPaymentMethods();
28+
this.maybeShowPlaceholder();
2829
this.$form.on('submit', $.proxy(this.handleSubmit, this));
2930
this.$form.find('input[name="mepr_payment_method"]').on('change', $.proxy(this.maybeCreatePaymentElement, this));
3031
this.$textFields.add(this.$form.find('input[name="mepr_coupon_code"]')).on('blur', $.proxy(this.maybeCreatePaymentElement, this));
@@ -154,6 +155,7 @@
154155

155156
paymentMethod.createPaymentElementTimeout = setTimeout(function () {
156157
self.createPaymentElement(paymentMethod);
158+
self.maybeShowPlaceholder('hide');
157159
}, 50);
158160
}
159161
};
@@ -833,4 +835,31 @@
833835
}
834836
});
835837
};
838+
839+
/**
840+
* Adds a placeholder for Stripe Elements on SPC forms.
841+
*
842+
* @param {string} status
843+
*/
844+
MeprStripeForm.prototype.maybeShowPlaceholder = function(status = 'show') {
845+
if (!this.isSpc) {
846+
return;
847+
}
848+
849+
var $placeholderDiv = $('.mepr-stripe-form-placeholder');
850+
851+
if(status == 'hide') {
852+
$placeholderDiv.hide();
853+
$placeholderDiv.html('');
854+
} else {
855+
if(MeprStripeGateway.address_fields_required) {
856+
var $placeholder = $('<p></p>').text(MeprStripeGateway.placeholder_text_email_address);
857+
} else {
858+
var $placeholder = $('<p></p>').text(MeprStripeGateway.placeholder_text_email);
859+
}
860+
861+
$placeholderDiv.show();
862+
$placeholderDiv.html($placeholder);
863+
}
864+
}
836865
})(jQuery);

app/helpers/MeprOptionsHelper.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,34 @@ private static function payment_method_label($payment_method, $first) {
296296
return MeprHooks::apply_filters('mepr_signup_form_payment_label', $label, $payment_method, $first);
297297
}
298298

299+
/**
300+
* Payment method description
301+
* @param MeprBaseRealGateway $payment_method
302+
* @return string Payment method description HTML
303+
*/
304+
public static function payment_method_description($payment_method) {
305+
$mepr_options = MeprOptions::fetch();
306+
$field_name = 'mepr_payment_method';
307+
$desc_html = '';
308+
309+
$desc = wpautop(esc_html(trim(stripslashes($payment_method->desc))));
310+
311+
ob_start();
312+
?>
313+
<div class="mepr-payment-method <?php echo "{$field_name}-{$payment_method->id}"; ?> mepr-payment-method-<?php echo $payment_method->key; ?>">
314+
<div class="mepr-payment-method-desc-text mp-pm-desc-<?php echo $payment_method->id; ?>">
315+
<?php echo wp_unslash($desc); ?>
316+
</div>
317+
</div>
318+
<?php
319+
$desc = ob_get_clean();
320+
321+
$desc_html .= $desc;
322+
323+
return $desc_html;
324+
}
325+
326+
299327
public static function payment_methods_dropdown($field_name, $pms = false) {
300328
$mepr_options = MeprOptions::fetch();
301329
$pms = $pms ? $pms : array_keys($mepr_options->integrations);

app/lib/MeprSubscriptionsTable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ public function __construct($screen, $columns, $lifetime=false) {
5959
'subscription' => 'sub.subscr_id',
6060
'username' => 'u.user_login',
6161
'email' => 'u.user_email',
62-
'id' => 'u.ID',
62+
'id' => 'sub.ID',
6363
);
6464

6565
$this->non_recurring_db_search_cols = array(
6666
'subscription' => 'txn.trans_num',
6767
'username' => 'u.user_login',
6868
'email' => 'u.user_email',
69-
'id' => 'u.ID',
69+
'id' => 'sub.ID',
7070
);
7171

7272
parent::__construct(

app/models/MeprRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ public static function is_locked_for_user($user, $context)
664664
if($user->has_access_from_rule($rule->ID)) {
665665
if($rule->has_dripped($user->ID)) {
666666
if(!$rule->has_expired($user->ID)) {
667-
return false;
667+
return MeprHooks::apply_filters('mepr-content-locked-for-user', false, $rule, $context, $rules);
668668
}
669669
}
670670
}

app/views/admin/options/form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@
443443
<h3><?php _e('Payment Methods', 'memberpress'); ?></h3>
444444
<div id="integrations-list">
445445
<?php
446-
$objs = $mepr_options->payment_methods();
446+
$objs = $mepr_options->payment_methods( true, true );
447447
$no_method = true;
448448
foreach( $objs as $pm_id => $obj ) {
449449
if( $obj instanceof MeprBaseRealGateway ) {

0 commit comments

Comments
 (0)