Skip to content

Commit

Permalink
Merge pull request #46 from mundipagg/develop
Browse files Browse the repository at this point in the history
merge Develop into master
  • Loading branch information
LilianaLessa authored Feb 1, 2019
2 parents 7afb451 + 31b0e68 commit 1c5e140
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "mundipagg/mundipagg-magento2-module",
"license": "MIT",
"version": "1.4.10",
"version": "1.4.11",
"type": "magento2-module",
"description": "Magento 2 Module Mundipagg",
"require": {
"php": ">=5.6.0",
"mundipagg/mundiapi": "^3.0",
"mundipagg/ecommerce-module-core": "1.2.3"
"mundipagg/ecommerce-module-core": "1.2.4"
},
"require-dev": {
"phpunit/phpunit": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MundiPagg_MundiPagg" setup_version="1.4.10">
<module name="MundiPagg_MundiPagg" setup_version="1.4.11">
<sequence>
<module name="Magento_Sales" />
<module name="Magento_Payment" />
Expand Down
33 changes: 33 additions & 0 deletions view/frontend/web/js/view/payment/cc-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,39 @@ define(

this._super();

//Set credit card number to credit card data object
this.creditCardNumber.subscribe(function (value) {
window.checkoutConfig.payment.mundipagg_creditcard.brandIsValid = false;
var result;

self.selectedCardType(null);

if (value === '' || value === null) {
return false;
}
result = cardNumberValidator(value);

if (!result.isPotentiallyValid && !result.isValid) {
return false;
}

if (result.card.title !== null) {
self.selectedCardType(result.card.type);
creditCardData.creditCard = result.card;
}

if (result.isValid) {
creditCardData.creditCardNumber = value;
self.creditCardType(result.card.type);
}

var cardsAvailables = window.checkoutConfig.payment.ccform.availableTypes.mundipagg_creditcard;

if(cardsAvailables[result.card.type]){
window.checkoutConfig.payment.mundipagg_creditcard.brandIsValid = true;
}
});

//Set expiration year to credit card data object
this.creditCardExpYear.subscribe(function (value) {
creditCardData.expirationYear = value;
Expand Down
10 changes: 8 additions & 2 deletions view/frontend/web/js/view/payment/method-renderer/creditcard.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,14 @@ define(
});
}
if (this.creditSavedCard()) {
var brand = this.creditSavedCard();
self.getInstallmentsByBrand(brand);
var cards = window.checkoutConfig.payment.mundipagg_creditcard.cards;

for (var i = 0; i < cards.length; i++) {
if (cards[i].id == this.creditSavedCard()) {
self.getInstallmentsByBrand(cards[i].brand);
break
}
}
}
this.creditCardType.subscribe(function (brand) {
self.getInstallmentsByBrand(brand);
Expand Down

0 comments on commit 1c5e140

Please sign in to comment.