fix for clear cart method

This commit is contained in:
Суханов Данила 2025-04-04 15:12:04 +03:00
parent d0b0dd59d6
commit 871459c8b7
3 changed files with 14 additions and 13 deletions

View file

@ -1965,17 +1965,17 @@ func (c *Client) CorporateCustomerEdit(customer CorporateCustomer, by string, si
//
// var client = retailcrm.New("https://demo.url", "09jIJ")
//
// data, status, err := client.ClearCart("site_id", SiteFilter{SiteBy: "id"},
// ClearCartRequest{
// CreatedAt: time.Now().String(),
// Customer: CartCustomer{
// data, status, err := client.ClearCart("site_id", retailcrm.SiteFilter{SiteBy: "id"},
// retailcrm.ClearCartRequest{
// ClearedAt: time.Now().String(),
// Customer: retailcrm.CartCustomer{
// ID: 1,
// ExternalID: "ext_id",
// Site: "site",
// BrowserID: "browser_id",
// GaClientID: "ga_client_id",
// },
// Order: ClearCartOrder{
// Order: retailcrm.ClearCartOrder{
// ID: 1,
// ExternalID: "ext_id",
// Number: "abc123",
@ -2027,23 +2027,23 @@ func (c *Client) ClearCart(site string, filter SiteFilter, req ClearCartRequest)
//
// var client = retailcrm.New("https://demo.url", "09jIJ")
//
// data, status, err := client.SetCart("site_id", SiteFilter{SiteBy: "id"},
// SetCartRequest{
// data, status, err := client.SetCart("site_id", retailcrm.SiteFilter{SiteBy: "id"},
// retailcrm.SetCartRequest{
// ExternalID: "ext_id",
// DroppedAt: time.Now().String(),
// Link: "link",
// Customer: CartCustomer{
// Customer: retailcrm.CartCustomer{
// ID: 1,
// ExternalID: "ext_id",
// Site: "site",
// BrowserID: "browser_id",
// GaClientID: "ga_client_id",
// },
// Items: []SetCartItem{
// Items: []retailcrm.SetCartItem{
// {
// Quantity: 1,
// Price: 1.0,
// Offer: SetCartOffer{
// Offer: retailcrm.SetCartOffer{
// ID: 1,
// ExternalID: "ext_id",
// XMLID: "xml_id",
@ -2097,7 +2097,8 @@ func (c *Client) SetCart(site string, filter SiteFilter, req SetCartRequest) (
//
// var client = retailcrm.New("https://demo.url", "09jIJ")
//
// data, status, err := client.GetCart("site_id","customer_id", GetCartFilter{ SiteBy: "code", By: "externalId"})
// data, status, err := client.GetCart("site_id","customer_id",
// retailcrm.GetCartFilter{ SiteBy: "code", By: "externalId"})
//
// if err != nil {
// if apiErr, ok := retailcrm.AsAPIError(err); ok {

View file

@ -1883,7 +1883,7 @@ func TestClient_ClearCart(t *testing.T) {
site := "site_id"
filter := SiteFilter{SiteBy: "id"}
request := ClearCartRequest{
CreatedAt: time.Now().String(),
ClearedAt: time.Now().String(),
Customer: CartCustomer{
ID: 1,
ExternalID: "ext_id",

View file

@ -196,7 +196,7 @@ type DeliveryShipmentsRequest struct {
// ClearCartRequest type.
type ClearCartRequest struct {
CreatedAt string `url:"createdAt,omitempty"`
ClearedAt string `url:"clearedAt,omitempty"`
Customer CartCustomer `url:"customer,omitempty"`
Order ClearCartOrder `url:"order,omitempty"`
}