Skip to content

Commit 1c609b7

Browse files
committed
Update December 3, 2024
1 parent 7f71ed6 commit 1c609b7

File tree

2 files changed

+111
-97
lines changed

2 files changed

+111
-97
lines changed

ozon/finance.go

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ type Finance struct {
1313
}
1414

1515
type ReportOnSoldProductsParams struct {
16-
// Time period in the `YYYY-MM` format
17-
Date string `json:"date"`
16+
// Month
17+
Month int32 `json:"month"`
18+
19+
// Year
20+
Year int32 `json:"year"`
1821
}
1922

2023
type ReportOnSoldProductsResponse struct {
@@ -34,7 +37,7 @@ type ReportonSoldProductsResult struct {
3437

3538
type ReportOnSoldProductsResultHeader struct {
3639
// Report ID
37-
Id string `json:"num"`
40+
Id string `json:"number"`
3841

3942
// Report generation date
4043
DocDate string `json:"doc_date"`
@@ -43,10 +46,10 @@ type ReportOnSoldProductsResultHeader struct {
4346
ContractDate string `json:"contract_date"`
4447

4548
// Offer agreement number
46-
ContractNum string `json:"contract_num"`
49+
ContractNum string `json:"contract_number"`
4750

4851
// Currency of your prices
49-
CurrencyCode string `json:"currency_code"`
52+
CurrencySysName string `json:"currency_sys_name"`
5053

5154
// Amount to accrue
5255
DocAmount float64 `json:"doc_amount"`
@@ -64,13 +67,13 @@ type ReportOnSoldProductsResultHeader struct {
6467
PayerName string `json:"payer_name"`
6568

6669
// Recipient's TIN
67-
RecipientINN string `json:"rcv_inn"`
70+
RecipientINN string `json:"receiver_inn"`
6871

6972
// Recipient's Tax Registration Reason Code (KPP)
70-
RecipientKPP string `json:"rcv_kpp"`
73+
RecipientKPP string `json:"receiver_kpp"`
7174

7275
// Recipient's name
73-
RecipientName string `json:"rcv_name"`
76+
RecipientName string `json:"receiver_name"`
7477

7578
// Period start in the report
7679
StartDate string `json:"start_date"`
@@ -81,72 +84,68 @@ type ReportOnSoldProductsResultHeader struct {
8184

8285
type ReportOnSoldProductsResultRow struct {
8386
// Row number
84-
RowNumber int32 `json:"row_number"`
87+
RowNumber int32 `json:"rowNumber"`
88+
89+
// Product Information
90+
Item ReturnOnSoldProduct `json:"item"`
91+
92+
// Commission including the quantity of products, discounts and extra charges.
93+
// Ozon compensates it for the returned products
94+
ReturnCommission ReturnCommission `json:"return_commission"`
8595

86-
// Product ID
87-
ProductId int64 `json:"product_id"`
96+
// Percentage of sales commission by category
97+
CommissionRatio float64 `json:"commission_ratio"`
8898

99+
// Delivery fee
100+
DeliveryCommission ReturnCommission `json:"delivery_commission"`
101+
102+
// Seller's discounted price
103+
SellerPricePerInstance float64 `json:"seller_price_per_instance"`
104+
}
105+
106+
type ReturnOnSoldProduct struct {
89107
// Product name
90-
ProductName string `json:"product_name"`
108+
ProductName string `json:"name"`
91109

92110
// Product barcode
93111
Barcode string `json:"barcode"`
94112

95113
// Product identifier in the seller's system
96114
OfferId string `json:"offer_id"`
97115

98-
// Sales commission by category
99-
CommissionPercent float64 `json:"commission_percent"`
100-
101-
// Seller's price with their discount
102-
Price float64 `json:"price"`
116+
SKU int64 `json:"sku"`
117+
}
103118

104-
// Selling price: the price at which the customer purchased the product. For sold products
105-
PriceSale float64 `json:"price_sale"`
119+
type ReturnCommission struct {
120+
// Amount
121+
Amount float64 `json:"amount"`
106122

107-
// Sold for amount.
108-
//
109-
// Sold products cost considering the quantity and regional coefficients. Calculation is made by the sale_amount price
110-
SaleAmount float64 `json:"sale_amount"`
123+
// Points for discounts
124+
Bonus float64 `json:"bonus"`
111125

112126
// Commission for sold products, including discounts and extra charges
113-
SaleCommission float64 `json:"sale_commission"`
127+
Commission float64 `json:"commission"`
114128

115-
// Extra charge at the expense of Ozon.
116-
//
117-
// Amount that Ozon will compensate the seller if the Ozon discount is greater than or equal to the sales commission
118-
SaleDiscount float64 `json:"sale_discount"`
129+
// Additional payment at the expense of Ozon
130+
Compensation float64 `json:"compensation"`
119131

120-
// Total accrual for the products sold.
121-
//
122-
// Amount after deduction of sales commission, application of discounts and extra charges
123-
SalePriceSeller float64 `json:"sale_price_seller"`
132+
// Price per item
133+
PricePerInstance float64 `json:"price_per_instance"`
124134

125-
// Quantity of products sold at the price_sale price
126-
SaleQuantity int32 `json:"sale_qty"`
135+
// Product quantity
136+
Quantity int32 `json:"quantity"`
127137

128-
// Price at which the customer purchased the product. For returned products
129-
ReturnSale float64 `json:"return_sale"`
138+
// Ozon referral fee
139+
StandardFee float64 `json:"standard_fee"`
130140

131-
// Cost of returned products, taking into account the quantity and regional coefficients.
132-
// Calculation is carried out at the return_sale price
133-
ReturnAmount float64 `json:"return_amount"`
134-
135-
// Commission including the quantity of products, discounts and extra charges.
136-
// Ozon compensates it for the returned products
137-
ReturnCommission float64 `json:"return_commission"`
138-
139-
// Extra charge at the expense of Ozon.
140-
//
141-
// Amount of the discount at the expense of Ozon on returned products.
142-
// Ozon will compensate it to the seller if the Ozon discount is greater than or equal to the sales commission
143-
ReturnDiscount float64 `json:"return_discount"`
141+
// Payouts on partner loyalty mechanics: green prices
142+
BankCoinvestment float64 `json:"bank_coinvestment"`
144143

145-
// Amount charged to the seller for returned products after deducing sales commissions, applying discounts and extra charges
146-
ReturnPriceSeller float64 `json:"return_price_seller"`
144+
// Payouts on partner loyalty mechanics: stars
145+
Stars float64 `json:"stars"`
147146

148-
// Quantity of returned products
149-
ReturnQuantity int32 `json:"return_qty"`
147+
// Total accrual
148+
Total float64 `json:"total"`
150149
}
151150

152151
// Returns information on products sold and returned within a month. Canceled or non-purchased products are not included.

ozon/finance_test.go

Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,52 +23,67 @@ func TestReportOnSoldProducts(t *testing.T) {
2323
http.StatusOK,
2424
map[string]string{"Client-Id": "my-client-id", "Api-Key": "my-api-key"},
2525
&ReportOnSoldProductsParams{
26-
Date: "2022-09",
26+
Month: 9,
27+
Year: 2022,
2728
},
2829
`{
29-
"result": {
30-
"header": {
31-
"doc_date": "2022-09-22",
32-
"num": "string",
33-
"start_date": "2022-09-02",
34-
"stop_date": "2022-09-22",
35-
"contract_date": "2022-09-02",
36-
"contract_num": "string",
37-
"payer_name": "string",
38-
"payer_inn": "string",
39-
"payer_kpp": "string",
40-
"rcv_name": "string",
41-
"rcv_inn": "string",
42-
"rcv_kpp": "string",
43-
"doc_amount": 1,
44-
"vat_amount": 1,
45-
"currency_code": "string"
46-
},
47-
"rows": [
48-
{
49-
"row_number": 0,
50-
"product_id": 0,
51-
"product_name": "string",
52-
"offer_id": "string",
53-
"barcode": "string",
54-
"price": 0,
55-
"commission_percent": 0,
56-
"price_sale": 0,
57-
"sale_qty": 0,
58-
"sale_amount": 0,
59-
"sale_discount": 0,
60-
"sale_commission": 0,
61-
"sale_price_seller": 0,
62-
"return_sale": 0,
63-
"return_qty": 0,
64-
"return_amount": 0,
65-
"return_discount": 0,
66-
"return_commission": 0,
67-
"return_price_seller": 0
68-
}
69-
]
70-
}
71-
}`,
30+
"result": {
31+
"header": {
32+
"contract_date": "string",
33+
"contract_number": "string",
34+
"currency_sys_name": "string",
35+
"doc_amount": 0,
36+
"doc_date": "string",
37+
"number": "string",
38+
"payer_inn": "string",
39+
"payer_kpp": "string",
40+
"payer_name": "string",
41+
"receiver_inn": "string",
42+
"receiver_kpp": "string",
43+
"receiver_name": "string",
44+
"start_date": "string",
45+
"stop_date": "string",
46+
"vat_amount": 0
47+
},
48+
"rows": [
49+
{
50+
"commission_ratio": 0,
51+
"delivery_commission": {
52+
"amount": 0,
53+
"bonus": 0,
54+
"commission": 0,
55+
"compensation": 0,
56+
"price_per_instance": 0,
57+
"quantity": 0,
58+
"standard_fee": 0,
59+
"bank_coinvestment": 0,
60+
"stars": 0,
61+
"total": 0
62+
},
63+
"item": {
64+
"barcode": "string",
65+
"name": "string",
66+
"offer_id": "string",
67+
"sku": 0
68+
},
69+
"return_commission": {
70+
"amount": 0,
71+
"bonus": 0,
72+
"commission": 0,
73+
"compensation": 0,
74+
"price_per_instance": 0,
75+
"quantity": 0,
76+
"standard_fee": 0,
77+
"bank_coinvestment": 0,
78+
"stars": 0,
79+
"total": 0
80+
},
81+
"rowNumber": 0,
82+
"seller_price_per_instance": 0
83+
}
84+
]
85+
}
86+
}`,
7287
"",
7388
},
7489
// Test No Client-Id or Api-Key

0 commit comments

Comments
 (0)