add support for more methods

This commit is contained in:
Pavel 2022-12-09 14:37:12 +03:00 committed by GitHub
commit 6c5eb72848
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 3648 additions and 1095 deletions

View File

@ -34,6 +34,7 @@ jobs:
version: v1.45.2 version: v1.45.2
only-new-issues: true only-new-issues: true
skip-pkg-cache: true skip-pkg-cache: true
args: --build-tags=testutils
tests: tests:
name: Tests name: Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -58,13 +59,13 @@ jobs:
env: env:
COVERAGE: ${{ matrix.coverage }} COVERAGE: ${{ matrix.coverage }}
if: env.COVERAGE != 1 if: env.COVERAGE != 1
run: go test ./... run: go test -tags=testutils ./...
- name: Tests with coverage - name: Tests with coverage
env: env:
COVERAGE: ${{ matrix.coverage }} COVERAGE: ${{ matrix.coverage }}
if: env.COVERAGE == 1 if: env.COVERAGE == 1
run: | run: |
go test ./... -race -coverprofile=coverage.txt -covermode=atomic "$d" go test -tags=testutils ./... -race -coverprofile=coverage.txt -covermode=atomic "$d"
- name: Coverage - name: Coverage
env: env:
COVERAGE: ${{ matrix.coverage }} COVERAGE: ${{ matrix.coverage }}

View File

@ -1,6 +1,8 @@
run: run:
skip-dirs-use-default: true skip-dirs-use-default: true
allow-parallel-runners: true allow-parallel-runners: true
skip-files:
- testutils.go
output: output:
format: colored-line-number format: colored-line-number

2898
client.go

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -439,3 +439,37 @@ type AccountBonusOperationsFilter struct {
CreatedAtFrom string `url:"createdAtFrom,omitempty"` CreatedAtFrom string `url:"createdAtFrom,omitempty"`
CreatedAtTo string `url:"createdAtTo,omitempty"` CreatedAtTo string `url:"createdAtTo,omitempty"`
} }
type LoyaltyBonusAPIFilterType struct {
Date string `url:"date,omitempty"`
}
type LoyaltyAccountAPIFilter struct {
ID string `url:"id,omitempty"`
Status string `url:"status,,omitempty"`
Customer string `url:"customer,omitempty"`
MinOrderSum string `url:"minOrderSum,omitempty"`
MaxOrderSum string `url:"maxOrderSum,omitempty"`
MinAmount string `url:"minAmount,omitempty"`
MaxAmount string `url:"maxAmount,omitempty"`
PhoneNumber string `url:"phoneNumber,omitempty"`
CardNumber string `url:"cardNumber,omitempty"`
Ids []int `url:"ids,omitempty,brackets"`
Loyalties []int `url:"loyalties,omitempty,brackets"`
Sites []string `url:"sites,omitempty,brackets"`
Level int `url:"level,omitempty"`
CreatedAtFrom string `url:"createdAtFrom,omitempty"`
CreatedAtTo string `url:"createdAtTo,omitempty"`
BurnDateFrom string `url:"burnDateFrom,omitempty"`
BurnDateTo string `url:"burnDateTo,omitempty"`
CustomFields []string `url:"customFields,omitempty,brackets"`
CustomerID string `url:"customerId,omitempty"`
CustomerExternalID string `url:"customerExternalId,omitempty"`
}
type LoyaltyAPIFilter struct {
Active *int `url:"active,omitempty"`
Blocked *int `url:"blocked,omitempty"`
Ids []int `url:"ids,omitempty,brackets"`
Sites []string `url:"sites,omitempty,brackets"`
}

View File

