Skip to content
Snippets Groups Projects
Commit 49ea803c authored by Gundo Sifhufhi's avatar Gundo Sifhufhi
Browse files

Frontend rules

parent aa37da10
Branches
Tags
No related merge requests found
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*global define*/
define(
[],
function () {
"use strict";
return {
getRules: function() {
return {
};
}
};
}
);
\ No newline at end of file
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*global define*/
define(
[
'jquery',
'mageUtils',
'./shipping-rates-validation-rules',
'mage/translate'
],
function ($, utils, validationRules, $t) {
"use strict";
return {
validationErrors: [],
validate: function(address) {
var self = this;
this.validationErrors = [];
$.each(validationRules.getRules(), function(field, rule) {
if (rule.required && utils.isEmpty(address[field])) {
var message = $t('Field ') + field + $t(' is required.');
self.validationErrors.push(message);
}
});
return !Boolean(this.validationErrors.length);
}
};
}
);
\ No newline at end of file
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'uiComponent',
'Magento_Checkout/js/model/shipping-rates-validator',
'Magento_Checkout/js/model/shipping-rates-validation-rules',
'../model/shipping-rates-validator',
'../model/shipping-rates-validation-rules'
],
function (
Component,
defaultShippingRatesValidator,
defaultShippingRatesValidationRules,
sampleShippingProviderShippingRatesValidator,
sampleShippingProviderShippingRatesValidationRules
) {
"use strict";
defaultShippingRatesValidator.registerValidator('uafrica', sampleShippingProviderShippingRatesValidator);
defaultShippingRatesValidationRules.registerRules('uafrica', sampleShippingProviderShippingRatesValidationRules);
return Component;
}
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment