Merge branch 'master' into package-details
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import moment from 'moment';
|
||||
import {fromWiaasProcessStep} from './ProcessHelper';
|
||||
|
||||
function formatDate(date) {
|
||||
return date ? moment(date).format("Do MMM, YYYY") : undefined;
|
||||
@@ -9,6 +10,10 @@ function formatAddress(addressObject) {
|
||||
}
|
||||
|
||||
export const fromWCOrder = (WCOrder) => {
|
||||
let processInfo = Object.assign({},WCOrder['delivery-process']);
|
||||
if (WCOrder['delivery-process']){
|
||||
processInfo.steps = WCOrder['delivery-process'].steps.map(step=>fromWiaasProcessStep(step));
|
||||
}
|
||||
return {
|
||||
id: WCOrder.id,
|
||||
number: WCOrder.number,
|
||||
@@ -22,6 +27,12 @@ export const fromWCOrder = (WCOrder) => {
|
||||
recurringPrice: 0,
|
||||
status: WCOrder.status,
|
||||
currency: WCOrder.currency,
|
||||
billing:{
|
||||
firstName: WCOrder.billing.first_name,
|
||||
lastName: WCOrder.billing.last_name,
|
||||
email: WCOrder.billing.email,
|
||||
address: formatAddress(WCOrder.billing)
|
||||
},
|
||||
packages: WCOrder['line_items'].map(packageLine => {
|
||||
return {
|
||||
id: packageLine['product_id'],
|
||||
@@ -48,6 +59,14 @@ export const fromWCOrder = (WCOrder) => {
|
||||
})),
|
||||
};
|
||||
}),
|
||||
process: processInfo,
|
||||
comments: WCOrder.comments ? WCOrder.comments.map(comment => ({
|
||||
id: comment.id,
|
||||
comment: comment.content,
|
||||
username: comment.username,
|
||||
dateCreated: formatDate(comment.date),
|
||||
isOwner: comment['is_owner']
|
||||
})) : [],
|
||||
deliveryAddress: formatAddress(WCOrder.shipping),
|
||||
customer: WCOrder.customer,
|
||||
commercialLead: WCOrder['commercial_lead'],
|
||||
|
||||
Reference in New Issue
Block a user