Skip to content

Commit

Permalink
Merge pull request #102 from saastechacademy/create-order
Browse files Browse the repository at this point in the history
Add design details for consuming OMS feeds.
  • Loading branch information
mridulpathak authored Jan 7, 2025
2 parents fa733e2 + 76a2508 commit 7163a41
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 4 deletions.
19 changes: 19 additions & 0 deletions project-ideas/order-ledger/ShopifyOrderSyncDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,23 @@ Following are the implementation details,
```xml
<org.apache.ofbiz.common.datasource.DataSourceType dataSourceTypeId="EXTERNAL_SYSTEM" description="External System"/>
<org.apache.ofbiz.common.datasource.DataSource dataSourceId="SHOPIFY" dataSourceTypeId="EXTERNAL_SYSTEM" description="Shopify"/>

<moqui.service.message.SystemMessageType systemMessageTypeId="NewOrdersFeed"
description="New Orders Feed"
parentTypeId="LocalFeedFile"
consumeServiceName="co.hotwax.orderledger.system.FeedServices.consume#OMSFeedSystemMessage"
receivePath=""
receiveResponseEnumId="MsgRrMove"
receiveMovePath=""
sendService="co.hotwax.orderledger.order.OrderServices.create#SalesOrder"
sendPath="${contentRoot}/oms/NewOrdersFeed"/>

<moqui.basic.EnumerationType enumTypeId="ORDER_SYS_JOB" description="Order Jobs"/>
<moqui.basic.Enumeration enumId="POL_NEWORDRS_FD" enumCode="POL_NEWORDRS_FD" description="Poll New Orders Feed" enumTypeId="ORDER_SYS_JOB"/>
<moqui.service.job.ServiceJob jobName="poll_SystemMessageFileSftp_NewOrdersFeed" jobTypeEnumId="POL_NEWORDRS_FD" description="Poll New Orders Feed"
serviceName="co.hotwax.ofbiz.SystemMessageServices.poll#SystemMessageFileSftp" cronExpression="0 0 * * * ?" paused="Y">
<parameters parameterName="systemMessageTypeId" parameterValue="NewOrdersFeed"/>
</moqui.service.job.ServiceJob>
```
### [create#PostalAddress](../oms/createPostalAddress.md)

Expand All @@ -241,3 +258,5 @@ Following are the implementation details,
### [create#SalesOrder](createSalesOrder.md)

### [findOrCreate#Product](../oms/findOrCreateProduct.md)

### [consume#OMSFeedSystemMessage](consumeOMSFeedSystemMessage.md)
16 changes: 16 additions & 0 deletions project-ideas/order-ledger/consumeOMSFeedSystemMessage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# co.hotwax.orderledger.system.FeedServices.consume#OMSFeedSystemMessage
1. Implements _org.moqui.impl.SystemMessageServices.consume#SystemMessage_.
2. Get the systemMessage record from SystemMessageAndType view entity.
3. Set filePathRef = location reference of systemMessage.messageText.
4. Get jsonList = filePath.fileText().
5. If !jsonList return error - "System message [${systemMessageId}] for Type [${systemMessage?.systemMessageTypeId}] has messageText [${systemMessage.messageText}], with feed file having incorrect data and may contain null, not consuming the feed file."
6. Prepare error file
* Set fileName from filePathRef.
* Split fileName by "." into fileNameArray.
* Set errorFileName = fileNameArray[0] + "Error." + fileNameArray[1].
* Set errorFilePathRef = expanded systemMessage.sendPath + "/error/" + errorFileName.
* Initiate a Json file for errorFilePathRef, we will write erroneous records with errors in this file.
7. Iterate through jsonList and for each entry call systemMessage.sendService in new transaction.
* If serviceOutput has error list then write following in error file - ["json":jsonList.entry, "error":serviceOutput.errorMessageList].
8. Close error file.
9. Create SystemMessage - [systemMessageTypeId:"FeedErrorFile", messageText:errorFilePathRef, parentMessageId:systemMessage.systemMessageId]
24 changes: 24 additions & 0 deletions project-ideas/product-master/ShopifyNewProductsSyncDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,34 @@ Following are the implementation details,

## OMS API

