@@ -69,7 +69,7 @@ export const configureRequests = ({ data, path }) => {
69
69
export const configureErrors = ( errors ) => {
70
70
const env = process . env . NODE_ENV
71
71
const remainingErrors = errors
72
- . filter ( error => Object . keys ( error ) . length )
72
+ . filter ( error => error && Object . keys ( error ) . length )
73
73
. map ( error => ( {
74
74
...error ,
75
75
message : `${ error . message } (${ error . response ?. data ?. message } )` ,
@@ -186,6 +186,8 @@ export const configureFiles = (data) => {
186
186
}
187
187
188
188
export const configureDocuments = ( documents , requestIdentifier ) => {
189
+ //lineitems, shipto, shipfrom, and terms are only in SOWs
190
+ // POs will need a SOW identifier to match up and get data from the correct SOW
189
191
return documents ?. map ( document => ( {
190
192
identifier : document . identifier ,
191
193
date : normalizeDate ( document . created_at ) ,
@@ -201,16 +203,20 @@ export const configureDocuments = (documents, requestIdentifier) => {
201
203
totalPrice : document . retail_total_price_currency ,
202
204
shippingPrice : document . shipping_cost_currency ,
203
205
shipTo : {
204
- organizationName : document . ship_to . organization_name ,
205
- text : document . ship_to . text ,
206
+ organizationName : document . ship_to ? .organization_name ,
207
+ text : document . ship_to ? .text ,
206
208
} ,
207
209
shipFrom : {
208
- organizationName : document . ship_from . organization_name ,
209
- text : document . ship_from . text ,
210
+ organizationName : document . ship_from ? .organization_name ,
211
+ text : document . ship_from ? .text ,
210
212
} ,
211
213
} ) )
212
214
}
213
215
216
+ // export const configurePOs = (POs, requestIdentifier, relatedSOWIdentifier) => {
217
+
218
+ // }
219
+
214
220
const configureLineItems = ( lineItems ) => ( lineItems . map ( lineItem => ( {
215
221
id : lineItem . id ,
216
222
quantity : lineItem . quantity ,
0 commit comments