Skip to content

Commit

Permalink
Merge pull request #220 from alma/develop
Browse files Browse the repository at this point in the history
Release 5.2.0
  • Loading branch information
ClaireAlma authored Feb 22, 2024
2 parents d8a7163 + 930a505 commit 5afd04a
Show file tree
Hide file tree
Showing 28 changed files with 503 additions and 468 deletions.
1 change: 1 addition & 0 deletions .github/workflows/aqua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
pull_request:
branches:
- main
- develop

jobs:
aqua:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

v5.2.0
------
* feature : HPOS compatibility
* feat: Update translations
* fix: widget XSS

v5.1.4
------
* feat: compatibility Woocommerce 8.2.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- Tested up to Wordpress: 6.3.2
- Tested up to Woocommerce: 8.2.1
- Requires PHP: 5.6
- Stable tag: 5.1.4
- Stable tag: 5.2.0
- License: GPLv3
- License URI: https://www.gnu.org/licenses/gpl-3.0.html
- Support: [email protected]
Expand Down
4 changes: 2 additions & 2 deletions bin/retrieve-widget-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ GIT_WC_RAW_DIR="${GIT_WC_DIST_DIR}/raw"

RAW_FILES="
css/widgets.css
js/widgets.umd.js
js/widgets.umd.js.map
js/widgets-wc.umd.js
js/widgets-wc.umd.js.map
"
#}}}

Expand Down
7 changes: 6 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.1.4
Stable tag: 5.2.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

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

== Changelog ==

= 5.2.0 =
* feat: Update translations
* fix: widget XSS
* feature : HPOS compatibility

= 5.1.4 =
* feat: Compatibility Woocommerce 8.2.1
* feat: change fee wording in the BO
Expand Down
17 changes: 15 additions & 2 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.1.4
* Version: 5.2.0
* Author: Alma
* Author URI: https://almapay.com
* License: GNU General Public License v3.0
Expand Down Expand Up @@ -38,7 +38,7 @@
}