@ -246,6 +246,37 @@ type AccountBonusOperationsRequest struct {
Page int `url:"page,omitempty"` Page int `url:"page,omitempty"`
} }
type LoyaltyBonusCreditRequest struct {
Amount float64 `url:"amount"`
ActivationDate string `url:"activationDate,omitempty"`
ExpiredDate string `url:"expiredDate,omitempty"`
Comment string `url:"comment,omitempty"`
}
type LoyaltyBonusStatusDetailsRequest struct {
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
Filter LoyaltyBonusAPIFilterType `url:"filter,omitempty"`
}
type LoyaltyAccountsRequest struct {
Limit int `url:"limit,omitempty"`
Page int `url:"limit,omitempty"`
Filter LoyaltyAccountAPIFilter `url:"filter,omitempty"`
}
type LoyaltyCalculateRequest struct {
Site string
Order Order
Bonuses float32
}
type LoyaltiesRequest struct {
Limit int `url:"limit,omitempty"`
Page int `url:"page,omitempty"`
Filter LoyaltyAPIFilter `url:"filter,omitempty"`
}
// SystemURL returns system URL from the connection request without trailing slash. // SystemURL returns system URL from the connection request without trailing slash.
func (r ConnectRequest) SystemURL() string { func (r ConnectRequest) SystemURL() string {
if r.URL == "" { if r.URL == "" {

View File

@ -5,6 +5,17 @@ type SuccessfulResponse struct {
Success bool `json:"success"` Success bool `json:"success"`
} }
type CreateLoyaltyAccountResponse struct {
SuccessfulResponse
LoyaltyAccount LoyaltyAccount `json:"loyaltyAccount,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
type EditLoyaltyAccountResponse struct {
SuccessfulResponse
LoyaltyAccount LoyaltyAccount `json:"loyaltyAccount,omitempty"`
}
// CreateResponse type. // CreateResponse type.
type CreateResponse struct { type CreateResponse struct {
Success bool `json:"success"` Success bool `json:"success"`
@ -112,6 +123,7 @@ type CorporateCustomerChangeResponse CustomerChangeResponse
type CustomersUploadResponse struct { type CustomersUploadResponse struct {
Success bool `json:"success"` Success bool `json:"success"`
UploadedCustomers []IdentifiersPair `json:"uploadedCustomers,omitempty"` UploadedCustomers []IdentifiersPair `json:"uploadedCustomers,omitempty"`
FailedCustomers []ExternalID `json:"failedCustomers,omitempty"`
} }
// CorporateCustomersUploadResponse type. // CorporateCustomersUploadResponse type.
@ -156,6 +168,7 @@ type OrdersStatusesResponse struct {
type OrdersUploadResponse struct { type OrdersUploadResponse struct {
Success bool `json:"success"` Success bool `json:"success"`
UploadedOrders []IdentifiersPair `json:"uploadedOrders,omitempty"` UploadedOrders []IdentifiersPair `json:"uploadedOrders,omitempty"`
FailedOrders []ExternalID `json:"failedOrders,omitempty"`
} }
// OrdersHistoryResponse type. // OrdersHistoryResponse type.
@ -370,6 +383,23 @@ type ProductsResponse struct {
Products []Product `json:"products,omitempty"` Products []Product `json:"products,omitempty"`
} }
type ProductEditNotFoundResponse struct {
ID string `json:"id"`
ExternalID string `json:"externalId,omitempty"`
}
type ProductsBatchEditResponse struct {
SuccessfulResponse
ProcessedProductsCount int `json:"processedProductsCount,omitempty"`
NotFoundProducts []ProductEditNotFoundResponse `json:"notFoundProducts,omitempty"`
}
type ProductsBatchCreateResponse struct {
SuccessfulResponse
ProcessedProductsCount int `json:"processedProductsCount,omitempty"`
AddedProducts []int `json:"addedProducts,omitempty"`
}
// ProductsPropertiesResponse type. // ProductsPropertiesResponse type.
type ProductsPropertiesResponse struct { type ProductsPropertiesResponse struct {
Success bool `json:"success"` Success bool `json:"success"`
@ -417,9 +447,10 @@ type IntegrationModuleEditResponse struct {
// ResponseInfo type. // ResponseInfo type.
type ResponseInfo struct { type ResponseInfo struct {
MgTransportInfo MgInfo `json:"mgTransport,omitempty"` MgTransportInfo MgInfo `json:"mgTransport,omitempty"`
MgBotInfo MgInfo `json:"mgBot,omitempty"` MgBotInfo MgInfo `json:"mgBot,omitempty"`
BillingInfo *BillingInfo `json:"billingInfo,omitempty"` BillingInfo *BillingInfo `json:"billingInfo,omitempty"`
DeliveryTypeInfo DeliveryTypeInfo `json:"deliveryType,omitempty"`
} }
type BillingInfo struct { type BillingInfo struct {
@ -564,3 +595,59 @@ type AccountBonusOperationsResponse struct {
Pagination *Pagination `json:"pagination,omitempty"` Pagination *Pagination `json:"pagination,omitempty"`
BonusOperations []BonusOperation `json:"bonusOperations,omitempty"` BonusOperations []BonusOperation `json:"bonusOperations,omitempty"`
} }
type LoyaltyAccountResponse struct {
SuccessfulResponse
LoyaltyAccount `json:"loyaltyAccount"`
}
type LoyaltyAccountActivateResponse struct {
SuccessfulResponse
LoyaltyAccount `json:"loyaltyAccount"`
Verification SmsVerification `json:"verification,omitempty"`
}
type LoyaltyBonusCreditResponse struct {
SuccessfulResponse
LoyaltyBonus LoyaltyBonus `json:"loyaltyBonus"`
}
type LoyaltyBonusDetailsResponse struct {
SuccessfulResponse
Pagination `json:"pagination"`
Statistic LoyaltyBonusStatisticResponse `json:"statistic"`
Bonuses []BonusDetail `json:"bonuses,omitempty"`
}
type LoyaltyBonusStatisticResponse struct {
TotalAmount float64 `json:"totalAmount"`
}
type LoyaltyAccountsResponse struct {
SuccessfulResponse
Pagination *Pagination `json:"pagination"`
LoyaltyAccounts []LoyaltyAccount `json:"loyaltyAccounts,omitempty"`
}
type LoyaltyCalculateResponse struct {
SuccessfulResponse
Order SerializedLoyaltyOrder `json:"order,omitempty"`
Calculations []LoyaltyCalculation `json:"calculations,omitempty"`
Loyalty SerializedLoyalty `json:"loyalty,omitempty"`
}
type LoyaltiesResponse struct {
SuccessfulResponse
Pagination *Pagination `json:"pagination"`
Loyalties []Loyalty `json:"loyalties,omitempty"`
}
type LoyaltyResponse struct {
SuccessfulResponse
Loyalty Loyalty `json:"loyalty"`
}
type ActionProductsGroupResponse struct {
SuccessfulResponse
ID int `json:"id"`
}

426
testutils.go Normal file
View File

@ -0,0 +1,426 @@
//go:build testutils
// +build testutils
package retailcrm
func getProductsCreate() []ProductCreate {
products := []ProductCreate{
{
CatalogID: 3,
BaseProduct: BaseProduct{
Name: "Product 1",
URL: "https://example.com/p/1",
Article: "p1",
ExternalID: "ext1",
Manufacturer: "man1",
Description: "Description 1",
Popular: true,
Stock: true,
Novelty: true,
Recommended: true,
Active: true,
Markable: true,
},
Groups: []ProductEditGroupInput{{ID: 19}},
},
{
CatalogID: 3,
BaseProduct: BaseProduct{
Name: "Product 2",
URL: "https://example.com/p/2",
Article: "p2",
ExternalID: "ext2",
Manufacturer: "man2",
Description: "Description 2",
Popular: true,
Stock: true,
Novelty: true,
Recommended: true,
Active: true,
Markable: true,
},
Groups: []ProductEditGroupInput{{ID: 19}},
},
}
return products
}
func getProductsCreateResponse() ProductsBatchCreateResponse {
return ProductsBatchCreateResponse{
SuccessfulResponse: SuccessfulResponse{Success: true},
ProcessedProductsCount: 2,
AddedProducts: []int{1, 2},
}
}
func getProductsEdit() []ProductEdit {
products := []ProductEdit{
{
BaseProduct: getProductsCreate()[0].BaseProduct,
ID: 194,
CatalogID: 3,
Site: "second",
},
{
BaseProduct: getProductsCreate()[1].BaseProduct,
ID: 195,
CatalogID: 3,
Site: "second",
},
}
return products
}
func getProductsEditResponse() ProductsBatchEditResponse {
return ProductsBatchEditResponse{
SuccessfulResponse: SuccessfulResponse{Success: true},
ProcessedProductsCount: 2,
NotFoundProducts: nil,
}
}
func getLoyaltyAccountCreate() SerializedCreateLoyaltyAccount {
return SerializedCreateLoyaltyAccount{
SerializedBaseLoyaltyAccount: SerializedBaseLoyaltyAccount{
PhoneNumber: "89151005004",
CustomFields: []string{"dog"},
},
Customer: SerializedEntityCustomer{
ID: 123,
},
}
}
func getLoyaltyAccountCreateResponse() CreateLoyaltyAccountResponse {
return CreateLoyaltyAccountResponse{
SuccessfulResponse: SuccessfulResponse{Success: true},
LoyaltyAccount: LoyaltyAccount{
Active: true,
ID: 13,
PhoneNumber: "89151005004",
LoyaltyLevel: LoyaltyLevel{},
CreatedAt: "2022-11-24 12:39:37",
ActivatedAt: "2022-11-24 12:39:37",
CustomFields: []string{"dog"},
},
}
}
func getLoyaltyAccountEditResponse() EditLoyaltyAccountResponse {
return EditLoyaltyAccountResponse{
SuccessfulResponse: SuccessfulResponse{Success: true},
LoyaltyAccount: LoyaltyAccount{
Active: true,
ID: 13,
PhoneNumber: "89142221020",
LoyaltyLevel: LoyaltyLevel{},
CreatedAt: "2022-11-24 12:39:37",
ActivatedAt: "2022-11-24 12:39:37",
CustomFields: []string{"dog"},
},
}
}
func getLoyaltyAccountResponse() string {
return `{
"success": true,
"loyaltyAccount": {
"active": true,
"id": 13,
"loyalty": {
"id": 2
},
"customer": {
"id": 123,
"customFields": [],
"firstName": "Руслан1",
"lastName": "Ефанов",
"patronymic": ""
},
"phoneNumber": "89142221020",
"amount": 0,
"ordersSum": 0,
"nextLevelSum": 10000,
"level": {
"type": "bonus_percent",
"id": 5,
"name": "Новичок",
"sum": 0,
"privilegeSize": 5,
"privilegeSizePromo": 3
},
"createdAt": "2022-11-24 12:39:37",
"activatedAt": "2022-11-24 12:39:37",
"status": "activated",
"customFields": []
}
}`
}
func getBonusDetailsResponse() string {
return `{
"success": true,
"pagination": {
"limit": 20,
"totalCount": 41,
"currentPage": 3,
"totalPageCount": 3
},
"statistic": {
"totalAmount": 240
},
"bonuses": [
{
"date": "2022-12-08",
"amount": 240
}
]
}`
}
func getLoyaltyAccountsResponse() string {
return `{
"success": true,
"pagination": {
"limit": 20,
"totalCount": 1,
"currentPage": 1,
"totalPageCount": 1
},
"loyaltyAccounts": [
{
"active": true,
"id": 14,
"loyalty": {
"id": 2
},
"customer": {
"id": 109,
"firstName": "Казимир",
"lastName": "Эльбрусов"
},
"phoneNumber": "89185556363",
"amount": 0,
"ordersSum": 0,
"nextLevelSum": 10000,
"level": {
"type": "bonus_percent",
"id": 5,
"name": "Новичок",
"sum": 0,
"privilegeSize": 5,
"privilegeSizePromo": 3
},
"createdAt": "2022-12-07 15:27:04",
"activatedAt": "2022-12-07 15:27:04",
"status": "activated"
}
]
}`
}
func getLoyaltyCalculateReq() LoyaltyCalculateRequest {
return LoyaltyCalculateRequest{
Site: "main",
Order: Order{
PrivilegeType: "loyalty_level",
Customer: &Customer{
ID: 123,
},
Items: []OrderItem{
{
InitialPrice: 10000,
Quantity: 1,
Offer: Offer{ID: 214},
PriceType: &PriceType{Code: "base"},
},
},
},
Bonuses: 10,
}
}
func getLoyaltyCalculateResponse() string {
return `{
"success": true,
"order": {
"bonusesCreditTotal": 999,
"bonusesChargeTotal": 10,
"privilegeType": "loyalty_level",
"totalSumm": 9990,
"loyaltyAccount": {
"id": 13,
"amount": 240
},
"loyaltyLevel": {
"id": 6,
"name": "Любитель"
},
"customer": {
"id": 123,
"personalDiscount": 0
},
"delivery": {
"cost": 0
},
"site": "main",
"items": [
{
"bonusesChargeTotal": 10,
"bonusesCreditTotal": 999,
"priceType": {
"code": "base"
},
"initialPrice": 10000,
"discounts": [
{
"type": "bonus_charge",
"amount": 10
}
],
"discountTotal": 10,
"prices": [
{
"price": 9990,
"quantity": 1
}
],
"quantity": 1,
"offer": {
"xmlId": "696999ed-bc8d-4d0f-9627-527acf7b1d57"
}
}
]
},
"calculations": [
{
"privilegeType": "loyalty_level",
"discount": 10,
"creditBonuses": 999,
"maxChargeBonuses": 240,
"maximum": true
},
{
"privilegeType": "none",
"discount": 10,
"creditBonuses": 0,
"maxChargeBonuses": 240,
"maximum": false
}
],
"loyalty": {
"name": "Бонусная программа",
"chargeRate": 1
}
}`
}
func getLoyaltiesResponse() string {
return `{
"success": true,
"pagination": {
"limit": 20,
"totalCount": 1,
"currentPage": 1,
"totalPageCount": 1
},
"loyalties": [
{
"levels": [
{
"type": "bonus_percent",
"id": 5,
"name": "Новичок",
"sum": 0,
"privilegeSize": 5,
"privilegeSizePromo": 3
},
{
"type": "bonus_percent",
"id": 6,
"name": "Любитель",
"sum": 10000,
"privilegeSize": 10,
"privilegeSizePromo": 5
},
{
"type": "bonus_percent",
"id": 7,
"name": "Продвинутый покупатель",
"sum": 25000,
"privilegeSize": 15,
"privilegeSizePromo": 7
},
{
"type": "bonus_percent",
"id": 8,
"name": "Мастер шоппинга",
"sum": 50000,
"privilegeSize": 20,
"privilegeSizePromo": 10
}
],
"active": true,
"blocked": false,
"id": 2,
"name": "Бонусная программа",
"confirmSmsCharge": false,
"confirmSmsRegistration": false,
"createdAt": "2022-01-18 15:40:22",
"activatedAt": "2022-12-08 12:05:45"
}
]
}`
}
func getLoyaltyResponse() string {
return `{
"success": true,
"loyalty": {
"levels": [
{
"type": "bonus_percent",
"id": 5,
"name": "Новичок",
"sum": 0,
"privilegeSize": 5,
"privilegeSizePromo": 3
},
{
"type": "bonus_percent",
"id": 6,
"name": "Любитель",
"sum": 10000,
"privilegeSize": 10,
"privilegeSizePromo": 5
},
{
"type": "bonus_percent",
"id": 7,
"name": "Продвинутый покупатель",
"sum": 25000,
"privilegeSize": 15,
"privilegeSizePromo": 7
},
{
"type": "bonus_percent",
"id": 8,
"name": "Мастер шоппинга",
"sum": 50000,
"privilegeSize": 20,
"privilegeSizePromo": 10
}
],
"active": true,
"blocked": false,
"id": 2,
"name": "Бонусная программа",
"confirmSmsCharge": false,
"confirmSmsRegistration": false,
"createdAt": "2022-01-18 15:40:22",
"activatedAt": "2022-12-08 12:05:45"
}
}`
}

307
types.go
View File

@ -328,6 +328,8 @@ type Order struct {
Items []OrderItem `json:"items,omitempty"` Items []OrderItem `json:"items,omitempty"`
CustomFields StringMap `json:"customFields,omitempty"` CustomFields StringMap `json:"customFields,omitempty"`
Payments OrderPayments `json:"payments,omitempty"` Payments OrderPayments `json:"payments,omitempty"`
ApplyRound *bool `json:"applyRound,omitempty"`
PrivilegeType string `json:"privilegeType,omitempty"`
} }
// OrdersStatus type. // OrdersStatus type.
@ -703,6 +705,21 @@ type WorkTime struct {
LunchEndTime string `json:"lunch_end_time"` LunchEndTime string `json:"lunch_end_time"`
} }
type SerializedBaseLoyaltyAccount struct {
PhoneNumber string `json:"phoneNumber,omitempty"`
CardNumber string `json:"cardNumber,omitempty"`
CustomFields []string `json:"customFields,omitempty"`
}
type SerializedCreateLoyaltyAccount struct {
SerializedBaseLoyaltyAccount
Customer SerializedEntityCustomer `json:"customer"`
}
type SerializedEditLoyaltyAccount struct {
SerializedBaseLoyaltyAccount
}
// Settings type. Contains retailCRM configuration. // Settings type. Contains retailCRM configuration.
type Settings struct { type Settings struct {
DefaultCurrency SettingsNode `json:"default_currency"` DefaultCurrency SettingsNode `json:"default_currency"`
@ -758,17 +775,23 @@ type DeliveryService struct {
// DeliveryType type. // DeliveryType type.
type DeliveryType struct { type DeliveryType struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"` Code string `json:"code,omitempty"`
Active bool `json:"active,omitempty"` Active bool `json:"active,omitempty"`
DefaultCost float32 `json:"defaultCost,omitempty"` DefaultCost float32 `json:"defaultCost,omitempty"`
DefaultNetCost float32 `json:"defaultNetCost,omitempty"` DefaultNetCost float32 `json:"defaultNetCost,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
IntegrationCode string `json:"integrationCode,omitempty"` IntegrationCode string `json:"integrationCode,omitempty"`
VatRate string `json:"vatRate,omitempty"` VatRate string `json:"vatRate,omitempty"`
DefaultForCrm bool `json:"defaultForCrm,omitempty"` DefaultForCrm bool `json:"defaultForCrm,omitempty"`
DeliveryServices []string `json:"deliveryServices,omitempty"` DeliveryServices []string `json:"deliveryServices,omitempty"`
PaymentTypes []string `json:"paymentTypes,omitempty"` PaymentTypes []string `json:"paymentTypes,omitempty"` // Deprecated, use DeliveryPaymentTypes
DeliveryPaymentTypes []DeliveryPaymentType `json:"deliveryPaymentTypes,omitempty"`
}
type DeliveryPaymentType struct {
Code string `json:"code"`
Cod bool `json:"cod,omitempty"`
} }
// LegalEntity type. // LegalEntity type.
@ -793,6 +816,11 @@ type LegalEntity struct {
BankAccount string `json:"bankAccount,omitempty"` BankAccount string `json:"bankAccount,omitempty"`
} }
type SerializedEntityCustomer struct {
ID int `json:"id,omitempty"`
ExternalID int `json:"externalId,omitempty"`
}
// OrderMethod type. // OrderMethod type.
type OrderMethod struct { type OrderMethod struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
@ -883,21 +911,24 @@ type StatusGroup struct {
// Site type. // Site type.
type Site struct { type Site struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Code string `json:"code,omitempty"` Code string `json:"code,omitempty"`
URL string `json:"url,omitempty"` URL string `json:"url,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Phones string `json:"phones,omitempty"` Phones string `json:"phones,omitempty"`
Zip string `json:"zip,omitempty"` Zip string `json:"zip,omitempty"`
Address string `json:"address,omitempty"` Address string `json:"address,omitempty"`
CountryIso string `json:"countryIso,omitempty"` CountryIso string `json:"countryIso,omitempty"`
YmlURL string `json:"ymlUrl,omitempty"` YmlURL string `json:"ymlUrl,omitempty"`
LoadFromYml bool `json:"loadFromYml,omitempty"` LoadFromYml bool `json:"loadFromYml,omitempty"`
CatalogUpdatedAt string `json:"catalogUpdatedAt,omitempty"` CatalogUpdatedAt string `json:"catalogUpdatedAt,omitempty"`
CatalogLoadingAt string `json:"catalogLoadingAt,omitempty"` CatalogLoadingAt string `json:"catalogLoadingAt,omitempty"`
Contragent *LegalEntity `json:"contragent,omitempty"` Contragent *LegalEntity `json:"contragent,omitempty"`
DefaultForCRM bool `json:"defaultForCrm,omitempty"` DefaultForCRM bool `json:"defaultForCrm,omitempty"`
Ordering int `json:"ordering,omitempty"` Ordering int `json:"ordering,omitempty"`
IsDemo bool `json:"isDemo,omitempty"`
CatalogID string `json:"catalogId,omitempty"`
IsCatalogMainSite bool `json:"isCatalogMainSite,omitempty"`
} }
// Store type. // Store type.
@ -917,34 +948,65 @@ type Store struct {
// ProductGroup type. // ProductGroup type.
type ProductGroup struct { type ProductGroup struct {
ID int `json:"id,omitempty"` ID int `json:"id,omitempty"`
ParentID int `json:"parentId,omitempty"` ParentID int `json:"parentId,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Site string `json:"site,omitempty"` Site string `json:"site,omitempty"`
Active bool `json:"active,omitempty"` Active bool `json:"active,omitempty"`
Description string `json:"description,omitempty"`
ExternalID string `json:"externalId,omitempty"`
ParentExternalID string `json:"parentExternalId,omitempty"`
}
// BaseProduct type.
type BaseProduct struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
Article string `json:"article,omitempty"`
ExternalID string `json:"externalId,omitempty"`
Manufacturer string `json:"manufacturer,omitempty"`
Description string `json:"description,omitempty"`
Popular bool `json:"popular,omitempty"`
Stock bool `json:"stock,omitempty"`
Novelty bool `json:"novelty,omitempty"`
Recommended bool `json:"recommended,omitempty"`
Active bool `json:"active,omitempty"`
Markable bool `json:"markable,omitempty"`
} }
// Product type. // Product type.
type Product struct { type Product struct {
ID int `json:"id,omitempty"` BaseProduct
MaxPrice float32 `json:"maxPrice,omitempty"` ID int `json:"id,omitempty"`
MinPrice float32 `json:"minPrice,omitempty"` MaxPrice float32 `json:"maxPrice,omitempty"`
Name string `json:"name,omitempty"` MinPrice float32 `json:"minPrice,omitempty"`
URL string `json:"url,omitempty"` ImageURL string `json:"imageUrl,omitempty"`
Article string `json:"article,omitempty"` Quantity float32 `json:"quantity,omitempty"`
ExternalID string `json:"externalId,omitempty"` Offers []Offer `json:"offers,omitempty"`
Manufacturer string `json:"manufacturer,omitempty"` Properties StringMap `json:"properties,omitempty"`
ImageURL string `json:"imageUrl,omitempty"` Groups []ProductGroup `json:"groups,omitempty"`
Description string `json:"description,omitempty"` }
Popular bool `json:"popular,omitempty"`
Stock bool `json:"stock,omitempty"` // ProductEditGroupInput type.
Novelty bool `json:"novelty,omitempty"` type ProductEditGroupInput struct {
Recommended bool `json:"recommended,omitempty"` ID int `json:"id"`
Active bool `json:"active,omitempty"` ExternalID int `json:"externalId,omitempty"`
Quantity float32 `json:"quantity,omitempty"` }
Offers []Offer `json:"offers,omitempty"`
Groups []ProductGroup `json:"groups,omitempty"` // ProductCreate type.
Properties StringMap `json:"properties,omitempty"` type ProductCreate struct {
BaseProduct
Groups []ProductEditGroupInput `json:"groups,omitempty"`
CatalogID int `json:"catalogId,omitempty"`
}
// ProductEdit type.
type ProductEdit struct {
BaseProduct
ID int `json:"id,omitempty"`
CatalogID int `json:"catalogId,omitempty"`
Site string `json:"site,omitempty"`
Groups []ProductEditGroupInput `json:"groups,omitempty"`
} }
// DeliveryHistoryRecord type. // DeliveryHistoryRecord type.
@ -1022,9 +1084,11 @@ type Delivery struct {
// DeliveryStatus type. // DeliveryStatus type.
type DeliveryStatus struct { type DeliveryStatus struct {
Code string `json:"code,omitempty"` Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
IsEditable bool `json:"isEditable,omitempty"` IsEditable bool `json:"isEditable,omitempty"`
IsError bool `json:"isError,omitempty"`
IsPreprocessing bool `json:"isPreprocessing,omitempty"`
} }
// Plate type. // Plate type.
@ -1230,3 +1294,140 @@ type OperationLoyalty struct {
type CursorPagination struct { type CursorPagination struct {
NextCursor string `json:"nextCursor,omitempty"` NextCursor string `json:"nextCursor,omitempty"`
} }
// DeliveryTypeInfo type.
type DeliveryTypeInfo struct {
ID int `json:"id"`
Code string `json:"code"`
}
// LoyaltyAccount type.
type LoyaltyAccount struct {
Active bool `json:"active"`
ID int `json:"id"`
PhoneNumber string `json:"phoneNumber,omitempty"`
CardNumber string `json:"cardNumber,omitempty"`
Amount float64 `json:"amount,omitempty"`
LoyaltyLevel LoyaltyLevel `json:"level,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
ActivatedAt string `json:"activatedAt,omitempty"`
ConfirmedPhoneAt string `json:"confirmedPhoneAt,omitempty"`
LastCheckID int `json:"lastCheckId,omitempty"`
CustomFields []string `json:"customFields,omitempty"`
Loyalty Loyalty `json:"loyalty,omitempty"`
Customer Customer `json:"customer,omitempty"`
Status string `json:"status,omitempty"`
OrderSum float64 `json:"orderSum,omitempty"`
NextLevelSum float64 `json:"nextLevelSum,omitempty"`
}
// Loyalty type.
type Loyalty struct {
ID int `json:"id"`
LoyaltyLevels []LoyaltyLevel `json:"levels,omitempty"`
Active bool `json:"active,omitempty"`
Blocked bool `json:"blocked,omitempty"`
Name string `json:"name,omitempty"`
ConfirmSmsCharge bool `json:"confirmSmsCharge,omitempty"`
ConfirmSmsRegistration bool `json:"confirmSmsRegistration,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
ActivatedAt string `json:"activatedAt,omitempty"`
DeactivatedAt string `json:"deactivatedAt,omitempty"`
BlockedAt string `json:"blockedAt,omitempty"`
}
// LoyaltyLevel type.
type LoyaltyLevel struct {
ID int `json:"id"`
Name string `json:"name"`
Type string `json:"type,omitempty"`
Sum float64 `json:"sum,omitempty"`
PrivilegeSize float64 `json:"privilegeSize,omitempty"`
PrivilegeSizePromo float64 `json:"privilegeSizePromo,omitempty"`
}
type SmsVerification struct {
CreatedAt string `json:"createdAt"`
ExpiredAt string `json:"expiredAt"`
VerifiedAt string `json:"verifiedAt"`
CheckID string `json:"checkId"`
ActionType string `json:"actionType"`
}
type LoyaltyBonus struct {
Amount float32 `json:"amount"`
ActivationDate string `json:"activationDate"`
ExpiredDate string `json:"expiredDate,omitempty"`
}
type BonusDetail struct {
Date string `json:"date"`
Amount float32 `json:"amount"`
}
type SerializedLoyaltyOrder struct {
BonusesCreditTotal float32 `json:"bonusesCreditTotal,omitempty"`
BonusesChargeTotal float32 `json:"bonusesChargeTotal,omitempty"`
PrivilegeType string `json:"privilegeType,omitempty"`
TotalSumm float64 `json:"totalSumm,omitempty"`
PersonalDiscountPercent float32 `json:"personalDiscountPercent,omitempty"`
LoyaltyAccount LoyaltyAccount `json:"loyaltyAccount"`
LoyaltyEventDiscount LoyaltyEventDiscount `json:"loyaltyEventDiscount,omitempty"`
Customer Customer `json:"customer"`
Delivery Delivery `json:"delivery,omitempty"`
Site string `json:"site,omitempty"`
Items []LoyaltyItems `json:"items,omitempty"`
}
type LoyaltyEventDiscount struct {
ID int `json:"id"`
}
type LoyaltyItems struct {
BonusesChargeTotal float32 `json:"bonusesChargeTotal,omitempty"`
BonusesCreditTotal float32 `json:"bonusesCreditTotal,omitempty"`
ID int `json:"id,omitempty"`
ExternalIds []CodeValueModel `json:"externalIds,omitempty"`
PriceType PriceType `json:"priceType,omitempty"`
InitialPrice float32 `json:"initialPrice,omitempty"`
Discounts []AbstractDiscount `json:"discounts,omitempty"`
Prices []OrderProductPriceItem `json:"prices,omitempty"`
VatRate string `json:"vatRate,omitempty"`
CreatedAt string `json:"createdAt"`
Quantity float32 `json:"quantity"`
Offer Offer `json:"offer,omitempty"`
}
type CodeValueModel struct {
Code string `json:"code"`
Value string `json:"value,omitempty"`
}
type AbstractDiscount struct {
Type string `json:"type"`
Amount float32 `json:"amount"`
}
type OrderProductPriceItem struct {
Price float64 `json:"price"`
Quantity float32 `json:"quantity"`
}
type LoyaltyCalculation struct {
PrivilegeType string `json:"privilegeType"`
Discount float32 `json:"discount"`
CreditBonuses float32 `json:"creditBonuses"`
LoyaltyEventDiscount LoyaltyEventDiscount `json:"loyaltyEventDiscount,omitempty"`
MaxChargeBonuses float32 `json:"maxChargeBonuses,omitempty"`
Maximum *bool `json:"maximum,omitempty"`
Loyalty SerializedLoyalty `json:"loyalty,omitempty"`
}
type SerializedLoyalty struct {
Name string `json:"name"`
ChargeRate float32 `json:"chargeRate"`
}
type ExternalID struct {
ExternalID string `json:"externalId,omitempty"`
}