Skip to content

Commit

Permalink
[AI-111] - Magento Infinite Loader Fix (#54)
Browse files Browse the repository at this point in the history
* AI-111: Retry when the form needs to be rendered but the element is still not available

* Increase version
  • Loading branch information
nicocedron authored Dec 6, 2024
1 parent ba5442b commit 470d400
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 32 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![alt tag](https://conekta.com/static/assets/Home/conekta-logo-blue-full.svg)

Magento 2 Plugin v.5.1.6 (Stable)
Magento 2 Plugin v.5.1.7 (Stable)
========================

Installation for Magento 2.3
Expand All @@ -13,7 +13,7 @@ composer config repositories.conekta git https://github.com/conekta/customer-mag

2. Add composer dependency
```bash
composer require conekta/conekta_payments 5.1.6
composer require conekta/conekta_payments 5.1.7
```

3. Update Magento
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"conekta/conekta-php": "v6.0.8"
},
"type": "magento2-module",
"version": "5.1.6",
"version": "5.1.7",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<system>
<section id="payment">
<group id="conekta" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
<comment><![CDATA[<div class="conekta-payment-logo"></div><div class="conekta-payment-text">Conekta Configuration. (v5.1.6) </div>]]></comment>
<comment><![CDATA[<div class="conekta-payment-logo"></div><div class="conekta-payment-text">Conekta Configuration. (v5.1.7) </div>]]></comment>
<fieldset_css>complex conekta-section</fieldset_css>
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
<!--global-->
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<global>
<api_version><![CDATA[2.0.0]]></api_version>
<plugin_type><![CDATA[Magento 2]]></plugin_type>
<plugin_version><![CDATA[5.1.6]]></plugin_version>
<plugin_version><![CDATA[5.1.7]]></plugin_version>
</global>
</conekta>
</default>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Conekta_Payments" setup_version="5.1.6">
<module name="Conekta_Payments" setup_version="5.1.7">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down
63 changes: 37 additions & 26 deletions view/frontend/web/js/view/payment/method-renderer/embedform.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ define(
self.checkoutId(response.checkout_id);

if (self.checkoutId()) {
self.renderizeEmbedFormTimes = 0
self.renderizeEmbedForm();
} else {
self.isFormLoading(false);
Expand All @@ -279,32 +280,42 @@ define(

renderizeEmbedForm: function () {
var self = this;
document.getElementById("conektaIframeContainer").innerHTML = "";
window.ConektaCheckoutComponents.Integration({
targetIFrame: '#conektaIframeContainer',
checkoutRequestId: this.checkoutId(),
publicKey: this.getPublicKey(),
paymentMethods: this.getPaymenMethods(),
options: {
theme: 'default'
},
onCreateTokenSucceeded: function (token) {

},
onCreateTokenError: function (error) {
console.error(error);
},
onFinalizePayment: function (event) {
self.iframOrderData(event);
self.beforePlaceOrder();
},
onErrorPayment: function(a) {
self.conektaError("Ocurrió un error al procesar el pago. Por favor, inténtalo de nuevo.");
},
});

$('#conektaIframeContainer').find('iframe').attr('data-cy', 'the-frame');
self.isFormLoading(false);
try {
document.getElementById("conektaIframeContainer").innerHTML = "";
window.ConektaCheckoutComponents.Integration({
targetIFrame: '#conektaIframeContainer',
checkoutRequestId: this.checkoutId(),
publicKey: this.getPublicKey(),
paymentMethods: this.getPaymenMethods(),
options: {
theme: 'default'
},
onCreateTokenSucceeded: function (token) {

},
onCreateTokenError: function (error) {
console.error(error);
},
onFinalizePayment: function (event) {
self.iframOrderData(event);
self.beforePlaceOrder();
},
onErrorPayment: function(a) {
self.conektaError("Ocurrió un error al procesar el pago. Por favor, inténtalo de nuevo.");
},
});

$('#conektaIframeContainer').find('iframe').attr('data-cy', 'the-frame');
self.isFormLoading(false);
} catch {
if(self.renderizeEmbedFormTimes > 4)
return self.isFormLoading(false);

self.renderizeEmbedFormTimes++;
setTimeout(function() {
self.renderizeEmbedForm();
}, 500);
}
},

getData: function () {
Expand Down

0 comments on commit 470d400

Please sign in to comment.