alma / alma-monthlypayments-magento2

Magento 2 Payment Gateway integration for Alma
Other
6 stars 9 forks source link

fix: change selectPaymentMethod name and call default method #110

Closed Francois-Gomis closed 1 year ago

Francois-Gomis commented 1 year ago

Reason for change

Bug on checkout

Linear task

Code changes

How to test

Select another payment method in first and after select Alma. Alma payment method doesn't work fine - no call to set-payment-method in network and no open description.

As a reviewer, you are encouraged to test the PR locally.

Checklist for authors and reviewers

Non applicable

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

danielgoodwin97 commented 1 year ago

For the record, this is the goofiest possible way you could've fixed this.

When overwriting a method and you still want it to perform it's previous action, call this._super(); at the top of the method, then add your additional code.

This could have been fixed in one line:

            selectPaymentMethod : function() {
                this._super();
                self.unMountInPage();
                const currentPaymentMethod = self.checkedPaymentMethod();
                if( self.lastSelectedPlan()[currentPaymentMethod].inPageAllowed) {
                    self.selectInstallments(self.lastSelectedPlan()[currentPaymentMethod]);
                }
                return true;
            },