Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 69080f9

Browse files
Merge remote-tracking branch 'jackalopes/MAGETWO-71706-paypal' into BundledPR-Sep7b
2 parents b506ca4 + e63ab12 commit 69080f9

File tree

2 files changed

+154
-147
lines changed

2 files changed

+154
-147
lines changed

app/code/Magento/Paypal/Model/AbstractConfig.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ abstract class AbstractConfig implements ConfigInterface
6161
*/
6262
private static $bnCode = 'Magento_Cart_%s';
6363

64+
/**
65+
* @var \Magento\Framework\App\Config\ScopeConfigInterface
66+
*/
67+
protected $_scopeConfig;
68+
6469
/**
6570
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
6671
*/

app/code/Magento/Paypal/view/adminhtml/web/js/rules.js

Lines changed: 149 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -16,177 +16,179 @@ define([
1616
* @returns {Boolean}
1717
*/
1818
var isSolutionEnabled = function (solution, enabler) {
19-
return solution.find(enabler).val() === '1';
20-
},
19+
return solution.find(enabler).val() === '1';
20+
},
2121

22-
/**
23-
* Check is solution has related solutions enabled
24-
*
25-
* @param {Object} data
26-
* @returns {Boolean}
27-
*/
28-
hasRelationsEnabled = function (data) {
29-
var name;
22+
/**
23+
* Check is solution has related solutions enabled
24+
*
25+
* @param {Object} data
26+
* @returns {Boolean}
27+
*/
28+
hasRelationsEnabled = function (data) {
29+
var name;
3030

31-
for (name in data.argument) {
32-
if (
33-
data.solutionsElements[name] &&
34-
isSolutionEnabled(data.solutionsElements[name], data.enableButton)
35-
) {
36-
return true;
31+
for (name in data.argument) {
32+
if (
33+
data.solutionsElements[name] &&
34+
isSolutionEnabled(data.solutionsElements[name], data.enableButton)
35+
) {
36+
return true;
37+
}
3738
}
38-
}
3939

40-
return false;
41-
},
40+
return false;
41+
},
4242

43-
/**
44-
* Set solution select-enabler to certain option
45-
*
46-
* @param {*} solution
47-
* @param {String} enabler
48-
* @param {Boolean} enabled
49-
*/
50-
setSolutionSelectEnabled = function (solution, enabler, enabled) {
51-
enabled = !(enabled || typeof enabled === 'undefined') ? '0' : '1';
43+
/**
44+
* Set solution select-enabler to certain option
45+
*
46+
* @param {*} solution
47+
* @param {String} enabler
48+
* @param {Boolean} enabled
49+
*/
50+
setSolutionSelectEnabled = function (solution, enabler, enabled) {
51+
enabled = !(enabled || typeof enabled === 'undefined') ? '0' : '1';
5252

53-
solution.find(enabler + ' option[value=' + enabled + ']')
53+
solution.find(enabler + ' option[value=' + enabled + ']')
5454
.prop('selected', true);
55-
},
55+
},
5656

57-
/**
58-
* Set solution property 'disabled' value
59-
*
60-
* @param {*} solution
61-
* @param {String} enabler
62-
* @param {Boolean} enabled
63-
*/
64-
setSolutionPropEnabled = function (solution, enabler, enabled) {
65-
enabled = !(enabled || typeof enabled === 'undefined');
57+
/**
58+
* Set solution property 'disabled' value
59+
*
60+
* @param {*} solution
61+
* @param {String} enabler
62+
* @param {Boolean} enabled
63+
*/
64+
setSolutionPropEnabled = function (solution, enabler, enabled) {
65+
enabled = !(enabled || typeof enabled === 'undefined');
6666

67-
solution.find(enabler).prop('disabled', enabled);
68-
},
67+
solution.find(enabler).prop('disabled', enabled);
68+
},
6969

70-
/**
71-
* Set/unset solution select-enabler label
72-
*
73-
* @param {*} solution
74-
* @param {String} enabler
75-
* @param {Boolean} enabled
76-
*/
77-
setSolutionMarkEnabled = function (solution, enabler, enabled) {
78-
var solutionEnabler = solution.find('label[for="' + solution.find(enabler).attr('id') + '"]');
70+
/**
71+
* Set/unset solution select-enabler label
72+
*
73+
* @param {*} solution
74+
* @param {String} enabler
75+
* @param {Boolean} enabled
76+
*/
77+
setSolutionMarkEnabled = function (solution, enabler, enabled) {
78+
var solutionEnabler = solution.find('label[for="' + solution.find(enabler).attr('id') + '"]');
7979

80-
enabled || typeof enabled === 'undefined' ?
81-
solutionEnabler.addClass('enabled') :
82-
solutionEnabler.removeClass('enabled');
83-
},
80+
enabled || typeof enabled === 'undefined' ?
81+
solutionEnabler.addClass('enabled') :
82+
solutionEnabler.removeClass('enabled');
83+
},
8484

85-
/**
86-
* Set/unset solution section label
87-
*
88-
* @param {*} solution
89-
* @param {Boolean} enabled
90-
*/
91-
setSolutionSectionMarkEnabled = function (solution, enabled) {
92-
var solutionSection = solution.find('.section-config');
85+
/**
86+
* Set/unset solution section label
87+
*
88+
* @param {*} solution
89+
* @param {Boolean} enabled
90+
*/
91+
setSolutionSectionMarkEnabled = function (solution, enabled) {
92+
var solutionSection = solution.find('.section-config');
9393

94-
enabled || typeof enabled === 'undefined' ?
95-
solutionSection.addClass('enabled') :
96-
solutionSection.removeClass('enabled');
97-
},
94+
enabled || typeof enabled === 'undefined' ?
95+
solutionSection.addClass('enabled') :
96+
solutionSection.removeClass('enabled');
97+
},
9898

99-
/**
100-
* Set/unset solution section inner labels
101-
*
102-
* @param {*} solution
103-
* @param {Boolean} enabled
104-
*/
105-
setSolutionLabelsMarkEnabled = function (solution, enabled) {
106-
var solutionLabels = solution.find('label.enabled');
99+
/**
100+
* Set/unset solution section inner labels
101+
*
102+
* @param {*} solution
103+
* @param {Boolean} enabled
104+
*/
105+
setSolutionLabelsMarkEnabled = function (solution, enabled) {
106+
var solutionLabels = solution.find('label.enabled');
107107

108-
enabled || typeof enabled === 'undefined' ?
109-
solutionLabels.addClass('enabled') :
110-
solutionLabels.removeClass('enabled');
111-
},
108+
enabled || typeof enabled === 'undefined' ?
109+
solutionLabels.addClass('enabled') :
110+
solutionLabels.removeClass('enabled');
111+
},
112112

113-
/**
114-
* Set solution as disabled
115-
*
116-
* @param {*} solution
117-
* @param {String} enabler
118-
*/
119-
disableSolution = function (solution, enabler) {
120-
setSolutionMarkEnabled(solution, enabler, false);
121-
setSolutionSelectEnabled(solution, enabler, false);
122-
setSolutionPropEnabled(solution, enabler, false);
123-
},
113+
/**
114+
* Set/unset solution usedefault checkbox
115+
*
116+
* @param {*} solution
117+
* @param {String} enabler
118+
* @param {Boolean} checked
119+
*/
120+
setSolutionUsedefaultEnabled = function (solution, enabler, checked) {
121+
checked = !(checked || typeof checked === 'undefined');
124122

125-
/**
126-
* Set solution as enabled
127-
*
128-
* @param {*} solution
129-
* @param {String} enabler
130-
*/
131-
enableSolution = function (solution, enabler) {
132-
setSolutionPropEnabled(solution, enabler);
133-
setSolutionSelectEnabled(solution, enabler);
134-
setSolutionMarkEnabled(solution, enabler);
135-
},
123+
solution.find('input[id="' + solution.find(enabler).attr('id') + '_inherit"]')
124+
.prop('checked', checked);
125+
},
136126

137-
/**
138-
* Lock/unlock solution configuration button
139-
*
140-
* @param {*} solution
141-
* @param {String} buttonConfiguration
142-
* @param {Boolean} unlock
143-
*/
144-
setSolutionConfigurationUnlock = function (solution, buttonConfiguration, unlock) {
145-
var solutionConfiguration = solution.find(buttonConfiguration);
127+
/**
128+
* Set solution as disabled
129+
*
130+
* @param {*} solution
131+
* @param {String} enabler
132+
*/
133+
disableSolution = function (solution, enabler) {
134+
setSolutionUsedefaultEnabled(solution, enabler);
135+
setSolutionMarkEnabled(solution, enabler, false);
136+
setSolutionSelectEnabled(solution, enabler, false);
137+
setSolutionPropEnabled(solution, enabler, false);
138+
},
146139

147-
unlock || typeof unlock === 'undefined' ?
148-
solutionConfiguration.removeClass('disabled').removeAttr('disabled') :
149-
solutionConfiguration.addClass('disabled').attr('disabled', 'disabled');
150-
},
140+
/**
141+
* Set solution as enabled
142+
*
143+
* @param {*} solution
144+
* @param {String} enabler
145+
*/
146+
enableSolution = function (solution, enabler) {
147+
setSolutionUsedefaultEnabled(solution, enabler);
148+
setSolutionPropEnabled(solution, enabler);
149+
setSolutionSelectEnabled(solution, enabler);
150+
setSolutionMarkEnabled(solution, enabler);
151+
},
151152

152-
/**
153-
* Set/unset solution usedefault checkbox
154-
*
155-
* @param {*} solution
156-
* @param {String} enabler
157-
* @param {Boolean} checked
158-
*/
159-
setSolutionUsedefaultEnabled = function (solution, enabler, checked) {
160-
checked = !(checked || typeof checked === 'undefined');
153+
/**
154+
* Lock/unlock solution configuration button
155+
*
156+
* @param {*} solution
157+
* @param {String} buttonConfiguration
158+
* @param {Boolean} unlock
159+
*/
160+
setSolutionConfigurationUnlock = function (solution, buttonConfiguration, unlock) {
161+
var solutionConfiguration = solution.find(buttonConfiguration);
161162

162-
solution.find('input[id="' + solution.find(enabler).attr('id') + '_inherit"]')
163-
.prop('checked', checked);
164-
},
163+
unlock || typeof unlock === 'undefined' ?
164+
solutionConfiguration.removeClass('disabled').removeAttr('disabled') :
165+
solutionConfiguration.addClass('disabled').attr('disabled', 'disabled');
166+
},
165167

166-
/**
167-
* Forward solution select-enabler changes
168-
*
169-
* @param {*} solution
170-
* @param {String} enabler
171-
*/
172-
forwardSolutionChange = function (solution, enabler) {
173-
solution.find(enabler).change();
174-
},
168+
/**
169+
* Forward solution select-enabler changes
170+
*
171+
* @param {*} solution
172+
* @param {String} enabler
173+
*/
174+
forwardSolutionChange = function (solution, enabler) {
175+
solution.find(enabler).change();
176+
},
175177

176-
/**
177-
* Show/hide dependent fields
178-
*
179-
* @param {*} solution
180-
* @param {String} identifier
181-
* @param {Boolean} show
182-
*/
183-
showDependsField = function (solution, identifier, show) {
184-
show = show || typeof show === 'undefined';
178+
/**
179+
* Show/hide dependent fields
180+
*
181+
* @param {*} solution
182+
* @param {String} identifier
183+
* @param {Boolean} show
184+
*/
185+
showDependsField = function (solution, identifier, show) {
186+
show = show || typeof show === 'undefined';
185187

186-
solution.find(identifier).toggle(show);
187-
solution.find(identifier).closest('tr').toggle(show);
188-
solution.find(identifier).attr('disabled', !show);
189-
};
188+
solution.find(identifier).toggle(show);
189+
solution.find(identifier).closest('tr').toggle(show);
190+
solution.find(identifier).attr('disabled', !show);
191+
};
190192

191193
return Class.extend({
192194
defaults: {

0 commit comments

Comments
 (0)