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

fix: center iframe on success screen #95

Merged
merged 6 commits into from
Dec 16, 2023
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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.17.1
16 changes: 8 additions & 8 deletions assets/scss/ledyer-checkout-for-woocommerce.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
display: flex;
flex-direction: column;
align-items: center;
}

#lco-order-review,
#lco-iframe {
width: 100%;
}
#lco-order-review,
#lco-iframe {
width: 100%;
}

#lco-iframe {
display: flex;
justify-content: center;
}
#lco-iframe {
display: flex;
justify-content: center;
}
33 changes: 14 additions & 19 deletions classes/class-ledyer-lco-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,19 @@ public function enqueue_scripts() {
return;
}

// Load the Ledyer Checkout for WooCommerce stylesheet.
wp_register_style(
'lco',
plugins_url('build/ledyer-checkout-for-woocommerce.css', LCO_WC_MAIN_FILE),
array(),
filemtime(plugin_dir_path(LCO_WC_MAIN_FILE) . ('build/ledyer-checkout-for-woocommerce.css'))
);
wp_enqueue_style('lco');

if ( ! is_checkout() ) {
return;
}


$scriptSrcUrl = 'https://checkout.live.ledyer.com/bootstrap.js';

if ( $this->testmode ) {
Expand All @@ -120,7 +128,7 @@ public function enqueue_scripts() {
case 'development':
$scriptSrcUrl = 'https://checkout.dev.ledyer.com/bootstrap.js';
break;
default:
default:
$scriptSrcUrl = 'https://checkout.sandbox.ledyer.com/bootstrap.js';
break;
}
Expand Down Expand Up @@ -155,13 +163,6 @@ public function enqueue_scripts() {
true
);

wp_register_style(
'lco',
plugins_url( 'build/ledyer-checkout-for-woocommerce.css', LCO_WC_MAIN_FILE ),
array(),
filemtime( plugin_dir_path( LCO_WC_MAIN_FILE ) . ( 'build/ledyer-checkout-for-woocommerce.css' ) )
);

$email_exists = 'no';

if ( null !== WC()->customer && method_exists( WC()->customer, 'get_billing_email' ) && ! empty( WC()->customer->get_billing_email() ) ) {
Expand Down Expand Up @@ -220,18 +221,11 @@ public function enqueue_scripts() {
'no_shipping_message' => apply_filters( 'woocommerce_no_shipping_available_html', __( 'There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'woocommerce' ) ),
);

if ( version_compare( WC_VERSION, '3.9', '>=' ) ) {
$checkout_localize_params['force_update'] = true;
}
wp_localize_script( 'lco', 'lco_params', $checkout_localize_params );
$checkout_localize_params['force_update'] = true;

wp_localize_script( 'lco', 'lco_params', $checkout_localize_params );
wp_enqueue_script( 'lco-iframe' );

wp_enqueue_script( 'lco' );

if ( ! $pay_for_order ) {
wp_enqueue_style( 'lco' );
}
}

/**
Expand Down Expand Up @@ -680,7 +674,7 @@ public function lom_allow_editing($order) {
if ( $order->has_status( array( 'completed', 'refunded', 'cancelled' ) ) ) {
return false;
}

return true;
}

Expand All @@ -692,3 +686,4 @@ public function lom_order_placed_with_ledyer($payment_method) {
}
}
}

Loading