add all methods for cancellations, add methods for getting fbo shipment details
This commit is contained in:
		
							
								
								
									
										179
									
								
								ozon/fbo.go
									
									
									
									
									
								
							
							
						
						
									
										179
									
								
								ozon/fbo.go
									
									
									
									
									
								
							@@ -99,19 +99,7 @@ type GetFBOShipmentsListResponse struct {
 | 
			
		||||
		CreatedAt time.Time `json:"created_at"`
 | 
			
		||||
 | 
			
		||||
		// Financial data
 | 
			
		||||
		FinancialData struct {
 | 
			
		||||
			// Identifier of the cluster, where the shipment is sent from
 | 
			
		||||
			ClusterFrom string `json:"cluster_from"`
 | 
			
		||||
 | 
			
		||||
			// Identifier of the cluster, where the shipment is delivered to
 | 
			
		||||
			ClusterTo string `json:"cluster_to"`
 | 
			
		||||
 | 
			
		||||
			// Services
 | 
			
		||||
			PostingServices MarketplaceServices `json:"posting_services"`
 | 
			
		||||
 | 
			
		||||
			// Products list
 | 
			
		||||
			Products []FinancialDataProduct `json:"products"`
 | 
			
		||||
		} `json:"financial_data"`
 | 
			
		||||
		FinancialData FBOFinancialData `json:"financial_data"`
 | 
			
		||||
 | 
			
		||||
		// Date and time of shipment processing start
 | 
			
		||||
		InProccessAt time.Time `json:"in_process_at"`
 | 
			
		||||
@@ -126,36 +114,52 @@ type GetFBOShipmentsListResponse struct {
 | 
			
		||||
		PostingNumber string `json:"posting_number"`
 | 
			
		||||
 | 
			
		||||
		// Number of products in the shipment
 | 
			
		||||
		Products []struct {
 | 
			
		||||
			// Activation codes for services and digital products
 | 
			
		||||
			DigitalCodes []string `json:"digital_codes"`
 | 
			
		||||
 | 
			
		||||
			// Currency of your prices. It matches the currency set in the personal account settings
 | 
			
		||||
			CurrencyCode string `json:"currency_code"`
 | 
			
		||||
 | 
			
		||||
			// Product name
 | 
			
		||||
			Name string `json:"name"`
 | 
			
		||||
 | 
			
		||||
			// Product identifier in the seller's system
 | 
			
		||||
			OfferId string `json:"offer_id"`
 | 
			
		||||
 | 
			
		||||
			// Product price
 | 
			
		||||
			Price string `json:"price"`
 | 
			
		||||
 | 
			
		||||
			// Quantity of products in the shipment
 | 
			
		||||
			Quantity int64 `json:"quantity"`
 | 
			
		||||
 | 
			
		||||
			// Product identifier in the Ozon system, SKU
 | 
			
		||||
			SKU int64 `json:"sku"`
 | 
			
		||||
		} `json:"products"`
 | 
			
		||||
		Products []FBOPostingProduct `json:"products"`
 | 
			
		||||
 | 
			
		||||
		// Shipment status
 | 
			
		||||
		Status string `json:"status"`
 | 
			
		||||
	} `json:"result"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type FBOPostingProduct struct {
 | 
			
		||||
	// Activation codes for services and digital products
 | 
			
		||||
	DigitalCodes []string `json:"digital_codes"`
 | 
			
		||||
 | 
			
		||||
	// Currency of your prices. It matches the currency set in the personal account settings
 | 
			
		||||
	CurrencyCode string `json:"currency_code"`
 | 
			
		||||
 | 
			
		||||
	// Product name
 | 
			
		||||
	Name string `json:"name"`
 | 
			
		||||
 | 
			
		||||
	// Product identifier in the seller's system
 | 
			
		||||
	OfferId string `json:"offer_id"`
 | 
			
		||||
 | 
			
		||||
	// Product price
 | 
			
		||||
	Price string `json:"price"`
 | 
			
		||||
 | 
			
		||||
	// Quantity of products in the shipment
 | 
			
		||||
	Quantity int64 `json:"quantity"`
 | 
			
		||||
 | 
			
		||||
	// Product identifier in the Ozon system, SKU
 | 
			
		||||
	SKU int64 `json:"sku"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type FBOFinancialData struct {
 | 
			
		||||
	// Identifier of the cluster, where the shipment is sent from
 | 
			
		||||
	ClusterFrom string `json:"cluster_from"`
 | 
			
		||||
 | 
			
		||||
	// Identifier of the cluster, where the shipment is delivered to
 | 
			
		||||
	ClusterTo string `json:"cluster_to"`
 | 
			
		||||
 | 
			
		||||
	// Services
 | 
			
		||||
	PostingServices MarketplaceServices `json:"posting_services"`
 | 
			
		||||
 | 
			
		||||
	// Products list
 | 
			
		||||
	Products []FinancialDataProduct `json:"products"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Returns a list of shipments for a specified period of time. You can additionally filter the shipments by their status
 | 
			
		||||
func (c FBO) GetFBOShipmentsList(params *GetFBOShipmentsListParams) (*GetFBOShipmentsListResponse, error) {
 | 
			
		||||
func (c FBO) GetShipmentsList(params *GetFBOShipmentsListParams) (*GetFBOShipmentsListResponse, error) {
 | 
			
		||||
	url := "/v2/posting/fbo/list"
 | 
			
		||||
 | 
			
		||||
	resp := &GetFBOShipmentsListResponse{}
 | 
			
		||||
@@ -168,3 +172,106 @@ func (c FBO) GetFBOShipmentsList(params *GetFBOShipmentsListParams) (*GetFBOShip
 | 
			
		||||
 | 
			
		||||
	return resp, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetShipmentDetailsParams struct{
 | 
			
		||||
	// Shipment number
 | 
			
		||||
	PostingNumber string `json:"posting_number"`
 | 
			
		||||
 | 
			
		||||
	// true if the address transliteration from Cyrillic to Latin is enabled
 | 
			
		||||
	Translit bool `json:"translit"`
 | 
			
		||||
 | 
			
		||||
	// Additional fields to add to the response
 | 
			
		||||
	With GetShipmentDetailsWith `json:"with"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetShipmentDetailsWith struct{
 | 
			
		||||
	// Specify true to add analytics data to the response
 | 
			
		||||
	AnalyticsData bool `json:"analytics_data"`
 | 
			
		||||
 | 
			
		||||
	// Specify true to add financial data to the response
 | 
			
		||||
	FinancialData bool `json:"financial_data"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetShipmentDetailsResponse struct{
 | 
			
		||||
	core.CommonResponse
 | 
			
		||||
 | 
			
		||||
	// Method result
 | 
			
		||||
	Result struct{
 | 
			
		||||
		// Additional data
 | 
			
		||||
		AdditionalData []struct{
 | 
			
		||||
			Key string `json:"key"`
 | 
			
		||||
			Value string `json:"value"`
 | 
			
		||||
		} `json:"additional_data"`
 | 
			
		||||
 | 
			
		||||
		// Analytical data
 | 
			
		||||
		AnalyticsData struct{
 | 
			
		||||
			// Delivery city
 | 
			
		||||
			City string `json:"Delivery city"`
 | 
			
		||||
 | 
			
		||||
			// Delivery method
 | 
			
		||||
			DeliveryType string `json:"delivery_type"`
 | 
			
		||||
 | 
			
		||||
			// Indication that the recipient is a legal person:
 | 
			
		||||
			//   - true — a legal person
 | 
			
		||||
			//   - false — a natural person
 | 
			
		||||
			IsLegal bool `json:"is_legal"`
 | 
			
		||||
 | 
			
		||||
			// Premium subscription
 | 
			
		||||
			IsPremium bool `json:"is_premium"`
 | 
			
		||||
 | 
			
		||||
			// Payment method
 | 
			
		||||
			PaymentTypeGroupName string `json:"payment_type_group_name"`
 | 
			
		||||
 | 
			
		||||
			// Delivery region
 | 
			
		||||
			Region string `json:"region"`
 | 
			
		||||
			
 | 
			
		||||
			// Warehouse identifier
 | 
			
		||||
			WarehouseId int64 `json:"warehouse_id"`
 | 
			
		||||
 | 
			
		||||
			// Name of the warehouse from which the order is shipped
 | 
			
		||||
			WarehouseName string `json:"warehouse_name"`
 | 
			
		||||
		} `json:"analytics_data"`
 | 
			
		||||
 | 
			
		||||
		// Shipment cancellation reason identifier
 | 
			
		||||
		CancelReasonId int64 `json:"cancel_reason_id"`
 | 
			
		||||
 | 
			
		||||
		// Date and time of shipment creation
 | 
			
		||||
		CreatedAt time.Time `json:"created_at"`
 | 
			
		||||
 | 
			
		||||
		// Financial data
 | 
			
		||||
		FinancialData FBOFinancialData `json:"financial_data"`
 | 
			
		||||
 | 
			
		||||
		// Date and time of shipment processing start
 | 
			
		||||
		InProcessAt time.Time `json:"in_process_at"`
 | 
			
		||||
 | 
			
		||||
		// Identifier of the order to which the shipment belongs
 | 
			
		||||
		OrderId int64 `json:"order_id"`
 | 
			
		||||
 | 
			
		||||
		// Number of the order to which the shipment belongs
 | 
			
		||||
		OrderNumber string `json:"order_number"`
 | 
			
		||||
 | 
			
		||||
		// Shipment number
 | 
			
		||||
		PostingNumber string `json:"posting_number"`
 | 
			
		||||
 | 
			
		||||
		// Number of products in the shipment
 | 
			
		||||
		Products []FBOPostingProduct `json:"products"`
 | 
			
		||||
 | 
			
		||||
		// Shipment status
 | 
			
		||||
		Status string `json:"status"`
 | 
			
		||||
	} `json:"result"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Returns information about the shipment by its identifier
 | 
			
		||||
func (c FBO) GetShipmentDetails(params *GetShipmentDetailsParams) (*GetShipmentDetailsResponse, error) {
 | 
			
		||||
	url := "/v2/posting/fbo/get"
 | 
			
		||||
 | 
			
		||||
	resp := &GetShipmentDetailsResponse{}
 | 
			
		||||
 | 
			
		||||
	response, err := c.client.Request(http.MethodPost, url, params, resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	response.CopyCommonResponse(&resp.CommonResponse)
 | 
			
		||||
 | 
			
		||||
	return resp, nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user