...
| | |
---|
Description | returns all credit cards | |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | none | |
Query Parameters | none
| |
Headers | none
| |
Receives Json | none | |
Returns Json | Array of CreditCard objects | The card number is not returned (only a mask) |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.getCreditCards = function (options) {
options = options || {};
var creditCards = [];
jQuery.ajax({
url: '/rest/myaccount/creditCards',
type: 'get',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json'
}).done(function (result) {
creditCards = result;
if (options.success) {
options.success(creditCards);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return creditCards;
}; |
|
...
| | |
---|
Description | returns a credit card record | |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | id | credit card identifier (not card number) |
Query Parameters | none
| |
Headers | none
| |
Receives Json | none | |
Returns Json | CreditCard object | The card number is not returned (only a mask) |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.getCreditCard = function (id, options) {
options = options || {};
var creditCard = null;
jQuery.ajax({
url: '/rest/myaccount/creditCards/' + id,
type: 'get',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json'
}).done(function (result) {
creditCard = result;
if (options.success) {
options.success(creditCard);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return creditCard;
}; |
|
...
| | |
---|
Description | deletes a credit card | |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| Customer must be logged in to delete an address |
Path Parameters | id | credit card identifier (not card number) |
Query Parameters | none
| |
Headers | none
| |
Receives Json | none | |
Returns Json | none | 204 No Content returned on success |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.deleteCreditCard = function (creditCard, options) {
options = options || {};
jQuery.ajax({
url: '/rest/myaccount/creditCards/' + creditCard.id,
type: 'delete',
data: JSON.stringify(creditCard),
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
contentType: 'application/json; charset=UTF-8',
dataType: 'json'
}).done(function () {
if (options.success) {
options.success();
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(textStatus, errorThrown);
}
});
}; |
|
TODO:
/rest/myaccount/orders
...
/myaccount/orders/orderId (GET)
/myaccount/orders/orderId/tracking (GET)
/myaccount/orders/orderId/case (GET)
/myaccount/orders/orderId/case (POST)
/myaccount/orders/orderId/case/messages (GET)
...
| | |
---|
Description | returns orders belonging to customer | |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | none | |
Query Parameters | pageNumber pageSize search _filterTime | pagination number number of records per page (max is 10) order id, item id, or item description search term One of the following values: last30days
last6months
year-XXXX
|
Headers | Returned headers: uc-pagination-page-size uc-pagination-page-number uc-pagination-total-records uc-pagination-total-pages | page size of result set page number of result set total number of records found total number of pages found |
Receives Json | none | |
Returns Json | Array of Order objects | |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| /**
* returns back pagination of orders, the success callback will
* receive 1) orders, 2) pagination object (pageSize,pageNumber,totalRecords,totalPages)
* @param [options] success and failure callbacks, 'pageNumber' and 'pageSize'
* @return Object no callbacks specified, this returns back an object containing 'orders' and 'pagination' of orders (on success), else null
*/
this.getOrders = function (options) {
options = options || {};
var data = {};
data['pageNumber'] = options.pageNumber || '';
data['pageSize'] = options.pageSize || '';
// data['searchString'] = options.search || '';
data['_filterTime'] = options.filter || '';
var orders = [];
var pagination = {};
jQuery.ajax({
url: '/rest/myaccount/orders',
type: 'get',
data: data,
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json'
}).done(function (result, textStatus, jqXHR) {
orders = result;
pagination['pageSize'] = parseInt(jqXHR.getResponseHeader('uc-pagination-page-size'));
pagination['pageNumber'] = parseInt(jqXHR.getResponseHeader('uc-pagination-page-number'));
pagination['totalRecords'] = parseInt(jqXHR.getResponseHeader('uc-pagination-total-records'));
pagination['totalPages'] = parseInt(jqXHR.getResponseHeader('uc-pagination-total-pages'));
if (options.success) {
options.success(orders, pagination);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(textStatus, errorThrown);
}
});
return {orders: orders, pagination: pagination};
}; |
|
/rest/myaccount/orders/{orderId}
| | |
---|
Description | returns an order | |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | orderId | Order ID |
Query Parameters | none
| |
Headers | none
| |
Receives Json | none | |
Returns Json | Order object | 404 if order is not found. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.getOrder = function (orderId, options) {
options = options || {};
var order = null;
jQuery.ajax({
url: '/rest/myaccount/orders/' + orderId,
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json'
}).done(function (result) {
order = result;
if (options.success) {
options.success(order);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(textStatus, errorThrown);
}
});
return order;
}; |
|
/rest/myaccount/orders/{orderId}/tracking
| | |
---|
Description | returns an order tracking information | |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | orderId | Order ID |
Query Parameters | none
| |
Headers | none
| |
Receives Json | none | |
Returns Json | Array of OrderTracking objects | empty array if no tracking available. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.getOrderTracking = function (orderId, options) {
options = options || {};
var tracking = null;
jQuery.ajax({
url: '/rest/myaccount/orders/' + orderId + "/tracking",
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json'
}).done(function (result) {
tracking = result;
if (options.success) {
options.success(tracking);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(textStatus, errorThrown);
}
});
return tracking;
}; |
|
/rest/myaccount/orders/{orderId}/case
| | |
---|
Description | returns a case object for an order | See Case Management to better understand what a case is |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | orderId | Order ID |
Query Parameters | none
| |
Headers | none
| |
Receives Json | none | |
Returns Json | Case object | empty object (NOT a 404) if no case created yet for this object. case actions are not returned (internal use only) |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.getOrderCase = function (orderId, options) {
options = options || {};
var orderCase = null;
jQuery.ajax({
url: '/rest/myaccount/orders/' + orderId + "/case",
type: 'get',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json'
}).done(function (result) {
if (result && result.caseOid) {
orderCase = result;
}
if (options.success) {
options.success(orderCase);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return orderCase;
};
|
|
/rest/myaccount/orders/{orderId}/case
| | |
---|
Description | inserts a case object for an order | See Case Management to better understand what a case is |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | orderId | Order ID |
Query Parameters | none
| |
Headers | none
| |
Receives Json | Case Object | The case must have one and only one message. A case can't exist without customer initiated feedback. If no message is supplied, a 400 Bad Request is returned. |
Returns Json | Case object | contains record identifier as well as submitted fields. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.insertOrderCase = function (orderId, orderCase, options) {
options = options || {};
jQuery.ajax({
url: '/rest/myaccount/orders/' + orderId + "/case",
data: JSON.stringify(orderCase),
type: 'post',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json',
contentType: 'application/json; charset=UTF-8'
}).done(function (result) {
if (result) {
orderCase = result;
}
if (options.success) {
options.success(orderCase);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return orderCase;
}; |
|
/rest/myaccount/orders/{orderId}/case/messages
| | |
---|
Description | returns all messages for the case associated with an order | See Case Management to better understand what a case is |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | orderId | Order ID |
Query Parameters | none
| |
Headers | none
| |
Receives Json | none | |
Returns Json | Array of CaseMessage | if order doesn't exist, a 404 is returned. If no case exists, a 404 is returned. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.getOrderCaseMessages = function (orderId, options) {
options = options || {};
var messages = [];
jQuery.ajax({
url: '/rest/myaccount/orders/' + orderId + "/case/messages",
type: 'get',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json'
}).done(function (result) {
if (result) {
messages = result;
}
if (options.success) {
options.success(messages);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return messages;
}; |
|
/rest/myaccount/orders/{orderId}/case/messages
| | |
---|
Description | inserts a case message object for a case | See Case Management to better understand what a case is This will trigger an email to customer service. |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | orderId | Order ID |
Query Parameters | none
| |
Headers | none
| |
Receives Json | CaseMessage Object | If this order id doesn't exist, a 404 is returned. If no case exists for this order, a 400 Bad Request is returned. If no message is supplied, a 400 Bad Request is returned. |
Returns Json | Case object | contains record identifier as well as submitted fields. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.insertOrderCaseMessage = function (orderId, messageText, options) {
options = options || {};
var orderCaseMessage = {message: messageText}; // this is all that's needed to insert message.
jQuery.ajax({
url: '/rest/myaccount/orders/' + orderId + "/case/messages",
data: JSON.stringify(orderCaseMessage),
type: 'post',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json',
contentType: 'application/json; charset=UTF-8'
}).done(function (result) {
if (result) {
orderCaseMessage = result;
}
if (options.success) {
options.success(orderCaseMessage);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return orderCaseMessage;
}; |
|
TODO:
/myaccount/notReviewedYet (GET)
/myaccount/reviews (GET)
...