updated plugin Easy Digital Downloads version 3.1.1.3

This commit is contained in:
2023-03-29 18:20:17 +00:00
committed by Gitium
parent 2573ae37c7
commit e42ba0e05a
20 changed files with 234 additions and 155 deletions

View File

@ -3,7 +3,7 @@
* Plugin Name: Easy Digital Downloads - Stripe Pro Payment Gateway
* Plugin URI: https://easydigitaldownloads.com/downloads/stripe-gateway/
* Description: Adds a payment gateway for Stripe.com
* Version: 2.9.2
* Version: 2.9.2.1
* Requires at least: 5.4
* Requires PHP: 7.1
* Author: Easy Digital Downloads
@ -44,7 +44,7 @@ function edd_stripe_core_bootstrap() {
}
if ( ! defined( 'EDD_STRIPE_VERSION' ) ) {
define( 'EDD_STRIPE_VERSION', '2.9.2' );
define( 'EDD_STRIPE_VERSION', '2.9.2.1' );
}
if ( ! defined( 'EDD_STRIPE_API_VERSION' ) ) {

View File

@ -112,12 +112,16 @@ function edds_add_settings( $settings ) {
'type' => 'text',
),
'stripe_restrict_assets' => array(
'id' => 'stripe_restrict_assets',
'name' => ( __( 'Restrict Stripe Assets', 'easy-digital-downloads' ) ),
'desc' => ( __( 'Only load Stripe.com hosted assets on pages that specifically utilize Stripe functionality.', 'easy-digital-downloads' ) ),
'type' => 'checkbox',
'tooltip_title' => __( 'Loading Javascript from Stripe', 'easy-digital-downloads' ),
'tooltip_desc' => __( 'Stripe advises that their Javascript library be loaded on every page to take advantage of their advanced fraud detection rules. If you are not concerned with this, enable this setting to only load the Javascript when necessary. Read more about Stripe\'s recommended setup here: https://stripe.com/docs/web/setup.', 'easy-digital-downloads' ),
'id' => 'stripe_restrict_assets',
'name' => ( __( 'Restrict Stripe Assets', 'easy-digital-downloads' ) ),
'check' => ( __( 'Only load Stripe.com hosted assets on pages that specifically utilize Stripe functionality.', 'easy-digital-downloads' ) ),
'type' => 'checkbox_description',
'desc' => sprintf(
/* translators: 1. opening link tag; 2. closing link tag */
__( 'Stripe advises that their Javascript library be loaded on every page to take advantage of their advanced fraud detection rules. If you are not concerned with this, enable this setting to only load the Javascript when necessary. %1$sLearn more about Stripe\'s recommended setup.%2$s', 'easy-digital-downloads' ),
'<a href="https://stripe.com/docs/web/setup" target="_blank" rel="noopener noreferrer">',
'</a>'
),
),
);

View File

@ -226,14 +226,15 @@ function edds_get_stripe_payment_elements_fonts() {
*/
function edds_gather_payment_element_customizations() {
$customizations = array(
'theme' => edds_get_stripe_payment_elements_theme(),
'variables' => edds_get_stripe_payment_elements_variables(),
'rules' => edds_get_stripe_payment_elements_rules(),
'layout' => edds_get_stripe_payment_elements_layout(),
'wallets' => edds_get_stripe_payment_elements_wallets(),
'labels' => edds_get_stripe_payment_elements_label_style(),
'fonts' => edds_get_stripe_payment_elements_fonts(),
'i18n' => array(
'theme' => edds_get_stripe_payment_elements_theme(),
'variables' => edds_get_stripe_payment_elements_variables(),
'rules' => edds_get_stripe_payment_elements_rules(),
'layout' => edds_get_stripe_payment_elements_layout(),
'wallets' => edds_get_stripe_payment_elements_wallets(),
'labels' => edds_get_stripe_payment_elements_label_style(),
'fonts' => edds_get_stripe_payment_elements_fonts(),
'paymentMethodTypes' => edds_payment_element_payment_method_types(),
'i18n' => array(
'errorMessages' => edds_get_localized_error_messages(),
),
);
@ -260,3 +261,37 @@ function edds_payment_element_js_vars( $stripe_vars ) {
return $stripe_vars;
}
add_filter( 'edd_stripe_js_vars', 'edds_payment_element_js_vars', 10, 1 );
/**
* Returns an array of payment method types.
*
* By default this is empty to allow the automatic payment methods to take over, but in the event someone
* wants to alter this, they can at their own risk as EDD controls what payment methods are availbale
* at the platform level.
*
* As of 2.9.2.1 - EDD only supports 'card' and 'link' as options.
*
* @since 2.9.2.1
*
* @return array The allowed payment_method_types
*/
function edds_payment_element_payment_method_types() {
/**
* Allows passing payment_method_types to the elements and intent.
*
* This is by default empty, but you can alter this on an account level if needed.
*
* @since 2.9.2.1
*
* @example
* add_filter( 'edds_stripe_payment_elements_payment_method_types', function( $payment_method_types ) {
* return array(
* 'card',
* 'link',
* );
* } );
*
* @param array The allowed payment elements payment method types.
*/
return apply_filters( 'edds_stripe_payment_elements_payment_method_types', array() );
}

View File

@ -152,12 +152,13 @@ function edds_process_purchase_form( $purchase_data ) {
if ( ! empty( $_REQUEST['payment_method_id'] ) ) {
$intent_args['payment_method'] = sanitize_text_field( $_REQUEST['payment_method_id'] );
} else {
$payment_method_types = array(
'card',
'link',
);
$payment_method_types = edds_payment_element_payment_method_types();
$intent_args['payment_method_types'] = $payment_method_types;
if ( ! empty( $payment_method_types ) ) {
$intent_args['payment_method_types'] = $payment_method_types;
} else {
$intent_args['automatic_payment_methods'] = array( 'enabled' => true );
}
}
// Create a SetupIntent for a non-payment carts.

View File

@ -3,7 +3,7 @@
'name' => 'easy-digital-downloads/edd-stripe',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'a63eec57c1f5da47c09cc9cd8cf4162f8c65652a',
'reference' => '47178f1567076390fc6f41a5c5ebdf986b915165',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -13,7 +13,7 @@
'easy-digital-downloads/edd-stripe' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'a63eec57c1f5da47c09cc9cd8cf4162f8c65652a',
'reference' => '47178f1567076390fc6f41a5c5ebdf986b915165',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),