Skip to content

Commit

Permalink
fix order entity update
Browse files Browse the repository at this point in the history
  • Loading branch information
Hermsi1337 committed May 10, 2020
1 parent c064f64 commit d4c609a
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 12 deletions.
3 changes: 2 additions & 1 deletion examples/administrator-api/category/create-category/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package main

import (
"fmt"
"log"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/categories"
"log"
)

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package main

import (
"fmt"
"log"
"strconv"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/configurableproducts"
"github.com/hermsi1337/go-magento2/pkg/magento2/products/attribute"
"log"
"strconv"
)

// TODO: FINISH EXAMPLE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package main

import (
"log"
"strconv"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/products/attribute"
"github.com/hermsi1337/go-magento2/pkg/magento2/products/attributeset"
"log"
"strconv"
)

func main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"log"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/products/attributeset"
"log"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion examples/administrator-api/products/create-attribute/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"log"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/products/attribute"
"log"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion examples/administrator-api/products/create-product/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"log"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/products"
"log"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion examples/administrator-api/products/get-product/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"log"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/products"
"log"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion examples/customer-api/place-order/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"log"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/cart"
"log"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion examples/guest-api/place-order/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"log"

"github.com/hermsi1337/go-magento2/pkg/magento2/api"
"github.com/hermsi1337/go-magento2/pkg/magento2/cart"
"log"
)

func main() {
Expand Down
8 changes: 7 additions & 1 deletion pkg/magento2/orders/orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ func GetOrderByIncrementID(id string, apiClient *api.Client) (*MOrder, error) {
}

func (mo *MOrder) UpdateOnRemote() error {
return mo.APIClient.PostRouteAndDecode(Orders, mo.Order, mo.Order, "update order entity on remote")
type updateOrderEntityPayload struct {
Entity Order `json:"entity"`
}

payLoad := updateOrderEntityPayload{Entity: *mo.Order}

return mo.APIClient.PostRouteAndDecode(Orders, payLoad, mo.Order, "update order entity on remote")
}

func (mo *MOrder) UpdateFromRemote() error {
Expand Down

0 comments on commit d4c609a

Please sign in to comment.