523 enhancement returns and refunds flow merge#164
523 enhancement returns and refunds flow merge#164Prerakghatode wants to merge 7 commits intohotwax:mainfrom
Conversation
Changelog: Added
…Feed Changelog: Added
Changelog: Added
data/ShopifyTemplateData.xml
Outdated
| </#if> | ||
| <#if !filterQuery?has_content> | ||
| <#assign filterQuery = "return_status:'RETURNED'"/> | ||
| <#assign filterQuery = "return_status:'RETURNED' OR (return_status:'NO_RETURN' AND (financial_status:'PARTIALLY_REFUNDED' OR financial_status:'REFUNDED'))"/> |
There was a problem hiding this comment.
Consider separating the repeated status condition into a variable to reduce duplication and improve readability.
As the status check is always there in filterQuery, we should declare it at the top and then conditionally append updated_at checks.
data/ShopifyTemplateData.xml
Outdated
| node(id: "${shopifyOrderId}") { | ||
| id | ||
| ... on Order { | ||
| refunds(first: 10) { |
There was a problem hiding this comment.
How will you make sure that we get all the refunds for a specific order?
data/ShopifyTemplateData.xml
Outdated
| ... on Order { | ||
| refunds(first: 10) { | ||
| id | ||
| transactions(first: 10) { |
There was a problem hiding this comment.
Where will you be using the transactions list, and if using the same thing, how will you make sure to get all transactions?
Consider the GraphQL query cost.
| <histories versionName="01" previousVersionName="01"/> | ||
| </file> | ||
| </moqui.resource.DbResource> | ||
| <moqui.resource.DbResource filename="RefundIdsByOrderIdQuery.ftl" isFile="Y" resourceId="RefundIdsByOrderIdQuery" parentResourceId="GraphQL"> |
There was a problem hiding this comment.
Update the filename, you are querying to fetch the transactions' createdAt too with refund ids
| <if condition="!refundResponse.response.node"> | ||
| <return type="warning" message="No Shopify order found for id: ${shopifyOrderId}"/> | ||
| </if> | ||
| <set field="refundIdList" from="[]"/> |
There was a problem hiding this comment.
What arethe requirements for this handling
<set field="refundIdList" from="[]"/>
<if condition="refundResponse.response.node.refunds">
<script>refundIdList.addAll(refundResponse.response.node.refunds)</script>
</if>|
|
||
| <service-call name="co.hotwax.shopify.return.ShopifyReturnServices.get#RefundsByOrderId" | ||
| in-map="[systemMessageRemoteId:systemMessage.systemMessageRemoteId, shopifyOrderId:order.id]" | ||
| out-map="refundsResponse" ignore-error="true" transaction="force-new"/> |
| <service-call name="co.hotwax.shopify.return.ShopifyReturnServices.get#RefundsByOrderId" | ||
| in-map="[systemMessageRemoteId:systemMessage.systemMessageRemoteId, shopifyOrderId:order.id]" | ||
| out-map="refundsResponse" ignore-error="true" transaction="force-new"/> | ||
| <set field="orderMap.refunds" from="refundsResponse.orderRefunds.refunds"/> |
| <iterate list="refundIdList" entry="refund"> | ||
| <set field="refundIdString" from="refund.id"/> | ||
| <service-call name="co.hotwax.shopify.return.ShopifyReturnServices.get#RefundDetails" in-map="[systemMessageRemoteId:systemMessageRemoteId, refundId:refundIdString]" out-map="refundDetails"/> | ||
| <script>refunds.addAll(refundDetails.refundDetail)</script> |
There was a problem hiding this comment.
Have you tried running this code once? I think the addAll method will throw an error as it accepts a List.
bc68a19 to
7cdddaa
Compare
Added Refunds handling flow in generate ReturnsAndExchangeFeed based on orderId.