@things-factory/integration-marketplace 8.0.6 → 9.0.0-beta.12
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/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/server/controllers/index.ts +0 -9
- package/server/controllers/lazada/apis/cancel-store-order.ts +0 -19
- package/server/controllers/lazada/apis/create-store-product.ts +0 -55
- package/server/controllers/lazada/apis/delete-store-product.ts +0 -16
- package/server/controllers/lazada/apis/echo.ts +0 -14
- package/server/controllers/lazada/apis/get-store-logistics.ts +0 -21
- package/server/controllers/lazada/apis/get-store-order-document.ts +0 -25
- package/server/controllers/lazada/apis/get-store-order-item-transaction-details.ts +0 -65
- package/server/controllers/lazada/apis/get-store-order-items.ts +0 -179
- package/server/controllers/lazada/apis/get-store-order.ts +0 -87
- package/server/controllers/lazada/apis/get-store-orders.ts +0 -127
- package/server/controllers/lazada/apis/get-store-product-brands.ts +0 -27
- package/server/controllers/lazada/apis/get-store-product-categories.ts +0 -14
- package/server/controllers/lazada/apis/get-store-product-category-attributes.ts +0 -16
- package/server/controllers/lazada/apis/get-store-product.ts +0 -42
- package/server/controllers/lazada/apis/get-store-products.ts +0 -84
- package/server/controllers/lazada/apis/get-store-refund-orders.ts +0 -52
- package/server/controllers/lazada/apis/index.ts +0 -24
- package/server/controllers/lazada/apis/set-order-invoice-no.ts +0 -24
- package/server/controllers/lazada/apis/set-store-order-status-delivered.ts +0 -17
- package/server/controllers/lazada/apis/set-store-order-status-failed-delivery.ts +0 -17
- package/server/controllers/lazada/apis/set-store-order-status-packed-by-marketplace.ts +0 -46
- package/server/controllers/lazada/apis/set-store-order-status-ready-to-ship.ts +0 -28
- package/server/controllers/lazada/apis/update-store-product-stock.ts +0 -29
- package/server/controllers/lazada/apis/update-store-product-variation-stock.ts +0 -29
- package/server/controllers/lazada/apis/update-store-product.ts +0 -51
- package/server/controllers/lazada/client/index.ts +0 -3
- package/server/controllers/lazada/client/lazada.ts +0 -142
- package/server/controllers/lazada/client/signature.ts +0 -67
- package/server/controllers/lazada/client/types.ts +0 -30
- package/server/controllers/lazada/client/xml.ts +0 -24
- package/server/controllers/lazada/index.ts +0 -8
- package/server/controllers/lazada/platform-action.ts +0 -35
- package/server/controllers/magento/apis/create-order-comment.ts +0 -32
- package/server/controllers/magento/apis/create-order-refund.ts +0 -20
- package/server/controllers/magento/apis/create-order-ship.ts +0 -43
- package/server/controllers/magento/apis/echo.ts +0 -14
- package/server/controllers/magento/apis/get-store-order.ts +0 -15
- package/server/controllers/magento/apis/get-store-orders.ts +0 -159
- package/server/controllers/magento/apis/get-store-product-categories.ts +0 -43
- package/server/controllers/magento/apis/get-store-product-variations.ts +0 -17
- package/server/controllers/magento/apis/get-store-product.ts +0 -44
- package/server/controllers/magento/apis/get-store-products.ts +0 -120
- package/server/controllers/magento/apis/get-store-stock-item.ts +0 -66
- package/server/controllers/magento/apis/index.ts +0 -16
- package/server/controllers/magento/apis/update-order-status.ts +0 -56
- package/server/controllers/magento/apis/update-store-product-price.ts +0 -24
- package/server/controllers/magento/apis/update-store-product-stock.ts +0 -42
- package/server/controllers/magento/apis/update-store-product-variation-price.ts +0 -24
- package/server/controllers/magento/apis/update-store-product-variation-stock.ts +0 -42
- package/server/controllers/magento/index.ts +0 -8
- package/server/controllers/magento/magento.ts +0 -202
- package/server/controllers/magento/platform-action.ts +0 -44
- package/server/controllers/shopee/apis/accept-store-order-cancellation.ts +0 -22
- package/server/controllers/shopee/apis/cancel-store-order.ts +0 -25
- package/server/controllers/shopee/apis/create-store-product-variations.ts +0 -33
- package/server/controllers/shopee/apis/create-store-product.ts +0 -57
- package/server/controllers/shopee/apis/delete-store-product.ts +0 -19
- package/server/controllers/shopee/apis/echo.ts +0 -14
- package/server/controllers/shopee/apis/get-address.ts +0 -32
- package/server/controllers/shopee/apis/get-branch-list.ts +0 -30
- package/server/controllers/shopee/apis/get-logistics-param.ts +0 -71
- package/server/controllers/shopee/apis/get-store-logistics.ts +0 -21
- package/server/controllers/shopee/apis/get-store-order-document.ts +0 -27
- package/server/controllers/shopee/apis/get-store-order-items.ts +0 -47
- package/server/controllers/shopee/apis/get-store-order-payout-dates.ts +0 -29
- package/server/controllers/shopee/apis/get-store-order-transaction-details.ts +0 -29
- package/server/controllers/shopee/apis/get-store-order.ts +0 -136
- package/server/controllers/shopee/apis/get-store-orders.ts +0 -39
- package/server/controllers/shopee/apis/get-store-product-categories.ts +0 -19
- package/server/controllers/shopee/apis/get-store-product-category-attributes.ts +0 -18
- package/server/controllers/shopee/apis/get-store-product.ts +0 -84
- package/server/controllers/shopee/apis/get-store-products.ts +0 -30
- package/server/controllers/shopee/apis/get-store-refund-order-details.ts +0 -41
- package/server/controllers/shopee/apis/get-store-refund-orders.ts +0 -47
- package/server/controllers/shopee/apis/get-time-slot.ts +0 -25
- package/server/controllers/shopee/apis/index.ts +0 -30
- package/server/controllers/shopee/apis/init-logistics.ts +0 -39
- package/server/controllers/shopee/apis/reject-store-order-cancellation.ts +0 -22
- package/server/controllers/shopee/apis/split-order.ts +0 -44
- package/server/controllers/shopee/apis/update-store-product-stock.ts +0 -24
- package/server/controllers/shopee/apis/update-store-product-variation-stock.ts +0 -21
- package/server/controllers/shopee/apis/update-store-product.ts +0 -85
- package/server/controllers/shopee/apis2/create-shipping-document.ts +0 -27
- package/server/controllers/shopee/apis2/echo.ts +0 -14
- package/server/controllers/shopee/apis2/get-logistics-param.ts +0 -66
- package/server/controllers/shopee/apis2/get-shipping-document-result.ts +0 -21
- package/server/controllers/shopee/apis2/get-store-logistics.ts +0 -23
- package/server/controllers/shopee/apis2/get-store-order-by-batch.ts +0 -97
- package/server/controllers/shopee/apis2/get-store-order-document.ts +0 -39
- package/server/controllers/shopee/apis2/get-store-order-payout-dates.ts +0 -33
- package/server/controllers/shopee/apis2/get-store-order-transaction-details.ts +0 -28
- package/server/controllers/shopee/apis2/get-store-order.ts +0 -93
- package/server/controllers/shopee/apis2/get-store-orders.ts +0 -40
- package/server/controllers/shopee/apis2/get-store-product-variations.ts +0 -17
- package/server/controllers/shopee/apis2/get-store-product.ts +0 -105
- package/server/controllers/shopee/apis2/get-store-products.ts +0 -28
- package/server/controllers/shopee/apis2/get-store-refund-order-details.ts +0 -39
- package/server/controllers/shopee/apis2/get-store-refund-orders.ts +0 -37
- package/server/controllers/shopee/apis2/get-tracking-number.ts +0 -17
- package/server/controllers/shopee/apis2/index.ts +0 -20
- package/server/controllers/shopee/apis2/init-logistics.ts +0 -39
- package/server/controllers/shopee/apis2/update-store-product-stock.ts +0 -26
- package/server/controllers/shopee/apis2/update-store-product-variation-stock.ts +0 -28
- package/server/controllers/shopee/index.ts +0 -16
- package/server/controllers/shopee/platform-action.ts +0 -58
- package/server/controllers/shopee/refresh-access-token.ts +0 -78
- package/server/controllers/shopee/shopee.ts +0 -191
- package/server/controllers/shopify/apis/echo.ts +0 -14
- package/server/controllers/shopify/apis/get-airway-bill.ts +0 -17
- package/server/controllers/shopify/apis/get-inventory-level.ts +0 -17
- package/server/controllers/shopify/apis/get-store-order.ts +0 -172
- package/server/controllers/shopify/apis/get-store-orders.ts +0 -290
- package/server/controllers/shopify/apis/get-store-product-categories.ts +0 -19
- package/server/controllers/shopify/apis/get-store-product-category-attributes.ts +0 -18
- package/server/controllers/shopify/apis/get-store-product-variation-stock.ts +0 -17
- package/server/controllers/shopify/apis/get-store-products-count.ts +0 -14
- package/server/controllers/shopify/apis/get-store-products.ts +0 -177
- package/server/controllers/shopify/apis/index.ts +0 -13
- package/server/controllers/shopify/apis/set-store-order-status-ready-to-ship.ts +0 -31
- package/server/controllers/shopify/apis/update-order-status.ts +0 -32
- package/server/controllers/shopify/apis/update-store-product-price.ts +0 -26
- package/server/controllers/shopify/apis/update-store-product-stock.ts +0 -20
- package/server/controllers/shopify/apis/update-store-product-variation-price.ts +0 -26
- package/server/controllers/shopify/apis/update-store-product-variation-stock.ts +0 -20
- package/server/controllers/shopify/index.ts +0 -8
- package/server/controllers/shopify/platform-action.ts +0 -43
- package/server/controllers/shopify/shopify.ts +0 -148
- package/server/controllers/store-api/decorators.ts +0 -44
- package/server/controllers/store-api/index.ts +0 -209
- package/server/controllers/store-api/types.ts +0 -0
- package/server/controllers/tiktok/apis/echo.ts +0 -14
- package/server/controllers/tiktok/apis/get-store-order-document.ts +0 -26
- package/server/controllers/tiktok/apis/get-store-order-package.ts +0 -46
- package/server/controllers/tiktok/apis/get-store-order-packages.ts +0 -43
- package/server/controllers/tiktok/apis/get-store-order.ts +0 -176
- package/server/controllers/tiktok/apis/get-store-orders.ts +0 -55
- package/server/controllers/tiktok/apis/get-store-product-attributes.ts +0 -29
- package/server/controllers/tiktok/apis/get-store-product-categories.ts +0 -27
- package/server/controllers/tiktok/apis/get-store-product.ts +0 -95
- package/server/controllers/tiktok/apis/get-store-products.ts +0 -45
- package/server/controllers/tiktok/apis/index.ts +0 -13
- package/server/controllers/tiktok/apis/update-order-status.ts +0 -24
- package/server/controllers/tiktok/apis/update-store-product-variation-price.ts +0 -24
- package/server/controllers/tiktok/apis/update-store-product-variation-stock.ts +0 -28
- package/server/controllers/tiktok/client/index.ts +0 -2
- package/server/controllers/tiktok/client/signature.ts +0 -78
- package/server/controllers/tiktok/client/tiktok.ts +0 -150
- package/server/controllers/tiktok/client/types.ts +0 -20
- package/server/controllers/tiktok/index.ts +0 -8
- package/server/controllers/tiktok/platform-action.ts +0 -72
- package/server/controllers/woocommerce/apis/create-order-note.ts +0 -17
- package/server/controllers/woocommerce/apis/echo.ts +0 -14
- package/server/controllers/woocommerce/apis/get-customer-info.ts +0 -18
- package/server/controllers/woocommerce/apis/get-store-order.ts +0 -116
- package/server/controllers/woocommerce/apis/get-store-orders.ts +0 -190
- package/server/controllers/woocommerce/apis/get-store-product-categories.ts +0 -18
- package/server/controllers/woocommerce/apis/get-store-product-variations.ts +0 -16
- package/server/controllers/woocommerce/apis/get-store-products.ts +0 -135
- package/server/controllers/woocommerce/apis/index.ts +0 -19
- package/server/controllers/woocommerce/apis/set-store-order-status-ready-to-ship.ts +0 -17
- package/server/controllers/woocommerce/apis/update-order-status.ts +0 -40
- package/server/controllers/woocommerce/apis/update-product-attribute.ts +0 -20
- package/server/controllers/woocommerce/apis/update-store-product-price.ts +0 -20
- package/server/controllers/woocommerce/apis/update-store-product-stock.ts +0 -17
- package/server/controllers/woocommerce/apis/update-store-product-variant-price.ts +0 -17
- package/server/controllers/woocommerce/apis/update-store-product-variant-stock.ts +0 -18
- package/server/controllers/woocommerce/apis/update-store-product-variation-price.ts +0 -20
- package/server/controllers/woocommerce/apis/update-store-product-variation-stock.ts +0 -20
- package/server/controllers/woocommerce/index.ts +0 -8
- package/server/controllers/woocommerce/platform-action.ts +0 -48
- package/server/controllers/woocommerce/woocommerce.ts +0 -104
- package/server/controllers/zalora/apis/echo.ts +0 -14
- package/server/controllers/zalora/apis/get-airway-bill.ts +0 -17
- package/server/controllers/zalora/apis/get-store-order-items.ts +0 -17
- package/server/controllers/zalora/apis/get-store-order.ts +0 -17
- package/server/controllers/zalora/apis/get-store-orders.ts +0 -21
- package/server/controllers/zalora/apis/get-store-product-categories.ts +0 -20
- package/server/controllers/zalora/apis/get-store-product-category-attributes.ts +0 -18
- package/server/controllers/zalora/apis/get-store-products.ts +0 -20
- package/server/controllers/zalora/apis/index.ts +0 -8
- package/server/controllers/zalora/index.ts +0 -8
- package/server/controllers/zalora/platform-action.ts +0 -18
- package/server/controllers/zalora/zalora/index.ts +0 -70
- package/server/controllers/zalora/zalora/signature.ts +0 -37
- package/server/controllers/zalora/zalora/xml.ts +0 -24
- package/server/engine/connector/index.ts +0 -3
- package/server/engine/connector/lazada-connector.ts +0 -49
- package/server/engine/connector/marketplace-connector.ts +0 -33
- package/server/engine/connector/shopee-connector.ts +0 -46
- package/server/engine/index.ts +0 -2
- package/server/engine/task/index.ts +0 -4
- package/server/engine/task/lazada-get.ts +0 -48
- package/server/engine/task/lazada-post.ts +0 -46
- package/server/engine/task/marketplace-api.ts +0 -72
- package/server/engine/task/shopee-post.ts +0 -51
- package/server/entities/index.ts +0 -8
- package/server/entities/marketplace-distributor.ts +0 -42
- package/server/entities/marketplace-setting.ts +0 -49
- package/server/entities/marketplace-store.ts +0 -100
- package/server/entities/marketplace-transporter.ts +0 -46
- package/server/graphql/constants/index.ts +0 -1
- package/server/graphql/constants/store.ts +0 -5
- package/server/graphql/index.ts +0 -9
- package/server/graphql/resolvers/index.ts +0 -6
- package/server/graphql/resolvers/marketplace-distributor/create-marketplace-distributor.ts +0 -15
- package/server/graphql/resolvers/marketplace-distributor/delete-marketplace-distributor.ts +0 -13
- package/server/graphql/resolvers/marketplace-distributor/delete-marketplace-distributors.ts +0 -18
- package/server/graphql/resolvers/marketplace-distributor/index.ts +0 -19
- package/server/graphql/resolvers/marketplace-distributor/marketplace-distributor-query.ts +0 -57
- package/server/graphql/resolvers/marketplace-distributor/update-marketplace-distributor.ts +0 -22
- package/server/graphql/resolvers/marketplace-distributor/update-multiple-marketplace-distributor.ts +0 -49
- package/server/graphql/resolvers/marketplace-setting/create-marketplace-setting.ts +0 -16
- package/server/graphql/resolvers/marketplace-setting/delete-marketplace-setting.ts +0 -13
- package/server/graphql/resolvers/marketplace-setting/delete-marketplace-settings.ts +0 -18
- package/server/graphql/resolvers/marketplace-setting/index.ts +0 -19
- package/server/graphql/resolvers/marketplace-setting/marketplace-setting-query.ts +0 -56
- package/server/graphql/resolvers/marketplace-setting/update-marketplace-setting.ts +0 -32
- package/server/graphql/resolvers/marketplace-setting/update-multiple-marketplace-setting.ts +0 -49
- package/server/graphql/resolvers/marketplace-store/create-marketplace-store.ts +0 -20
- package/server/graphql/resolvers/marketplace-store/delete-marketplace-store.ts +0 -21
- package/server/graphql/resolvers/marketplace-store/delete-marketplace-stores.ts +0 -26
- package/server/graphql/resolvers/marketplace-store/index.ts +0 -40
- package/server/graphql/resolvers/marketplace-store/lazada/deactivate-lazada-store.ts +0 -28
- package/server/graphql/resolvers/marketplace-store/lazada/generate-lazada-access-token.ts +0 -61
- package/server/graphql/resolvers/marketplace-store/lazada/get-lazada-auth-url.ts +0 -9
- package/server/graphql/resolvers/marketplace-store/lazada/index.ts +0 -12
- package/server/graphql/resolvers/marketplace-store/magento/activate-magento-store.ts +0 -82
- package/server/graphql/resolvers/marketplace-store/magento/deactivate-magento-store.ts +0 -27
- package/server/graphql/resolvers/marketplace-store/magento/get-magento-auth-url.ts +0 -12
- package/server/graphql/resolvers/marketplace-store/magento/index.ts +0 -12
- package/server/graphql/resolvers/marketplace-store/marketplace-store.ts +0 -14
- package/server/graphql/resolvers/marketplace-store/marketplace-stores.ts +0 -18
- package/server/graphql/resolvers/marketplace-store/shopee/deactivate-shopee-store.ts +0 -28
- package/server/graphql/resolvers/marketplace-store/shopee/generate-shopee-access-token.ts +0 -96
- package/server/graphql/resolvers/marketplace-store/shopee/get-shopee-auth-url.ts +0 -18
- package/server/graphql/resolvers/marketplace-store/shopee/index.ts +0 -13
- package/server/graphql/resolvers/marketplace-store/shopify/deactivate-shopify-store.ts +0 -29
- package/server/graphql/resolvers/marketplace-store/shopify/get-shopify-auth-url.ts +0 -26
- package/server/graphql/resolvers/marketplace-store/shopify/index.ts +0 -11
- package/server/graphql/resolvers/marketplace-store/update-marketplace-store.ts +0 -19
- package/server/graphql/resolvers/marketplace-store/update-multiple-marketplace-store.ts +0 -46
- package/server/graphql/resolvers/marketplace-store/woocommerce/deactivate-woocommerce-store.ts +0 -20
- package/server/graphql/resolvers/marketplace-store/woocommerce/get-woocommerce-auth-url.ts +0 -14
- package/server/graphql/resolvers/marketplace-store/woocommerce/index.ts +0 -10
- package/server/graphql/resolvers/marketplace-store/zalora/deactivate-zalora-store.ts +0 -28
- package/server/graphql/resolvers/marketplace-store/zalora/generate-zalora-access-token.ts +0 -55
- package/server/graphql/resolvers/marketplace-store/zalora/index.ts +0 -9
- package/server/graphql/resolvers/marketplace-transporter/create-marketplace-transporter.ts +0 -21
- package/server/graphql/resolvers/marketplace-transporter/delete-marketplace-transporter.ts +0 -13
- package/server/graphql/resolvers/marketplace-transporter/delete-marketplace-transporters.ts +0 -18
- package/server/graphql/resolvers/marketplace-transporter/index.ts +0 -19
- package/server/graphql/resolvers/marketplace-transporter/marketplace-transporter-query.ts +0 -60
- package/server/graphql/resolvers/marketplace-transporter/update-marketplace-transporter.ts +0 -25
- package/server/graphql/resolvers/marketplace-transporter/update-multiple-marketplace-transporter.ts +0 -49
- package/server/graphql/resolvers/store-order/accept-store-order-cancellation.ts +0 -9
- package/server/graphql/resolvers/store-order/cancel-store-order.ts +0 -8
- package/server/graphql/resolvers/store-order/get-store-order-document.ts +0 -8
- package/server/graphql/resolvers/store-order/get-store-order-items.ts +0 -8
- package/server/graphql/resolvers/store-order/get-store-order.ts +0 -8
- package/server/graphql/resolvers/store-order/get-store-orders.ts +0 -13
- package/server/graphql/resolvers/store-order/index.ts +0 -23
- package/server/graphql/resolvers/store-order/reject-store-order-cancellation.ts +0 -9
- package/server/graphql/resolvers/store-order/set-store-order-status-packed-by-marketplace.ts +0 -9
- package/server/graphql/resolvers/store-order/set-store-order-status-ready-to-ship.ts +0 -10
- package/server/graphql/resolvers/store-product/create-store-product-variations.ts +0 -9
- package/server/graphql/resolvers/store-product/create-store-product.ts +0 -8
- package/server/graphql/resolvers/store-product/delete-store-product.ts +0 -8
- package/server/graphql/resolvers/store-product/get-store-product-brands.ts +0 -14
- package/server/graphql/resolvers/store-product/get-store-product-categories.ts +0 -8
- package/server/graphql/resolvers/store-product/get-store-product-category-attributes.ts +0 -11
- package/server/graphql/resolvers/store-product/get-store-product.ts +0 -8
- package/server/graphql/resolvers/store-product/get-store-products.ts +0 -13
- package/server/graphql/resolvers/store-product/index.ts +0 -25
- package/server/graphql/resolvers/store-product/update-store-product.ts +0 -8
- package/server/graphql/types/index.ts +0 -6
- package/server/graphql/types/marketplace-distributor/index.ts +0 -26
- package/server/graphql/types/marketplace-distributor/marketplace-distributor-list.ts +0 -8
- package/server/graphql/types/marketplace-distributor/marketplace-distributor-patch.ts +0 -11
- package/server/graphql/types/marketplace-distributor/marketplace-distributor.ts +0 -16
- package/server/graphql/types/marketplace-distributor/new-marketplace-distributor.ts +0 -9
- package/server/graphql/types/marketplace-setting/index.ts +0 -22
- package/server/graphql/types/marketplace-setting/marketplace-setting-list.ts +0 -8
- package/server/graphql/types/marketplace-setting/marketplace-setting-patch.ts +0 -12
- package/server/graphql/types/marketplace-setting/marketplace-setting.ts +0 -17
- package/server/graphql/types/marketplace-setting/new-marketplace-setting.ts +0 -11
- package/server/graphql/types/marketplace-store/index.ts +0 -38
- package/server/graphql/types/marketplace-store/marketplace-store-list.ts +0 -8
- package/server/graphql/types/marketplace-store/marketplace-store-patch.ts +0 -21
- package/server/graphql/types/marketplace-store/marketplace-store.ts +0 -28
- package/server/graphql/types/marketplace-store/new-marketplace-store.ts +0 -19
- package/server/graphql/types/marketplace-transporter/index.ts +0 -24
- package/server/graphql/types/marketplace-transporter/marketplace-transporter-list.ts +0 -8
- package/server/graphql/types/marketplace-transporter/marketplace-transporter-patch.ts +0 -13
- package/server/graphql/types/marketplace-transporter/marketplace-transporter.ts +0 -17
- package/server/graphql/types/marketplace-transporter/new-marketplace-transporter.ts +0 -11
- package/server/graphql/types/store-order/index.ts +0 -23
- package/server/graphql/types/store-order/new-store-order.ts +0 -8
- package/server/graphql/types/store-order/store-order-list.ts +0 -8
- package/server/graphql/types/store-order/store-order-patch.ts +0 -10
- package/server/graphql/types/store-order/store-order.ts +0 -14
- package/server/graphql/types/store-product/index.ts +0 -23
- package/server/graphql/types/store-product/new-store-product.ts +0 -8
- package/server/graphql/types/store-product/store-product-list.ts +0 -8
- package/server/graphql/types/store-product/store-product-patch.ts +0 -10
- package/server/graphql/types/store-product/store-product.ts +0 -14
- package/server/index.ts +0 -9
- package/server/migrations/index.ts +0 -9
- package/server/routers/magento-private-router.ts +0 -192
- package/server/routers/magento-public-router.ts +0 -38
- package/server/routers/shopify-install-private-router.ts +0 -95
- package/server/routers/shopify-install-public-router.ts +0 -241
- package/server/routers/shopify-private-router.ts +0 -78
- package/server/routers/shopify-public-router.ts +0 -182
- package/server/routers/woocommerce-router.ts +0 -70
- package/server/routes.ts +0 -21
@@ -1,19 +0,0 @@
|
|
1
|
-
/* https://open.shopee.com/documents?module=2&type=1&id=373 */
|
2
|
-
|
3
|
-
export function getStoreProductCategories() {
|
4
|
-
return {
|
5
|
-
path: '/item/categories/get',
|
6
|
-
denormalize(req) {
|
7
|
-
var { pagination } = req || {}
|
8
|
-
var { page = 0, limit = 100 } = pagination || {}
|
9
|
-
|
10
|
-
return {
|
11
|
-
pagination_entries_per_page: limit,
|
12
|
-
pagination_offset: page
|
13
|
-
}
|
14
|
-
},
|
15
|
-
normalize(res) {
|
16
|
-
return res.categories
|
17
|
-
}
|
18
|
-
}
|
19
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
/* https://open.shopee.com/documents?module=2&type=1&id=372 */
|
2
|
-
|
3
|
-
export function getStoreProductCategoryAttributes() {
|
4
|
-
return {
|
5
|
-
path: '/item/attributes/get',
|
6
|
-
denormalize(req) {
|
7
|
-
var { categoryId, isCrossBorder = true } = req
|
8
|
-
|
9
|
-
return {
|
10
|
-
category_id: categoryId,
|
11
|
-
is_cb: isCrossBorder
|
12
|
-
}
|
13
|
-
},
|
14
|
-
normalize(res) {
|
15
|
-
return res.attributes
|
16
|
-
}
|
17
|
-
}
|
18
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
export function getStoreProductVariationStock() {
|
2
|
-
return {
|
3
|
-
path: '/variants/{variantId}.json',
|
4
|
-
method: 'get',
|
5
|
-
denormalize(req) {
|
6
|
-
let { variantId } = req
|
7
|
-
return {
|
8
|
-
resource: {
|
9
|
-
variantId
|
10
|
-
}
|
11
|
-
}
|
12
|
-
},
|
13
|
-
normalize(res) {
|
14
|
-
return res?.variant?.inventory_quantity
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/* https://shopify.dev/docs/admin-api/rest/reference/products/product?api[version]=2020-01#index-2020-01 */
|
2
|
-
|
3
|
-
export function getStoreProductsCount() {
|
4
|
-
return {
|
5
|
-
method: 'get',
|
6
|
-
path: '/products/count.json',
|
7
|
-
denormalize(req) {
|
8
|
-
return {}
|
9
|
-
},
|
10
|
-
async normalize(res, { store }) {
|
11
|
-
return res.count
|
12
|
-
}
|
13
|
-
}
|
14
|
-
}
|
@@ -1,177 +0,0 @@
|
|
1
|
-
/* https://shopify.dev/docs/admin-api/rest/reference/products/product?api[version]=2020-07#index-2020-07 */
|
2
|
-
|
3
|
-
import { URL } from 'url'
|
4
|
-
|
5
|
-
import { StoreAPI } from '../../store-api'
|
6
|
-
|
7
|
-
export function getStoreProducts() {
|
8
|
-
return {
|
9
|
-
method: 'get',
|
10
|
-
path: '/products.json',
|
11
|
-
denormalize(req) {
|
12
|
-
var { pagination, pageInfo, fromUpdatedDate, toUpdatedDate } = req || {}
|
13
|
-
var { page, limit } = pagination || { page: 0, limit: 100 }
|
14
|
-
|
15
|
-
var payload: any = {
|
16
|
-
limit: limit
|
17
|
-
}
|
18
|
-
|
19
|
-
if (fromUpdatedDate && toUpdatedDate) {
|
20
|
-
payload.updated_at_max = toUpdatedDate
|
21
|
-
payload.updated_at_min = fromUpdatedDate
|
22
|
-
}
|
23
|
-
|
24
|
-
if (pageInfo) payload.page_info = pageInfo
|
25
|
-
|
26
|
-
return { payload }
|
27
|
-
},
|
28
|
-
async normalize(res, { store }) {
|
29
|
-
// return res.products
|
30
|
-
const linkParams = res.link
|
31
|
-
let page_info: string
|
32
|
-
|
33
|
-
if (linkParams) {
|
34
|
-
const url = extractLinkParams(linkParams)
|
35
|
-
var urlParams = new URL(url)
|
36
|
-
page_info = urlParams.searchParams.get('page_info')
|
37
|
-
}
|
38
|
-
|
39
|
-
let results: any[] = []
|
40
|
-
let totalProducts = await StoreAPI.getStoreProductsCount(store, res)
|
41
|
-
|
42
|
-
for (var i = 0; i < res.products.length; i++) {
|
43
|
-
const product: any = res.products[i]
|
44
|
-
const productVariations: any[] = product.variants
|
45
|
-
|
46
|
-
const inventoryIds: string[] = productVariations.map(productVariation => productVariation.inventory_item_id)
|
47
|
-
const inventoryItemIds: string = inventoryIds.join()
|
48
|
-
|
49
|
-
const inventoryLevels: any = await StoreAPI.getInventoryLevel(store, {
|
50
|
-
inventoryItemIds
|
51
|
-
})
|
52
|
-
|
53
|
-
for (var j = 0; j < productVariations.length; j++) {
|
54
|
-
let locationIds: any = []
|
55
|
-
const productVariation: any = productVariations[j]
|
56
|
-
const productInventoryItemId = productVariation.inventory_item_id
|
57
|
-
for (var k = 0; k < inventoryLevels.inventory_levels.length; k++) {
|
58
|
-
const inventoryLevel: any = inventoryLevels.inventory_levels[k]
|
59
|
-
const inventoryItemId = inventoryLevel.inventory_item_id
|
60
|
-
|
61
|
-
if (inventoryItemId == productInventoryItemId) {
|
62
|
-
const locationId: any = {
|
63
|
-
location_id: inventoryLevel.location_id,
|
64
|
-
available: inventoryLevel.available === null ? 0 : inventoryLevel.available
|
65
|
-
}
|
66
|
-
locationIds.push(locationId)
|
67
|
-
}
|
68
|
-
}
|
69
|
-
productVariation.location_id = JSON.stringify(locationIds)
|
70
|
-
}
|
71
|
-
|
72
|
-
const result = {
|
73
|
-
itemId: product.id,
|
74
|
-
name: product.title,
|
75
|
-
type: product.product_type,
|
76
|
-
description: product.body_html,
|
77
|
-
marketplaceStatus: product.status,
|
78
|
-
hasVariation: true,
|
79
|
-
categoryId: product?.collection_id ? product.collection_id : null,
|
80
|
-
attributes: [],
|
81
|
-
sellercraftAttributes: [
|
82
|
-
{
|
83
|
-
native_attribute_id: 'description',
|
84
|
-
attribute_key: 'description',
|
85
|
-
display_name: 'Description',
|
86
|
-
values: [product.body_html],
|
87
|
-
data_type: 'RICH_TEXT'
|
88
|
-
}
|
89
|
-
],
|
90
|
-
images: product?.images?.map(image => {
|
91
|
-
return image.src
|
92
|
-
}) || [],
|
93
|
-
variations: productVariations.map(variant => {
|
94
|
-
return {
|
95
|
-
variationId: variant.id,
|
96
|
-
variationSku: variant.sku,
|
97
|
-
channelSku: variant.sku,
|
98
|
-
name: variant.title == 'Default Title' ? product.title : variant.title,
|
99
|
-
qty: variant.inventory_quantity,
|
100
|
-
inventoryPolicy: variant.inventory_policy,
|
101
|
-
inventoryItemId: variant.inventory_item_id,
|
102
|
-
locationId: variant.location_id,
|
103
|
-
extraMetadata: {
|
104
|
-
inventoryItemId: variant.inventory_item_id,
|
105
|
-
locationId: variant.location_id,
|
106
|
-
},
|
107
|
-
primaryUnit: variant.weight_unit,
|
108
|
-
primaryUnitValue: variant.weight,
|
109
|
-
costPrice: variant.price,
|
110
|
-
sellPrice: variant.compare_at_price || variant.price,
|
111
|
-
attributes: [
|
112
|
-
{
|
113
|
-
attributeId: variant.option1,
|
114
|
-
name: variant.option1
|
115
|
-
},
|
116
|
-
{
|
117
|
-
attributeId: variant.option2,
|
118
|
-
name: variant.option2
|
119
|
-
},
|
120
|
-
{
|
121
|
-
attributeId: variant.option3,
|
122
|
-
name: variant.option3
|
123
|
-
}
|
124
|
-
],
|
125
|
-
sellercraftAttributes: product?.options.map(option => {
|
126
|
-
return {
|
127
|
-
native_attribute_id: option.name,
|
128
|
-
attribute_key: option.name,
|
129
|
-
display_name: option.name,
|
130
|
-
values: [variant[`option${option.position}`]]
|
131
|
-
}
|
132
|
-
}) || [],
|
133
|
-
weight: variant.grams,
|
134
|
-
presentmentPrices: variant?.presentment_prices
|
135
|
-
? variant.presentment_prices.map(presentmentPrice => {
|
136
|
-
return {
|
137
|
-
currency: presentmentPrice.price?.currency_code
|
138
|
-
? presentmentPrice.price.currency_code
|
139
|
-
: presentmentPrice.compare_at_price.currency_code,
|
140
|
-
costPrice: presentmentPrice.compare_at_price?.amount
|
141
|
-
? presentmentPrice.compare_at_price.amount
|
142
|
-
: presentmentPrice.price.amount,
|
143
|
-
sellPrice: presentmentPrice.price?.amount
|
144
|
-
? presentmentPrice.price.amount
|
145
|
-
: presentmentPrice.compare_at_price.amount
|
146
|
-
}
|
147
|
-
})
|
148
|
-
: {
|
149
|
-
currency: null,
|
150
|
-
costPrice: variant.price,
|
151
|
-
sellPrice: variant.compare_at_price
|
152
|
-
}
|
153
|
-
}
|
154
|
-
})
|
155
|
-
}
|
156
|
-
|
157
|
-
results.push({ ...result })
|
158
|
-
}
|
159
|
-
|
160
|
-
return { results, total: totalProducts, page_info }
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}
|
164
|
-
|
165
|
-
function extractLinkParams(link) {
|
166
|
-
let nextLink = link
|
167
|
-
|
168
|
-
// If there's a previous link, remove the first part of the string entirely
|
169
|
-
if (nextLink.indexOf(`rel="previous"`) > -1) {
|
170
|
-
nextLink = nextLink.substr(nextLink.indexOf(',') + 2, nextLink.length)
|
171
|
-
}
|
172
|
-
|
173
|
-
// Parse the remaining string for the actual link
|
174
|
-
nextLink = nextLink.substr(1, nextLink.indexOf('>') - 1)
|
175
|
-
|
176
|
-
return nextLink
|
177
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
export * from './echo'
|
2
|
-
export * from './get-store-products'
|
3
|
-
export * from './get-store-products-count'
|
4
|
-
export * from './get-store-orders'
|
5
|
-
export * from './get-inventory-level'
|
6
|
-
export * from './update-store-product-variation-stock'
|
7
|
-
export * from './update-order-status'
|
8
|
-
export * from './set-store-order-status-ready-to-ship'
|
9
|
-
export * from './get-store-order'
|
10
|
-
export * from './update-store-product-variation-price'
|
11
|
-
export * from './update-store-product-price'
|
12
|
-
export * from './update-store-product-stock'
|
13
|
-
export * from './get-store-product-variation-stock'
|
@@ -1,31 +0,0 @@
|
|
1
|
-
/* https://shopify.dev/api/admin-rest/2021-10/resources/fulfillment#[post]/admin/api/2021-10/fulfillments.json */
|
2
|
-
|
3
|
-
export function setStoreOrderStatusReadyToShip() {
|
4
|
-
return {
|
5
|
-
method: 'post',
|
6
|
-
path: '/orders/{orderId}/fulfillments.json',
|
7
|
-
denormalize(req) {
|
8
|
-
const { orderId, trackingUrl, trackingNo, orderItemId, order, transporter } = req || {}
|
9
|
-
|
10
|
-
let locationId = JSON.parse(order.marketplaceOrderItems[0].marketplaceProductVariation.locationId)[0].location_id
|
11
|
-
|
12
|
-
return {
|
13
|
-
payload: {
|
14
|
-
fulfillment: {
|
15
|
-
location_id: locationId,
|
16
|
-
tracking_number: trackingNo,
|
17
|
-
tracking_urls: [trackingUrl],
|
18
|
-
notify_customer: true,
|
19
|
-
tracking_company: transporter
|
20
|
-
}
|
21
|
-
},
|
22
|
-
resource: {
|
23
|
-
orderId
|
24
|
-
}
|
25
|
-
}
|
26
|
-
},
|
27
|
-
normalize(res) {
|
28
|
-
return res
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
/* https://shopify.dev/api/admin-rest/2021-10/resources/fulfillment#[post]/admin/api/2021-10/fulfillments.json */
|
2
|
-
|
3
|
-
export function updateOrderStatus() {
|
4
|
-
return {
|
5
|
-
method: 'post',
|
6
|
-
path: '/orders/{orderId}/fulfillments.json',
|
7
|
-
denormalize(req) {
|
8
|
-
const { orderId, trackingNo, locations, carrier, status } = req || {}
|
9
|
-
|
10
|
-
if (status != 'READY_TO_SHIP') {
|
11
|
-
throw new Error('Shopify cannot create fulfillment, order status is not READY_TO_SHIP')
|
12
|
-
}
|
13
|
-
|
14
|
-
return {
|
15
|
-
payload: {
|
16
|
-
fulfillment: {
|
17
|
-
location_id: locations[0],
|
18
|
-
tracking_number: trackingNo,
|
19
|
-
notify_customer: true,
|
20
|
-
tracking_company: carrier
|
21
|
-
}
|
22
|
-
},
|
23
|
-
resource: {
|
24
|
-
orderId
|
25
|
-
}
|
26
|
-
}
|
27
|
-
},
|
28
|
-
normalize(res) {
|
29
|
-
return res
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/*https://shopify.dev/api/admin-rest/2021-10/resources/product-variant#put-variants-variant-id */
|
2
|
-
|
3
|
-
export function updateStoreProductPrice() {
|
4
|
-
return {
|
5
|
-
path: '/variants/{variantId}.json',
|
6
|
-
method: 'put',
|
7
|
-
denormalize(req) {
|
8
|
-
let { costPrice, sellPrice, variationId } = req
|
9
|
-
|
10
|
-
return {
|
11
|
-
payload: {
|
12
|
-
variant: {
|
13
|
-
price: costPrice,
|
14
|
-
compare_at_price: sellPrice
|
15
|
-
}
|
16
|
-
},
|
17
|
-
resource: {
|
18
|
-
variantId: variationId
|
19
|
-
}
|
20
|
-
}
|
21
|
-
},
|
22
|
-
normalize(res) {
|
23
|
-
return res
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
export function updateStoreProductStock() {
|
2
|
-
return {
|
3
|
-
method: 'post',
|
4
|
-
path: '/inventory_levels/adjust.json',
|
5
|
-
denormalize(req) {
|
6
|
-
const { inventoryItemId, locationId: location_id, qty } = (Array.isArray(req) ? req[0] : req) || {}
|
7
|
-
|
8
|
-
return {
|
9
|
-
payload: {
|
10
|
-
inventory_item_id: parseInt(inventoryItemId),
|
11
|
-
location_id,
|
12
|
-
available_adjustment: parseInt(qty)
|
13
|
-
}
|
14
|
-
}
|
15
|
-
},
|
16
|
-
normalize(res) {
|
17
|
-
return res
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/*https://shopify.dev/api/admin-rest/2021-10/resources/product-variant#put-variants-variant-id */
|
2
|
-
|
3
|
-
export function updateStoreProductVariationPrice() {
|
4
|
-
return {
|
5
|
-
path: '/variants/{variantId}.json',
|
6
|
-
method: 'put',
|
7
|
-
denormalize(req) {
|
8
|
-
let { costPrice, sellPrice, variationId } = req
|
9
|
-
|
10
|
-
return {
|
11
|
-
payload: {
|
12
|
-
variant: {
|
13
|
-
price: costPrice,
|
14
|
-
compare_at_price: sellPrice
|
15
|
-
}
|
16
|
-
},
|
17
|
-
resource: {
|
18
|
-
variantId: variationId
|
19
|
-
}
|
20
|
-
}
|
21
|
-
},
|
22
|
-
normalize(res) {
|
23
|
-
return res
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
export function updateStoreProductVariationStock() {
|
2
|
-
return {
|
3
|
-
method: 'post',
|
4
|
-
path: '/inventory_levels/adjust.json',
|
5
|
-
denormalize(req) {
|
6
|
-
const { inventoryItemId, locationId: location_id, qty } = (Array.isArray(req) ? req[0] : req) || {}
|
7
|
-
|
8
|
-
return {
|
9
|
-
payload: {
|
10
|
-
inventory_item_id: parseInt(inventoryItemId),
|
11
|
-
location_id,
|
12
|
-
available_adjustment: parseInt(qty)
|
13
|
-
}
|
14
|
-
}
|
15
|
-
},
|
16
|
-
normalize(res) {
|
17
|
-
return res
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import { Shopify } from './shopify'
|
2
|
-
|
3
|
-
import { config } from '@things-factory/env'
|
4
|
-
const shopifyConfig = config.get('marketplaceIntegrationShopify', {})
|
5
|
-
const { apiKey, apiSecret } = shopifyConfig
|
6
|
-
|
7
|
-
function substitute(path, obj) {
|
8
|
-
var props = []
|
9
|
-
var re = /{([^}]+)}/g
|
10
|
-
var text
|
11
|
-
|
12
|
-
while ((text = re.exec(path))) {
|
13
|
-
props.push(text[1])
|
14
|
-
}
|
15
|
-
|
16
|
-
var result = path
|
17
|
-
props.forEach(prop => {
|
18
|
-
let value = obj[prop.trim()]
|
19
|
-
result = result.replace(`{${prop}}`, value === undefined ? '' : value)
|
20
|
-
})
|
21
|
-
|
22
|
-
return result
|
23
|
-
}
|
24
|
-
|
25
|
-
export const action = async ({ store, method = 'get', path, request }) => {
|
26
|
-
const client = new Shopify({
|
27
|
-
shop: store.storeId,
|
28
|
-
apiKey,
|
29
|
-
apiSecret,
|
30
|
-
accessToken: store.accessToken
|
31
|
-
})
|
32
|
-
|
33
|
-
const { resource = {}, payload = {} } = request
|
34
|
-
|
35
|
-
path = substitute(path, resource)
|
36
|
-
|
37
|
-
var response = await client[method](path, payload)
|
38
|
-
if (response.errors) {
|
39
|
-
throw response
|
40
|
-
}
|
41
|
-
|
42
|
-
return response
|
43
|
-
}
|
@@ -1,148 +0,0 @@
|
|
1
|
-
import fetch from 'node-fetch'
|
2
|
-
import crypto from 'crypto'
|
3
|
-
import { URLSearchParams } from 'url'
|
4
|
-
|
5
|
-
import { createPayloadLog } from '@things-factory/integration-base'
|
6
|
-
|
7
|
-
const debug = require('debug')('things-factory:integration-marketplace:shopify')
|
8
|
-
|
9
|
-
export type ShopifyConfig = {
|
10
|
-
apiKey: string
|
11
|
-
apiSecret: string
|
12
|
-
shop: string
|
13
|
-
accessToken?: string
|
14
|
-
}
|
15
|
-
|
16
|
-
export class Shopify {
|
17
|
-
private config: ShopifyConfig
|
18
|
-
|
19
|
-
constructor(config: ShopifyConfig) {
|
20
|
-
this.config = {
|
21
|
-
...config
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
makeVerificationTokenForNonce() {
|
26
|
-
return crypto.randomBytes(16).toString('hex')
|
27
|
-
}
|
28
|
-
|
29
|
-
buildAuthURL(redirectUrl, nonce) {
|
30
|
-
// regarding accessMode refer to https://shopify.dev/tutorials/authenticate-with-oauth#step-2-ask-for-permission
|
31
|
-
// and https://community.shopify.com/c/API-Announcements/Shopify-now-offers-two-types-of-API-access-tokens/td-p/315398
|
32
|
-
// so, accessMode should be 'offline'
|
33
|
-
// var accessMode = 'per-user'
|
34
|
-
|
35
|
-
// TODO make scopes properly
|
36
|
-
var scopes = 'read_products,write_orders,read_customers,read_inventory,write_inventory'
|
37
|
-
|
38
|
-
var { shop, apiKey } = this.config
|
39
|
-
|
40
|
-
// return `https://${shop}.myshopify.com/admin/oauth/authorize?client_id=${apiKey}&scope=${scopes}&redirect_uri=${redirectUrl}&state=${nonce}&grant_options[]=${accessMode}`
|
41
|
-
return `https://${shop}.myshopify.com/admin/oauth/authorize?client_id=${apiKey}&scope=${scopes}&redirect_uri=${redirectUrl}&state=${nonce}`
|
42
|
-
}
|
43
|
-
|
44
|
-
isValidSignature(query) {
|
45
|
-
const { apiSecret } = this.config
|
46
|
-
const { hmac, ...params } = query
|
47
|
-
|
48
|
-
const queryParams = new URLSearchParams(params).toString()
|
49
|
-
|
50
|
-
return hmac === crypto.createHmac('sha256', apiSecret).update(queryParams).digest('hex')
|
51
|
-
}
|
52
|
-
|
53
|
-
verifyWebhook(request, hmac: string, webhookKey) {
|
54
|
-
return hmac === crypto.createHmac('sha256', webhookKey).update(request.rawBody.toString()).digest('base64')
|
55
|
-
}
|
56
|
-
|
57
|
-
async get(path: string, data: any) {
|
58
|
-
const { shop, accessToken } = this.config
|
59
|
-
|
60
|
-
const qs = new URLSearchParams(data).toString()
|
61
|
-
|
62
|
-
const endpoint = `https://${shop}.myshopify.com/admin/api/2020-01${path}${qs ? '?' + qs : ''}`
|
63
|
-
debug('endpoint', endpoint)
|
64
|
-
|
65
|
-
const response = await fetch(endpoint, {
|
66
|
-
headers: {
|
67
|
-
'Content-Type': 'application/json',
|
68
|
-
'X-Shopify-Access-Token': accessToken
|
69
|
-
}
|
70
|
-
})
|
71
|
-
|
72
|
-
const callLimit = response.headers.get('x-shopify-shop-api-call-limit')
|
73
|
-
debug('call-limit', callLimit)
|
74
|
-
|
75
|
-
const retryAfter = response.headers.get('retry-after')
|
76
|
-
|
77
|
-
const link = response.headers.get('link')
|
78
|
-
var result = await response.json()
|
79
|
-
result.link = link
|
80
|
-
|
81
|
-
// try {
|
82
|
-
// createPayloadLog(shop, path, qs || '', result, {
|
83
|
-
// state: { domain: null }
|
84
|
-
// })
|
85
|
-
// } catch (e) {}
|
86
|
-
debug('response result', result)
|
87
|
-
|
88
|
-
return result
|
89
|
-
}
|
90
|
-
|
91
|
-
async post(path: string, data: any = {}) {
|
92
|
-
const { shop, accessToken } = this.config
|
93
|
-
|
94
|
-
debug('data', data)
|
95
|
-
|
96
|
-
const jsondata = JSON.stringify(data)
|
97
|
-
|
98
|
-
const endpoint = `https://${shop}.myshopify.com/admin/api/2020-01${path}`
|
99
|
-
|
100
|
-
const response = await fetch(endpoint, {
|
101
|
-
method: 'post',
|
102
|
-
headers: {
|
103
|
-
'Content-Type': 'application/json',
|
104
|
-
'X-Shopify-Access-Token': accessToken
|
105
|
-
},
|
106
|
-
body: jsondata
|
107
|
-
})
|
108
|
-
|
109
|
-
const result = await response.json()
|
110
|
-
// try {
|
111
|
-
// createPayloadLog(shop, path, jsondata, result, {
|
112
|
-
// state: { domain: null }
|
113
|
-
// })
|
114
|
-
// } catch (e) {}
|
115
|
-
debug('response result', result)
|
116
|
-
|
117
|
-
return result
|
118
|
-
}
|
119
|
-
|
120
|
-
async put(path: string, data: any = {}) {
|
121
|
-
const { shop, accessToken } = this.config
|
122
|
-
|
123
|
-
debug('data', data)
|
124
|
-
|
125
|
-
const jsondata = JSON.stringify(data)
|
126
|
-
|
127
|
-
const endpoint = `https://${shop}.myshopify.com/admin/api/2020-01${path}`
|
128
|
-
|
129
|
-
const response = await fetch(endpoint, {
|
130
|
-
method: 'put',
|
131
|
-
headers: {
|
132
|
-
'Content-Type': 'application/json',
|
133
|
-
'X-Shopify-Access-Token': accessToken
|
134
|
-
},
|
135
|
-
body: jsondata
|
136
|
-
})
|
137
|
-
|
138
|
-
const result = await response.json()
|
139
|
-
// try {
|
140
|
-
// createPayloadLog(shop, path, jsondata, result, {
|
141
|
-
// state: { domain: null }
|
142
|
-
// })
|
143
|
-
// } catch (e) {}
|
144
|
-
debug('response result', result)
|
145
|
-
|
146
|
-
return result
|
147
|
-
}
|
148
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import Debug from 'debug'
|
2
|
-
const debug = Debug('things-factory:integration-marketplace:store-api-decorator')
|
3
|
-
|
4
|
-
import { MarketplaceStore } from '../../entities'
|
5
|
-
|
6
|
-
const NOOP = v => v
|
7
|
-
|
8
|
-
export const api = (target: Object, property: string, descriptor: TypedPropertyDescriptor<any>): any => {
|
9
|
-
const method = descriptor.value
|
10
|
-
|
11
|
-
descriptor.value = async function (store: MarketplaceStore, request) {
|
12
|
-
const StoreAPI = this
|
13
|
-
|
14
|
-
var { platform } = store
|
15
|
-
|
16
|
-
var { action: platformAction, apis } = StoreAPI.getPlatform(platform)
|
17
|
-
|
18
|
-
var m = apis[method.name]
|
19
|
-
if (!m) {
|
20
|
-
throw Error(`Marketplace Platform '${platform}' doesn't have API ${method.name}`)
|
21
|
-
}
|
22
|
-
|
23
|
-
var {
|
24
|
-
path,
|
25
|
-
method: httpMethod = 'post',
|
26
|
-
denormalize = NOOP,
|
27
|
-
normalize = NOOP,
|
28
|
-
action = platformAction
|
29
|
-
} = m.apply(this, [request])
|
30
|
-
|
31
|
-
var denormalized = await denormalize(request || {}, { store })
|
32
|
-
debug('request', denormalized)
|
33
|
-
|
34
|
-
var response = await action.apply(this, [
|
35
|
-
{ store, method: httpMethod, path, request: denormalized, platformAction }
|
36
|
-
])
|
37
|
-
|
38
|
-
debug('response', response)
|
39
|
-
|
40
|
-
return await normalize(response, { store })
|
41
|
-
}
|
42
|
-
|
43
|
-
return descriptor
|
44
|
-
}
|