Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the HC to Shopify Fulfillment flow #107

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,12 @@ under the License.

<iterate list="systemMessageList" entry="systemMessage">
<set field="shipment" from="org.moqui.impl.context.ContextJavaUtil.jacksonMapper.readValue(systemMessage.messageText, Map.class)"/>
<iterate list="shipment.shipmentItems" entry="shipmentItem">
<set field="shopifyFulfillmentAckMap" from="[shipmentId:shipmentItem.shipmentId, orderId:shipmentItem.orderId, orderItemSeqId: shipmentItem.orderItemSeqId, externalFulfillmentId: systemMessage.remoteMessageId]"/>
<set field="shopifyFulfillmentAckMap" from="[shipmentId:shipment.shipmentId, primaryOrderId:shipment.orderId, externalId: systemMessage.remoteMessageId]"/>
<script>
new ObjectMapper()
.setDateFormat(new java.text.SimpleDateFormat(System.getProperty('default_date_time_format')))
.writerWithDefaultPrettyPrinter().writeValue(jGenerator, shopifyFulfillmentAckMap)
</script>
</iterate>
</iterate>
<script>
jGenerator.writeEndArray()
Expand Down
19 changes: 3 additions & 16 deletions service/co/hotwax/shopify/system/ShopifySystemMessageServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,10 @@ under the License.
</entity-find-one>

<set field="shipment" from="org.moqui.impl.context.ContextJavaUtil.jacksonMapper.readValue(systemMessage.messageText, Map.class)"/>
<set field="lineItems" from="[]"/>
<iterate list="shipment.shipmentItems" entry="shipmentItem">
<set field="lineItem" from="[:]"/>
<set field="lineItem.shopifyLineItemId" from="shipmentItem.shopifyOrderLineId"/>
<set field="lineItem.quantity" from="shipmentItem.quantity"/>
<script>lineItems.add(lineItem)</script>
</iterate>

<set field="fulfillmentContext" from="[:]"/>
<set field="fulfillmentContext.lineItems" from="lineItems"/>
<set field="fulfillmentContext.shopifyOrderId" from="shipment.shopifyOrderId"/>
<set field="fulfillmentContext.trackingNumber" from="shipment.trackingNumber"/>
<set field="fulfillmentContext.trackingUrl" from="shipment.trackingUrl"/>
<set field="fulfillmentContext.carrier" from="shipment.carrierPartyId"/>
<set field="fulfillmentContext.notifyCustomer" from="shipment.notifyCustomer"/>
<set field="fulfillmentContext.systemMessageRemoteId" from="systemMessage.systemMessageRemoteId"/>
<service-call name="co.hotwax.shopify.fulfillment.ShopifyFulfillmentServices.create#Fulfillment" in-map="fulfillmentContext" out-map="outMap"/>
<set field="shipment.systemMessageRemoteId" from="systemMessage.systemMessageRemoteId"/>

<service-call name="co.hotwax.shopify.fulfillment.ShopifyFulfillmentServices.create#Fulfillment" in-map="shipment" out-map="outMap"/>

<set field="remoteMessageId" from="outMap.shopifyFulfillmentId"/>
</actions>
Expand Down