@things-factory/integration-marketplace 3.7.8 → 3.8.3

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 (79) hide show
  1. package/dist-server/controllers/lazada/apis/get-store-order-item-transaction-details.js +88 -0
  2. package/dist-server/controllers/lazada/apis/get-store-order-item-transaction-details.js.map +1 -0
  3. package/dist-server/controllers/lazada/apis/get-store-order-items.js +39 -7
  4. package/dist-server/controllers/lazada/apis/get-store-order-items.js.map +1 -1
  5. package/dist-server/controllers/lazada/apis/get-store-order.js +1 -0
  6. package/dist-server/controllers/lazada/apis/get-store-order.js.map +1 -1
  7. package/dist-server/controllers/lazada/apis/get-store-orders.js +2 -1
  8. package/dist-server/controllers/lazada/apis/get-store-orders.js.map +1 -1
  9. package/dist-server/controllers/lazada/apis/index.js +1 -1
  10. package/dist-server/controllers/lazada/apis/index.js.map +1 -1
  11. package/dist-server/controllers/lazada/client/lazada.js +24 -4
  12. package/dist-server/controllers/lazada/client/lazada.js.map +1 -1
  13. package/dist-server/controllers/lazada/platform-action.js +18 -3
  14. package/dist-server/controllers/lazada/platform-action.js.map +1 -1
  15. package/dist-server/controllers/shopee/apis/get-store-order-transaction-details.js +32 -0
  16. package/dist-server/controllers/shopee/apis/get-store-order-transaction-details.js.map +1 -0
  17. package/dist-server/controllers/shopee/apis/get-store-order.js +11 -10
  18. package/dist-server/controllers/shopee/apis/get-store-order.js.map +1 -1
  19. package/dist-server/controllers/shopee/apis/index.js +1 -0
  20. package/dist-server/controllers/shopee/apis/index.js.map +1 -1
  21. package/dist-server/controllers/shopify/apis/get-store-orders.js +46 -8
  22. package/dist-server/controllers/shopify/apis/get-store-orders.js.map +1 -1
  23. package/dist-server/controllers/shopify/apis/get-store-products.js +2 -1
  24. package/dist-server/controllers/shopify/apis/get-store-products.js.map +1 -1
  25. package/dist-server/controllers/store-api/index.js +42 -0
  26. package/dist-server/controllers/store-api/index.js.map +1 -1
  27. package/dist-server/controllers/woocommerce/apis/get-store-order.js +21 -0
  28. package/dist-server/controllers/woocommerce/apis/get-store-order.js.map +1 -0
  29. package/dist-server/controllers/woocommerce/apis/get-store-product-categories.js +8 -44
  30. package/dist-server/controllers/woocommerce/apis/get-store-product-categories.js.map +1 -1
  31. package/dist-server/controllers/woocommerce/apis/index.js +10 -0
  32. package/dist-server/controllers/woocommerce/apis/index.js.map +1 -1
  33. package/dist-server/controllers/woocommerce/apis/update-order.js +37 -0
  34. package/dist-server/controllers/woocommerce/apis/update-order.js.map +1 -0
  35. package/dist-server/controllers/woocommerce/apis/update-product-attribute.js +20 -0
  36. package/dist-server/controllers/woocommerce/apis/update-product-attribute.js.map +1 -0
  37. package/dist-server/controllers/woocommerce/apis/update-store-product-price.js +23 -0
  38. package/dist-server/controllers/woocommerce/apis/update-store-product-price.js.map +1 -0
  39. package/dist-server/controllers/woocommerce/apis/update-store-product-stock.js +2 -2
  40. package/dist-server/controllers/woocommerce/apis/update-store-product-stock.js.map +1 -1
  41. package/dist-server/controllers/woocommerce/apis/update-store-product-variant-price.js +20 -0
  42. package/dist-server/controllers/woocommerce/apis/update-store-product-variant-price.js.map +1 -0
  43. package/dist-server/controllers/woocommerce/apis/update-store-product-variant-stock.js +20 -0
  44. package/dist-server/controllers/woocommerce/apis/update-store-product-variant-stock.js.map +1 -0
  45. package/dist-server/controllers/woocommerce/apis/update-store-product-variation-price.js +23 -0
  46. package/dist-server/controllers/woocommerce/apis/update-store-product-variation-price.js.map +1 -0
  47. package/dist-server/controllers/woocommerce/apis/update-store-product-variation-stock.js +3 -3
  48. package/dist-server/controllers/woocommerce/apis/update-store-product-variation-stock.js.map +1 -1
  49. package/dist-server/controllers/woocommerce/woocommerce.js +2 -2
  50. package/dist-server/controllers/woocommerce/woocommerce.js.map +1 -1
  51. package/package.json +14 -14
  52. package/server/controllers/lazada/apis/get-store-order-item-transaction-details.ts +65 -0
  53. package/server/controllers/lazada/apis/get-store-order-items.ts +74 -6
  54. package/server/controllers/lazada/apis/get-store-order.ts +1 -0
  55. package/server/controllers/lazada/apis/get-store-orders.ts +2 -1
  56. package/server/controllers/lazada/apis/index.ts +1 -1
  57. package/server/controllers/lazada/client/lazada.ts +42 -12
  58. package/server/controllers/lazada/platform-action.ts +20 -1
  59. package/server/controllers/shopee/apis/get-store-order-transaction-details.ts +29 -0
  60. package/server/controllers/shopee/apis/get-store-order.ts +13 -7
  61. package/server/controllers/shopee/apis/index.ts +2 -1
  62. package/server/controllers/shopify/apis/get-store-orders.ts +49 -9
  63. package/server/controllers/shopify/apis/get-store-products.ts +3 -1
  64. package/server/controllers/store-api/index.ts +21 -2
  65. package/server/controllers/woocommerce/apis/get-store-order.ts +17 -0
  66. package/server/controllers/woocommerce/apis/get-store-product-categories.ts +6 -48
  67. package/server/controllers/woocommerce/apis/index.ts +10 -0
  68. package/server/controllers/woocommerce/apis/update-order.ts +36 -0
  69. package/server/controllers/woocommerce/apis/update-product-attribute.ts +17 -0
  70. package/server/controllers/woocommerce/apis/update-store-product-price.ts +20 -0
  71. package/server/controllers/woocommerce/apis/update-store-product-stock.ts +2 -2
  72. package/server/controllers/woocommerce/apis/update-store-product-variant-price.ts +17 -0
  73. package/server/controllers/woocommerce/apis/update-store-product-variant-stock.ts +18 -0
  74. package/server/controllers/woocommerce/apis/update-store-product-variation-price.ts +20 -0
  75. package/server/controllers/woocommerce/apis/update-store-product-variation-stock.ts +3 -3
  76. package/server/controllers/woocommerce/woocommerce.ts +2 -2
  77. package/dist-server/controllers/lazada/apis/get-store-order-item-payment-fee.js +0 -35
  78. package/dist-server/controllers/lazada/apis/get-store-order-item-payment-fee.js.map +0 -1
  79. package/server/controllers/lazada/apis/get-store-order-item-payment-fee.ts +0 -34
