Coder Social home page Coder Social logo

woocommerce-go's People

Contributors

hiscaler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

woocommerce-go's Issues

incorrect structure ProductAttribute

https://github.com/hiscaler/woocommerce-go/blob/main/entity/product_attribute.go
its incorrect. pks check WC api doc http://woocommerce.github.io/woocommerce-rest-api-docs/#product-properties

correct:

package entity

// ProductAttribute product attribute properties
type ProductAttribute struct {
/*
ID int json:"id"
Name string json:"name"
Slug string json:"slug"
Type string json:"type"
OrderBy string json:"order_by"
HasArchives bool json:"has_archives"
*/
ID int json:"id" // Attribute ID.
Name string json:"name" // Attribute name.
Position int json:"position" // Attribute position.
Visible bool json:"visible" // Define if the attribute is visible on the "Additional information" tab in the product's page. Default is false
Variation bool json:"variation" // Define if the attribute can be used as variation. Default is false
Options []string json:"options" // List of available term names of the attribute
}

HTTP not working with get orders when passing array of statues

Hi, i found an issue when querying multiple statuses from get Orders API

package main

import (
	"fmt"
	"os"

	"github.com/hiscaler/woocommerce-go"
	"github.com/hiscaler/woocommerce-go/config"
	jsoniter "github.com/json-iterator/go"
)

func main() {
	// Read you config
	b, err := os.ReadFile("./config_test.json")
	if err != nil {
		panic(fmt.Sprintf("Read config error: %s", err.Error()))
	}
	var c config.Config
	err = jsoniter.Unmarshal(b, &c)
	if err != nil {
		panic(fmt.Sprintf("Parse config file error: %s", err.Error()))
	}

	wooClient := woocommerce.NewClient(c)

	params := woocommerce.OrdersQueryParams{
		Status: []string{
			"pending",
			"completed",
		},
	}
	wooClient.Services.Order.All(params)

}

`2022/08/24 18:28:16.680337 DEBUG RESTY

GET  /wp-json/wc/v3/orders?context=view&oauth_consumer_key=xxxxx&oauth_nonce=7cd699b2e9bf1decb2e6ab063316585210846068&oauth_signature=EmtXCNXZTYkLyGktZPCrrFA3Pg8P3Z7S4aMnWE%2BBJiY%3D&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1661340496&order=asc&page=1&per_page=10&status=pending&status=completed  HTTP/1.1
HOST   : 35.240.240.242
HEADERS:
        Accept: application/json
        Content-Type: application/json
        User-Agent: WooCommerce API Client-Golang/1.0.0
BODY   :
***** NO CONTENT *****
------------------------------------------------------------------------------
~~~ RESPONSE ~~~
STATUS       : 401 Unauthorized
PROTO        : HTTP/1.1
RECEIVED AT  : 2022-08-24T18:28:16.679604+07:00
TIME DURATION: 204.796333ms
HEADERS      :
        Access-Control-Allow-Headers: Authorization, Content-Type
        Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages
        Content-Length: 137
        Content-Type: application/json; charset=UTF-8
        Date: Wed, 24 Aug 2022 11:28:16 GMT
        Link: <http://35.240.240.242/wp-json/>; rel="https://api.w.org/"
        Server: Apache/2.4.29 (Ubuntu)
        Vary: Origin
        X-Content-Type-Options: nosniff
        X-Robots-Tag: noindex
BODY         :
{
   "code": "woocommerce_rest_authentication_error",
   "message": "Invalid signature - provided signature does not match.",
   "data": {
      "status": 401
   }
}
==============================================================================
[ WooCommerce ] 2022/08/24 18:28:16 /Users/loithai/go/pkg/mod/github.com/hiscaler/[email protected]/woo.go:190: OnAfterResponse error: 401: Invalid signature - provided signature does not match.`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.