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

Re: #249 #251

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions includes/gateways/manual.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@
*/
add_action( 'give_manual_cc_form', '__return_false' );

/**
* Manual Gateway does not need a CC form validation, so remove it.
*
* @since 1.0
* @return void
*/
add_filter( 'give_require_billing_address', 'give_manual_no_cc_validation' );

function give_manual_no_cc_validation() {
return false;
}

/**
* Processes the purchase data and uses the Manual Payment gateway to record
* the transaction in the Purchase History
Expand Down
5 changes: 2 additions & 3 deletions includes/gateways/offline-donations.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* @since 1.0
*/


/**
* Register the payment gateway
*
Expand Down Expand Up @@ -70,7 +69,7 @@ function give_offline_payment_cc_form( $form_id ) {
$post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
$global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' );

if ( $global_offline_cc_fields == 'on' || $post_offline_cc_fields == 'on' ) {
if ( $global_offline_cc_fields == 'on' || ( $post_offline_customization_option == 'yes' && $post_offline_cc_fields == 'on' ) ) {
add_action( 'give_before_offline_info_fields', 'give_default_cc_address_fields' );
}

Expand Down Expand Up @@ -365,4 +364,4 @@ function give_get_default_offline_donation_email_content() {

return apply_filters( 'give_default_offline_donation_content', $default_text );

}
}
23 changes: 20 additions & 3 deletions includes/process-purchase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage Functions
* @copyright Copyright (c) 2015, WordImpress
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.0
* @since 1.0.1
*/

// Exit if accessed directly
Expand Down Expand Up @@ -272,7 +272,7 @@ function give_purchase_form_required_fields() {
);

// Let payment gateways and other extensions determine if address fields should be required
$require_address = apply_filters( 'give_require_billing_address', true );
$require_address = give_require_billing_address();

if ( $require_address ) {
$required_fields['card_zip'] = array(
Expand All @@ -297,6 +297,23 @@ function give_purchase_form_required_fields() {

}

/**
* Check if the Billing Address is required
*
* @since 1.0.1
* @return bool
*/
function give_require_billing_address() {

$return = false;

if ( isset( $_POST['billing_country'] ) ) {
$return = true;
}

return apply_filters( 'give_require_billing_address', $return );
}

/**
* Purchase Form Validate Logged In User
*
Expand Down Expand Up @@ -993,4 +1010,4 @@ function give_check_purchase_email( $valid_data, $posted ) {
}
}

add_action( 'give_checkout_error_checks', 'give_check_purchase_email', 10, 2 );
add_action( 'give_checkout_error_checks', 'give_check_purchase_email', 10, 2 );
2 changes: 0 additions & 2 deletions tests/tests-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ public function test_load_admin_scripts() {
$this->assertTrue( wp_script_is( 'give-admin-scripts', 'enqueued' ) );
$this->assertTrue( wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) );
$this->assertTrue( wp_script_is( 'jquery-flot', 'enqueued' ) );
$this->assertTrue( wp_script_is( 'jquery-flot-orderbars', 'enqueued' ) );
$this->assertTrue( wp_script_is( 'jquery-flot-time', 'enqueued' ) );
$this->assertTrue( wp_script_is( 'thickbox', 'enqueued' ) );

//Forms CPT Script
Expand Down