Skip to content

Commit

Permalink
Merge pull request #105 from Dintero/develop
Browse files Browse the repository at this point in the history
Version 1.2.3
  • Loading branch information
mntzrr authored Oct 3, 2022
2 parents 84dda94 + 5bf1a36 commit 53234eb
Show file tree
Hide file tree
Showing 12 changed files with 503 additions and 414 deletions.
16 changes: 16 additions & 0 deletions assets/css/dintero-checkout-express.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
.dintero-checkout-pip {
display: block;
font-size: 0.9em;
box-shadow: 1px 1px 5px -1px grey;
padding: 5px;
border-radius: 5px;
}

.woocommerce-checkout-review-order-table .dintero-checkout-pip::before {
display: none;
}

.dintero-checkout-no-spinner::before {
display: none !important;
}

/* Desktop view / multi columns */
@media only screen and (min-width : 769px) {

Expand Down
2 changes: 1 addition & 1 deletion assets/css/dintero-checkout-express.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 43 additions & 7 deletions assets/js/dintero-checkout-express.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ jQuery( function( $ ) {
},
} );
},

/**
* Triggers on document ready.
*/
Expand Down Expand Up @@ -386,18 +385,55 @@ jQuery( function( $ ) {
},

/**
* Submit the order using the WooCommerce AJAX function.
*
* @param {callback} callback
* Block form fields from being modified by the user.
*/
submitOrder( callback ) {
blockForm() {
/* Order review. */
$( '.woocommerce-checkout-review-order-table' ).block( {
message: dinteroCheckoutParams.pip_text,
overlayCSS: {
background: '#fff',
},
css: {
width: 'fit-content',
height: 'fit-content',
padding: '0.2em 0.8em',
border: 'none',
},
blockMsgClass: 'dintero-checkout-pip',
} );

/* Additional checkout fields. */
$( '#dintero-express-extra-checkout-fields' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6,
},
blockMsgClass: 'dintero-checkout-pip',
} );

$( '.dintero-checkout-pip' ).siblings( '.blockOverlay' ).addClass( 'dintero-checkout-no-spinner' );
},

/**
* Unblock form fields.
*/
unblockForm() {
/* Order review. */
$( '.woocommerce-checkout-review-order-table' ).unblock();

/* Additional checkout fields. */
$( '#dintero-express-extra-checkout-fields' ).unblock();
},

