mirror of
https://github.com/retailcrm/api-client-go.git
synced 2024-11-25 06:16:03 +03:00
pass parameter 'by' in payment edit method
This commit is contained in:
commit
d105cf9dee
@ -2489,6 +2489,7 @@ func (c *Client) OrderPaymentEdit(payment Payment, by string, site ...string) (S
|
|||||||
paymentJSON, _ := json.Marshal(&payment)
|
paymentJSON, _ := json.Marshal(&payment)
|
||||||
|
|
||||||
p := url.Values{
|
p := url.Values{
|
||||||
|
"by": {context},
|
||||||
"payment": {string(paymentJSON[:])},
|
"payment": {string(paymentJSON[:])},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3238,6 +3238,41 @@ func TestClient_OrderMethods(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestClient_OrderPaymentEdit(t *testing.T) {
|
||||||
|
c := client()
|
||||||
|
payment := Payment{
|
||||||
|
ExternalID: RandomString(8),
|
||||||
|
}
|
||||||
|
|
||||||
|
defer gock.Off()
|
||||||
|
|
||||||
|
jr, _ := json.Marshal(&payment)
|
||||||
|
p := url.Values{
|
||||||
|
"by": {"externalId"},
|
||||||
|
"payment": {string(jr[:])},
|
||||||
|
}
|
||||||
|
|
||||||
|
gock.New(crmURL).
|
||||||
|
Post(fmt.Sprintf("/orders/payments/%s/edit", payment.ExternalID)).
|
||||||
|
MatchType("url").
|
||||||
|
BodyString(p.Encode()).
|
||||||
|
Reply(200).
|
||||||
|
BodyString(`{"success": true}`)
|
||||||
|
|
||||||
|
data, status, err := c.OrderPaymentEdit(payment, "externalId")
|
||||||
|
if err.Error() != "" {
|
||||||
|
t.Errorf("%v", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if status >= http.StatusBadRequest {
|
||||||
|
t.Errorf("%v", err.ApiError())
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.Success != true {
|
||||||
|
t.Errorf("%v", err.ApiError())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestClient_OrderTypes(t *testing.T) {
|
func TestClient_OrderTypes(t *testing.T) {
|
||||||
c := client()
|
c := client()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user