mirror of
https://github.com/retailcrm/api-client-go.git
synced 2025-04-07 19:12:00 +00:00
Compare commits
No commits in common. "master" and "v2.0.12" have entirely different histories.
15 changed files with 1407 additions and 6761 deletions
25
.github/workflows/ci.yml
vendored
25
.github/workflows/ci.yml
vendored
|
@ -20,10 +20,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Set up Go 1.23
|
- name: Set up Go 1.17
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '1.23'
|
go-version: '1.17'
|
||||||
- name: Get dependencies
|
- name: Get dependencies
|
||||||
run: |
|
run: |
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
@ -31,22 +31,21 @@ jobs:
|
||||||
- name: Lint code with golangci-lint
|
- name: Lint code with golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v3
|
uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
version: v1.62.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
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: ['1.19', '1.20', '1.21', '1.22', '1.23', 'stable']
|
go-version: ['1.13', '1.14', '1.15', '1.16', '1.17']
|
||||||
include:
|
include:
|
||||||
- go-version: '1.23'
|
- go-version: '1.17'
|
||||||
coverage: 1
|
coverage: 1
|
||||||
steps:
|
steps:
|
||||||
- name: Set up Go ${{ matrix.go-version }}
|
- name: Set up Go ${{ matrix.go-version }}
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go-version }}
|
go-version: ${{ matrix.go-version }}
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
|
@ -59,21 +58,17 @@ jobs:
|
||||||
env:
|
env:
|
||||||
COVERAGE: ${{ matrix.coverage }}
|
COVERAGE: ${{ matrix.coverage }}
|
||||||
if: env.COVERAGE != 1
|
if: env.COVERAGE != 1
|
||||||
run: |
|
run: go test ./...
|
||||||
go install gotest.tools/gotestsum@latest
|
|
||||||
gotestsum --format testdox ./... -tags=testutils -v -cpu 2 -timeout 60s -race
|
|
||||||
- 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 install gotest.tools/gotestsum@latest
|
go test ./... -race -coverprofile=coverage.txt -covermode=atomic "$d"
|
||||||
gotestsum --format testdox ./... -tags=testutils -v -cpu 2 -timeout 60s -race -cover -coverprofile=coverage.txt -covermode=atomic "$d"
|
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
env:
|
env:
|
||||||
COVERAGE: ${{ matrix.coverage }}
|
COVERAGE: ${{ matrix.coverage }}
|
||||||
if: env.COVERAGE == 1
|
if: env.COVERAGE == 1
|
||||||
run: |
|
run: |
|
||||||
go install github.com/axw/gocov/gocov@latest
|
|
||||||
gocov convert ./coverage.txt | gocov report
|
|
||||||
bash <(curl -s https://codecov.io/bash)
|
bash <(curl -s https://codecov.io/bash)
|
||||||
|
rm coverage.txt
|
||||||
|
|
103
.golangci.yml
103
.golangci.yml
|
@ -2,69 +2,29 @@ run:
|
||||||
skip-dirs-use-default: true
|
skip-dirs-use-default: true
|
||||||
allow-parallel-runners: true
|
allow-parallel-runners: true
|
||||||
|
|
||||||
issues:
|
|
||||||
exclude-files:
|
|
||||||
- testutils.go
|
|
||||||
exclude-rules:
|
|
||||||
- path: _test\.go
|
|
||||||
linters:
|
|
||||||
- lll
|
|
||||||
- errcheck
|
|
||||||
- misspell
|
|
||||||
- ineffassign
|
|
||||||
- whitespace
|
|
||||||
- makezero
|
|
||||||
- errcheck
|
|
||||||
- funlen
|
|
||||||
- goconst
|
|
||||||
- gocognit
|
|
||||||
- gocyclo
|
|
||||||
- godot
|
|
||||||
- unused
|
|
||||||
- errchkjson
|
|
||||||
- varnamelen
|
|
||||||
exclude-use-default: true
|
|
||||||
exclude-case-sensitive: false
|
|
||||||
max-issues-per-linter: 0
|
|
||||||
max-same-issues: 0
|
|
||||||
fix: true
|
|
||||||
|
|
||||||
output:
|
output:
|
||||||
formats:
|
format: colored-line-number
|
||||||
- format: colored-line-number
|
|
||||||
sort-results: true
|
sort-results: true
|
||||||
|
|
||||||
# Linters below do not support go1.18 yet because of generics.
|
|
||||||
# See https://github.com/golangci/golangci-lint/issues/2649
|
|
||||||
# - bodyclose
|
|
||||||
# - sqlclosecheck
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
enable:
|
enable:
|
||||||
- asciicheck
|
- deadcode
|
||||||
- asasalint
|
|
||||||
- varnamelen
|
|
||||||
- reassign
|
|
||||||
- nilnil
|
|
||||||
- nilerr
|
|
||||||
- nakedret
|
|
||||||
- goprintffuncname
|
|
||||||
- typecheck
|
|
||||||
- errchkjson
|
|
||||||
- errcheck
|
- errcheck
|
||||||
- gosimple
|
- gosimple
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- staticcheck
|
- staticcheck
|
||||||
|
- structcheck
|
||||||
- unused
|
- unused
|
||||||
- unparam
|
- unparam
|
||||||
|
- varcheck
|
||||||
|
- bodyclose
|
||||||
- dogsled
|
- dogsled
|
||||||
- dupl
|
- dupl
|
||||||
- errorlint
|
- errorlint
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- exportloopref
|
- exportloopref
|
||||||
- copyloopvar
|
|
||||||
- funlen
|
- funlen
|
||||||
- gocognit
|
- gocognit
|
||||||
- goconst
|
- goconst
|
||||||
|
@ -73,13 +33,16 @@ linters:
|
||||||
- godot
|
- godot
|
||||||
- goimports
|
- goimports
|
||||||
- revive
|
- revive
|
||||||
|
- gomnd
|
||||||
- gosec
|
- gosec
|
||||||
|
- ifshort
|
||||||
- lll
|
- lll
|
||||||
- makezero
|
- makezero
|
||||||
- misspell
|
- misspell
|
||||||
- nestif
|
- nestif
|
||||||
- prealloc
|
- prealloc
|
||||||
- predeclared
|
- predeclared
|
||||||
|
- sqlclosecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- whitespace
|
- whitespace
|
||||||
|
|
||||||
|
@ -90,7 +53,6 @@ linters-settings:
|
||||||
enable:
|
enable:
|
||||||
- assign
|
- assign
|
||||||
- atomic
|
- atomic
|
||||||
- atomicalign
|
|
||||||
- bools
|
- bools
|
||||||
- buildtag
|
- buildtag
|
||||||
- copylocks
|
- copylocks
|
||||||
|
@ -105,6 +67,7 @@ linters-settings:
|
||||||
- unmarshal
|
- unmarshal
|
||||||
- unreachable
|
- unreachable
|
||||||
- unsafeptr
|
- unsafeptr
|
||||||
|
- unused
|
||||||
settings:
|
settings:
|
||||||
printf:
|
printf:
|
||||||
funcs:
|
funcs:
|
||||||
|
@ -172,13 +135,11 @@ linters-settings:
|
||||||
threshold: 200
|
threshold: 200
|
||||||
errorlint:
|
errorlint:
|
||||||
errorf: true
|
errorf: true
|
||||||
asserts: false
|
|
||||||
comparison: false
|
|
||||||
exhaustive:
|
exhaustive:
|
||||||
check-generated: false
|
check-generated: false
|
||||||
default-signifies-exhaustive: false
|
default-signifies-exhaustive: false
|
||||||
funlen:
|
funlen:
|
||||||
lines: 90
|
lines: 60
|
||||||
statements: 40
|
statements: 40
|
||||||
gocognit:
|
gocognit:
|
||||||
min-complexity: 25
|
min-complexity: 25
|
||||||
|
@ -188,6 +149,8 @@ linters-settings:
|
||||||
local-prefixes: github.com/retailcrm/api-client-go/v2
|
local-prefixes: github.com/retailcrm/api-client-go/v2
|
||||||
lll:
|
lll:
|
||||||
line-length: 160
|
line-length: 160
|
||||||
|
maligned:
|
||||||
|
suggest-new: true
|
||||||
misspell:
|
misspell:
|
||||||
locale: US
|
locale: US
|
||||||
nestif:
|
nestif:
|
||||||
|
@ -195,19 +158,41 @@ linters-settings:
|
||||||
whitespace:
|
whitespace:
|
||||||
multi-if: false
|
multi-if: false
|
||||||
multi-func: false
|
multi-func: false
|
||||||
varnamelen:
|
|
||||||
max-distance: 10
|
issues:
|
||||||
ignore-map-index-ok: true
|
exclude-rules:
|
||||||
ignore-type-assert-ok: true
|
- path: _test\.go
|
||||||
ignore-chan-recv-ok: true
|
linters:
|
||||||
ignore-decls:
|
- gomnd
|
||||||
- t *testing.T
|
- lll
|
||||||
- e error
|
- bodyclose
|
||||||
- i int
|
- errcheck
|
||||||
|
- sqlclosecheck
|
||||||
|
- misspell
|
||||||
|
- ineffassign
|
||||||
|
- whitespace
|
||||||
|
- makezero
|
||||||
|
- maligned
|
||||||
|
- ifshort
|
||||||
|
- errcheck
|
||||||
|
- funlen
|
||||||
|
- goconst
|
||||||
|
- gocognit
|
||||||
|
- gocyclo
|
||||||
|
- godot
|
||||||
|
- gocritic
|
||||||
|
- gosec
|
||||||
|
- staticcheck
|
||||||
|
- unused
|
||||||
|
exclude-use-default: true
|
||||||
|
exclude-case-sensitive: false
|
||||||
|
max-issues-per-linter: 0
|
||||||
|
max-same-issues: 0
|
||||||
|
fix: true
|
||||||
|
|
||||||
severity:
|
severity:
|
||||||
default-severity: error
|
default-severity: error
|
||||||
case-sensitive: false
|
case-sensitive: false
|
||||||
|
|
||||||
service:
|
service:
|
||||||
golangci-lint-version: 1.62.x
|
golangci-lint-version: 1.36.x
|
||||||
|
|
2139
client_test.go
2139
client_test.go
File diff suppressed because it is too large
Load diff
8
enum.go
8
enum.go
|
@ -1,8 +0,0 @@
|
||||||
package retailcrm
|
|
||||||
|
|
||||||
var UserGroupSuperadmins UserGroupType = "superadmins"
|
|
||||||
|
|
||||||
var (
|
|
||||||
NotificationTypeError NotificationType = "api.error"
|
|
||||||
NotificationTypeInfo NotificationType = "api.info"
|
|
||||||
)
|
|
2
error.go
2
error.go
|
@ -9,8 +9,6 @@ import (
|
||||||
|
|
||||||
var missingParameterMatcher = regexp.MustCompile(`^Parameter \'([\w\]\[\_\-]+)\' is missing$`)
|
var missingParameterMatcher = regexp.MustCompile(`^Parameter \'([\w\]\[\_\-]+)\' is missing$`)
|
||||||
var (
|
var (
|
||||||
// ErrRateLimited will be returned if request was rate limited.
|
|
||||||
ErrRateLimited = NewAPIError("rate limit exceeded")
|
|
||||||
// ErrMissingCredentials will be returned if no API key was provided to the API.
|
// ErrMissingCredentials will be returned if no API key was provided to the API.
|
||||||
ErrMissingCredentials = NewAPIError(`apiKey is missing`)
|
ErrMissingCredentials = NewAPIError(`apiKey is missing`)
|
||||||
// ErrInvalidCredentials will be returned if provided API key is invalid.
|
// ErrInvalidCredentials will be returned if provided API key is invalid.
|
||||||
|
|
82
filters.go
82
filters.go
|
@ -199,7 +199,6 @@ type OrdersFilter struct {
|
||||||
PaymentStatuses []string `url:"paymentStatuses,omitempty,brackets"`
|
PaymentStatuses []string `url:"paymentStatuses,omitempty,brackets"`
|
||||||
PaymentTypes []string `url:"paymentTypes,omitempty,brackets"`
|
PaymentTypes []string `url:"paymentTypes,omitempty,brackets"`
|
||||||
DeliveryTypes []string `url:"deliveryTypes,omitempty,brackets"`
|
DeliveryTypes []string `url:"deliveryTypes,omitempty,brackets"`
|
||||||
DeliveryServices []string `url:"deliveryServices,omitempty,brackets"`
|
|
||||||
OrderMethods []string `url:"orderMethods,omitempty,brackets"`
|
OrderMethods []string `url:"orderMethods,omitempty,brackets"`
|
||||||
ShipmentStores []string `url:"shipmentStores,omitempty,brackets"`
|
ShipmentStores []string `url:"shipmentStores,omitempty,brackets"`
|
||||||
Couriers []string `url:"couriers,omitempty,brackets"`
|
Couriers []string `url:"couriers,omitempty,brackets"`
|
||||||
|
@ -208,8 +207,6 @@ type OrdersFilter struct {
|
||||||
Sites []string `url:"sites,omitempty,brackets"`
|
Sites []string `url:"sites,omitempty,brackets"`
|
||||||
CreatedAtFrom string `url:"createdAtFrom,omitempty"`
|
CreatedAtFrom string `url:"createdAtFrom,omitempty"`
|
||||||
CreatedAtTo string `url:"createdAtTo,omitempty"`
|
CreatedAtTo string `url:"createdAtTo,omitempty"`
|
||||||
PaidAtFrom string `url:"paidAtFrom,omitempty"`
|
|
||||||
PaidAtTo string `url:"paidAtTo,omitempty"`
|
|
||||||
FullPaidAtFrom string `url:"fullPaidAtFrom,omitempty"`
|
FullPaidAtFrom string `url:"fullPaidAtFrom,omitempty"`
|
||||||
FullPaidAtTo string `url:"fullPaidAtTo,omitempty"`
|
FullPaidAtTo string `url:"fullPaidAtTo,omitempty"`
|
||||||
DeliveryDateFrom string `url:"deliveryDateFrom,omitempty"`
|
DeliveryDateFrom string `url:"deliveryDateFrom,omitempty"`
|
||||||
|
@ -352,7 +349,6 @@ type ProductsFilter struct {
|
||||||
ExternalID string `url:"externalId,omitempty"`
|
ExternalID string `url:"externalId,omitempty"`
|
||||||
Manufacturer string `url:"manufacturer,omitempty"`
|
Manufacturer string `url:"manufacturer,omitempty"`
|
||||||
URL string `url:"url,omitempty"`
|
URL string `url:"url,omitempty"`
|
||||||
URLLike string `url:"urlLike,omitempty"`
|
|
||||||
PriceType string `url:"priceType,omitempty"`
|
PriceType string `url:"priceType,omitempty"`
|
||||||
OfferExternalID string `url:"offerExternalId,omitempty"`
|
OfferExternalID string `url:"offerExternalId,omitempty"`
|
||||||
Sites []string `url:"sites,omitempty,brackets"`
|
Sites []string `url:"sites,omitempty,brackets"`
|
||||||
|
@ -381,22 +377,22 @@ type ShipmentFilter struct {
|
||||||
|
|
||||||
// CostsFilter type.
|
// CostsFilter type.
|
||||||
type CostsFilter struct {
|
type CostsFilter struct {
|
||||||
MinSumm int `url:"minSumm,omitempty"`
|
MinSumm string `url:"minSumm,omitempty"`
|
||||||
MaxSumm int `url:"maxSumm,omitempty"`
|
MaxSumm string `url:"maxSumm,omitempty"`
|
||||||
OrderNumber string `url:"orderNumber,omitempty"`
|
OrderNumber string `url:"orderNumber,omitempty"`
|
||||||
Comment string `url:"orderNumber,omitempty"`
|
Comment string `url:"orderNumber,omitempty"`
|
||||||
IDs []int `url:"ids,omitempty,brackets"`
|
Ids []string `url:"ids,omitempty,brackets"`
|
||||||
Sites []string `url:"sites,omitempty,brackets"`
|
Sites []string `url:"sites,omitempty,brackets"`
|
||||||
CreatedBy []int `url:"createdBy,omitempty,brackets"`
|
CreatedBy []string `url:"createdBy,omitempty,brackets"`
|
||||||
CostGroups []string `url:"costGroups,omitempty,brackets"`
|
CostGroups []string `url:"costGroups,omitempty,brackets"`
|
||||||
CostItems []string `url:"costItems,omitempty,brackets"`
|
CostItems []string `url:"costItems,omitempty,brackets"`
|
||||||
Users []int `url:"users,omitempty,brackets"`
|
Users []string `url:"users,omitempty,brackets"`
|
||||||
DateFrom string `url:"dateFrom,omitempty"`
|
DateFrom string `url:"dateFrom,omitempty"`
|
||||||
DateTo string `url:"dateTo,omitempty"`
|
DateTo string `url:"dateTo,omitempty"`
|
||||||
CreatedAtFrom string `url:"createdAtFrom,omitempty"`
|
CreatedAtFrom string `url:"createdAtFrom,omitempty"`
|
||||||
CreatedAtTo string `url:"createdAtTo,omitempty"`
|
CreatedAtTo string `url:"createdAtTo,omitempty"`
|
||||||
OrderIDs []int `url:"orderIds,omitempty,brackets"`
|
OrderIds []string `url:"orderIds,omitempty,brackets"`
|
||||||
OrderExternalIDs []string `url:"orderExternalIds,omitempty,brackets"`
|
OrderExternalIds []string `url:"orderIds,omitempty,brackets"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FilesFilter type.
|
// FilesFilter type.
|
||||||
|
@ -431,67 +427,3 @@ type CustomDictionariesFilter struct {
|
||||||
Name string `url:"name,omitempty"`
|
Name string `url:"name,omitempty"`
|
||||||
Code string `url:"code,omitempty"`
|
Code string `url:"code,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BonusOperationsFilter type.
|
|
||||||
type BonusOperationsFilter struct {
|
|
||||||
Loyalties []int `url:"loyalties,omitempty,brackets"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AccountBonusOperationsFilter struct {
|
|
||||||
CreatedAtFrom string `url:"createdAtFrom,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:"minOrdersSum,omitempty"`
|
|
||||||
MaxOrderSum string `url:"maxOrdersSum,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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OffersFilter struct {
|
|
||||||
Ids []int `url:"ids,omitempty,brackets"`
|
|
||||||
Active *int `url:"active,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SiteFilter struct {
|
|
||||||
// SiteBy contains information about what is betrayed site id or site code.
|
|
||||||
// id|code, default is code.
|
|
||||||
SiteBy string `url:"siteBy,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetCartFilter struct {
|
|
||||||
// SiteBy contains information about what is betrayed site id or site code.
|
|
||||||
// id|code, default is code.
|
|
||||||
SiteBy string `url:"siteBy,omitempty"`
|
|
||||||
// By contains information about what is betrayed: customer id or customer externalId.
|
|
||||||
// id|externalId, default is externalId.
|
|
||||||
By string `url:"by,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
|
@ -58,30 +58,6 @@ func (l *StringMap) UnmarshalJSON(data []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *CustomFieldMap) UnmarshalJSON(data []byte) error {
|
|
||||||
var i interface{}
|
|
||||||
var items CustomFieldMap
|
|
||||||
if err := json.Unmarshal(data, &i); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
switch e := i.(type) {
|
|
||||||
case map[string]interface{}:
|
|
||||||
items = make(CustomFieldMap, len(e))
|
|
||||||
for idx, val := range e {
|
|
||||||
items[idx] = val
|
|
||||||
}
|
|
||||||
case []interface{}:
|
|
||||||
items = make(CustomFieldMap, len(e))
|
|
||||||
for idx, val := range e {
|
|
||||||
items[strconv.Itoa(idx)] = val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*l = items
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *OrderPayments) UnmarshalJSON(data []byte) error {
|
func (p *OrderPayments) UnmarshalJSON(data []byte) error {
|
||||||
var i interface{}
|
var i interface{}
|
||||||
var m OrderPayments
|
var m OrderPayments
|
||||||
|
|
|
@ -44,7 +44,7 @@ func TestAPIErrorsList_UnmarshalJSON(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCustomFieldsList_UnmarshalJSON(t *testing.T) {
|
func TestCustomFieldsList_UnmarshalJSON(t *testing.T) {
|
||||||
var list CustomFieldMap
|
var list StringMap
|
||||||
|
|
||||||
require.NoError(t, json.Unmarshal([]byte(`["first", "second"]`), &list))
|
require.NoError(t, json.Unmarshal([]byte(`["first", "second"]`), &list))
|
||||||
assert.Len(t, list, 2)
|
assert.Len(t, list, 2)
|
||||||
|
@ -56,13 +56,6 @@ func TestCustomFieldsList_UnmarshalJSON(t *testing.T) {
|
||||||
assert.Equal(t, list["a"], "first")
|
assert.Equal(t, list["a"], "first")
|
||||||
assert.Equal(t, list["b"], "second")
|
assert.Equal(t, list["b"], "second")
|
||||||
|
|
||||||
require.NoError(t, json.Unmarshal([]byte(`{"a": ["first", "second"], "b": "second"}`), &list))
|
|
||||||
assert.Len(t, list, 2)
|
|
||||||
assert.Len(t, list["a"].([]interface{}), 2)
|
|
||||||
assert.Equal(t, list["a"].([]interface{})[0], "first")
|
|
||||||
assert.Equal(t, list["a"].([]interface{})[1], "second")
|
|
||||||
assert.Equal(t, list["b"], "second")
|
|
||||||
|
|
||||||
require.NoError(t, json.Unmarshal([]byte(`[]`), &list))
|
require.NoError(t, json.Unmarshal([]byte(`[]`), &list))
|
||||||
assert.Len(t, list, 0)
|
assert.Len(t, list, 0)
|
||||||
}
|
}
|
||||||
|
|
77
request.go
77
request.go
|
@ -194,22 +194,6 @@ type DeliveryShipmentsRequest struct {
|
||||||
Page int `url:"page,omitempty"`
|
Page int `url:"page,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearCartRequest type.
|
|
||||||
type ClearCartRequest struct {
|
|
||||||
ClearedAt string `url:"clearedAt,omitempty"`
|
|
||||||
Customer CartCustomer `url:"customer,omitempty"`
|
|
||||||
Order ClearCartOrder `url:"order,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetCartRequest type.
|
|
||||||
type SetCartRequest struct {
|
|
||||||
ExternalID string `url:"externalId,omitempty"`
|
|
||||||
DroppedAt string `url:"droppedAt,omitempty"`
|
|
||||||
Link string `url:"link,omitempty"`
|
|
||||||
Customer CartCustomer `url:"customer,omitempty"`
|
|
||||||
Items []SetCartItem `url:"items,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CostsRequest type.
|
// CostsRequest type.
|
||||||
type CostsRequest struct {
|
type CostsRequest struct {
|
||||||
Filter CostsFilter `url:"filter,omitempty"`
|
Filter CostsFilter `url:"filter,omitempty"`
|
||||||
|
@ -248,63 +232,6 @@ type ConnectRequest struct {
|
||||||
URL string `json:"systemUrl"`
|
URL string `json:"systemUrl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BonusOperationsRequest type.
|
|
||||||
type BonusOperationsRequest struct {
|
|
||||||
Filter BonusOperationsFilter `url:"filter,omitempty"`
|
|
||||||
Limit int `url:"limit,omitempty"`
|
|
||||||
Cursor string `url:"cursor,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountBonusOperationsRequest type.
|
|
||||||
type AccountBonusOperationsRequest struct {
|
|
||||||
Filter AccountBonusOperationsFilter `url:"filter,omitempty"`
|
|
||||||
Limit int `url:"limit,omitempty"`
|
|
||||||
Page int `url:"page,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type LoyaltyBonusCreditRequest struct {
|
|
||||||
Amount float64 `url:"amount"`
|
|
||||||
ActivationDate string `url:"activationDate,omitempty"`
|
|
||||||
ExpiredDate string `url:"expireDate,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:"page,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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NotificationsSendRequest struct {
|
|
||||||
UserGroups []UserGroupType `json:"userGroups,omitempty"`
|
|
||||||
Type NotificationType `json:"type"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
UserIDs []string `json:"userIds,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type EditMGChannelTemplateRequest struct {
|
|
||||||
Templates []MGChannelTemplate `json:"templates"`
|
|
||||||
Removed []int `json:"removed"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 == "" {
|
||||||
|
@ -326,7 +253,3 @@ func (r ConnectRequest) Verify(secret string) bool {
|
||||||
}
|
}
|
||||||
return hmac.Equal([]byte(r.Token), []byte(hex.EncodeToString(mac.Sum(nil))))
|
return hmac.Equal([]byte(r.Token), []byte(hex.EncodeToString(mac.Sum(nil))))
|
||||||
}
|
}
|
||||||
|
|
||||||
type OffersRequest struct {
|
|
||||||
OffersFilter `url:"filter,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
153
response.go
153
response.go
|
@ -5,17 +5,6 @@ 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"`
|
||||||
|
@ -123,7 +112,6 @@ 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.
|
||||||
|
@ -168,7 +156,6 @@ 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.
|
||||||
|
@ -383,23 +370,6 @@ 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"`
|
||||||
|
@ -407,12 +377,6 @@ type ProductsPropertiesResponse struct {
|
||||||
Properties []Property `json:"properties,omitempty"`
|
Properties []Property `json:"properties,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CartResponse type.
|
|
||||||
type CartResponse struct {
|
|
||||||
SuccessfulResponse
|
|
||||||
Cart Cart `json:"cart"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeliveryShipmentsResponse type.
|
// DeliveryShipmentsResponse type.
|
||||||
type DeliveryShipmentsResponse struct {
|
type DeliveryShipmentsResponse struct {
|
||||||
Success bool `json:"success"`
|
Success bool `json:"success"`
|
||||||
|
@ -453,10 +417,9 @@ 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 {
|
||||||
|
@ -587,113 +550,3 @@ func NewConnectResponse(accountURL string) ConnectResponse {
|
||||||
AccountURL: accountURL,
|
AccountURL: accountURL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BonusOperationsResponse type.
|
|
||||||
type BonusOperationsResponse struct {
|
|
||||||
Success bool `json:"success"`
|
|
||||||
Pagination *CursorPagination `json:"pagination,omitempty"`
|
|
||||||
BonusOperations []BonusOperation `json:"bonusOperations,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AccountBonusOperationsResponse type.
|
|
||||||
type AccountBonusOperationsResponse struct {
|
|
||||||
Success bool `json:"success"`
|
|
||||||
Pagination *Pagination `json:"pagination,omitempty"`
|
|
||||||
BonusOperations []BonusOperation `json:"bonusOperations,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClientIDResponse type.
|
|
||||||
type ClientIDResponse struct {
|
|
||||||
ErrorMsg string `json:"errorMsg,omitempty"`
|
|
||||||
Errors map[string]string `json:"errors,omitempty"`
|
|
||||||
FailedClientIds []ClientID `json:"failed_client_ids,omitempty"`
|
|
||||||
Success bool `json:"success"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// SourcesResponse type.
|
|
||||||
type SourcesResponse struct {
|
|
||||||
ErrorMsg string `json:"errorMsg,omitempty"`
|
|
||||||
Errors map[string]string `json:"errors,omitempty"`
|
|
||||||
FailedSources []Source `json:"failed_sources,omitempty"`
|
|
||||||
Success bool `json:"success"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CurrencyResponse type.
|
|
||||||
type CurrencyResponse struct {
|
|
||||||
Currencies []Currency `json:"currencies,omitempty"`
|
|
||||||
Success bool `json:"success"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CurrencyCreateResponse type.
|
|
||||||
type CurrencyCreateResponse struct {
|
|
||||||
Success bool `json:"success"`
|
|
||||||
ID int `json:"id,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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MGChannelTemplatesResponse struct {
|
|
||||||
Pagination *Pagination `json:"pagination"`
|
|
||||||
Templates []MGChannelTemplate `json:"templates"`
|
|
||||||
SuccessfulResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
type StoreOffersResponse struct {
|
|
||||||
Pagination *Pagination `json:"pagination"`
|
|
||||||
SuccessfulResponse
|
|
||||||
Offers []Offer `json:"offers,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package retailcrm
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SystemTime time.Time
|
|
||||||
|
|
||||||
const systemTimeLayout = "2006-01-02 15:04:05"
|
|
||||||
|
|
||||||
// UnmarshalJSON parses time.Time from system format.
|
|
||||||
func (st *SystemTime) UnmarshalJSON(b []byte) (err error) {
|
|
||||||
s := strings.Trim(string(b), `"`)
|
|
||||||
nt, err := time.Parse(systemTimeLayout, s)
|
|
||||||
*st = SystemTime(nt)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON will marshal time.Time to system format.
|
|
||||||
func (st SystemTime) MarshalJSON() ([]byte, error) {
|
|
||||||
return []byte(st.String()), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// String returns the time in the custom format.
|
|
||||||
func (st *SystemTime) String() string {
|
|
||||||
t := time.Time(*st)
|
|
||||||
return fmt.Sprintf("%q", t.Format(systemTimeLayout))
|
|
||||||
}
|
|
122
template.go
122
template.go
|
@ -1,122 +0,0 @@
|
||||||
package retailcrm
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// TemplateItemTypeText is a type for text chunk in template.
|
|
||||||
TemplateItemTypeText uint8 = iota
|
|
||||||
// TemplateItemTypeVar is a type for variable in template.
|
|
||||||
TemplateItemTypeVar
|
|
||||||
QuickReply ButtonType = "QUICK_REPLY"
|
|
||||||
PhoneNumber ButtonType = "PHONE_NUMBER"
|
|
||||||
URL ButtonType = "URL"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// TemplateVarCustom is a custom variable type.
|
|
||||||
TemplateVarCustom = "custom"
|
|
||||||
// TemplateVarName is a name variable type.
|
|
||||||
TemplateVarName = "name"
|
|
||||||
// TemplateVarFirstName is a first name variable type.
|
|
||||||
TemplateVarFirstName = "first_name"
|
|
||||||
// TemplateVarLastName is a last name variable type.
|
|
||||||
TemplateVarLastName = "last_name"
|
|
||||||
)
|
|
||||||
|
|
||||||
// templateVarAssoc for checking variable validity, only for internal use.
|
|
||||||
var templateVarAssoc = map[string]interface{}{
|
|
||||||
TemplateVarCustom: nil,
|
|
||||||
TemplateVarName: nil,
|
|
||||||
TemplateVarFirstName: nil,
|
|
||||||
TemplateVarLastName: nil,
|
|
||||||
}
|
|
||||||
|
|
||||||
type Text struct {
|
|
||||||
Parts []TextTemplateItem `json:"parts"`
|
|
||||||
Example []string `json:"example,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Media struct {
|
|
||||||
Example string `json:"example,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Header struct {
|
|
||||||
Text *Text `json:"text,omitempty"`
|
|
||||||
Document *Media `json:"document,omitempty"`
|
|
||||||
Image *Media `json:"image,omitempty"`
|
|
||||||
Video *Media `json:"video,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type TemplateItemList []TextTemplateItem
|
|
||||||
|
|
||||||
// TextTemplateItem is a part of template.
|
|
||||||
type TextTemplateItem struct {
|
|
||||||
Text string
|
|
||||||
VarType string
|
|
||||||
Type uint8
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON controls how TextTemplateItem will be marshaled into JSON.
|
|
||||||
func (t TextTemplateItem) MarshalJSON() ([]byte, error) {
|
|
||||||
switch t.Type {
|
|
||||||
case TemplateItemTypeText:
|
|
||||||
return json.Marshal(t.Text)
|
|
||||||
case TemplateItemTypeVar:
|
|
||||||
return json.Marshal(map[string]interface{}{
|
|
||||||
"var": t.VarType,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, errors.New("unknown TextTemplateItem type")
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON will correctly unmarshal TextTemplateItem.
|
|
||||||
func (t *TextTemplateItem) UnmarshalJSON(b []byte) error {
|
|
||||||
var obj interface{}
|
|
||||||
err := json.Unmarshal(b, &obj)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
switch bodyPart := obj.(type) {
|
|
||||||
case string:
|
|
||||||
t.Type = TemplateItemTypeText
|
|
||||||
t.Text = bodyPart
|
|
||||||
case map[string]interface{}:
|
|
||||||
// {} case
|
|
||||||
if len(bodyPart) == 0 {
|
|
||||||
t.Type = TemplateItemTypeText
|
|
||||||
t.Text = "{}"
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if varTypeCurr, ok := bodyPart["var"].(string); ok {
|
|
||||||
if _, ok := templateVarAssoc[varTypeCurr]; !ok {
|
|
||||||
return fmt.Errorf("invalid placeholder var '%s'", varTypeCurr)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Type = TemplateItemTypeVar
|
|
||||||
t.VarType = varTypeCurr
|
|
||||||
} else {
|
|
||||||
return errors.New("invalid TextTemplateItem")
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return errors.New("invalid TextTemplateItem")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type ButtonType string
|
|
||||||
|
|
||||||
type Button struct {
|
|
||||||
Type ButtonType `json:"type"`
|
|
||||||
URL string `json:"url,omitempty"`
|
|
||||||
Text string `json:"text,omitempty"`
|
|
||||||
PhoneNumber string `json:"phoneNumber,omitempty"`
|
|
||||||
Example []string `json:"example,omitempty"`
|
|
||||||
}
|
|
565
testutils.go
565
testutils.go
|
@ -1,565 +0,0 @@
|
||||||
//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: []interface{}{"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: map[string]interface{}{
|
|
||||||
"animal": "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: map[string]interface{}{
|
|
||||||
"animal": "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": {
|
|
||||||
"custom_multiselect": ["test1", "test3"],
|
|
||||||
"custom_select": "test2",
|
|
||||||
"custom_integer": 456,
|
|
||||||
"custom_float": 8.43
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
|
|
||||||
func getMGTemplatesResponse() string {
|
|
||||||
return `{
|
|
||||||
"success": true,
|
|
||||||
"pagination": {
|
|
||||||
"limit": 10,
|
|
||||||
"totalCount": 100,
|
|
||||||
"currentPage": 5,
|
|
||||||
"totalPageCount": 10
|
|
||||||
},
|
|
||||||
"templates": [
|
|
||||||
{
|
|
||||||
"id": 1,
|
|
||||||
"externalId": 0,
|
|
||||||
"channel": {
|
|
||||||
"allowedSendByPhone": false,
|
|
||||||
"id": 1,
|
|
||||||
"externalId": 1,
|
|
||||||
"type": "fbmessenger",
|
|
||||||
"active": true,
|
|
||||||
"name": "fbmessenger"
|
|
||||||
},
|
|
||||||
"code": "namespace#NAMEAAA#ru",
|
|
||||||
"name": "NAMEAAA",
|
|
||||||
"active": true,
|
|
||||||
"template": [
|
|
||||||
"Text_0",
|
|
||||||
{
|
|
||||||
"var": "custom"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"templateExample": ["Text_1"],
|
|
||||||
"namespace": "namespace_0",
|
|
||||||
"lang": "en",
|
|
||||||
"category": "test_0",
|
|
||||||
"header": {
|
|
||||||
"text": {
|
|
||||||
"parts": [
|
|
||||||
"JABAAA",
|
|
||||||
{
|
|
||||||
"var": "custom"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"example": [
|
|
||||||
"AAAAAA"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"image": {
|
|
||||||
"example": "https://example.com/file/123.png"
|
|
||||||
},
|
|
||||||
"document": {
|
|
||||||
"example": "https://example.com/file/123.pdf"
|
|
||||||
},
|
|
||||||
"video": {
|
|
||||||
"example": "https://example.com/file/123.mp4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"footer": "footer_0",
|
|
||||||
"buttons": [
|
|
||||||
{
|
|
||||||
"type": "PHONE_NUMBER",
|
|
||||||
"text": "your-phone-button-text",
|
|
||||||
"phoneNumber": "+79895553535"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "QUICK_REPLY",
|
|
||||||
"text": "Yes"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "URL",
|
|
||||||
"url": "https://example.com/file/{{1}}",
|
|
||||||
"text": "button",
|
|
||||||
"example": [
|
|
||||||
"https://www.website.com/dynamic-url-example"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"verificationStatus": "APPROVED"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}`
|
|
||||||
}
|
|
||||||
|
|
||||||
func getMGTemplatesForEdit() string {
|
|
||||||
return `[{"header":{"text":{"parts":["Hello,",{"var":"custom"}],"example":["Henry"]},"document":{"example":"https://example.com/file/123.pdf"},"image":{"example":"https://example.com/file/123.png"},"video":{"example":"https://example.com/file/123.mp4"}},"lang":"en","category":"test_0","code":"namespace#name_0#ru","name":"name_0","namespace":"namespace","footer":"footer_0","verificationStatus":"REJECTED","template":["Text_0",{"var":"custom"}],"buttons":[{"type":"PHONE_NUMBER","text":"your-phone-button-text","phoneNumber":"+79895553535"},{"type":"QUICK_REPLY","text":"Yes"},{"type":"URL","url":"https://example.com/file/{{1}}","text":"button","example":["https://www.website.com/dynamic-url-example"]}],"templateExample":["WIU"],"id":1,"externalId":10,"mgChannelId":110,"active":true}]`
|
|
||||||
}
|
|
||||||
|
|
||||||
func getStoreOfferResponse() string {
|
|
||||||
return `{
|
|
||||||
"success": true,
|
|
||||||
"pagination": {
|
|
||||||
"limit": 20,
|
|
||||||
"totalCount": 1,
|
|
||||||
"currentPage": 1,
|
|
||||||
"totalPageCount": 1
|
|
||||||
},
|
|
||||||
"offers": [
|
|
||||||
{
|
|
||||||
"images": [
|
|
||||||
"https://s3-s1.retailcrm.tech/ru-central1/retailcrm/dev-vega-d32aea7f9a5bc26eba6ad986077cea03/product/65a92fa0bb737-test.jpeg"
|
|
||||||
],
|
|
||||||
"id": 76,
|
|
||||||
"site": "main",
|
|
||||||
"name": "Название\nПеревод строки",
|
|
||||||
"article": "Артикул",
|
|
||||||
"product": {
|
|
||||||
"type": "product",
|
|
||||||
"catalogId": 2,
|
|
||||||
"id": 222
|
|
||||||
},
|
|
||||||
"prices": [
|
|
||||||
{
|
|
||||||
"priceType": "base",
|
|
||||||
"price": 10000,
|
|
||||||
"ordering": 991,
|
|
||||||
"currency": "RUB"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"purchasePrice": 10,
|
|
||||||
"quantity": 5,
|
|
||||||
"active": true,
|
|
||||||
"unit": {
|
|
||||||
"code": "pc",
|
|
||||||
"name": "Штука",
|
|
||||||
"sym": "шт."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}`
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue