Sajitha Poduval (Deactivated)
Prerequisite for building new control.
...
- GET service call method should be control leve level with parameters and should have deferred object handling.
example:eb_billingShippingAddress.createAddressRecord = function (data, personId) {
var defer = jQuery.Deferred();
console.info('create address record...');if (!personId || personId <= 0) {
throw { type: "argument_null", message: "personId property is required.", stack: Error().stack };
}
if (!data) {
throw { data: "argument_null", message: "data property is required.", stack: Error().stack };
}
var service = eb_billingShippingAddress.newAddressService.replace("{personId}", personId);$.ajax({
url: service,
crossDomain: true,
type: "POST",
data: data,
xhrFields: {
withCredentials: true
}
}).done(function (result) {
defer.resolve(result);
}).fail(defer.reject);
return defer.promise();
}; - PATCH service call method should be control leve control level with parameters and should have deferred object handling.
example:eb_billingShippingAddress.updateProfileAddressRecord = function (data, addressName, personId) {
var defer = jQuery.Deferred();
if (!personId || personId <= 0) {
throw { type: "argument_null", message: "personId property is required.", stack: Error().stack };
}if (!addressName) {
throw { type: "argument_null", message: "addressName property is required.", stack: Error().stack };
}if (!data) {
throw { data: "argument_null", message: "data property is required.", stack: Error().stack };
}console.info('update address...');
var service = eb_billingShippingAddress.updateProfileAddressService.replace("{personId}", personId).replace("{addressName}", addressName);
$.ajax({
url: service,
type: "PATCH",
contentType: "application/json",
data: JSON.stringify(data),
xhrFields: {
withCredentials: true
}
}).done(function (result) {
defer.resolve(result);
}).fail(defer.reject);
return defer.promise();
}; - POST service call method should be control leve control level with parameters and should have deferred object handling.
example:eb_billingShippingAddress.createAddressRecord = function (data, personId) {
var defer = jQuery.Deferred();
console.info('create address record...');if (!personId || personId <= 0) {
throw { type: "argument_null", message: "personId property is required.", stack: Error().stack };
}
if (!data) {
throw { data: "argument_null", message: "data property is required.", stack: Error().stack };
}
var service = eb_billingShippingAddress.newAddressService.replace("{personId}", personId);$.ajax({
url: service,
crossDomain: true,
type: "POST",
data: data,
xhrFields: {
withCredentials: true
}
}).done(function (result) {
defer.resolve(result);
}).fail(defer.reject);
return defer.promise();
};
- DELETE service call method should be control leve control level with parameters and should have deferred object handling.
example:eb_billingShippingAddress.deletePersonAddressRecord = function (addressName, personId) {
var defer = jQuery.Deferred();
if (!personId || personId <= 0) {
throw { type: "argument_null", message: "personId property is required.", stack: Error().stack };
}if (!addressName) {
throw { type: "argument_null", message: "addressName property is required.", stack: Error().stack };
}console.info('delete address...');
var service = eb_billingShippingAddress.deletePersonAddressService.replace("{personId}", personId).replace("{addressName}", addressName);$.ajax({
url: service,
type: "DELETE",
xhrFields: {
withCredentials: true
}
}).done(function (result) {
defer.resolve(result);
}).fail(defer.reject);
return defer.promise();
};
...