/**
* Submit the order using the WooCommerce AJAX function.
*
* @param {callback} callback
*/
submitOrder( callback ) {
this.blockForm();

$.ajax( {
type: 'POST',
url: dinteroCheckoutParams.submitOrder,
Expand Down Expand Up @@ -449,7 +485,7 @@ jQuery( function( $ ) {
$( 'body' ).trigger( 'updated_checkout' );
$( dinteroCheckoutForWooCommerce.checkoutFormSelector ).removeClass( 'processing' );
$( dinteroCheckoutForWooCommerce.checkoutFormSelector ).unblock();
$( '.woocommerce-checkout-review-order-table' ).unblock();
this.unblockForm();
},

printNotice( message, noticeType = 'error' ) {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/dintero-checkout-express.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/dintero-checkout-express.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions classes/class-dintero-checkout-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public function enqueue_scripts() {
'print_notice_url' => WC_AJAX::get_endpoint( 'dintero_checkout_print_notice' ),
'print_notice_nonce' => wp_create_nonce( 'dintero_checkout_print_notice' ),
'shipping_in_iframe' => ( isset( $settings['express_shipping_in_iframe'] ) && 'yes' === $settings['express_shipping_in_iframe'] && 'express' === $settings['checkout_type'] ),
'pip_text' => __( 'Payment in progress', 'dintero-checkout-for-woocommerce' ),

)
);
Expand Down
6 changes: 3 additions & 3 deletions classes/requests/helpers/class-dintero-checkout-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ public function get_shipping_items() {
* method for when shipping is not able to be selected in the iframe.
*
* @param object $shipping_method The id of the shipping method.
* @return array
* @return array An empty array is returned if no shipping method is available.
*/
public function get_shipping_option( $shipping_method = null ) {
if ( empty( $shipping_method ) ) {
$packages = WC()->shipping()->get_packages();
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
if ( empty( $chosen_methods ) || count( $chosen_methods ) > 1 ) {
return null;
return array();
}
$chosen_shipping = $chosen_methods[0];
foreach ( $packages as $i => $package ) {
Expand All @@ -222,7 +222,7 @@ public function get_shipping_option( $shipping_method = null ) {
}

if ( empty( $shipping_method ) ) {
return null;
return array();
}

return array(
Expand Down
19 changes: 17 additions & 2 deletions classes/requests/helpers/class-dintero-checkout-helper-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,24 @@ public static function add_shipping( &$body, $helper, $is_embedded, $is_express,
$body['express']['shipping_mode'] = 'shipping_not_required';
return;
}
if ( $is_shipping_in_iframe ) {
$body['express']['shipping_options'] = $helper->get_express_shipping_options();
} else {
$shipping_option = $helper->get_shipping_option();
$body['express']['shipping_options'] = empty( $shipping_option ) ? array() : array( $shipping_option );
}

if ( $is_shipping_in_iframe ) {
$body['express']['shipping_options'] = $helper->get_express_shipping_options();
} else {
$shipping_option = $helper->get_shipping_option();
$body['express']['shipping_options'] = empty( $shipping_option ) ? array() : array( $shipping_option );
}

$body['express']['shipping_options'] = $is_shipping_in_iframe ? $helper->get_express_shipping_options() : array( $helper->get_shipping_option() );
$body['express']['shipping_mode'] = 'shipping_required';
$body['express']['shipping_mode'] = 'shipping_required';
if ( ! empty( $body['express']['shipping_options'] ) && ! $is_shipping_in_iframe ) {
$body['express']['shipping_mode'] = 'shipping_not_required';
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions dintero-checkout-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* Description: Dintero offers a complete payment solution. Simplifying the payment process for you and the customer.
* Author: Dintero, Krokedil
* Author URI: https://krokedil.com/
* Version: 1.2.2
* Version: 1.2.3
* Text Domain: dintero-checkout-for-woocommerce
* Domain Path: /languages
*
* WC requires at least: 6.1.0
* WC tested up to: 6.8.2
* WC tested up to: 6.9.2
*
* Copyright (c) 2022 Krokedil
*
Expand All @@ -22,7 +22,7 @@
exit;
}

define( 'DINTERO_CHECKOUT_VERSION', '1.2.2' );
define( 'DINTERO_CHECKOUT_VERSION', '1.2.3' );
define( 'DINTERO_CHECKOUT_URL', untrailingslashit( plugins_url( '/', __FILE__ ) ) );
define( 'DINTERO_CHECKOUT_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'DINTERO_CHECKOUT_MAIN_FILE', __FILE__ );
Expand Down
10 changes: 7 additions & 3 deletions languages/dintero-checkout-for-woocommerce.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/Dintero.Checkout.WooCommerce.V2\n"
"POT-Creation-Date: 2022-08-22 09:17:16+00:00\n"
"POT-Creation-Date: 2022-10-03 12:03:58+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand All @@ -14,6 +14,10 @@ msgstr ""
"Language-Team: LANGUAGE <LL@li.org>\n"
"X-Generator: grunt-wp-i18n 1.0.3\n"

#: classes/class-dintero-checkout-assets.php:181
msgid "Payment in progress"
msgstr ""

#: classes/class-dintero-checkout-callback.php:164
msgid "The order was CANCELED in the Dintero."
msgstr ""
Expand Down Expand Up @@ -415,8 +419,8 @@ msgstr ""
msgid "Gift card:"
msgstr ""

#: classes/requests/helpers/class-dintero-checkout-helper-base.php:81
#: classes/requests/helpers/class-dintero-checkout-helper-base.php:114
#: classes/requests/helpers/class-dintero-checkout-helper-base.php:96
#: classes/requests/helpers/class-dintero-checkout-helper-base.php:129
msgid "Rounding fee"
msgstr ""

Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Requires at least: 5.8.3
Tested up to: 6.0.2
Requires PHP: 7.0
WC requires at least: 6.1.0
WC tested up to: 6.8.2
Stable tag: 1.2.2
WC tested up to: 6.9.2
Stable tag: 1.2.3
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -83,6 +83,11 @@ Go to [https://www.dintero.com/contact-us](https://www.dintero.com/contact-us) t
1. The plugin settings screen where you set up the details to connect to Dintero.

== Changelog ==
= 2022.10.03 - version 1.2.3 =
- Fix - Fixed an error in the embedded checkout that would occur if the cart contained shippable products, but no shipping method is available.
- Fix - The "Display shipping in the iframe" option should now work as expected.
- Tweak - It should now be more clear for customers when a payment is in progress.

= 2022.09.15 - version 1.2.2 =
* Fix - Fixed an issue where the embedded checkout layout would sometimes switch from two-column to single-column when trying to change payment method.
* Fix - Fixed an issue with switching from embedded checkout if Dintero Checkout was set as the first payment gateway.
Expand Down
Loading

0 comments on commit 53234eb

Please sign in to comment.