@things-factory/integration-marketplace 8.0.0-beta.8 → 8.0.0

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.
Files changed (318) hide show
  1. package/dist-server/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +14 -14
  3. package/server/controllers/index.ts +9 -0
  4. package/server/controllers/lazada/apis/cancel-store-order.ts +19 -0
  5. package/server/controllers/lazada/apis/create-store-product.ts +55 -0
  6. package/server/controllers/lazada/apis/delete-store-product.ts +16 -0
  7. package/server/controllers/lazada/apis/echo.ts +14 -0
  8. package/server/controllers/lazada/apis/get-store-logistics.ts +21 -0
  9. package/server/controllers/lazada/apis/get-store-order-document.ts +25 -0
  10. package/server/controllers/lazada/apis/get-store-order-item-transaction-details.ts +65 -0
  11. package/server/controllers/lazada/apis/get-store-order-items.ts +179 -0
  12. package/server/controllers/lazada/apis/get-store-order.ts +87 -0
  13. package/server/controllers/lazada/apis/get-store-orders.ts +127 -0
  14. package/server/controllers/lazada/apis/get-store-product-brands.ts +27 -0
  15. package/server/controllers/lazada/apis/get-store-product-categories.ts +14 -0
  16. package/server/controllers/lazada/apis/get-store-product-category-attributes.ts +16 -0
  17. package/server/controllers/lazada/apis/get-store-product.ts +42 -0
  18. package/server/controllers/lazada/apis/get-store-products.ts +84 -0
  19. package/server/controllers/lazada/apis/get-store-refund-orders.ts +52 -0
  20. package/server/controllers/lazada/apis/index.ts +24 -0
  21. package/server/controllers/lazada/apis/set-order-invoice-no.ts +24 -0
  22. package/server/controllers/lazada/apis/set-store-order-status-delivered.ts +17 -0
  23. package/server/controllers/lazada/apis/set-store-order-status-failed-delivery.ts +17 -0
  24. package/server/controllers/lazada/apis/set-store-order-status-packed-by-marketplace.ts +46 -0
  25. package/server/controllers/lazada/apis/set-store-order-status-ready-to-ship.ts +28 -0
  26. package/server/controllers/lazada/apis/update-store-product-stock.ts +29 -0
  27. package/server/controllers/lazada/apis/update-store-product-variation-stock.ts +29 -0
  28. package/server/controllers/lazada/apis/update-store-product.ts +51 -0
  29. package/server/controllers/lazada/client/index.ts +3 -0
  30. package/server/controllers/lazada/client/lazada.ts +142 -0
  31. package/server/controllers/lazada/client/signature.ts +67 -0
  32. package/server/controllers/lazada/client/types.ts +30 -0
  33. package/server/controllers/lazada/client/xml.ts +24 -0
  34. package/server/controllers/lazada/index.ts +8 -0
  35. package/server/controllers/lazada/platform-action.ts +35 -0
  36. package/server/controllers/magento/apis/create-order-comment.ts +32 -0
  37. package/server/controllers/magento/apis/create-order-refund.ts +20 -0
  38. package/server/controllers/magento/apis/create-order-ship.ts +43 -0
  39. package/server/controllers/magento/apis/echo.ts +14 -0
  40. package/server/controllers/magento/apis/get-store-order.ts +15 -0
  41. package/server/controllers/magento/apis/get-store-orders.ts +159 -0
  42. package/server/controllers/magento/apis/get-store-product-categories.ts +43 -0
  43. package/server/controllers/magento/apis/get-store-product-variations.ts +17 -0
  44. package/server/controllers/magento/apis/get-store-product.ts +44 -0
  45. package/server/controllers/magento/apis/get-store-products.ts +120 -0
  46. package/server/controllers/magento/apis/get-store-stock-item.ts +66 -0
  47. package/server/controllers/magento/apis/index.ts +16 -0
  48. package/server/controllers/magento/apis/update-order-status.ts +56 -0
  49. package/server/controllers/magento/apis/update-store-product-price.ts +24 -0
  50. package/server/controllers/magento/apis/update-store-product-stock.ts +42 -0
  51. package/server/controllers/magento/apis/update-store-product-variation-price.ts +24 -0
  52. package/server/controllers/magento/apis/update-store-product-variation-stock.ts +42 -0
  53. package/server/controllers/magento/index.ts +8 -0
  54. package/server/controllers/magento/magento.ts +202 -0
  55. package/server/controllers/magento/platform-action.ts +44 -0
  56. package/server/controllers/shopee/apis/accept-store-order-cancellation.ts +22 -0
  57. package/server/controllers/shopee/apis/cancel-store-order.ts +25 -0
  58. package/server/controllers/shopee/apis/create-store-product-variations.ts +33 -0
  59. package/server/controllers/shopee/apis/create-store-product.ts +57 -0
  60. package/server/controllers/shopee/apis/delete-store-product.ts +19 -0
  61. package/server/controllers/shopee/apis/echo.ts +14 -0
  62. package/server/controllers/shopee/apis/get-address.ts +32 -0
  63. package/server/controllers/shopee/apis/get-branch-list.ts +30 -0
  64. package/server/controllers/shopee/apis/get-logistics-param.ts +71 -0
  65. package/server/controllers/shopee/apis/get-store-logistics.ts +21 -0
  66. package/server/controllers/shopee/apis/get-store-order-document.ts +27 -0
  67. package/server/controllers/shopee/apis/get-store-order-items.ts +47 -0
  68. package/server/controllers/shopee/apis/get-store-order-payout-dates.ts +29 -0
  69. package/server/controllers/shopee/apis/get-store-order-transaction-details.ts +29 -0
  70. package/server/controllers/shopee/apis/get-store-order.ts +136 -0
  71. package/server/controllers/shopee/apis/get-store-orders.ts +39 -0
  72. package/server/controllers/shopee/apis/get-store-product-categories.ts +19 -0
  73. package/server/controllers/shopee/apis/get-store-product-category-attributes.ts +18 -0
  74. package/server/controllers/shopee/apis/get-store-product.ts +84 -0
  75. package/server/controllers/shopee/apis/get-store-products.ts +30 -0
  76. package/server/controllers/shopee/apis/get-store-refund-order-details.ts +41 -0
  77. package/server/controllers/shopee/apis/get-store-refund-orders.ts +47 -0
  78. package/server/controllers/shopee/apis/get-time-slot.ts +25 -0
  79. package/server/controllers/shopee/apis/index.ts +30 -0
  80. package/server/controllers/shopee/apis/init-logistics.ts +39 -0
  81. package/server/controllers/shopee/apis/reject-store-order-cancellation.ts +22 -0
  82. package/server/controllers/shopee/apis/split-order.ts +44 -0
  83. package/server/controllers/shopee/apis/update-store-product-stock.ts +24 -0
  84. package/server/controllers/shopee/apis/update-store-product-variation-stock.ts +21 -0
  85. package/server/controllers/shopee/apis/update-store-product.ts +85 -0
  86. package/server/controllers/shopee/apis2/create-shipping-document.ts +27 -0
  87. package/server/controllers/shopee/apis2/echo.ts +14 -0
  88. package/server/controllers/shopee/apis2/get-logistics-param.ts +66 -0
  89. package/server/controllers/shopee/apis2/get-shipping-document-result.ts +21 -0
  90. package/server/controllers/shopee/apis2/get-store-logistics.ts +23 -0
  91. package/server/controllers/shopee/apis2/get-store-order-by-batch.ts +97 -0
  92. package/server/controllers/shopee/apis2/get-store-order-document.ts +39 -0
  93. package/server/controllers/shopee/apis2/get-store-order-payout-dates.ts +33 -0
  94. package/server/controllers/shopee/apis2/get-store-order-transaction-details.ts +28 -0
  95. package/server/controllers/shopee/apis2/get-store-order.ts +93 -0
  96. package/server/controllers/shopee/apis2/get-store-orders.ts +40 -0
  97. package/server/controllers/shopee/apis2/get-store-product-variations.ts +17 -0
  98. package/server/controllers/shopee/apis2/get-store-product.ts +105 -0
  99. package/server/controllers/shopee/apis2/get-store-products.ts +28 -0
  100. package/server/controllers/shopee/apis2/get-store-refund-order-details.ts +39 -0
  101. package/server/controllers/shopee/apis2/get-store-refund-orders.ts +37 -0
  102. package/server/controllers/shopee/apis2/get-tracking-number.ts +17 -0
  103. package/server/controllers/shopee/apis2/index.ts +20 -0
  104. package/server/controllers/shopee/apis2/init-logistics.ts +39 -0
  105. package/server/controllers/shopee/apis2/update-store-product-stock.ts +26 -0
  106. package/server/controllers/shopee/apis2/update-store-product-variation-stock.ts +28 -0
  107. package/server/controllers/shopee/index.ts +16 -0
  108. package/server/controllers/shopee/platform-action.ts +58 -0
  109. package/server/controllers/shopee/refresh-access-token.ts +78 -0
  110. package/server/controllers/shopee/shopee.ts +191 -0
  111. package/server/controllers/shopify/apis/echo.ts +14 -0
  112. package/server/controllers/shopify/apis/get-airway-bill.ts +17 -0
  113. package/server/controllers/shopify/apis/get-inventory-level.ts +17 -0
  114. package/server/controllers/shopify/apis/get-store-order.ts +172 -0
  115. package/server/controllers/shopify/apis/get-store-orders.ts +290 -0
  116. package/server/controllers/shopify/apis/get-store-product-categories.ts +19 -0
  117. package/server/controllers/shopify/apis/get-store-product-category-attributes.ts +18 -0
  118. package/server/controllers/shopify/apis/get-store-product-variation-stock.ts +17 -0
  119. package/server/controllers/shopify/apis/get-store-products-count.ts +14 -0
  120. package/server/controllers/shopify/apis/get-store-products.ts +177 -0
  121. package/server/controllers/shopify/apis/index.ts +13 -0
  122. package/server/controllers/shopify/apis/set-store-order-status-ready-to-ship.ts +31 -0
  123. package/server/controllers/shopify/apis/update-order-status.ts +32 -0
  124. package/server/controllers/shopify/apis/update-store-product-price.ts +26 -0
  125. package/server/controllers/shopify/apis/update-store-product-stock.ts +20 -0
  126. package/server/controllers/shopify/apis/update-store-product-variation-price.ts +26 -0
  127. package/server/controllers/shopify/apis/update-store-product-variation-stock.ts +20 -0
  128. package/server/controllers/shopify/index.ts +8 -0
  129. package/server/controllers/shopify/platform-action.ts +43 -0
  130. package/server/controllers/shopify/shopify.ts +148 -0
  131. package/server/controllers/store-api/decorators.ts +44 -0
  132. package/server/controllers/store-api/index.ts +209 -0
  133. package/server/controllers/store-api/types.ts +0 -0
  134. package/server/controllers/tiktok/apis/echo.ts +14 -0
  135. package/server/controllers/tiktok/apis/get-store-order-document.ts +26 -0
  136. package/server/controllers/tiktok/apis/get-store-order-package.ts +46 -0
  137. package/server/controllers/tiktok/apis/get-store-order-packages.ts +43 -0
  138. package/server/controllers/tiktok/apis/get-store-order.ts +176 -0
  139. package/server/controllers/tiktok/apis/get-store-orders.ts +55 -0
  140. package/server/controllers/tiktok/apis/get-store-product-attributes.ts +29 -0
  141. package/server/controllers/tiktok/apis/get-store-product-categories.ts +27 -0
  142. package/server/controllers/tiktok/apis/get-store-product.ts +95 -0
  143. package/server/controllers/tiktok/apis/get-store-products.ts +45 -0
  144. package/server/controllers/tiktok/apis/index.ts +13 -0
  145. package/server/controllers/tiktok/apis/update-order-status.ts +24 -0
  146. package/server/controllers/tiktok/apis/update-store-product-variation-price.ts +24 -0
  147. package/server/controllers/tiktok/apis/update-store-product-variation-stock.ts +28 -0
  148. package/server/controllers/tiktok/client/index.ts +2 -0
  149. package/server/controllers/tiktok/client/signature.ts +78 -0
  150. package/server/controllers/tiktok/client/tiktok.ts +150 -0
  151. package/server/controllers/tiktok/client/types.ts +20 -0
  152. package/server/controllers/tiktok/index.ts +8 -0
  153. package/server/controllers/tiktok/platform-action.ts +72 -0
  154. package/server/controllers/woocommerce/apis/create-order-note.ts +17 -0
  155. package/server/controllers/woocommerce/apis/echo.ts +14 -0
  156. package/server/controllers/woocommerce/apis/get-customer-info.ts +18 -0
  157. package/server/controllers/woocommerce/apis/get-store-order.ts +116 -0
  158. package/server/controllers/woocommerce/apis/get-store-orders.ts +190 -0
  159. package/server/controllers/woocommerce/apis/get-store-product-categories.ts +18 -0
  160. package/server/controllers/woocommerce/apis/get-store-product-variations.ts +16 -0
  161. package/server/controllers/woocommerce/apis/get-store-products.ts +135 -0
  162. package/server/controllers/woocommerce/apis/index.ts +19 -0
  163. package/server/controllers/woocommerce/apis/set-store-order-status-ready-to-ship.ts +17 -0
  164. package/server/controllers/woocommerce/apis/update-order-status.ts +40 -0
  165. package/server/controllers/woocommerce/apis/update-product-attribute.ts +20 -0
  166. package/server/controllers/woocommerce/apis/update-store-product-price.ts +20 -0
  167. package/server/controllers/woocommerce/apis/update-store-product-stock.ts +17 -0
  168. package/server/controllers/woocommerce/apis/update-store-product-variant-price.ts +17 -0
  169. package/server/controllers/woocommerce/apis/update-store-product-variant-stock.ts +18 -0
  170. package/server/controllers/woocommerce/apis/update-store-product-variation-price.ts +20 -0
  171. package/server/controllers/woocommerce/apis/update-store-product-variation-stock.ts +20 -0
  172. package/server/controllers/woocommerce/index.ts +8 -0
  173. package/server/controllers/woocommerce/platform-action.ts +48 -0
  174. package/server/controllers/woocommerce/woocommerce.ts +104 -0
  175. package/server/controllers/zalora/apis/echo.ts +14 -0
  176. package/server/controllers/zalora/apis/get-airway-bill.ts +17 -0
  177. package/server/controllers/zalora/apis/get-store-order-items.ts +17 -0
  178. package/server/controllers/zalora/apis/get-store-order.ts +17 -0
  179. package/server/controllers/zalora/apis/get-store-orders.ts +21 -0
  180. package/server/controllers/zalora/apis/get-store-product-categories.ts +20 -0
  181. package/server/controllers/zalora/apis/get-store-product-category-attributes.ts +18 -0
  182. package/server/controllers/zalora/apis/get-store-products.ts +20 -0
  183. package/server/controllers/zalora/apis/index.ts +8 -0
  184. package/server/controllers/zalora/index.ts +8 -0
  185. package/server/controllers/zalora/platform-action.ts +18 -0
  186. package/server/controllers/zalora/zalora/index.ts +70 -0
  187. package/server/controllers/zalora/zalora/signature.ts +37 -0
  188. package/server/controllers/zalora/zalora/xml.ts +24 -0
  189. package/server/engine/connector/index.ts +3 -0
  190. package/server/engine/connector/lazada-connector.ts +49 -0
  191. package/server/engine/connector/marketplace-connector.ts +33 -0
  192. package/server/engine/connector/shopee-connector.ts +46 -0
  193. package/server/engine/index.ts +2 -0
  194. package/server/engine/task/index.ts +4 -0
  195. package/server/engine/task/lazada-get.ts +48 -0
  196. package/server/engine/task/lazada-post.ts +46 -0
  197. package/server/engine/task/marketplace-api.ts +72 -0
  198. package/server/engine/task/shopee-post.ts +51 -0
  199. package/server/entities/index.ts +8 -0
  200. package/server/entities/marketplace-distributor.ts +42 -0
  201. package/server/entities/marketplace-setting.ts +49 -0
  202. package/server/entities/marketplace-store.ts +100 -0
  203. package/server/entities/marketplace-transporter.ts +46 -0
  204. package/server/graphql/constants/index.ts +1 -0
  205. package/server/graphql/constants/store.ts +5 -0
  206. package/server/graphql/index.ts +9 -0
  207. package/server/graphql/resolvers/index.ts +6 -0
  208. package/server/graphql/resolvers/marketplace-distributor/create-marketplace-distributor.ts +15 -0
  209. package/server/graphql/resolvers/marketplace-distributor/delete-marketplace-distributor.ts +13 -0
  210. package/server/graphql/resolvers/marketplace-distributor/delete-marketplace-distributors.ts +18 -0
  211. package/server/graphql/resolvers/marketplace-distributor/index.ts +19 -0
  212. package/server/graphql/resolvers/marketplace-distributor/marketplace-distributor-query.ts +57 -0
  213. package/server/graphql/resolvers/marketplace-distributor/update-marketplace-distributor.ts +22 -0
  214. package/server/graphql/resolvers/marketplace-distributor/update-multiple-marketplace-distributor.ts +49 -0
  215. package/server/graphql/resolvers/marketplace-setting/create-marketplace-setting.ts +16 -0
  216. package/server/graphql/resolvers/marketplace-setting/delete-marketplace-setting.ts +13 -0
  217. package/server/graphql/resolvers/marketplace-setting/delete-marketplace-settings.ts +18 -0
  218. package/server/graphql/resolvers/marketplace-setting/index.ts +19 -0
  219. package/server/graphql/resolvers/marketplace-setting/marketplace-setting-query.ts +56 -0
  220. package/server/graphql/resolvers/marketplace-setting/update-marketplace-setting.ts +32 -0
  221. package/server/graphql/resolvers/marketplace-setting/update-multiple-marketplace-setting.ts +49 -0
  222. package/server/graphql/resolvers/marketplace-store/create-marketplace-store.ts +20 -0
  223. package/server/graphql/resolvers/marketplace-store/delete-marketplace-store.ts +21 -0
  224. package/server/graphql/resolvers/marketplace-store/delete-marketplace-stores.ts +26 -0
  225. package/server/graphql/resolvers/marketplace-store/index.ts +40 -0
  226. package/server/graphql/resolvers/marketplace-store/lazada/deactivate-lazada-store.ts +28 -0
  227. package/server/graphql/resolvers/marketplace-store/lazada/generate-lazada-access-token.ts +61 -0
  228. package/server/graphql/resolvers/marketplace-store/lazada/get-lazada-auth-url.ts +9 -0
  229. package/server/graphql/resolvers/marketplace-store/lazada/index.ts +12 -0
  230. package/server/graphql/resolvers/marketplace-store/magento/activate-magento-store.ts +82 -0
  231. package/server/graphql/resolvers/marketplace-store/magento/deactivate-magento-store.ts +27 -0
  232. package/server/graphql/resolvers/marketplace-store/magento/get-magento-auth-url.ts +12 -0
  233. package/server/graphql/resolvers/marketplace-store/magento/index.ts +12 -0
  234. package/server/graphql/resolvers/marketplace-store/marketplace-store.ts +14 -0
  235. package/server/graphql/resolvers/marketplace-store/marketplace-stores.ts +18 -0
  236. package/server/graphql/resolvers/marketplace-store/shopee/deactivate-shopee-store.ts +28 -0
  237. package/server/graphql/resolvers/marketplace-store/shopee/generate-shopee-access-token.ts +96 -0
  238. package/server/graphql/resolvers/marketplace-store/shopee/get-shopee-auth-url.ts +18 -0
  239. package/server/graphql/resolvers/marketplace-store/shopee/index.ts +13 -0
  240. package/server/graphql/resolvers/marketplace-store/shopify/deactivate-shopify-store.ts +29 -0
  241. package/server/graphql/resolvers/marketplace-store/shopify/get-shopify-auth-url.ts +26 -0
  242. package/server/graphql/resolvers/marketplace-store/shopify/index.ts +11 -0
  243. package/server/graphql/resolvers/marketplace-store/update-marketplace-store.ts +19 -0
  244. package/server/graphql/resolvers/marketplace-store/update-multiple-marketplace-store.ts +46 -0
  245. package/server/graphql/resolvers/marketplace-store/woocommerce/deactivate-woocommerce-store.ts +20 -0
  246. package/server/graphql/resolvers/marketplace-store/woocommerce/get-woocommerce-auth-url.ts +14 -0
  247. package/server/graphql/resolvers/marketplace-store/woocommerce/index.ts +10 -0
  248. package/server/graphql/resolvers/marketplace-store/zalora/deactivate-zalora-store.ts +28 -0
  249. package/server/graphql/resolvers/marketplace-store/zalora/generate-zalora-access-token.ts +55 -0
  250. package/server/graphql/resolvers/marketplace-store/zalora/index.ts +9 -0
  251. package/server/graphql/resolvers/marketplace-transporter/create-marketplace-transporter.ts +21 -0
  252. package/server/graphql/resolvers/marketplace-transporter/delete-marketplace-transporter.ts +13 -0
  253. package/server/graphql/resolvers/marketplace-transporter/delete-marketplace-transporters.ts +18 -0
  254. package/server/graphql/resolvers/marketplace-transporter/index.ts +19 -0
  255. package/server/graphql/resolvers/marketplace-transporter/marketplace-transporter-query.ts +60 -0
  256. package/server/graphql/resolvers/marketplace-transporter/update-marketplace-transporter.ts +25 -0
  257. package/server/graphql/resolvers/marketplace-transporter/update-multiple-marketplace-transporter.ts +49 -0
  258. package/server/graphql/resolvers/store-order/accept-store-order-cancellation.ts +9 -0
  259. package/server/graphql/resolvers/store-order/cancel-store-order.ts +8 -0
  260. package/server/graphql/resolvers/store-order/get-store-order-document.ts +8 -0
  261. package/server/graphql/resolvers/store-order/get-store-order-items.ts +8 -0
  262. package/server/graphql/resolvers/store-order/get-store-order.ts +8 -0
  263. package/server/graphql/resolvers/store-order/get-store-orders.ts +13 -0
  264. package/server/graphql/resolvers/store-order/index.ts +23 -0
  265. package/server/graphql/resolvers/store-order/reject-store-order-cancellation.ts +9 -0
  266. package/server/graphql/resolvers/store-order/set-store-order-status-packed-by-marketplace.ts +9 -0
  267. package/server/graphql/resolvers/store-order/set-store-order-status-ready-to-ship.ts +10 -0
  268. package/server/graphql/resolvers/store-product/create-store-product-variations.ts +9 -0
  269. package/server/graphql/resolvers/store-product/create-store-product.ts +8 -0
  270. package/server/graphql/resolvers/store-product/delete-store-product.ts +8 -0
  271. package/server/graphql/resolvers/store-product/get-store-product-brands.ts +14 -0
  272. package/server/graphql/resolvers/store-product/get-store-product-categories.ts +8 -0
  273. package/server/graphql/resolvers/store-product/get-store-product-category-attributes.ts +11 -0
  274. package/server/graphql/resolvers/store-product/get-store-product.ts +8 -0
  275. package/server/graphql/resolvers/store-product/get-store-products.ts +13 -0
  276. package/server/graphql/resolvers/store-product/index.ts +25 -0
  277. package/server/graphql/resolvers/store-product/update-store-product.ts +8 -0
  278. package/server/graphql/types/index.ts +6 -0
  279. package/server/graphql/types/marketplace-distributor/index.ts +26 -0
  280. package/server/graphql/types/marketplace-distributor/marketplace-distributor-list.ts +8 -0
  281. package/server/graphql/types/marketplace-distributor/marketplace-distributor-patch.ts +11 -0
  282. package/server/graphql/types/marketplace-distributor/marketplace-distributor.ts +16 -0
  283. package/server/graphql/types/marketplace-distributor/new-marketplace-distributor.ts +9 -0
  284. package/server/graphql/types/marketplace-setting/index.ts +22 -0
  285. package/server/graphql/types/marketplace-setting/marketplace-setting-list.ts +8 -0
  286. package/server/graphql/types/marketplace-setting/marketplace-setting-patch.ts +12 -0
  287. package/server/graphql/types/marketplace-setting/marketplace-setting.ts +17 -0
  288. package/server/graphql/types/marketplace-setting/new-marketplace-setting.ts +11 -0
  289. package/server/graphql/types/marketplace-store/index.ts +38 -0
  290. package/server/graphql/types/marketplace-store/marketplace-store-list.ts +8 -0
  291. package/server/graphql/types/marketplace-store/marketplace-store-patch.ts +21 -0
  292. package/server/graphql/types/marketplace-store/marketplace-store.ts +28 -0
  293. package/server/graphql/types/marketplace-store/new-marketplace-store.ts +19 -0
  294. package/server/graphql/types/marketplace-transporter/index.ts +24 -0
  295. package/server/graphql/types/marketplace-transporter/marketplace-transporter-list.ts +8 -0
  296. package/server/graphql/types/marketplace-transporter/marketplace-transporter-patch.ts +13 -0
  297. package/server/graphql/types/marketplace-transporter/marketplace-transporter.ts +17 -0
  298. package/server/graphql/types/marketplace-transporter/new-marketplace-transporter.ts +11 -0
  299. package/server/graphql/types/store-order/index.ts +23 -0
  300. package/server/graphql/types/store-order/new-store-order.ts +8 -0
  301. package/server/graphql/types/store-order/store-order-list.ts +8 -0
  302. package/server/graphql/types/store-order/store-order-patch.ts +10 -0
  303. package/server/graphql/types/store-order/store-order.ts +14 -0
  304. package/server/graphql/types/store-product/index.ts +23 -0
  305. package/server/graphql/types/store-product/new-store-product.ts +8 -0
  306. package/server/graphql/types/store-product/store-product-list.ts +8 -0
  307. package/server/graphql/types/store-product/store-product-patch.ts +10 -0
  308. package/server/graphql/types/store-product/store-product.ts +14 -0
  309. package/server/index.ts +9 -0
  310. package/server/migrations/index.ts +9 -0
  311. package/server/routers/magento-private-router.ts +192 -0
  312. package/server/routers/magento-public-router.ts +38 -0
  313. package/server/routers/shopify-install-private-router.ts +95 -0
  314. package/server/routers/shopify-install-public-router.ts +241 -0
  315. package/server/routers/shopify-private-router.ts +78 -0
  316. package/server/routers/shopify-public-router.ts +182 -0
  317. package/server/routers/woocommerce-router.ts +70 -0
  318. package/server/routes.ts +21 -0
