@things-factory/operato-mms 4.1.33 → 4.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js +70 -70
- package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js.map +1 -1
- package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js +70 -69
- package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js.map +1 -1
- package/package.json +5 -5
- package/server/graphql/resolvers/interface-with-hub/add-release-order.ts +73 -76
- package/server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts +73 -75
|
@@ -26,6 +26,7 @@ exports.addReleaseOrderResolver = {
|
|
|
26
26
|
'marketplaceStore'
|
|
27
27
|
]
|
|
28
28
|
});
|
|
29
|
+
const marketplaceOrderItems = marketplaceOrder.marketplaceOrderItems;
|
|
29
30
|
let marketplaceOrderShippings = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrderShipping).find({
|
|
30
31
|
where: { orderNoRef: marketplaceOrder.orderNo, domain },
|
|
31
32
|
order: { subOrderNoRef: 'ASC' },
|
|
@@ -44,7 +45,7 @@ exports.addReleaseOrderResolver = {
|
|
|
44
45
|
.getDate()
|
|
45
46
|
.toString()
|
|
46
47
|
.padStart(2, '0')}`;
|
|
47
|
-
|
|
48
|
+
var newReleaseOrder = {
|
|
48
49
|
releaseDate,
|
|
49
50
|
type: 'b2c',
|
|
50
51
|
transporter: marketplaceOrder.shippingProvider,
|
|
@@ -99,77 +100,76 @@ exports.addReleaseOrderResolver = {
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
catch (e) { }
|
|
102
|
-
var invoiceProducts = await Promise.all(newReleaseOrder.orderInventories.map(async (oi) => {
|
|
103
|
-
let product = await (0, typeorm_1.getRepository)(product_base_1.Product).findOne({
|
|
104
|
-
where: { domain, sku: oi.product.sku }
|
|
105
|
-
});
|
|
106
|
-
if (!product) {
|
|
107
|
-
product = await (0, typeorm_1.getRepository)(product_base_1.ProductBundle).findOne({
|
|
108
|
-
where: { domain, sku: oi.product.sku }
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
let mosis = marketplaceOrderShippingItems.filter(mosi => mosi.product.sku === product.sku);
|
|
112
|
-
let moi = mosis[0].marketplaceOrderItem;
|
|
113
|
-
return {
|
|
114
|
-
sku: product.sku,
|
|
115
|
-
name: product.name,
|
|
116
|
-
description: product.description,
|
|
117
|
-
product: { sku: product.sku },
|
|
118
|
-
qty: oi.releaseQty,
|
|
119
|
-
unitPrice: ((moi === null || moi === void 0 ? void 0 : moi.originalPrice) || 0) / moi.qty,
|
|
120
|
-
paidPrice: ((moi === null || moi === void 0 ? void 0 : moi.paidPrice) || 0) / moi.qty
|
|
121
|
-
};
|
|
122
|
-
}));
|
|
123
|
-
let newInvoice = {
|
|
124
|
-
invoiceProducts,
|
|
125
|
-
name: '-',
|
|
126
|
-
releaseGood: { id: releaseOrder.id, name: releaseOrder.name },
|
|
127
|
-
refNo1: newReleaseOrder.refNo.toString(),
|
|
128
|
-
refNo2: newReleaseOrder.refNo2.toString(),
|
|
129
|
-
issuedOn: new Date(),
|
|
130
|
-
from: marketplaceOrder.marketplaceStore.storeName,
|
|
131
|
-
fromContactPhone: '-',
|
|
132
|
-
fromAddress1: '-',
|
|
133
|
-
fromAddress2: null,
|
|
134
|
-
fromAddress3: null,
|
|
135
|
-
fromAddress4: null,
|
|
136
|
-
fromAddress5: null,
|
|
137
|
-
fromPostcode: null,
|
|
138
|
-
fromCity: null,
|
|
139
|
-
fromState: null,
|
|
140
|
-
fromCountry: null,
|
|
141
|
-
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
142
|
-
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
143
|
-
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
144
|
-
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
145
|
-
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
146
|
-
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
147
|
-
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
148
|
-
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
149
|
-
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
150
|
-
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
151
|
-
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
152
|
-
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
153
|
-
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
154
|
-
billingAddress1: releaseOrder.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
155
|
-
billingAddress2: null,
|
|
156
|
-
billingAddress3: null,
|
|
157
|
-
billingAddress4: null,
|
|
158
|
-
billingAddress5: null,
|
|
159
|
-
billingPostcode: '-',
|
|
160
|
-
billingCity: '-',
|
|
161
|
-
billingState: '-',
|
|
162
|
-
billingCountry: '-'
|
|
163
|
-
};
|
|
164
|
-
try {
|
|
165
|
-
await integration_fulfillment_1.FulfillmentAPI.createSalesInvoice(fulfilmentCenter, {
|
|
166
|
-
customerBizplaceId,
|
|
167
|
-
invoice: newInvoice
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
catch (e) { }
|
|
171
103
|
}
|
|
172
104
|
}
|
|
105
|
+
var invoiceProducts = await Promise.all(marketplaceOrderItems.map(async (mi) => {
|
|
106
|
+
let product = await (0, typeorm_1.getRepository)(product_base_1.Product).findOne({
|
|
107
|
+
where: { domain, sku: mi.marketplaceProductVariation.sku }
|
|
108
|
+
});
|
|
109
|
+
let productBundle;
|
|
110
|
+
if (!product) {
|
|
111
|
+
productBundle = await (0, typeorm_1.getRepository)(product_base_1.ProductBundle).findOne({
|
|
112
|
+
where: { domain, sku: mi.marketplaceProductVariation.sku }
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
sku: product ? product.sku : productBundle.sku,
|
|
117
|
+
name: product ? product.name : productBundle.name,
|
|
118
|
+
description: product ? product.description : productBundle.description,
|
|
119
|
+
qty: mi.qty,
|
|
120
|
+
unitPrice: ((mi === null || mi === void 0 ? void 0 : mi.originalPrice) || 0) / mi.qty,
|
|
121
|
+
paidPrice: ((mi === null || mi === void 0 ? void 0 : mi.paidPrice) || 0) / mi.qty,
|
|
122
|
+
discount: (mi === null || mi === void 0 ? void 0 : mi.discount) || 0,
|
|
123
|
+
shippingFeePaidByCustomer: (mi === null || mi === void 0 ? void 0 : mi.shippingFeePaidByCustomer) || 0
|
|
124
|
+
};
|
|
125
|
+
}));
|
|
126
|
+
let newInvoice = {
|
|
127
|
+
invoiceProducts,
|
|
128
|
+
name: '-',
|
|
129
|
+
refNo1: newReleaseOrder.refNo.toString(),
|
|
130
|
+
refNo2: newReleaseOrder.refNo2.toString(),
|
|
131
|
+
issuedOn: new Date(),
|
|
132
|
+
from: marketplaceOrder.marketplaceStore.storeName,
|
|
133
|
+
fromContactPhone: '-',
|
|
134
|
+
fromAddress1: '-',
|
|
135
|
+
fromAddress2: null,
|
|
136
|
+
fromAddress3: null,
|
|
137
|
+
fromAddress4: null,
|
|
138
|
+
fromAddress5: null,
|
|
139
|
+
fromPostcode: null,
|
|
140
|
+
fromCity: null,
|
|
141
|
+
fromState: null,
|
|
142
|
+
fromCountry: null,
|
|
143
|
+
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
144
|
+
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
145
|
+
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
146
|
+
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
147
|
+
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
148
|
+
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
149
|
+
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
150
|
+
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
151
|
+
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
152
|
+
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
153
|
+
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
154
|
+
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
155
|
+
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
156
|
+
billingAddress1: newReleaseOrder.deliverTo.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
157
|
+
billingAddress2: null,
|
|
158
|
+
billingAddress3: null,
|
|
159
|
+
billingAddress4: null,
|
|
160
|
+
billingAddress5: null,
|
|
161
|
+
billingPostcode: '-',
|
|
162
|
+
billingCity: '-',
|
|
163
|
+
billingState: '-',
|
|
164
|
+
billingCountry: '-'
|
|
165
|
+
};
|
|
166
|
+
try {
|
|
167
|
+
await integration_fulfillment_1.FulfillmentAPI.createSalesInvoice(fulfilmentCenter, {
|
|
168
|
+
customerBizplaceId,
|
|
169
|
+
invoice: newInvoice
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (e) { }
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/add-release-order.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,uDAAyE;AACzE,qFAA2F;AAC3F,uEAKyC;AACzC,+DAAqE;AACrE,iDAA8C;AAEjC,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,eAAe,CACnB,CAAO,EACP,EAAE,mBAAmB,EAAE,WAAW,EAAqD,EACvF,OAAY;QAEZ,MAAM,EAAE,MAAM,EAAE,GAAuB,OAAO,C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,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,yBAAyB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACzD,IAAI,wBAAwB,GAA6B,yBAAyB,CAAC,CAAC,CAAC,CAAA;gBACrF,IAAI,6BAA6B,GAC/B,wBAAwB,CAAC,6BAA6B,CAAA;gBAExD,IAAI,CAAC,CAAA,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,cAAc,CAAA,EAAE;oBAC7C,MAAM,IAAI,GAAS,IAAI,IAAI,EAAE,CAAA;oBAC7B,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,IAAI;yBACnG,OAAO,EAAE;yBACT,QAAQ,EAAE;yBACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;oBAErB,
|
|
1
|
+
{"version":3,"file":"add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/add-release-order.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,uDAAyE;AACzE,qFAA2F;AAC3F,uEAKyC;AACzC,+DAAqE;AACrE,iDAA8C;AAEjC,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,eAAe,CACnB,CAAO,EACP,EAAE,mBAAmB,EAAE,WAAW,EAAqD,EACvF,OAAY;QAEZ,MAAM,EAAE,MAAM,EAAE,GAAuB,OAAO,CAAC,KAAK,CAAA;QAEpD,MAAM,gBAAgB,GAAsB,MAAM,wCAAc,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAA;QAClG,MAAM,QAAQ,GAAW,gBAAgB,CAAC,QAAQ,CAAA;QAElD,IAAI,eAAe,GAAW,MAAM,IAAA,uBAAa,EAAC,cAAM,CAAC,CAAC,OAAO,CAAC,EAAE,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erBizplace => customerBizplace.company.domain.id === domain.id).id;
|
|
32
32
|
for (var i = 0; i < marketplaceOrders.length; i++) {
|
|
33
33
|
const marketplaceOrder = marketplaceOrders[i];
|
|
34
|
+
const marketplaceOrderItems = marketplaceOrder.marketplaceOrderItems;
|
|
34
35
|
const marketplaceOrderShippings = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrderShipping).find({
|
|
35
36
|
where: { orderNoRef: marketplaceOrder.orderNo, domain },
|
|
36
37
|
order: { subOrderNoRef: 'ASC' },
|
|
@@ -49,7 +50,7 @@ exports.autoAddReleaseOrderResolver = {
|
|
|
49
50
|
.getDate()
|
|
50
51
|
.toString()
|
|
51
52
|
.padStart(2, '0')}`;
|
|
52
|
-
|
|
53
|
+
var newReleaseOrder = {
|
|
53
54
|
releaseDate,
|
|
54
55
|
type: 'b2c',
|
|
55
56
|
transporter: marketplaceOrder.shippingProvider,
|
|
@@ -104,76 +105,76 @@ exports.autoAddReleaseOrderResolver = {
|
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
catch (e) { }
|
|
107
|
-
var invoiceProducts = await Promise.all(newReleaseOrder.orderInventories.map(async (oi) => {
|
|
108
|
-
let product = await (0, typeorm_1.getRepository)(product_base_1.Product).findOne({
|
|
109
|
-
where: { domain, sku: oi.product.sku }
|
|
110
|
-
});
|
|
111
|
-
if (!product) {
|
|
112
|
-
product = await (0, typeorm_1.getRepository)(product_base_1.ProductBundle).findOne({
|
|
113
|
-
where: { domain, sku: oi.product.sku }
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
let mosis = marketplaceOrderShippingItems.filter(mosi => mosi.product.sku === product.sku);
|
|
117
|
-
let moi = mosis[0].marketplaceOrderItem;
|
|
118
|
-
return {
|
|
119
|
-
sku: product.sku,
|
|
120
|
-
name: product.name,
|
|
121
|
-
description: product.description,
|
|
122
|
-
product: { sku: product.sku },
|
|
123
|
-
qty: oi.releaseQty,
|
|
124
|
-
unitPrice: ((moi === null || moi === void 0 ? void 0 : moi.originalPrice) || 0) / moi.qty,
|
|
125
|
-
paidPrice: ((moi === null || moi === void 0 ? void 0 : moi.paidPrice) || 0) / moi.qty
|
|
126
|
-
};
|
|
127
|
-
}));
|
|
128
|
-
let newInvoice = {
|
|
129
|
-
invoiceProducts,
|
|
130
|
-
releaseGood: { id: releaseOrder.id, name: releaseOrder.name },
|
|
131
|
-
refNo1: newReleaseOrder.refNo.toString(),
|
|
132
|
-
refNo2: newReleaseOrder.refNo2.toString(),
|
|
133
|
-
issuedOn: new Date(),
|
|
134
|
-
from: marketplaceOrder.marketplaceStore.storeName,
|
|
135
|
-
fromContactPhone: '-',
|
|
136
|
-
fromAddress1: '-',
|
|
137
|
-
fromAddress2: null,
|
|
138
|
-
fromAddress3: null,
|
|
139
|
-
fromAddress4: null,
|
|
140
|
-
fromAddress5: null,
|
|
141
|
-
fromPostcode: null,
|
|
142
|
-
fromCity: null,
|
|
143
|
-
fromState: null,
|
|
144
|
-
fromCountry: null,
|
|
145
|
-
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
146
|
-
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
147
|
-
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
148
|
-
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
149
|
-
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
150
|
-
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
151
|
-
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
152
|
-
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
153
|
-
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
154
|
-
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
155
|
-
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
156
|
-
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
157
|
-
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
158
|
-
billingAddress1: releaseOrder.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
159
|
-
billingAddress2: null,
|
|
160
|
-
billingAddress3: null,
|
|
161
|
-
billingAddress4: null,
|
|
162
|
-
billingAddress5: null,
|
|
163
|
-
billingPostcode: '-',
|
|
164
|
-
billingCity: '-',
|
|
165
|
-
billingState: '-',
|
|
166
|
-
billingCountry: '-'
|
|
167
|
-
};
|
|
168
|
-
try {
|
|
169
|
-
await integration_fulfillment_1.FulfillmentAPI.createSalesInvoice(fulfilmentCenter, {
|
|
170
|
-
customerBizplaceId,
|
|
171
|
-
invoice: newInvoice
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
catch (e) { }
|
|
175
108
|
}
|
|
176
109
|
}
|
|
110
|
+
var invoiceProducts = await Promise.all(marketplaceOrderItems.map(async (mi) => {
|
|
111
|
+
let product = await (0, typeorm_1.getRepository)(product_base_1.Product).findOne({
|
|
112
|
+
where: { domain, sku: mi.marketplaceProductVariation.sku }
|
|
113
|
+
});
|
|
114
|
+
let productBundle;
|
|
115
|
+
if (!product) {
|
|
116
|
+
productBundle = await (0, typeorm_1.getRepository)(product_base_1.ProductBundle).findOne({
|
|
117
|
+
where: { domain, sku: mi.marketplaceProductVariation.sku }
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
sku: product ? product.sku : productBundle.sku,
|
|
122
|
+
name: product ? product.name : productBundle.name,
|
|
123
|
+
description: product ? product.description : productBundle.description,
|
|
124
|
+
qty: mi.qty,
|
|
125
|
+
unitPrice: ((mi === null || mi === void 0 ? void 0 : mi.originalPrice) || 0) / mi.qty,
|
|
126
|
+
paidPrice: ((mi === null || mi === void 0 ? void 0 : mi.paidPrice) || 0) / mi.qty,
|
|
127
|
+
discount: (mi === null || mi === void 0 ? void 0 : mi.discount) || 0,
|
|
128
|
+
shippingFeePaidByCustomer: (mi === null || mi === void 0 ? void 0 : mi.shippingFeePaidByCustomer) || 0
|
|
129
|
+
};
|
|
130
|
+
}));
|
|
131
|
+
let newInvoice = {
|
|
132
|
+
invoiceProducts,
|
|
133
|
+
name: '-',
|
|
134
|
+
refNo1: newReleaseOrder.refNo.toString(),
|
|
135
|
+
refNo2: newReleaseOrder.refNo2.toString(),
|
|
136
|
+
issuedOn: new Date(),
|
|
137
|
+
from: marketplaceOrder.marketplaceStore.storeName,
|
|
138
|
+
fromContactPhone: '-',
|
|
139
|
+
fromAddress1: '-',
|
|
140
|
+
fromAddress2: null,
|
|
141
|
+
fromAddress3: null,
|
|
142
|
+
fromAddress4: null,
|
|
143
|
+
fromAddress5: null,
|
|
144
|
+
fromPostcode: null,
|
|
145
|
+
fromCity: null,
|
|
146
|
+
fromState: null,
|
|
147
|
+
fromCountry: null,
|
|
148
|
+
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
149
|
+
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
150
|
+
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
151
|
+
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
152
|
+
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
153
|
+
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
154
|
+
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
155
|
+
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
156
|
+
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
157
|
+
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
158
|
+
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
159
|
+
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
160
|
+
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
161
|
+
billingAddress1: newReleaseOrder.deliverTo.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
162
|
+
billingAddress2: null,
|
|
163
|
+
billingAddress3: null,
|
|
164
|
+
billingAddress4: null,
|
|
165
|
+
billingAddress5: null,
|
|
166
|
+
billingPostcode: '-',
|
|
167
|
+
billingCity: '-',
|
|
168
|
+
billingState: '-',
|
|
169
|
+
billingCountry: '-'
|
|
170
|
+
};
|
|
171
|
+
try {
|
|
172
|
+
await integration_fulfillment_1.FulfillmentAPI.createSalesInvoice(fulfilmentCenter, {
|
|
173
|
+
customerBizplaceId,
|
|
174
|
+
invoice: newInvoice
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
catch (e) { }
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts"],"names":[],"mappings":";;;AAAA,qCAA+E;AAE/E,uDAAyE;AACzE,qFAAwE;AACxE,uEAKyC;AACzC,+DAAqE;AACrE,iDAA8C;AAEjC,QAAA,2BAA2B,GAAG;IACzC,KAAK,CAAC,mBAAmB,CAAC,CAAO,EAAE,EAAE,WAAW,EAA2B,EAAE,OAAY;QACvF,MAAM,EAAE,MAAM,EAAE,GAAuB,OAAO,CAAC,KAAK,CAAA;QAEpD,MAAM,EAAE,GAAyC,IAAA,4BAAkB,EAAC,mCAAgB,EAAE,IAAI,CAAC,CAAA;QAC3F,MAAM,iBAAiB,GAAuB,MAAM,EAAE;aACnD,iBAAiB,CAAC,0BAA0B,EAAE,KAAK,CAAC;aACpD,iBAAiB,CAAC,mCAAmC,EAAE,MAAM,CAAC;aAC9D,iBAAiB,CAAC,+BAA+B,EAAE,KAAK,CAAC;aACzD,iBAAiB,CAAC,iCAAiC,EAAE,KAAK,CAAC;aAC3D,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,CAAC;aAC/C,KAAK,CAAC,uBAAuB,EAAE,EAAE,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B,oDAAoD;oBACpD,uCAAuC;iBACxC;aACF,CAAC,CAAA;YAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,yBAAyB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACzD,IAAI,wBAAwB,GAA6B,yBAAyB,CAAC,CAAC,CAAC,CAAA;gBACrF,IAAI,6BAA6B,GAC/B,wBAAwB,CAAC,6BAA6B,CAAA;gBAExD,IAAI,CAAC,CAAA,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,cAAc,CAAA,EAAE;oBAC7C,MAAM,IAAI,GAAS,IAAI,IAAI,EAAE,CAAA;oBAC7B,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,IAAI;yBACnG,OAAO,EAAE;yBACT,QAAQ,EAAE;yBACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAA;oBAErB,
|
|
1
|
+
{"version":3,"file":"auto-add-release-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts"],"names":[],"mappings":";;;AAAA,qCAA+E;AAE/E,uDAAyE;AACzE,qFAAwE;AACxE,uEAKyC;AACzC,+DAAqE;AACrE,iDAA8C;AAEjC,QAAA,2BAA2B,GAAG;IACzC,KAAK,CAAC,mBAAmB,CAAC,CAAO,EAAE,EAAE,WAAW,EAA2B,EAAE,OAAY;QACvF,MAAM,EAAE,MAAM,EAAE,GAAuB,OAAO,CAAC,KAAK,CAAA;QAEpD,MAAM,EAAE,GAAyC,IAAA,4BAAkB,EAAC,mCAAgB,EAAE,IAAI,CAAC,CAAA;QAC3F,MAAM,iBAAiB,GAAuB,MAAM,EAAE;aACnD,iBAAiB,CAAC,0BAA0B,EAAE,KAAK,CAAC;aAC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CAAC,gBAAgB,IAAI,GAAG;gBAC9G,eAAe,EAAE,IAAI;gBACrB,eAAe,EAAE,IAAI;gBACrB,eAAe,EAAE,IAAI;gBACrB,eAAe,EAAE,IAAI;gBACrB,eAAe,EAAE,GAAG;gBACpB,WAAW,EAAE,GAAG;gBAChB,YAAY,EAAE,GAAG;gBACjB,cAAc,EAAE,GAAG;aACpB,CAAA;YAED,IAAI;gBACF,MAAM,wCAAc,CAAC,kBAAkB,CAAC,gBAAgB,EAAE;oBACxD,kBAAkB;oBAClB,OAAO,EAAE,UAAU;iBACpB,CAAC,CAAA;aACH;YAAC,OAAO,CAAC,EAAE,GAAE;SACf;IACH,CAAC;CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-mms",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.36",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"@things-factory/integration-fulfillment": "^4.1.28",
|
|
80
80
|
"@things-factory/integration-lmd": "^4.1.28",
|
|
81
81
|
"@things-factory/lite-menu": "^4.1.28",
|
|
82
|
-
"@things-factory/marketplace-base": "^4.1.
|
|
82
|
+
"@things-factory/marketplace-base": "^4.1.36",
|
|
83
83
|
"@things-factory/more-ui": "^4.1.28",
|
|
84
84
|
"@things-factory/notification": "^4.1.28",
|
|
85
85
|
"@things-factory/oauth2-client": "^4.1.28",
|
|
86
86
|
"@things-factory/pdf": "^4.1.28",
|
|
87
|
-
"@things-factory/product-base": "^4.1.
|
|
87
|
+
"@things-factory/product-base": "^4.1.34",
|
|
88
88
|
"@things-factory/resource-ui": "^4.1.28",
|
|
89
89
|
"@things-factory/scene-data-transform": "^4.1.28",
|
|
90
90
|
"@things-factory/scene-excel": "^4.1.28",
|
|
@@ -99,11 +99,11 @@
|
|
|
99
99
|
"@things-factory/scene-visualizer": "^4.1.28",
|
|
100
100
|
"@things-factory/setting-ui": "^4.1.28",
|
|
101
101
|
"@things-factory/system-ui": "^4.1.28",
|
|
102
|
-
"@things-factory/warehouse-base": "^4.1.
|
|
102
|
+
"@things-factory/warehouse-base": "^4.1.36"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@things-factory/builder": "^4.1.28",
|
|
106
106
|
"@types/node-fetch": "^2.5.7"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "5b86caac48cdae550c7469ec25dd4c71f73b5582"
|
|
109
109
|
}
|
|
@@ -42,6 +42,8 @@ export const addReleaseOrderResolver = {
|
|
|
42
42
|
]
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
+
const marketplaceOrderItems: MarketplaceOrderItem[] = marketplaceOrder.marketplaceOrderItems
|
|
46
|
+
|
|
45
47
|
let marketplaceOrderShippings: MarketplaceOrderShipping[] = await getRepository(MarketplaceOrderShipping).find({
|
|
46
48
|
where: { orderNoRef: marketplaceOrder.orderNo, domain },
|
|
47
49
|
order: { subOrderNoRef: 'ASC' },
|
|
@@ -64,7 +66,7 @@ export const addReleaseOrderResolver = {
|
|
|
64
66
|
.toString()
|
|
65
67
|
.padStart(2, '0')}`
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
var newReleaseOrder: any = {
|
|
68
70
|
releaseDate,
|
|
69
71
|
type: 'b2c',
|
|
70
72
|
transporter: marketplaceOrder.shippingProvider,
|
|
@@ -122,87 +124,82 @@ export const addReleaseOrderResolver = {
|
|
|
122
124
|
await getRepository(MarketplaceOrder).save(marketplaceOrder)
|
|
123
125
|
}
|
|
124
126
|
} catch (e) {}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
125
129
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (!product) {
|
|
133
|
-
product = await getRepository(ProductBundle).findOne({
|
|
134
|
-
where: { domain, sku: oi.product.sku }
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
let mosis: MarketplaceOrderShippingItem[] = marketplaceOrderShippingItems.filter(
|
|
139
|
-
mosi => mosi.product.sku === product.sku
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
let moi: MarketplaceOrderItem = mosis[0].marketplaceOrderItem
|
|
130
|
+
var invoiceProducts = await Promise.all(
|
|
131
|
+
marketplaceOrderItems.map(async mi => {
|
|
132
|
+
let product: Product = await getRepository(Product).findOne({
|
|
133
|
+
where: { domain, sku: mi.marketplaceProductVariation.sku }
|
|
134
|
+
})
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
product: { sku: product.sku },
|
|
149
|
-
qty: oi.releaseQty,
|
|
150
|
-
unitPrice: (moi?.originalPrice || 0) / moi.qty,
|
|
151
|
-
paidPrice: (moi?.paidPrice || 0) / moi.qty
|
|
152
|
-
}
|
|
136
|
+
let productBundle: ProductBundle
|
|
137
|
+
if (!product) {
|
|
138
|
+
productBundle = await getRepository(ProductBundle).findOne({
|
|
139
|
+
where: { domain, sku: mi.marketplaceProductVariation.sku }
|
|
153
140
|
})
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
let newInvoice = {
|
|
157
|
-
invoiceProducts,
|
|
158
|
-
name: '-',
|
|
159
|
-
releaseGood: { id: releaseOrder.id, name: releaseOrder.name },
|
|
160
|
-
refNo1: newReleaseOrder.refNo.toString(),
|
|
161
|
-
refNo2: newReleaseOrder.refNo2.toString(),
|
|
162
|
-
issuedOn: new Date(),
|
|
163
|
-
from: marketplaceOrder.marketplaceStore.storeName,
|
|
164
|
-
fromContactPhone: '-',
|
|
165
|
-
fromAddress1: '-',
|
|
166
|
-
fromAddress2: null,
|
|
167
|
-
fromAddress3: null,
|
|
168
|
-
fromAddress4: null,
|
|
169
|
-
fromAddress5: null,
|
|
170
|
-
fromPostcode: null,
|
|
171
|
-
fromCity: null,
|
|
172
|
-
fromState: null,
|
|
173
|
-
fromCountry: null,
|
|
174
|
-
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
175
|
-
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
176
|
-
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
177
|
-
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
178
|
-
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
179
|
-
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
180
|
-
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
181
|
-
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
182
|
-
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
183
|
-
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
184
|
-
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
185
|
-
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
186
|
-
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
187
|
-
billingAddress1: releaseOrder.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
188
|
-
billingAddress2: null,
|
|
189
|
-
billingAddress3: null,
|
|
190
|
-
billingAddress4: null,
|
|
191
|
-
billingAddress5: null,
|
|
192
|
-
billingPostcode: '-',
|
|
193
|
-
billingCity: '-',
|
|
194
|
-
billingState: '-',
|
|
195
|
-
billingCountry: '-'
|
|
196
141
|
}
|
|
197
142
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
143
|
+
return {
|
|
144
|
+
sku: product ? product.sku : productBundle.sku,
|
|
145
|
+
name: product ? product.name : productBundle.name,
|
|
146
|
+
description: product ? product.description : productBundle.description,
|
|
147
|
+
qty: mi.qty,
|
|
148
|
+
unitPrice: (mi?.originalPrice || 0) / mi.qty,
|
|
149
|
+
paidPrice: (mi?.paidPrice || 0) / mi.qty,
|
|
150
|
+
discount: mi?.discount || 0,
|
|
151
|
+
shippingFeePaidByCustomer: mi?.shippingFeePaidByCustomer || 0
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
let newInvoice = {
|
|
157
|
+
invoiceProducts,
|
|
158
|
+
name: '-',
|
|
159
|
+
refNo1: newReleaseOrder.refNo.toString(),
|
|
160
|
+
refNo2: newReleaseOrder.refNo2.toString(),
|
|
161
|
+
issuedOn: new Date(),
|
|
162
|
+
from: marketplaceOrder.marketplaceStore.storeName,
|
|
163
|
+
fromContactPhone: '-',
|
|
164
|
+
fromAddress1: '-',
|
|
165
|
+
fromAddress2: null,
|
|
166
|
+
fromAddress3: null,
|
|
167
|
+
fromAddress4: null,
|
|
168
|
+
fromAddress5: null,
|
|
169
|
+
fromPostcode: null,
|
|
170
|
+
fromCity: null,
|
|
171
|
+
fromState: null,
|
|
172
|
+
fromCountry: null,
|
|
173
|
+
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
174
|
+
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
175
|
+
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
176
|
+
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
177
|
+
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
178
|
+
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
179
|
+
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
180
|
+
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
181
|
+
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
182
|
+
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
183
|
+
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
184
|
+
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
185
|
+
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
186
|
+
billingAddress1: newReleaseOrder.deliverTo.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
187
|
+
billingAddress2: null,
|
|
188
|
+
billingAddress3: null,
|
|
189
|
+
billingAddress4: null,
|
|
190
|
+
billingAddress5: null,
|
|
191
|
+
billingPostcode: '-',
|
|
192
|
+
billingCity: '-',
|
|
193
|
+
billingState: '-',
|
|
194
|
+
billingCountry: '-'
|
|
205
195
|
}
|
|
196
|
+
|
|
197
|
+
try {
|
|
198
|
+
await FulfillmentAPI.createSalesInvoice(fulfilmentCenter, {
|
|
199
|
+
customerBizplaceId,
|
|
200
|
+
invoice: newInvoice
|
|
201
|
+
})
|
|
202
|
+
} catch (e) {}
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
205
|
}
|
|
@@ -42,6 +42,8 @@ export const autoAddReleaseOrderResolver = {
|
|
|
42
42
|
for (var i = 0; i < marketplaceOrders.length; i++) {
|
|
43
43
|
const marketplaceOrder = marketplaceOrders[i]
|
|
44
44
|
|
|
45
|
+
const marketplaceOrderItems: MarketplaceOrderItem[] = marketplaceOrder.marketplaceOrderItems
|
|
46
|
+
|
|
45
47
|
const marketplaceOrderShippings: MarketplaceOrderShipping[] = await getRepository(MarketplaceOrderShipping).find({
|
|
46
48
|
where: { orderNoRef: marketplaceOrder.orderNo, domain },
|
|
47
49
|
order: { subOrderNoRef: 'ASC' },
|
|
@@ -64,7 +66,7 @@ export const autoAddReleaseOrderResolver = {
|
|
|
64
66
|
.toString()
|
|
65
67
|
.padStart(2, '0')}`
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
var newReleaseOrder: any = {
|
|
68
70
|
releaseDate,
|
|
69
71
|
type: 'b2c',
|
|
70
72
|
transporter: marketplaceOrder.shippingProvider,
|
|
@@ -122,86 +124,82 @@ export const autoAddReleaseOrderResolver = {
|
|
|
122
124
|
await getRepository(MarketplaceOrder).save(marketplaceOrder)
|
|
123
125
|
}
|
|
124
126
|
} catch (e) {}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
125
129
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (!product) {
|
|
133
|
-
product = await getRepository(ProductBundle).findOne({
|
|
134
|
-
where: { domain, sku: oi.product.sku }
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
let mosis: MarketplaceOrderShippingItem[] = marketplaceOrderShippingItems.filter(
|
|
139
|
-
mosi => mosi.product.sku === product.sku
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
let moi: MarketplaceOrderItem = mosis[0].marketplaceOrderItem
|
|
130
|
+
var invoiceProducts = await Promise.all(
|
|
131
|
+
marketplaceOrderItems.map(async mi => {
|
|
132
|
+
let product: Product = await getRepository(Product).findOne({
|
|
133
|
+
where: { domain, sku: mi.marketplaceProductVariation.sku }
|
|
134
|
+
})
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
product: { sku: product.sku },
|
|
149
|
-
qty: oi.releaseQty,
|
|
150
|
-
unitPrice: (moi?.originalPrice || 0) / moi.qty,
|
|
151
|
-
paidPrice: (moi?.paidPrice || 0) / moi.qty
|
|
152
|
-
}
|
|
136
|
+
let productBundle: ProductBundle
|
|
137
|
+
if (!product) {
|
|
138
|
+
productBundle = await getRepository(ProductBundle).findOne({
|
|
139
|
+
where: { domain, sku: mi.marketplaceProductVariation.sku }
|
|
153
140
|
})
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
let newInvoice = {
|
|
157
|
-
invoiceProducts,
|
|
158
|
-
releaseGood: { id: releaseOrder.id, name: releaseOrder.name },
|
|
159
|
-
refNo1: newReleaseOrder.refNo.toString(),
|
|
160
|
-
refNo2: newReleaseOrder.refNo2.toString(),
|
|
161
|
-
issuedOn: new Date(),
|
|
162
|
-
from: marketplaceOrder.marketplaceStore.storeName,
|
|
163
|
-
fromContactPhone: '-',
|
|
164
|
-
fromAddress1: '-',
|
|
165
|
-
fromAddress2: null,
|
|
166
|
-
fromAddress3: null,
|
|
167
|
-
fromAddress4: null,
|
|
168
|
-
fromAddress5: null,
|
|
169
|
-
fromPostcode: null,
|
|
170
|
-
fromCity: null,
|
|
171
|
-
fromState: null,
|
|
172
|
-
fromCountry: null,
|
|
173
|
-
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
174
|
-
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
175
|
-
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
176
|
-
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
177
|
-
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
178
|
-
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
179
|
-
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
180
|
-
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
181
|
-
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
182
|
-
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
183
|
-
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
184
|
-
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
185
|
-
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
186
|
-
billingAddress1: releaseOrder.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
187
|
-
billingAddress2: null,
|
|
188
|
-
billingAddress3: null,
|
|
189
|
-
billingAddress4: null,
|
|
190
|
-
billingAddress5: null,
|
|
191
|
-
billingPostcode: '-',
|
|
192
|
-
billingCity: '-',
|
|
193
|
-
billingState: '-',
|
|
194
|
-
billingCountry: '-'
|
|
195
141
|
}
|
|
196
142
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
143
|
+
return {
|
|
144
|
+
sku: product ? product.sku : productBundle.sku,
|
|
145
|
+
name: product ? product.name : productBundle.name,
|
|
146
|
+
description: product ? product.description : productBundle.description,
|
|
147
|
+
qty: mi.qty,
|
|
148
|
+
unitPrice: (mi?.originalPrice || 0) / mi.qty,
|
|
149
|
+
paidPrice: (mi?.paidPrice || 0) / mi.qty,
|
|
150
|
+
discount: mi?.discount || 0,
|
|
151
|
+
shippingFeePaidByCustomer: mi?.shippingFeePaidByCustomer || 0
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
let newInvoice = {
|
|
157
|
+
invoiceProducts,
|
|
158
|
+
name: '-',
|
|
159
|
+
refNo1: newReleaseOrder.refNo.toString(),
|
|
160
|
+
refNo2: newReleaseOrder.refNo2.toString(),
|
|
161
|
+
issuedOn: new Date(),
|
|
162
|
+
from: marketplaceOrder.marketplaceStore.storeName,
|
|
163
|
+
fromContactPhone: '-',
|
|
164
|
+
fromAddress1: '-',
|
|
165
|
+
fromAddress2: null,
|
|
166
|
+
fromAddress3: null,
|
|
167
|
+
fromAddress4: null,
|
|
168
|
+
fromAddress5: null,
|
|
169
|
+
fromPostcode: null,
|
|
170
|
+
fromCity: null,
|
|
171
|
+
fromState: null,
|
|
172
|
+
fromCountry: null,
|
|
173
|
+
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
174
|
+
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
175
|
+
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
176
|
+
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
177
|
+
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
178
|
+
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
179
|
+
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
180
|
+
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
181
|
+
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
182
|
+
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
183
|
+
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
184
|
+
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
185
|
+
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
186
|
+
billingAddress1: newReleaseOrder.deliverTo.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
187
|
+
billingAddress2: null,
|
|
188
|
+
billingAddress3: null,
|
|
189
|
+
billingAddress4: null,
|
|
190
|
+
billingAddress5: null,
|
|
191
|
+
billingPostcode: '-',
|
|
192
|
+
billingCity: '-',
|
|
193
|
+
billingState: '-',
|
|
194
|
+
billingCountry: '-'
|
|
204
195
|
}
|
|
196
|
+
|
|
197
|
+
try {
|
|
198
|
+
await FulfillmentAPI.createSalesInvoice(fulfilmentCenter, {
|
|
199
|
+
customerBizplaceId,
|
|
200
|
+
invoice: newInvoice
|
|
201
|
+
})
|
|
202
|
+
} catch (e) {}
|
|
205
203
|
}
|
|
206
204
|
}
|
|
207
205
|
}
|