Skip to content

Commit

Permalink
Merge pull request #177 from alma/feature/MPP-573/in-page-frais-de-po…
Browse files Browse the repository at this point in the history
…rts-manquants

Missing shipping information for In page
  • Loading branch information
ClaireAlma authored Sep 5, 2023
2 parents e191614 + 5be11ef commit 08d5e36
Show file tree
Hide file tree
Showing 24 changed files with 697 additions and 625 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
version:
- 8.0.2
- 8.0.3
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Changelog
=========

v5.0.1
------
* fix: missing shipping information when In Page is activated
* fix: missing client information when In Page is activated
* fix: loading of the translation files
* feat: Compatibility Woocommerce 8.0.3

v5.0.0
------
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
- Requires at least Wordpress: 4.4
- Requires at least Woocommerce: 3.0.0
- Tested up to Wordpress: 6.3
- Tested up to Woocommerce: 8.0.2
- Tested up to Woocommerce: 8.0.3
- Requires PHP: 5.6
- Stable tag: 5.0.0
- Stable tag: 5.0.1
- License: GPLv3
- License URI: https://www.gnu.org/licenses/gpl-3.0.html
- Support: [email protected]
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: payments, BNPL, woocommerce, ecommerce, e-commerce, payment gateway, sell,
Requires at least: 4.4
Tested up to: 6.3
Requires PHP: 5.6
Stable tag: 5.0.0
Stable tag: 5.0.1
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -51,7 +51,11 @@ You can find more documentation on our [website](https://docs.almapay.com/docs/w

== Changelog ==

= 5.0.1 =
* fix: missing client information when In Page is activated
* fix: missing shipping information when In Page is activated
* fix: loading of the translation files
* feat: Compatibility Woocommerce 8.0.3

= 5.0.0 =
* feat: In Page checkout
Expand Down
6 changes: 3 additions & 3 deletions src/alma-gateway-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Alma - Pay in installments or later for WooCommerce
* Plugin URI: https://docs.almapay.com/docs/woocommerce
* Description: Install Alma and boost your sales! It's simple and guaranteed, your cash flow is secured. 0 commitment, 0 subscription, 0 risk.
* Version: 5.0.0
* Version: 5.0.1
* Author: Alma
* Author URI: https://almapay.com
* License: GNU General Public License v3.0
Expand All @@ -17,7 +17,7 @@
* @package Alma_Gateway_For_Woocommerce
*
* WC requires at least: 2.6
* WC tested up to: 8.0.2
* WC tested up to: 8.0.3
*
* Alma Payment Gateway for WooCommerce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -38,7 +38,7 @@
}

if ( ! defined( 'ALMA_VERSION' ) ) {
define( 'ALMA_VERSION', '5.0.0' );
define( 'ALMA_VERSION', '5.0.1' );
}
if ( ! defined( 'ALMA_PLUGIN_FILE' ) ) {
define( 'ALMA_PLUGIN_FILE', __FILE__ );
Expand Down
12 changes: 8 additions & 4 deletions src/assets/js/alma-checkout-in-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
'updated_checkout',
function (event) {
if (isAlmaInPageChecked()) {
feePlanChecked = $( "input[type='radio'][name='alma_fee_plan_in_page']:checked" ).val();
render_installments( feePlanChecked );
$( "input[type='radio'][name='alma_fee_plan_in_page']:checked" ).click();
}
}
);
Expand Down Expand Up @@ -55,14 +54,19 @@
}

if (null !== installment) {
if ( inPage !== undefined) {
if (
inPage !== undefined
&& document.getElementById( 'alma-embedded-iframe' ) !== null
) {
inPage.unmount();
}

amount = document.getElementsByClassName( "order-total" )["0"].getElementsByClassName( "woocommerce-Price-amount amount" )["0"].innerText.replace( /[^0-9]/g, '' );

inPage = Alma.InPage.initialize(
{
merchantId: alma_iframe_params.merchant_id,
amountInCents: alma_iframe_params.amount_in_cents,
amountInCents: amount,
installmentsCount: installment,
selector: "#alma-inpage-" + payment_value,
environment: alma_iframe_params.environment,
Expand Down
5 changes: 2 additions & 3 deletions src/includes/admin/helpers/class-alma-form-fields-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ public function init_inpage_fields( $default_settings ) {
'display_in_page' => array(
'title' => __( 'Activate in-page checkout', 'alma-gateway-for-woocommerce' ),
'type' => 'checkbox',
'label' => __( 'Activate this setting if you want in-page checkout for Pay Now, P2X, P3X, and P4X', 'alma-gateway-for-woocommerce' ),
// translators: %s: Admin logs url.
// translators: %s: The previous plugin version if exists.
/* translators: %s: Alma in page doc URL */
'label' => __( 'Activate this setting if you want in-page checkout for Pay Now, P2X, P3X, and P4X', 'alma-gateway-for-woocommerce' ) . '<br>' . sprintf( __( '(Learn more about this feature <a href="%s">here</a>)', 'alma-gateway-for-woocommerce' ), Alma_Assets_Helper::get_in_page_doc_link() ),
'default' => $default_settings['display_in_page'],
),
);
Expand Down
8 changes: 8 additions & 0 deletions src/includes/helpers/class-alma-assets-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ public static function get_alma_dashboard_url( $env = 'test', $path = '' ) {
return esc_url( sprintf( __( 'https://dashboard.sandbox.getalma.eu/%s', 'alma-gateway-for-woocommerce' ), $path ) );
}

/**
* Get Alma doc for in page.
*
* @return string
*/
public static function get_in_page_doc_link() {
return esc_url( 'https://docs.almapay.com/docs/in-page-woocommerce' );
}
/**
* Enqueue scripts needed into admin form.
*
Expand Down
6 changes: 5 additions & 1 deletion src/includes/helpers/class-alma-order-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,11 @@ protected function create_inpage_order( $post_fields ) {

$order->set_created_via( 'checkout' );
$order->set_cart_hash( $cart_hash );

$order->set_customer_id(
apply_filters(
'woocommerce_checkout_customer_id', // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
isset( $post_fields['user_id'] ) ? $post_fields['user_id'] : ''
isset( $post_fields['user_id'] ) ? $post_fields['user_id'] : get_current_user_id()
)
);

Expand All @@ -342,6 +343,9 @@ protected function create_inpage_order( $post_fields ) {

$checkout->create_order_line_items( $order, $cart );
$checkout->create_order_fee_lines( $order, $cart );

WC()->cart->calculate_shipping();

$checkout->create_order_shipping_lines( $order, WC()->session->get( 'chosen_shipping_methods' ), WC()->shipping->get_packages() );
$checkout->create_order_tax_lines( $order, $cart );
$checkout->create_order_coupon_lines( $order, $cart );
Expand Down
Binary file modified src/languages/alma-gateway-for-woocommerce-de_DE.mo
Binary file not shown.
Loading

0 comments on commit 08d5e36

Please sign in to comment.