@@ -0,0 +1,116 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#retrieve-an-order */
2
+
3
+ export function getStoreOrder() {
4
+ return {
5
+ method: 'get',
6
+ path: '/orders/{orderId}',
7
+ denormalize(req) {
8
+ var { orderId } = req
9
+ return {
10
+ resource: { orderId }
11
+ }
12
+ },
13
+ normalize(res) {
14
+ const order = res.items
15
+
16
+ const {
17
+ id: name,
18
+ number: orderNo,
19
+ currency,
20
+ total: totalAmount,
21
+ payment_method: paymentMethod,
22
+ status,
23
+ discount_total: discountValue,
24
+ date_created_gmt,
25
+ date_modified_gmt,
26
+ shipping,
27
+ billing,
28
+ line_items
29
+ } = order
30
+
31
+ let docRefNo = orderNo
32
+ var orderCreatedAt = new Date(date_created_gmt)
33
+ var orderUpdatedAt = new Date(date_modified_gmt)
34
+
35
+ let orderItems = line_items.map(item => {
36
+ var { id: name, product_id, variation_id, quantity: qty, price } = item
37
+
38
+ return {
39
+ name,
40
+ variationId: variation_id === 0 ? product_id : variation_id,
41
+ qty,
42
+ paidPrice: price,
43
+ orderNo,
44
+ docRefNo,
45
+ paymentMethod,
46
+ discountValue
47
+ }
48
+ })
49
+
50
+ const {
51
+ address_1: shippingAddress1,
52
+ address_2: shippingAddress2,
53
+ postcode: shippingPostCode,
54
+ country: shippingCountry,
55
+ city: shippingCity,
56
+ first_name: shippingFirstName,
57
+ last_name: shippingLastName,
58
+ state: shippingState,
59
+ phone: shippingPhone,
60
+ email: shippingEmail
61
+ } = shipping
62
+
63
+ const {
64
+ address_1: billingAddress1,
65
+ address_2: billingAddress2,
66
+ postcode: billingPostCode,
67
+ country: billingCountry,
68
+ city: billingCity,
69
+ first_name: billingFirstName,
70
+ last_name: billingLastName,
71
+ state: billingState,
72
+ phone: billingPhone,
73
+ email: billingEmail
74
+ } = billing
75
+
76
+ var orderShipping = {
77
+ address1: shippingAddress1 == null ? billingAddress1 : shippingAddress1,
78
+ address2: shippingAddress2 == null ? billingAddress2 : shippingAddress2,
79
+ address3: null,
80
+ address4: null,
81
+ address5: null,
82
+ phone1: shippingPhone == null || shippingPhone == '' ? billingPhone : shippingPhone,
83
+ phone2: null,
84
+ email: shippingEmail == null ? billingEmail : shippingEmail,
85
+ postCode: shippingPostCode == null ? billingPostCode : shippingPostCode,
86
+ city: shippingCity == null ? billingCity : shippingCity,
87
+ state: shippingState == null ? billingState : shippingState,
88
+ country:
89
+ shippingCountry == null
90
+ ? billingCountry === 'MY'
91
+ ? 'Malaysia'
92
+ : billingCountry
93
+ : billingCountry === 'MY'
94
+ ? 'Malaysia'
95
+ : billingCountry,
96
+ collectionCurrency: currency,
97
+ attentionTo:
98
+ shippingFirstName == null
99
+ ? `${billingFirstName} ${billingLastName}`
100
+ : `${shippingFirstName} ${shippingLastName}`
101
+ }
102
+
103
+ return {
104
+ name,
105
+ orderNo,
106
+ status,
107
+ orderCreatedAt,
108
+ orderUpdatedAt,
109
+ totalAmount,
110
+ itemCount: line_items.length,
111
+ orderItems,
112
+ orderShipping
113
+ }
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,190 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#list-all-orders */
2
+ /* /wp-json/wc/v3/orders */
3
+
4
+ import { StoreAPI } from '../../store-api'
5
+
6
+ export function getStoreOrders() {
7
+ return {
8
+ method: 'get',
9
+ path: '/orders',
10
+ denormalize(req) {
11
+ var { pagination, fromCreatedDate, toCreatedDate } = req || {}
12
+ var { page = 0, limit = 100 } = pagination || {}
13
+
14
+ var after = new Date(fromCreatedDate).toISOString()
15
+ var before = new Date(toCreatedDate).toISOString()
16
+ /* Must include only create_time or update_time in the request. */
17
+ // var update_time_from = lastOneDay
18
+ // var update_time_to = now
19
+
20
+ var payload = {
21
+ offset: page * limit,
22
+ per_page: limit,
23
+ page: page + 1,
24
+ after,
25
+ before
26
+ }
27
+
28
+ return { payload }
29
+ },
30
+ async normalize(res, { store }) {
31
+ // return res.orders
32
+ var { items: orders, link } = res
33
+ let results: any[] = []
34
+
35
+ var more: boolean = false
36
+
37
+ if (link) {
38
+ more = checkNextPage(link)
39
+ }
40
+
41
+ for (var i = 0; i < orders.length; i++) {
42
+ const order = orders[i]
43
+
44
+ var firstName: any
45
+ var lastName: any
46
+ if (order.customer_id != 0) {
47
+ var customerInfo = await StoreAPI.getCustomerInfo(store, { id: order.customer_id })
48
+
49
+ firstName = customerInfo.first_name
50
+ lastName = customerInfo.last_name
51
+ } else {
52
+ firstName = 'GUEST'
53
+ }
54
+
55
+ const {
56
+ id: name,
57
+ number: orderNo,
58
+ currency,
59
+ total: totalAmount,
60
+ payment_method: paymentMethod,
61
+ status,
62
+ discount_total: discountValue,
63
+ date_created_gmt,
64
+ date_modified_gmt,
65
+ shipping,
66
+ billing,
67
+ line_items
68
+ } = order
69
+
70
+ let docRefNo = orderNo
71
+ var orderCreatedAt = new Date(date_created_gmt)
72
+ var orderUpdatedAt = new Date(date_modified_gmt)
73
+
74
+ let orderItems = line_items.map(item => {
75
+ var {
76
+ id: name,
77
+ product_id,
78
+ variation_id,
79
+ quantity: qty,
80
+ price,
81
+ subtotal,
82
+ subtotal_tax: subtotalTax,
83
+ total,
84
+ total_tax: totalTax,
85
+ originalPrice: subtotal
86
+ } = item
87
+
88
+ return {
89
+ name,
90
+ variationId: variation_id === 0 ? product_id : variation_id,
91
+ qty,
92
+ paidPrice: price,
93
+ orderNo,
94
+ docRefNo,
95
+ paymentMethod,
96
+ discountValue,
97
+ subtotal,
98
+ subtotalTax,
99
+ total,
100
+ totalTax,
101
+ originalPrice: subtotal
102
+ }
103
+ })
104
+
105
+ const {
106
+ address_1: shippingAddress1,
107
+ address_2: shippingAddress2,
108
+ postcode: shippingPostCode,
109
+ country: shippingCountry,
110
+ city: shippingCity,
111
+ first_name: shippingFirstName,
112
+ last_name: shippingLastName,
113
+ state: shippingState,
114
+ phone: shippingPhone,
115
+ email: shippingEmail
116
+ } = shipping
117
+
118
+ const {
119
+ address_1: billingAddress1,
120
+ address_2: billingAddress2,
121
+ postcode: billingPostCode,
122
+ country: billingCountry,
123
+ city: billingCity,
124
+ first_name: billingFirstName,
125
+ last_name: billingLastName,
126
+ state: billingState,
127
+ phone: billingPhone,
128
+ email: billingEmail
129
+ } = billing
130
+
131
+ var orderShipping = {
132
+ address1: shippingAddress1 == null ? billingAddress1 : shippingAddress1,
133
+ address2: shippingAddress2 == null ? billingAddress2 : shippingAddress2,
134
+ address3: null,
135
+ address4: null,
136
+ address5: null,
137
+ phone1: shippingPhone == null || shippingPhone == '' ? billingPhone : shippingPhone,
138
+ phone2: null,
139
+ email: shippingEmail == null ? billingEmail : shippingEmail,
140
+ postCode: shippingPostCode == null ? billingPostCode : shippingPostCode,
141
+ city: shippingCity == null ? billingCity : shippingCity,
142
+ state: shippingState == null ? billingState : shippingState,
143
+ country:
144
+ shippingCountry == null
145
+ ? billingCountry === 'MY'
146
+ ? 'Malaysia'
147
+ : billingCountry
148
+ : billingCountry === 'MY'
149
+ ? 'Malaysia'
150
+ : billingCountry,
151
+ collectionCurrency: currency,
152
+ attentionTo:
153
+ shippingFirstName == null
154
+ ? `${billingFirstName} ${billingLastName}`
155
+ : `${shippingFirstName} ${shippingLastName}`
156
+ }
157
+
158
+ results.push({
159
+ name,
160
+ orderNo,
161
+ status,
162
+ orderCreatedAt,
163
+ orderUpdatedAt,
164
+ totalAmount,
165
+ itemCount: line_items.length,
166
+ orderItems,
167
+ orderShipping,
168
+ billing,
169
+ shipping,
170
+ firstName,
171
+ lastName,
172
+ isSOF: true
173
+ })
174
+ }
175
+
176
+ return { results, more }
177
+ }
178
+ }
179
+ }
180
+
181
+ function checkNextPage(link) {
182
+ let nextPage: boolean = false
183
+
184
+ // If there's a previous link, remove the first part of the string entirely
185
+ if (link.indexOf(`rel="next"`) > -1) {
186
+ nextPage = true
187
+ }
188
+
189
+ return nextPage
190
+ }
@@ -0,0 +1,18 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#list-all-products /wp-json/wc/v3/categoriess */
2
+
3
+ export function getStoreProductCategories() {
4
+ return {
5
+ method: 'get',
6
+ path: '/products/categories',
7
+ denormalize(req) {
8
+ return { payload: {
9
+ per_page: 100
10
+ } }
11
+ },
12
+ normalize(res, { store }) {
13
+ const { items, totalItems } = res
14
+
15
+ return { results: items, total: parseInt(totalItems) }
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,16 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#list-all-product-variations */
2
+ /* /wp-json/wc/v3/products/<product_id>/variations */
3
+
4
+ export function getStoreProductVariations(req) {
5
+ return {
6
+ method: 'get',
7
+ denormalize() {
8
+ const payload: any = {}
9
+ return { payload }
10
+ },
11
+ async normalize(res, { store }) {
12
+ return res.items
13
+ },
14
+ path: '/products/' + req + '/variations'
15
+ }
16
+ }
@@ -0,0 +1,135 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#list-all-products /wp-json/wc/v3/products */
2
+ import { StoreAPI } from '../../store-api'
3
+
4
+ export function getStoreProducts() {
5
+ return {
6
+ method: 'get',
7
+ path: '/products',
8
+ denormalize(req) {
9
+ var { pagination } = req || {}
10
+ var { page, limit } = pagination || { page: 0, limit: 100 }
11
+
12
+ var payload: any = {
13
+ per_page: limit,
14
+ offset: page * limit
15
+ }
16
+
17
+ return { payload }
18
+ },
19
+ async normalize(res, { store }) {
20
+ const { items, totalItems: totalProducts } = res
21
+
22
+ let results: any[] = []
23
+
24
+ for (var i = 0; i < items.length; i++) {
25
+ const product: any = items[i]
26
+ const productVariations: any[] = await StoreAPI.getStoreProductVariations(store, product.id)
27
+
28
+ const result = {
29
+ itemId: product.id,
30
+ name: product.name,
31
+ type: product.type,
32
+ description: product.description,
33
+ hasVariation: product.variations.length > 0 ? true : false,
34
+ categoryId: product?.categories.length > 0 ? product.categories[0].id : null,
35
+ images: product.images.map(image => {
36
+ return image.src
37
+ }),
38
+ attributes:
39
+ product?.attributes?.map(attribute => {
40
+ return {
41
+ attributeId: attribute.id,
42
+ name: attribute.name,
43
+ originalValue: attribute.options,
44
+ native_attribute_id: attribute.id,
45
+ attribute_key: attribute.name,
46
+ values: attribute.options
47
+ }
48
+ }) || [],
49
+ sellercraftAttributes: [
50
+ {
51
+ native_attribute_id: 'description',
52
+ attribute_key: 'description',
53
+ display_name: 'Description',
54
+ values: [product.description]
55
+ }
56
+ ],
57
+ isVerified: product.purchasable,
58
+ variations:
59
+ productVariations.length === 0
60
+ ? [
61
+ {
62
+ variationId: product.id,
63
+ variationSku: product.sku,
64
+ channelSku: product.sku,
65
+ name: product.name,
66
+ qty: product.manage_stock === true ? parseFloat(product.stock_quantity) : null,
67
+ primaryUnit: 'N/A',
68
+ primaryUnitValue: product.weight === '' ? null : parseFloat(product.weight),
69
+ costPrice: product.price === '' ? null : parseFloat(product.regular_price),
70
+ sellPrice: product.sale_price === '' ? null : parseFloat(product.sale_price),
71
+ attributes:
72
+ product?.attributes?.map(attribute => {
73
+ return {
74
+ attributeId: attribute.id,
75
+ name: attribute.name,
76
+ originalValue: attribute.options,
77
+ native_attribute_id: attribute.id,
78
+ attribute_key: attribute.name,
79
+ values: attribute.options
80
+ }
81
+ }) || [],
82
+ isEnabled: product.purchasable,
83
+ length: product.dimensions.length * 10,
84
+ width: product.dimensions.width * 10,
85
+ height: product.dimensions.height * 10,
86
+ weight: product.weight * 1000
87
+ }
88
+ ]
89
+ : productVariations.map(variant => {
90
+ return {
91
+ variationId: variant.id,
92
+ variationSku: variant.sku,
93
+ channelSku: variant.sku,
94
+ name:
95
+ product.name + variant?.attributes.length > 0 ? ' (' + variant.attributes[0].options + ')' : '',
96
+ qty: variant.manage_stock === true ? parseFloat(variant.stock_quantity) : null,
97
+ primaryUnit: 'N/A',
98
+ primaryUnitValue: variant.weight === '' ? null : parseFloat(variant.weight),
99
+ costPrice: variant.price === '' ? null : parseFloat(variant.regular_price),
100
+ sellPrice: variant.sale_price === '' ? null : parseFloat(variant.sale_price),
101
+ attributes:
102
+ variant?.attributes?.map(attribute => {
103
+ return {
104
+ attributeId: attribute.id,
105
+ name: attribute.name,
106
+ originalValue: attribute.options,
107
+ native_attribute_id: attribute.id,
108
+ attribute_key: attribute.name,
109
+ values: [attribute.option]
110
+ }
111
+ }) || [],
112
+ sellercraftAttributes: variant?.attributes?.map(attribute => {
113
+ return {
114
+ native_attribute_id: attribute.name,
115
+ attribute_key: attribute.name,
116
+ display_name: attribute.name,
117
+ values: [attribute.option]
118
+ }
119
+ }) || [],
120
+ isEnabled: variant.purchasable,
121
+ length: variant.dimensions.length * 10,
122
+ width: variant.dimensions.width * 10,
123
+ height: variant.dimensions.height * 10,
124
+ weight: variant.weight * 1000
125
+ }
126
+ })
127
+ }
128
+
129
+ results.push({ ...result })
130
+ }
131
+
132
+ return { results, total: totalProducts }
133
+ }
134
+ }
135
+ }
@@ -0,0 +1,19 @@
1
+ export * from './echo'
2
+ export * from './create-order-note'
3
+ export * from './get-store-product-categories'
4
+ export * from './get-store-products'
5
+ export * from './get-store-product-variations'
6
+ export * from './get-store-orders'
7
+ export * from './update-store-product-stock'
8
+ export * from './update-store-product-variation-stock'
9
+ export * from './get-store-product-categories'
10
+ export * from './update-order-status'
11
+ export * from './update-product-attribute'
12
+ export * from './update-store-product-price'
13
+ export * from './update-store-product-variation-price'
14
+ export * from './get-store-order'
15
+ export * from './update-store-product-price'
16
+ export * from './update-store-product-variant-stock'
17
+ export * from './update-store-product-variant-price'
18
+ export * from './get-customer-info'
19
+ export * from './set-store-order-status-ready-to-ship'
@@ -0,0 +1,17 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#create-an-order-note */
2
+ /* /wp-json/wc/v3/orders */
3
+
4
+ export function setStoreOrderStatusReadyToShip(req) {
5
+ return {
6
+ method: 'post',
7
+ path: '/orders/{orderId}/notes',
8
+ denormalize(req) {
9
+ var { note, orderId } = req || {}
10
+
11
+ return { resource: { orderId: orderId }, payload: { note, customer_note: true } }
12
+ },
13
+ normalize(res) {
14
+ return res
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,40 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/#update-an-order */
2
+ /* /wp-json/wc/v3/orders/<id> */
3
+
4
+ import { StoreAPI } from '../../store-api'
5
+
6
+ const ORDER_STATUS = {
7
+ PAYMENT_PENDING: 'pending',
8
+ PROCESSING: 'processing',
9
+ PACKED: 'processing',
10
+ READY_TO_SHIP: 'processing',
11
+ SHIPPED: 'processing',
12
+ CONFIRMED: 'processing',
13
+ DELIVERED: 'completed',
14
+ CLOSED: 'completed',
15
+ CANCELLED: 'cancelled',
16
+ REFUND_COMPLETE: 'refunded',
17
+ RETURN_COMPLETE: 'refunded',
18
+ REVERSE_SHIPMENT_FAILED: 'failed',
19
+ SHIPMENT_LOST_OR_DAMAGED: 'failed',
20
+ PAYMENT_PENDING_TIMEOUT: 'failed'
21
+ }
22
+
23
+ export function updateOrderStatus(req) {
24
+ return {
25
+ method: 'put',
26
+ path: '/orders/{orderId}',
27
+ async denormalize(req, { store }) {
28
+ var { status, orderId } = req || {}
29
+
30
+ const order = await StoreAPI.getStoreOrder(store, { orderId })
31
+
32
+ let orderStatus = ORDER_STATUS[`${status}`] || order.status
33
+
34
+ return { resource: { orderId: orderId }, payload: { status: orderStatus } }
35
+ },
36
+ normalize(res) {
37
+ return res
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,20 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-product-attribute */
2
+ /* /wp-json/wc/v3/attributes/<id> */
3
+
4
+ export function updateProductAttribute(req) {
5
+ return {
6
+ method: 'put',
7
+ path: '/products/{itemId}/variations/{variantId}',
8
+ denormalize(req) {
9
+
10
+ var { productSku, itemId, variant } = req || {}
11
+
12
+ const data = variant.attributes
13
+
14
+ return { resource: { itemId, variantId: variant.native_variant_id }, payload: { attributes: data } }
15
+ },
16
+ normalize(res) {
17
+ return res
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#update-a-product */
2
+ /* /wp-json/wc/v3/products/<id> */
3
+
4
+ export function updateStoreProductPrice(req) {
5
+ return {
6
+ method: 'put',
7
+ path: '/products/{itemId}',
8
+ denormalize(req) {
9
+ var { costPrice, sellPrice, productId } = req || {}
10
+
11
+ return {
12
+ resource: { itemId: parseInt(productId) },
13
+ payload: { regular_price: costPrice?.toString(), sale_price: sellPrice?.toString() }
14
+ }
15
+ },
16
+ normalize(res) {
17
+ return res
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,17 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#update-a-product */
2
+ /* /wp-json/wc/v3/products/<id> */
3
+
4
+ export function updateStoreProductStock(req) {
5
+ return {
6
+ method: 'put',
7
+ path: '/products/{itemId}',
8
+ denormalize(req) {
9
+ var { qty, itemId } = (Array.isArray(req) ? req[0] : req) || {}
10
+
11
+ return { resource: { itemId: parseInt(itemId) }, payload: { stock_quantity: qty, manage_stock: true } }
12
+ },
13
+ normalize(res) {
14
+ return res
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#update-a-product-variation */
2
+ /* /wp-json/wc/v3/products/<product_id>/variations/<id> */
3
+
4
+ export function updateStoreProductVariantPrice(req) {
5
+ return {
6
+ method: 'put',
7
+ path: '/products/{itemId}/variations/{variantId}',
8
+ denormalize(req) {
9
+ var { cost_price, sell_price, product_id, variant_id } = req[0] || {}
10
+
11
+ return { resource: { itemId: parseInt(product_id), variantId: parseInt(variant_id) }, payload: { price: cost_price, sale_price: sell_price } }
12
+ },
13
+ normalize(res) {
14
+ return res.items
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#update-a-product-variation */
2
+ /* /wp-json/wc/v3/products/<product_id>/variations/<id> */
3
+
4
+ export function updateStoreProductVariantStock(req) {
5
+ return {
6
+ method: 'put',
7
+ path: '/products/{itemId}/variations/{variantId}',
8
+ denormalize(req) {
9
+ var { qty, product_id, variant_id } = req[0] || {}
10
+
11
+ return { resource: { itemId: parseInt(product_id), variantId: parseInt(variant_id) }, payload: { stock_quantity: qty, manage_stock: true } }
12
+ },
13
+ normalize(res) {
14
+ return res.items
15
+ }
16
+ }
17
+ }
18
+
@@ -0,0 +1,20 @@
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#update-a-product-variation */
2
+ /* /wp-json/wc/v3/products/<product_id>/variations/<id> */
3
+
4
+ export function updateStoreProductVariationPrice(req) {
5
+ return {
6
+ method: 'put',
7
+ path: '/products/{itemId}/variations/{variantId}',
8
+ denormalize(req) {
9
+ var { costPrice, sellPrice, productId, variationId } = req || {}
10
+
11
+ return {
12
+ resource: { itemId: parseInt(productId), variantId: parseInt(variationId) },
13
+ payload: { regular_price: costPrice?.toString(), sale_price: sellPrice?.toString(), on_sale: costPrice != sellPrice ? true : false }
14
+ }
15
+ },
16
+ normalize(res) {
17
+ return res
18
+ }
19
+ }
20
+ }