@@ -1,6 +1,7 @@
1
1
  /* https://shopify.dev/docs/admin-api/rest/reference/products/product?api[version]=2020-07#index-2020-07 */
2
2
 
3
3
  import { URL } from 'url'
4
+
4
5
  import { StoreAPI } from '../../store-api'
5
6
 
6
7
  export function getStoreProducts() {
@@ -68,6 +69,7 @@ export function getStoreProducts() {
68
69
  name: product.title,
69
70
  type: product.product_type,
70
71
  description: product.body_html,
72
+ marketplaceStatus: product.status,
71
73
  hasVariation: true,
72
74
  categoryId: product?.collection_id ? product.collection_id : null,
73
75
  attributes: [],
@@ -76,7 +78,7 @@ export function getStoreProducts() {
76
78
  variationId: variant.id,
77
79
  variationSku: variant.sku,
78
80
  channelSku: variant.sku,
79
- name: variant.title,
81
+ name: variant.title == 'Default Title' ? product.title : variant.title,
80
82
  qty: variant.inventory_quantity,
81
83
  inventoryPolicy: variant.inventory_policy,
82
84
  inventoryItemId: variant.inventory_item_id,
@@ -1,4 +1,5 @@
1
1
  import { getRepository } from 'typeorm'
2
+
2
3
  import { MarketplaceStore } from '../../entities'
3
4
  import { api } from './decorators'
4
5
 
@@ -80,6 +81,9 @@ export class StoreAPI {
80
81
  @api
81
82
  static updateStoreProduct(store, req): any {}
82
83
 
84
+ @api
85
+ static updateOrder(store, req): any {}
86
+
83
87
  @api
84
88
  static cancelStoreOrder(store, req): any {}
85
89
 
@@ -156,8 +160,23 @@ export class StoreAPI {
156
160
  static getStoreRefundOrders(store, req): any {}
157
161
 
158
162
  @api
159
- static getStoreRefundOrderDetails(store, req): any{}
163
+ static getStoreRefundOrderDetails(store, req): any {}
164
+
165
+ @api
166
+ static getStoreOrderItemPaymentFee(store, req): any {}
167
+
168
+ @api
169
+ static getStoreOrderItemTransactionDetails(store, req): any {}
170
+
171
+ @api
172
+ static updateProductAttribute(store, req): any {}
173
+
174
+ @api
175
+ static getStoreOrderTransactionDetails(store, req): any {}
176
+
177
+ @api
178
+ static updateStoreProductVariationPrice(store, req): any {}
160
179
 
161
180
  @api
162
- static getStoreOrderItemPaymentFee(store, req): any{}
181
+ static updateStoreProductPrice(store, req): any {}
163
182
  }
@@ -0,0 +1,17 @@
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
+ return res.items
15
+ }
16
+ }
17
+ }
@@ -1,58 +1,16 @@
1
1
  /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#list-all-products /wp-json/wc/v3/categoriess */
2
2
 
3
- export function getStoreProducts() {
3
+ export function getStoreProductCategories() {
4
4
  return {
5
5
  method: 'get',
6
- path: '/categories',
6
+ path: '/products/categories',
7
7
  denormalize(req) {
8
- var { pagination } = req || {}
9
- var { page, limit } = pagination || { page: 0, limit: 100 }
10
-
11
- var payload: any = {
12
- per_page: limit,
13
- offset: page * limit
14
- }
15
-
16
- return { payload }
8
+ return { payload: {} }
17
9
  },
18
- async normalize(res, { store }) {
19
- // return res.products
20
-
21
- let results: any[] = []
22
- const totalProducts = res.totalProducts
23
-
24
- for (var i = 0; i < res.products.length; i++) {
25
- const product: any = res.products[i]
26
- const productVariations: any[] = product.variations
27
-
28
- const result = {
29
- itemId: product.id,
30
- name: product.name,
31
- type: product.type,
32
- description: product.description,
33
- hasVariation: true,
34
- categoryId: product?.categories.length > 0 ? product.categories[0].id : null,
35
- attributes: [],
36
- variations: productVariations.map(variant => {
37
- return {
38
- variationId: variant.id,
39
- variationSku: variant.sku,
40
- channelSku: variant.sku,
41
- name: product.name + ' (' + variant.attributes[0].options + ')',
42
- qty: variant.stock_quantity,
43
- primaryUnit: 'N/A',
44
- primaryUnitValue: variant.weight,
45
- costPrice: variant.price,
46
- sellPrice: variant.sale_price,
47
- attributes: variant.attributes
48
- }
49
- })
50
- }
51
-
52
- results.push({ ...result })
53
- }
10
+ normalize(res, { store }) {
11
+ const { items, totalItems } = res
54
12
 
55
- return { results, total: totalProducts }
13
+ return { results: items, total: totalItems }
56
14
  }
57
15
  }
58
16
  }
@@ -1,7 +1,17 @@
1
1
  export * from './echo'
2
2
  export * from './create-order-note'
3
+ export * from './get-store-product-categories'
3
4
  export * from './get-store-products'
4
5
  export * from './get-store-product-variations'
5
6
  export * from './get-store-orders'
6
7
  export * from './update-store-product-stock'
7
8
  export * from './update-store-product-variation-stock'
9
+ export * from './get-store-product-categories'
10
+ export * from './update-order'
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'
@@ -0,0 +1,36 @@
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
+ export function updateOrder(req) {
7
+ return {
8
+ method: 'put',
9
+ path: '/orders/{orderId}',
10
+ async denormalize(req, { store }) {
11
+ var { status, orderId } = req || {}
12
+
13
+ const order = await StoreAPI.getStoreOrder(store, { orderId })
14
+
15
+ let orderStatus = status
16
+ if (orderStatus == 'PACKED') {
17
+ if (order.status == 'pending') {
18
+ orderStatus = 'on-hold'
19
+ } else {
20
+ orderStatus = order.status
21
+ }
22
+ }
23
+ if (orderStatus == 'READY_TO_SHIP') {
24
+ orderStatus = 'completed'
25
+ }
26
+ if (orderStatus == 'CANCELLED') {
27
+ orderStatus = 'cancelled'
28
+ }
29
+
30
+ return { resource: { orderId: orderId }, payload: { status: orderStatus } }
31
+ },
32
+ normalize(res) {
33
+ return res.items
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,17 @@
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/attributes/{attributeId}',
8
+ denormalize(req) {
9
+ var { name, attributeId } = req || {}
10
+
11
+ return { resource: { attributeId: attributeId }, payload: { name } }
12
+ },
13
+ normalize(res) {
14
+ return res
15
+ }
16
+ }
17
+ }
@@ -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
+ }
@@ -6,12 +6,12 @@ export function updateStoreProductStock(req) {
6
6
  method: 'put',
7
7
  path: '/products/{itemId}',
8
8
  denormalize(req) {
9
- var { qty, itemId } = req[0] || {}
9
+ var { qty, itemId } = req || {}
10
10
 
11
11
  return { resource: { itemId: parseInt(itemId) }, payload: { stock_quantity: qty, manage_stock: true } }
12
12
  },
13
13
  normalize(res) {
14
- return res.items
14
+ return res
15
15
  }
16
16
  }
17
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() }
14
+ }
15
+ },
16
+ normalize(res) {
17
+ return res
18
+ }
19
+ }
20
+ }
@@ -1,4 +1,4 @@
1
- /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#update-a-product */
1
+ /* https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#update-a-product-variation */
2
2
  /* /wp-json/wc/v3/products/<product_id>/variations/<id> */
