add optional paramter with_details to request and details to response in GetFinancial in reports
This commit is contained in:
@@ -313,3 +313,50 @@ const (
|
|||||||
// delivery by the seller
|
// delivery by the seller
|
||||||
NonIntegratedTPLType TPLIntegrationType = "non_integrated"
|
NonIntegratedTPLType TPLIntegrationType = "non_integrated"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type DetailsDeliveryItemName string
|
||||||
|
|
||||||
|
const (
|
||||||
|
DirectFlowLogisticSumDetailsDeliveryItemName DetailsDeliveryItemName = "MarketplaceServiceItemDirectFlowLogisticSum"
|
||||||
|
DropoffDetailsDeliveryItemName DetailsDeliveryItemName = "MarketplaceServiceItemDropoff"
|
||||||
|
DelivToCustomerDetailsDeliveryItemName DetailsDeliveryItemName = "MarketplaceServiceItemDelivToCustomer"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DetailsReturnServiceName string
|
||||||
|
|
||||||
|
const (
|
||||||
|
ReturnAfterDelivToCustomerDetailsReturnServiceName DetailsReturnServiceName = "MarketplaceServiceItemReturnAfterDelivToCustomer"
|
||||||
|
ReturnPartGoodsCustomerDetailsReturnServiceName DetailsReturnServiceName = "MarketplaceServiceItemReturnPartGoodsCustomer"
|
||||||
|
ReturnNotDelivToCustomerDetailsReturnServiceName DetailsReturnServiceName = "MarketplaceServiceItemReturnNotDelivToCustomer"
|
||||||
|
ReturnFlowLogisticDetailsReturnServiceName DetailsReturnServiceName = "MarketplaceServiceItemReturnFlowLogistic"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DetailsServiceItemName string
|
||||||
|
|
||||||
|
const (
|
||||||
|
OtherMarketAndTech DetailsServiceItemName = "MarketplaceServiceItemOtherMarketAndTechService"
|
||||||
|
ReturnStorageServiceAtThePickupPointFbsItem DetailsServiceItemName = "MarketplaceReturnStorageServiceAtThePickupPointFbsItem"
|
||||||
|
SaleReviewsItem DetailsServiceItemName = "MarketplaceSaleReviewsItem"
|
||||||
|
ServicePremiumCashbackIndividualPoints DetailsServiceItemName = "MarketplaceServicePremiumCashbackIndividualPoints"
|
||||||
|
ServiceStorageItem DetailsServiceItemName = "MarketplaceServiceStorageItem"
|
||||||
|
ServiceStockDisposal DetailsServiceItemName = "MarketplaceServiceStockDisposal"
|
||||||
|
ReturnDisposalServiceFbsItem DetailsServiceItemName = "MarketplaceReturnDisposalServiceFbsItem"
|
||||||
|
ServiceItemFlexiblePaymentSchedule DetailsServiceItemName = "MarketplaceServiceItemFlexiblePaymentSchedule"
|
||||||
|
ServiceProcessingSpoilage DetailsServiceItemName = "MarketplaceServiceProcessingSpoilage"
|
||||||
|
ServiceProcessingIdentifiedSurplus DetailsServiceItemName = "MarketplaceServiceProcessingIdentifiedSurplus"
|
||||||
|
ServiceProcessingIdentifiedDiscrepancies DetailsServiceItemName = "MarketplaceServiceProcessingIdentifiedDiscrepancies"
|
||||||
|
ServiceItemInternetSiteAdvertising DetailsServiceItemName = "MarketplaceServiceItemInternetSiteAdvertising"
|
||||||
|
ServiceItemPremiumSubscribtion DetailsServiceItemName = "MarketplaceServiceItemPremiumSubscribtion"
|
||||||
|
AgencyFeeAggregator3PLGlobalItem DetailsServiceItemName = "MarketplaceAgencyFeeAggregator3PLGlobalItem"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DetailsOtherItemName string
|
||||||
|
|
||||||
|
const (
|
||||||
|
RedistributionOfAcquiringOperation DetailsOtherItemName = "MarketplaceRedistributionOfAcquiringOperation"
|
||||||
|
CompensationLossOfGoodsOperation DetailsOtherItemName = "MarketplaceSellerCompensationLossOfGoodsOperation"
|
||||||
|
CorrectionOperation DetailsOtherItemName = "MarketplaceSellerCorrectionOperation"
|
||||||
|
OperationCorrectionSeller DetailsOtherItemName = "OperationCorrectionSeller"
|
||||||
|
OperationMarketplaceWithHoldingForUndeliverableGoods DetailsOtherItemName = "OperationMarketplaceWithHoldingForUndeliverableGoods"
|
||||||
|
OperationClaim DetailsOtherItemName = "OperationClaim"
|
||||||
|
)
|
||||||
|
|||||||
@@ -159,6 +159,9 @@ type GetFinancialReportParams struct {
|
|||||||
// Number of the page returned in the request
|
// Number of the page returned in the request
|
||||||
Page int64 `json:"page"`
|
Page int64 `json:"page"`
|
||||||
|
|
||||||
|
// true, если нужно добавить дополнительные параметры в ответ
|
||||||
|
WithDetails bool `json:"with_details"`
|
||||||
|
|
||||||
// Number of items on the page
|
// Number of items on the page
|
||||||
PageSize int64 `json:"page_size"`
|
PageSize int64 `json:"page_size"`
|
||||||
}
|
}
|
||||||
@@ -209,6 +212,99 @@ type GetFinancialReportResponse struct {
|
|||||||
CurrencyCode string `json:"currency_code"`
|
CurrencyCode string `json:"currency_code"`
|
||||||
} `json:"cash_flows"`
|
} `json:"cash_flows"`
|
||||||
|
|
||||||
|
// Detailed info
|
||||||
|
Details struct {
|
||||||
|
// Balance on the beginning of period
|
||||||
|
BeginBalanceAmount float64 `json:"begin_balance_amount"`
|
||||||
|
|
||||||
|
// Orders
|
||||||
|
Delivery struct {
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
|
||||||
|
Amount float64 `json:"amount"`
|
||||||
|
|
||||||
|
DeliveryServices struct {
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
|
||||||
|
Items []struct {
|
||||||
|
Name DetailsDeliveryItemName `json:"name"`
|
||||||
|
|
||||||
|
Price float64 `json:"price"`
|
||||||
|
} `json:"items"`
|
||||||
|
} `json:"delivery_services"`
|
||||||
|
} `json:"delivery"`
|
||||||
|
|
||||||
|
InvoiceTransfer float64 `json:"invoice_transfer"`
|
||||||
|
|
||||||
|
Loan float64 `json:"loan"`
|
||||||
|
|
||||||
|
Payments []struct {
|
||||||
|
CurrencyCode string `json:"currency_code"`
|
||||||
|
|
||||||
|
Payment float64 `json:"payment"`
|
||||||
|
} `json:"payments"`
|
||||||
|
|
||||||
|
Period struct {
|
||||||
|
Begin time.Time `json:"begin"`
|
||||||
|
|
||||||
|
End time.Time `json:"end"`
|
||||||
|
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
} `json:"period"`
|
||||||
|
|
||||||
|
Return struct {
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
|
||||||
|
Amount float64 `json:"amount"`
|
||||||
|
|
||||||
|
ReturnServices struct {
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
|
||||||
|
Items []struct {
|
||||||
|
Name DetailsReturnServiceName `json:"name"`
|
||||||
|
|
||||||
|
Price float64 `json:"price"`
|
||||||
|
} `json:"items"`
|
||||||
|
} `json:"return_services"`
|
||||||
|
} `json:"return"`
|
||||||
|
|
||||||
|
RFBS struct {
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
|
||||||
|
TransferDelivery float64 `json:"transfer_delivery"`
|
||||||
|
|
||||||
|
TransferDeliveryReturn float64 `json:"transfer_delivery_return"`
|
||||||
|
|
||||||
|
CompensationDeliveryReturn float64 `json:"compensation_delivery_return"`
|
||||||
|
|
||||||
|
PartialCompensation float64 `json:"partial_compensation"`
|
||||||
|
|
||||||
|
PartialCompensationReturn float64 `json:"partial_compensation_return"`
|
||||||
|
} `json:"rfbs"`
|
||||||
|
|
||||||
|
Services struct {
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
|
||||||
|
Items []struct {
|
||||||
|
Name DetailsServiceItemName `json:"name"`
|
||||||
|
|
||||||
|
Price float64 `json:"price"`
|
||||||
|
} `json:"items"`
|
||||||
|
} `json:"services"`
|
||||||
|
|
||||||
|
Others struct {
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
|
||||||
|
Items []struct {
|
||||||
|
Name DetailsOtherItemName `json:"name"`
|
||||||
|
|
||||||
|
Price float64 `json:"price"`
|
||||||
|
} `json:"items"`
|
||||||
|
} `json:"others"`
|
||||||
|
|
||||||
|
EndBalanceAmount float64 `json:"end_balance_amount"`
|
||||||
|
} `json:"details"`
|
||||||
|
|
||||||
// Number of pages with reports
|
// Number of pages with reports
|
||||||
PageCount int64 `json:"page_count"`
|
PageCount int64 `json:"page_count"`
|
||||||
} `json:"result"`
|
} `json:"result"`
|
||||||
|
|||||||
@@ -165,28 +165,98 @@ func TestGetFinancialReport(t *testing.T) {
|
|||||||
From: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2022-01-01T00:00:00.000Z"),
|
From: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2022-01-01T00:00:00.000Z"),
|
||||||
To: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2022-12-31T00:00:00.000Z"),
|
To: core.TimeFromString(t, "2006-01-02T15:04:05Z", "2022-12-31T00:00:00.000Z"),
|
||||||
},
|
},
|
||||||
Page: 1,
|
WithDetails: true,
|
||||||
PageSize: 1,
|
Page: 1,
|
||||||
|
PageSize: 1,
|
||||||
},
|
},
|
||||||
`{
|
`{
|
||||||
"result": {
|
"result": {
|
||||||
"cash_flows": [
|
"cash_flows": [
|
||||||
{
|
{
|
||||||
"period": {
|
|
||||||
"id": 11567022278500,
|
|
||||||
"begin": "2022-08-01T00:00:00Z",
|
|
||||||
"end": "2022-08-15T00:00:00Z"
|
|
||||||
},
|
|
||||||
"orders_amount": 1000,
|
|
||||||
"returns_amount": -3000,
|
|
||||||
"commission_amount": 1437,
|
"commission_amount": 1437,
|
||||||
"services_amount": 8471.28,
|
"currency_code": "string",
|
||||||
"item_delivery_and_return_amount": 1991,
|
"item_delivery_and_return_amount": 1991,
|
||||||
"currency_code": "RUB"
|
"orders_amount": 1000,
|
||||||
|
"period": {
|
||||||
|
"begin": "2023-04-03T09:12:10.239Z",
|
||||||
|
"end": "2023-04-03T09:12:10.239Z",
|
||||||
|
"id": 11567022278500
|
||||||
|
},
|
||||||
|
"returns_amount": -3000,
|
||||||
|
"services_amount": 8471.28
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"page_count": 15
|
"details": {
|
||||||
}
|
"period": {
|
||||||
|
"begin": "2023-04-03T09:12:10.239Z",
|
||||||
|
"end": "2023-04-03T09:12:10.239Z",
|
||||||
|
"id": 11567022278500
|
||||||
|
},
|
||||||
|
"payments": [
|
||||||
|
{
|
||||||
|
"payment": 0,
|
||||||
|
"currency_code": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"begin_balance_amount": 0,
|
||||||
|
"delivery": {
|
||||||
|
"total": 0,
|
||||||
|
"amount": 0,
|
||||||
|
"delivery_services": {
|
||||||
|
"total": 0,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "string",
|
||||||
|
"price": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"return": {
|
||||||
|
"total": 0,
|
||||||
|
"amount": 0,
|
||||||
|
"return_services": {
|
||||||
|
"total": 0,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "string",
|
||||||
|
"price": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"loan": 0,
|
||||||
|
"invoice_transfer": 0,
|
||||||
|
"rfbs": {
|
||||||
|
"total": 0,
|
||||||
|
"transfer_delivery": 0,
|
||||||
|
"transfer_delivery_return": 0,
|
||||||
|
"compensation_delivery_return": 0,
|
||||||
|
"partial_compensation": 0,
|
||||||
|
"partial_compensation_return": 0
|
||||||
|
},
|
||||||
|
"services": {
|
||||||
|
"total": 0,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "string",
|
||||||
|
"price": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"others": {
|
||||||
|
"total": 0,
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"name": "string",
|
||||||
|
"price": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"end_balance_amount": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"page_count": 15
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
// Test No Client-Id or Api-Key
|
// Test No Client-Id or Api-Key
|
||||||
|
|||||||
Reference in New Issue
Block a user