if ( ! defined( 'ALMA_VERSION' ) ) {
define( 'ALMA_VERSION', '5.1.4' );
define( 'ALMA_VERSION', '5.2.0' );
}
if ( ! defined( 'ALMA_PLUGIN_FILE' ) ) {
define( 'ALMA_PLUGIN_FILE', __FILE__ );
Expand Down Expand Up @@ -86,6 +86,19 @@ function alma_plugin() {
*/
add_action( 'plugins_loaded', 'alma_plugin' );

add_action(
'before_woocommerce_init',
function() {
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
/**
* Skip WC class check.
*
* @psalm-suppress UndefinedClass
*/
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
}
);



Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@
}

function polyfillClassList(ele) {
if (!ele || !('innerHTML' in ele)) throw TypeError('Illegal invocation');
if (!ele || !('innerText' in ele)) throw TypeError('Illegal invocation');
ele.detachEvent('onpropertychange', whenPropChanges); // prevent duplicate handler infinite loop

allowTokenListConstruction = 1;
Expand Down Expand Up @@ -6868,21 +6868,21 @@
"credit-features.credit-cost-display": "{creditCost} (gemiddeld rente percentage {taegPercentage})",
"credit-features.information": "Een lening is bindend en moet worden terugbetaald. Ga na of je het kunt terugbetalen voordat je jezelf vastlegt.",
"credit-features.total-credit-cost": "Waarvan kredietkosten",
"eligibility-modal.bullet-1": "Kies <strong>Alma</strong> bij het afrekenen om de eerste termijn te voldoen via jouw gewenste betaalmethode.",
"eligibility-modal.bullet-2": "Laat ons je begeleiden om de betaling binnen <strong>1 minuut </strong> te valideren zonder dat je een account hoeft aan te maken.",
"eligibility-modal.bullet-1": "Kies <strong>Alma</strong> bij het afrekenen om de eerste termijnbetaling te voldoen. Dit kan gemakkelijk via jouw favoriete betaalmethode.",
"eligibility-modal.bullet-2": "Betaal gemakkelijk <strong>binnen 1 minuut </strong>. Je hebt hier geen account voor nodig.",
"eligibility-modal.bullet-3": "<strong>Behoudt de controle </strong> en bepaal je eigen tempo. Bij Alma schuif je de deadlines gemakkelijk vooruit of achteruit. Zonder bijkomende kosten.",
"eligibility-modal.no-eligibility": "Oeps, het lijkt erop dat de simulatie niet werkte.",
"eligibility-modal.p1x-bullet-1": "Kies <strong>Alma - Betaal nu</strong> bij het afrekenen om de eerste termijn te voldoen via jouw gewenste betaalmethode.",
"eligibility-modal.p1x-bullet-1": "Kies <strong>Alma - Betaal nu</strong> bij het afrekenen om de eerste termijnbetaling te voldoen. Dit kan gemakkelijk via jouw favoriete betaalmethode.",
"eligibility-modal.p1x-bullet-2": "Vul jouw <strong>gegevens </strong> in",
"eligibility-modal.p1x-bullet-3": "<strong>De bevestiging </strong> van jouw betaling is onmiddellijk!",
"eligibility-modal.title-deferred-plan": "Betaal in rentevrije termijnen bij Alma - zonder BKR of CKP registratie.",
"eligibility-modal.title-normal": "Betaal in rentevrije termijnen bij Alma - zonder BKR of CKP registratie.",
"eligibility-modal.title-deferred-plan": "Betaal in termijnen bij Alma - helemaal rentevrij.",
"eligibility-modal.title-normal": "Betaal in termijnen bij Alma - helemaal rentevrij.",
"eligibility-modal.title-pay-now": "Betaal met iDEAL of per creditcard bij Alma.",
"installments.today": "Vandaag",
"installments.total-amount": "Totaal",
"installments.total-fees": "Waarvan kosten (incl. BTW)",
"payment-plan-strings.day-abbreviation": "D{deferredDays}",
"payment-plan-strings.default-message": "Betaal in rentevrije termijnen bij Alma - zonder BKR of CKP registratie",
"payment-plan-strings.default-message": "Betaal in termijnen bij Alma - helemaal rentevrij",
"payment-plan-strings.deferred": "{totalAmount} te betalen op {dueDate}",
"payment-plan-strings.ineligible-greater-than-max": "Tot {maxAmount}",
"payment-plan-strings.ineligible-lower-than-min": "Vanaf {minAmount}",
Expand Down Expand Up @@ -7398,7 +7398,7 @@
}

var D = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function (a) {
"children dangerouslySetInnerHTML defaultValue defaultChecked innerText suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function (a) {
D[a] = new B(a, 0, !1, a, null, !1, !1);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function (a) {
Expand Down Expand Up @@ -7932,9 +7932,9 @@
});
} : a;
}(function (a, b) {
if (a.namespaceURI !== kb.svg || "innerHTML" in a) a.innerHTML = b;else {
if (a.namespaceURI !== kb.svg || "innerText" in a) a.innerText = b;else {
nb = nb || document.createElement("div");
nb.innerHTML = "<svg>" + b.valueOf().toString() + "</svg>";
nb.innerText = "<svg>" + b.valueOf().toString() + "</svg>";

for (b = nb.firstChild; a.firstChild;) a.removeChild(a.firstChild);

Expand Down Expand Up @@ -12217,7 +12217,7 @@
} else {
g = 9 === e.nodeType ? e : e.ownerDocument;
a === kb.html && (a = lb(c));
a === kb.html ? "script" === c ? (a = g.createElement("div"), a.innerHTML = "<script>\x3c/script>", a = a.removeChild(a.firstChild)) : "string" === typeof d.is ? a = g.createElement(c, {
a === kb.html ? "script" === c ? (a = g.createElement("div"), a.innerText = "<script>\x3c/script>", a = a.removeChild(a.firstChild)) : "string" === typeof d.is ? a = g.createElement(c, {
is: d.is
}) : (a = g.createElement(c), "select" === c && (g = a, d.multiple ? g.multiple = !0 : d.size && (g.size = d.size))) : a = g.createElementNS(a, c);
a[wf] = b;
Expand Down Expand Up @@ -15073,7 +15073,7 @@
shipping_address: shipping_address
}, {
Authorization: "Alma-Merchant-Auth " + merchantId,
'X-Alma-Agent': "Alma Widget/" + "v3.3.8"
'X-Alma-Agent': "Alma Widget/" + "v3.3.10"
}).then(function (res) {
setEligibility(res);
setStatus(apiStatus.SUCCESS);
Expand Down Expand Up @@ -15518,7 +15518,7 @@
function hidesContents(element) {
var zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0; // If the node is empty, this is good enough

if (zeroSize && !element.innerHTML) return true;
if (zeroSize && !element.innerText) return true;

try {
// Otherwise we need to check some styles
Expand Down Expand Up @@ -20914,4 +20914,4 @@
})(exports.Utils || (exports.Utils = {}));

})));
//# sourceMappingURL=widgets.umd.js.map
//# sourceMappingURL=widgets-wc.umd.js.map
1 change: 1 addition & 0 deletions src/assets/widget/js/widgets-wc.umd.js.map

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

1 change: 0 additions & 1 deletion src/assets/widget/js/widgets.umd.js.map

This file was deleted.

14 changes: 8 additions & 6 deletions src/includes/admin/helpers/class-alma-refund-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function get_display_refund_amount( $refund ) {
*/
public function make_full_refund( $wc_order, $refund_id = 0 ) {

if ( '1' === get_post_meta( $wc_order->get_id(), Alma_Constants_Helper::FLAG_ORDER_FULLY_REFUNDED, true ) ) {
if ( '1' === $wc_order->get_meta( Alma_Constants_Helper::FLAG_ORDER_FULLY_REFUNDED ) ) {
return;
}

Expand All @@ -101,7 +101,7 @@ public function make_full_refund( $wc_order, $refund_id = 0 ) {
try {
$this->alma_settings->full_refund( $wc_order->get_transaction_id(), $merchant_reference, $this->format_refund_comment( $comment ) );

update_post_meta( $wc_order->get_id(), Alma_Constants_Helper::FLAG_ORDER_FULLY_REFUNDED, '1' );
$wc_order->update_meta_data( Alma_Constants_Helper::FLAG_ORDER_FULLY_REFUNDED, '1' );

/* translators: %s is a username. */
$order_note = sprintf( __( 'Order fully refunded by %s.', 'alma-gateway-for-woocommerce' ), wp_get_current_user()->display_name );
Expand Down Expand Up @@ -179,12 +179,14 @@ protected function add_order_note( $wc_order, $notice_type, $message ) {
* @return void
*/
protected function add_notice( $wc_order, $notice_type, $message ) {
$refund_notices = get_post_meta( $wc_order->get_id(), Alma_Constants_Helper::REFUND_NOTICE_META_KEY );
$refund_notices = $wc_order->get_meta( Alma_Constants_Helper::REFUND_NOTICE_META_KEY );
$refund_notices = json_decode( $refund_notices );
$refund_notices[] = array(
'notice_type' => $notice_type,
'message' => $message,
);
update_post_meta( $wc_order->get_id(), Alma_Constants_Helper::REFUND_NOTICE_META_KEY, $refund_notices );

$wc_order->update_meta_data( Alma_Constants_Helper::REFUND_NOTICE_META_KEY, wp_json_encode( $refund_notices ) );
}

/**
Expand Down Expand Up @@ -306,7 +308,7 @@ protected function has_transaction_id( $wc_order ) {
* @return void
*/
public function print_notices( $wc_order ) {
$refund_notices = get_post_meta( $wc_order->get_id(), Alma_Constants_Helper::REFUND_NOTICE_META_KEY, true );
$refund_notices = $wc_order->get_meta( Alma_Constants_Helper::REFUND_NOTICE_META_KEY );

if ( ! is_array( $refund_notices ) ) {
return;
Expand All @@ -332,6 +334,6 @@ public function print_notices( $wc_order ) {
* @return void
*/
public function delete_notices( $wc_order ) {
delete_post_meta( $wc_order->get_id(), Alma_Constants_Helper::REFUND_NOTICE_META_KEY );
$wc_order->delete_meta_data( Alma_Constants_Helper::REFUND_NOTICE_META_KEY );
}
}
2 changes: 1 addition & 1 deletion src/includes/class-alma-generic-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function inject_payment_plan_widget(
);

// Inject JS/CSS required for the eligibility/payment plans info display.
$alma_widgets_js_url = Alma_Assets_Helper::get_asset_url( 'widget/js/widgets.umd.js' );
$alma_widgets_js_url = Alma_Assets_Helper::get_asset_url( 'widget/js/widgets-wc.umd.js' );
wp_enqueue_script( 'alma-widgets', $alma_widgets_js_url, array(), ALMA_VERSION, true ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion

$alma_widgets_css_url = Alma_Assets_Helper::get_asset_url( 'widget/css/widgets.css' );
Expand Down
2 changes: 1 addition & 1 deletion src/includes/class-alma-payment-upon-trigger.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function woocommerce_order_status_changed( $order_id, $previous_status, $
return;
}

if ( ! get_post_meta( $order_id, 'alma_payment_upon_trigger_enabled' ) ) {
if ( ! $wc_order->get_meta( 'alma_payment_upon_trigger_enabled' ) ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/includes/helpers/class-alma-payment-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected function manage_mismatch( $wc_order, $payment, $payment_id ) {
*/
public function update_order_post_meta_if_deferred_trigger( $payment, $wc_order ) {
if ( $payment->deferred_trigger ) {
update_post_meta( $wc_order->get_id(), 'alma_payment_upon_trigger_enabled', true );
$wc_order->update_meta_data( 'alma_payment_upon_trigger_enabled', true );
}
}

Expand Down
Binary file modified src/languages/alma-gateway-for-woocommerce-de_DE.mo
Binary file not shown.
Loading

0 comments on commit 5afd04a

Please sign in to comment.