3
3
 
4
4
  export function updateStoreProductVariationStock(req) {
@@ -6,7 +6,7 @@ export function updateStoreProductVariationStock(req) {
6
6
  method: 'put',
7
7
  path: '/products/{itemId}/variations/{variationId}',
8
8
  denormalize(req) {
9
- var { qty, itemId, variationId } = req[0] || {}
9
+ var { qty, itemId, variationId } = req || {}
10
10
 
11
11
  return {
12
12
  resource: { itemId: parseInt(itemId), variationId: parseInt(variationId) },
@@ -14,7 +14,7 @@ export function updateStoreProductVariationStock(req) {
14
14
  }
15
15
  },
16
16
  normalize(res) {
17
- return res.items
17
+ return res
18
18
  }
19
19
  }
20
20
  }
@@ -24,13 +24,13 @@ export class Woocommerce {
24
24
  * X-WP-Total is to get the total items from the response
25
25
  */
26
26
  async get(path: string, data: any) {
27
- const { consumer_key, consumer_secret, storeURL } = this.config
27
+ const { consumer_key, consumer_secret, storeURL, queryStringAuth } = this.config
28
28
 
29
29
  const qs = Object.entries(data)
30
30
  .map(([k, v]) => `${k}=${encodeURIComponent(String(v))}`)
31
31
  .join('&')
32
32
 
33
- const endpoint = `${storeURL}/wp-json/wc/v3${path}?consumer_key=${consumer_key}&consumer_secret=${consumer_secret}${
33
+ const endpoint = `${storeURL}/wp-json/wc/v3${path}?consumer_key=${consumer_key}&consumer_secret=${consumer_secret}&query_string_auth=${queryStringAuth}&${
34
34
  qs ? '&' + qs : ''
35
35
  }`
36
36
  debug('endpoint', endpoint)
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /* https://open.lazada.com/doc/api.htm?spm=a2o9m.11193531.0.0.4f406bbetGwYgx#/api?cid=9&path=/finance/transaction/details/get */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getStoreOrderItemPaymentFee = void 0;
5
- function getStoreOrderItemPaymentFee() {
6
- return {
7
- method: 'get',
8
- path: '/finance/transaction/details/get',
9
- denormalize(req) {
10
- var { orderItemId, orderCreatedAt } = req;
11
- let startDate = new Date(orderCreatedAt);
12
- let endDate = new Date(orderCreatedAt);
13
- endDate.setDate(endDate.getDate() + 7);
14
- let currentDate = new Date;
15
- if (endDate > currentDate) {
16
- endDate = currentDate;
17
- }
18
- return {
19
- start_time: startDate.toISOString().replace(/T.*/, '').split('-').join('-'),
20
- end_time: endDate.toISOString().replace(/T.*/, '').split('-').join('-'),
21
- trade_order_line_id: orderItemId
22
- };
23
- },
24
- normalize(res) {
25
- let filtered = res.filter(item => item.fee_name === 'Payment Fee');
26
- let amount = 0;
27
- filtered.forEach(item => {
28
- amount += parseFloat(item.amount);
29
- });
30
- return amount;
31
- }
32
- };
33
- }
34
- exports.getStoreOrderItemPaymentFee = getStoreOrderItemPaymentFee;
35
- //# sourceMappingURL=get-store-order-item-payment-fee.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-store-order-item-payment-fee.js","sourceRoot":"","sources":["../../../../server/controllers/lazada/apis/get-store-order-item-payment-fee.ts"],"names":[],"mappings":";AAAA,gIAAgI;;;AAEhI,SAAgB,2BAA2B;IACvC,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,kCAAkC;QACxC,WAAW,CAAC,GAAG;YACb,IAAI,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,GAAG,CAAA;YACzC,IAAI,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,CAAA;YACxC,IAAI,OAAO,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,CAAA;YACtC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;YACtC,IAAI,WAAW,GAAG,IAAI,IAAI,CAAA;YAC1B,IAAI,OAAO,GAAG,WAAW,EAAE;gBACvB,OAAO,GAAG,WAAW,CAAA;aACxB;YAED,OAAO;gBACL,UAAU,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBAC1E,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBACtE,mBAAmB,EAAE,WAAW;aACjC,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,IAAI,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAA;YAElE,IAAI,MAAM,GAAW,CAAC,CAAA;YACtB,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACtB,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACnC,CAAC,CAAC,CAAA;YACF,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC;AA9BH,kEA8BG"}
@@ -1,34 +0,0 @@
1
- /* https://open.lazada.com/doc/api.htm?spm=a2o9m.11193531.0.0.4f406bbetGwYgx#/api?cid=9&path=/finance/transaction/details/get */
2
-
3
- export function getStoreOrderItemPaymentFee() {
4
- return {
5
- method: 'get',
6
- path: '/finance/transaction/details/get',
7
- denormalize(req) {
8
- var { orderItemId, orderCreatedAt } = req
9
- let startDate = new Date(orderCreatedAt)
10
- let endDate = new Date(orderCreatedAt)
11
- endDate.setDate(endDate.getDate() + 7)
12
- let currentDate = new Date
13
- if (endDate > currentDate) {
14
- endDate = currentDate
15
- }
16
-
17
- return {
18
- start_time: startDate.toISOString().replace(/T.*/,'').split('-').join('-'),
19
- end_time: endDate.toISOString().replace(/T.*/,'').split('-').join('-'),
20
- trade_order_line_id: orderItemId
21
- }
22
- },
23
- normalize(res) {
24
- let filtered = res.filter(item => item.fee_name === 'Payment Fee')
25
-
26
- let amount: number = 0
27
- filtered.forEach(item => {
28
- amount += parseFloat(item.amount)
29
- })
30
- return amount
31
- }
32
- }
33
- }
34
-