Skip to content

Commit b82ee21

Browse files
authored
Merge pull request #292 from skyverge/v4-wc-3.4-compat
v4: Port WC 3.4 & GDPR changes
2 parents 8e8180a + 3876ba1 commit b82ee21

File tree

4 files changed

+405
-4
lines changed

4 files changed

+405
-4
lines changed

woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ jQuery( document ).ready ($) ->
294294
id_dasherized = @id_dasherized
295295
csc_required = @csc_required
296296
$new_payment_method_selection = $( "div.js-wc-#{ id_dasherized }-new-payment-method-form" )
297-
$csc_field = $new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-csc' ).parent()
297+
$csc_field = $new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-csc' ).closest( '.form-row' )
298298

299299
# show/hide the saved payment methods when a saved payment method is de-selected/selected
300300
$( "input.js-wc-#{ @id_dasherized }-payment-token" ).change ->
@@ -317,7 +317,7 @@ jQuery( document ).ready ($) ->
317317
# move the CSC field back into its regular spot
318318
if csc_required
319319
$csc_field.removeClass( 'form-row-first' ).addClass( 'form-row-last' )
320-
$new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-expiry' ).parent().after( $csc_field )
320+
$new_payment_method_selection.find( '.js-sv-wc-payment-gateway-credit-card-form-expiry' ).closest( '.form-row' ).after( $csc_field )
321321
.change()
322322

323323
# display the 'save payment method' option for guest checkouts if the 'create account' option is checked

woocommerce/payment-gateway/assets/js/frontend/sv-wc-payment-gateway-payment-form.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

woocommerce/payment-gateway/class-sv-wc-payment-gateway-plugin.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ abstract class SV_WC_Payment_Gateway_Plugin extends SV_WC_Plugin {
8282
/** @var boolean true if this gateway requires SSL for processing transactions, false otherwise */
8383
private $require_ssl;
8484

85+
/** @var SV_WC_Payment_Gateway_Privacy payment gateway privacy handler instance */
86+
protected $privacy_handler;
87+
8588
/** @var SV_WC_Payment_Gateway_Admin_User_Edit_Handler adds admin user edit payment gateway functionality */
8689
private $admin_user_edit_handler;
8790

@@ -276,6 +279,12 @@ public function lib_includes() {
276279
require_once( $payment_gateway_framework_path . '/integrations/class-sv-wc-payment-gateway-integration-pre-orders.php' );
277280
}
278281

282+
// privacy
283+
if ( SV_WC_Plugin_Compatibility::is_wc_version_gte( '3.4' ) && class_exists( 'WC_Abstract_Privacy' ) ) {
284+
require_once( "{$payment_gateway_framework_path}/class-sv-wc-payment-gateway-privacy.php" );
285+
$this->privacy_handler = new SV_WC_Payment_Gateway_Privacy( $this );
286+
}
287+
279288
// Admin user handler
280289
if ( is_admin() ) {
281290
require_once( $payment_gateway_framework_path . '/admin/class-sv-wc-payment-gateway-admin-user-handler.php' );
@@ -951,6 +960,19 @@ public function can_capture_charge( $gateway ) {
951960
/** Getter methods ******************************************************/
952961

953962

963+
/**
964+
* Gets the privacy handler instance.
965+
*
966+
* @since 4.9.2-dev
967+
*
968+
* @return SV_WC_Payment_Gateway_Privacy
969+
*/
970+
public function get_privacy_instance() {
971+
972+
return $this->privacy_handler;
973+
}
974+
975+
954976
/**
955977
* Get the admin user handler instance.
956978
*

0 commit comments

Comments
 (0)