### Seed Data
```xml
<moqui.service.message.SystemMessageType systemMessageTypeId="FeedErrorFile"/>

<moqui.service.message.SystemMessageType systemMessageTypeId="NewProductsFeed"
description="New Products Feed"
parentTypeId="LocalFeedFile"
consumeServiceName="co.hotwax.orderledger.system.FeedServices.consume#OMSFeedSystemMessage"
receivePath=""
receiveResponseEnumId="MsgRrMove"
receiveMovePath=""
sendService="co.hotwax.oms.ProductServices.create#ProductAndVariants"
sendPath="${contentRoot}/oms/NewProductsFeed"/>

<moqui.basic.EnumerationType enumTypeId="PRODUCT_SYS_JOB" description="Product Jobs"/>
<moqui.basic.Enumeration enumId="POL_NEWPRDTS_FD" enumCode="POL_NEWPRDTS_FD" description="Poll New Products Feed" enumTypeId="PRODUCT_SYS_JOB"/>
<moqui.service.job.ServiceJob jobName="poll_SystemMessageFileSftp_NewProductsFeed" jobTypeEnumId="POL_NEWPRDTS_FD" description="Poll New Products Feed"
serviceName="co.hotwax.ofbiz.SystemMessageServices.poll#SystemMessageFileSftp" cronExpression="0 0 * * * ?" paused="Y">
<parameters parameterName="systemMessageTypeId" parameterValue="NewProductsFeed"/>
</moqui.service.job.ServiceJob>
```

### [create#Product](../oms/createProduct.md)

### [create#ProductAndVariants](createProductAndVariants.md)

### [create#ProductVariant](createProductVariant.md)

### [prepare#ProductCreate](prepareProductCreate.md)

### [consume#OMSFeedSystemMessage](../order-ledger/consumeOMSFeedSystemMessage.md)
27 changes: 23 additions & 4 deletions project-ideas/product-master/ShopifyProductUpdatesSyncDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,37 @@ Following are the implementation details,

### [generate#OMSProductUpdatesFeed](generateOMSProductUpdatesFeed.md)

### map#Product
Refer implementation details in [createProduct.md](https://github.com/saastechacademy/foundation/blob/main/project-ideas/product-master/createProduct.md).
### [map#Product](mapProduct.md)

### map#ProductVariant
Refer implementation details in [createProduct.md](https://github.com/saastechacademy/foundation/blob/main/project-ideas/product-master/createProduct.md).
### [map#ProductVariant](mapProductVariant.md)

## OMS API

### Seed Data
```xml
<moqui.service.message.SystemMessageType systemMessageTypeId="ProductUpdatesFeed"
description="Product Updates Feed"
parentTypeId="LocalFeedFile"
consumeServiceName="co.hotwax.orderledger.system.FeedServices.consume#OMSFeedSystemMessage"
receivePath=""
receiveResponseEnumId="MsgRrMove"
receiveMovePath=""
sendService="co.hotwax.oms.ProductServices.update#ProductAndVariants"
sendPath="${contentRoot}/oms/ProductUpdatesFeed"/>

<moqui.basic.Enumeration enumId="POL_PRDTUPDTS_FD" enumCode="POL_PRDTUPDTS_FD" description="Poll Product Updates Feed" enumTypeId="PRODUCT_SYS_JOB"/>
<moqui.service.job.ServiceJob jobName="poll_SystemMessageFileSftp_ProductUpdatesFeed" jobTypeEnumId="POL_PRDTUPDTS_FD" description="Poll Product Updates Feed"
serviceName="co.hotwax.ofbiz.SystemMessageServices.poll#SystemMessageFileSftp" cronExpression="0 0 * * * ?" paused="Y">
<parameters parameterName="systemMessageTypeId" parameterValue="ProductUpdatesFeed"/>
</moqui.service.job.ServiceJob>
```

### [update#Product](../oms/updateProduct.md)

### [update#ProductAndVariants](updateProductAndVariants.md)

### [update#ProductVariant](updateProductVariant.md)

### [prepare#ProductUpdate](prepareProductUpdate.md)

### [consume#OMSFeedSystemMessage](../order-ledger/consumeOMSFeedSystemMessage.md)

0 comments on commit 7163a41

Please sign in to comment.