From bac3c04f59d359ee3537684ebddf30fd3e5f9e1b Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 6 Mar 2025 01:23:54 +0300 Subject: [PATCH] Fix GetProductPriceInfo response (#152) --- ozon/products.go | 6 +- ozon/products_test.go | 128 +++++++++++++++++++++--------------------- 2 files changed, 64 insertions(+), 70 deletions(-) diff --git a/ozon/products.go b/ozon/products.go index 99ef4d5..b907cd9 100644 --- a/ozon/products.go +++ b/ozon/products.go @@ -2130,10 +2130,6 @@ type GetProductPriceInfoFilter struct { type GetProductPriceInfoResponse struct { core.CommonResponse - Result GetProductPriceInfoResult `json:"result"` -} - -type GetProductPriceInfoResult struct { // Products list Items []GetProductPriceInfoResultItem `json:"items"` @@ -2146,7 +2142,7 @@ type GetProductPriceInfoResult struct { type GetProductPriceInfoResultItem struct { // Maximum acquiring fee - Acquiring int32 `json:"acquiring"` + Acquiring float64 `json:"acquiring"` // Commissions information Commissions GetProductPriceInfoResultItemCommission `json:"commissions"` diff --git a/ozon/products_test.go b/ozon/products_test.go index 8eeb199..66d2b02 100644 --- a/ozon/products_test.go +++ b/ozon/products_test.go @@ -2155,74 +2155,72 @@ func TestGetProductPriceInfo(t *testing.T) { }, }, `{ - "result": { - "cursor": "string", - "items": [ - { - "acquiring": 0, - "commissions": { - "fbo_deliv_to_customer_amount": 14.75, - "fbo_direct_flow_trans_max_amount": 46.5, - "fbo_direct_flow_trans_min_amount": 31, - "fbo_return_flow_amount": 50, - "fbs_deliv_to_customer_amount": 60, - "fbs_direct_flow_trans_max_amount": 61.5, - "fbs_direct_flow_trans_min_amount": 41, - "fbs_first_mile_max_amount": 25, - "fbs_first_mile_min_amount": 0, - "fbs_return_flow_amount": 40, - "sales_percent_fbo": 15, - "sales_percent_fbs": 0 - }, - "marketing_actions": { - "actions": [ - { - "date_from": "2024-12-13T06:49:37.591Z", - "date_to": "2024-12-13T06:49:37.591Z", - "title": "string", - "value": 0 - } - ], - "current_period_from": "2024-12-13T06:49:37.591Z", - "current_period_to": "2024-12-13T06:49:37.591Z", - "ozon_actions_exist": true - }, - "offer_id": "356792", - "price": { - "auto_action_enabled": true, - "currency_code": "RUB", - "marketing_price": 0, - "marketing_seller_price": 0, - "min_price": 0, - "old_price": 579, - "price": 499, - "retail_price": 0, - "vat": 0.2 - }, - "price_indexes": { - "color_index": "WITHOUT_INDEX", - "external_index_data": { - "min_price": 0, - "min_price_currency": "string", - "price_index_value": 0 - }, - "ozon_index_data": { - "min_price": 0, - "min_price_currency": "string", - "price_index_value": 0 - }, - "self_marketplaces_index_data": { - "min_price": 0, - "min_price_currency": "string", - "price_index_value": 0 + "cursor": "string", + "items": [ + { + "acquiring": 0.5, + "commissions": { + "fbo_deliv_to_customer_amount": 14.75, + "fbo_direct_flow_trans_max_amount": 46.5, + "fbo_direct_flow_trans_min_amount": 31, + "fbo_return_flow_amount": 50, + "fbs_deliv_to_customer_amount": 60, + "fbs_direct_flow_trans_max_amount": 61.5, + "fbs_direct_flow_trans_min_amount": 41, + "fbs_first_mile_max_amount": 25, + "fbs_first_mile_min_amount": 0, + "fbs_return_flow_amount": 40, + "sales_percent_fbo": 15, + "sales_percent_fbs": 0 + }, + "marketing_actions": { + "actions": [ + { + "date_from": "2024-12-13T06:49:37.591Z", + "date_to": "2024-12-13T06:49:37.591Z", + "title": "string", + "value": 0 } - }, - "product_id": 243686911, - "volume_weight": 0 + ], + "current_period_from": "2024-12-13T06:49:37.591Z", + "current_period_to": "2024-12-13T06:49:37.591Z", + "ozon_actions_exist": true + }, + "offer_id": "356792", + "price": { + "auto_action_enabled": true, + "currency_code": "RUB", + "marketing_price": 0, + "marketing_seller_price": 0, + "min_price": 0, + "old_price": 579, + "price": 499, + "retail_price": 0, + "vat": 0.2 + }, + "price_indexes": { + "color_index": "WITHOUT_INDEX", + "external_index_data": { + "min_price": 0, + "min_price_currency": "string", + "price_index_value": 0 + }, + "ozon_index_data": { + "min_price": 0, + "min_price_currency": "string", + "price_index_value": 0 + }, + "self_marketplaces_index_data": { + "min_price": 0, + "min_price_currency": "string", + "price_index_value": 0 } - ], - "total": 0 + }, + "product_id": 243686911, + "volume_weight": 0 } + ], + "total": 0 }`, }, // Test No Client-Id or Api-Key