Giter Site home page Giter Site logo

monei / shopify-api-node Goto Github PK

View Code? Open in Web Editor NEW
929.0 25.0 275.0 1.34 MB

Node Shopify connector sponsored by MONEI

Home Page: https://monei.com/shopify-payment-gateway/

License: MIT License

JavaScript 99.52% TypeScript 0.46% Shell 0.02%
shopify javascript ecommerce nodejs node node-module pricing-rules wholesaler polaris monei

shopify-api-node's People

Contributors

airhorns avatar alexandresaiz avatar alua-kinzhebayeva avatar barrycarlyon avatar builtbylane avatar carlosvillu avatar ikudosi avatar ivaylopivanov avatar jineshshah36 avatar kazinov avatar kenrick avatar khanghoang avatar kjaenicke avatar lpinca avatar matomesc avatar mbogdan18 avatar metasloth avatar mitchpierias avatar mrtravisb avatar msoghoian avatar neuralch avatar nikmartin avatar pauloluan avatar seapunk avatar squirly avatar summersk avatar temsa avatar tkalliom avatar wlaurance avatar yourwishes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shopify-api-node's Issues

Format of params for webhook.create

I'm a little confused what the format for params should be in this context, since the method already has create, and normally the topic would be something like "customers\/create". Can someone clarify? My app can create webhooks fine (using another package), but using this package I just keep getting a 422 when trying to create.

Product Metafields

Hi,
How to get metafields of a product, please?

The Shopify api says:

GET /admin/products/#{id}/metafields/#{id}.json

or:

GET /admin/products/632910392/metafields.json

Cheers
Marc

complete Metafield resource

Metafield resource requires to be completed and have associated integration tests.
P.S. if you look into source code, you will find that a resource inherits from base or base_child. Metafield has endpoints that "belong" to both base classes.
P.P.S. actual implementation is not sufficient, and has to be overwritten to support both cases.

Error: writing metafield data as part of product of variant

Me again, sorry.

I'm trying to include metafield data when writing to a product (or variant).

When I create/update a product I simply include as part of the object { "variants": [{...}, {...}] } and everything works great. While I get successful save messages it has no effect if I include { "metafield": {...} } or { "metafields": [{...}, {...}] }.

Is this by design? What is the best practice for working with metafields?

Cannot Get Product Metafields

shopify.metafield.list() only returns shop metafields. I would like to get product metafields. Is this possible? Am I missing some crucial piece of information?

OAuth

I want to help write the OAuth implementation for this connector. I have a partners account with a test app and test store. I am following this doc.

Any suggestions or any other resources I should look at?

Thanks,

Will

Using CreateSession for a private app

Hi, I'm using nodify.createSession for a private app. I know that unlike in public apps, one doesn't need to use Oauth to authenticate the client as the apiKey and secret are already generated for me. My question is in the createSession call what do I need to put as the argument for the last argument (i.e. createSession(MyShop.myshopify.com, ourAPIkey, ourSecret, persistentOauth2Token)?

I'm wondering whether it is consistent with the PHP Shopify API skeleton app that I saw where true was the last parameter or should I include a token irrespective of this being a private app.

Thanks in advance,

John

errors with webpack

Sorry to bother:

I get two errors when using nodify-shopify with webpack

ERROR in ./~/nodify-shopify/index.js
Module not found: Error: Cannot resolve module 'fs' in /Users/naturgewalt/Coding/gigster/vavavoo-slingshot/node_modules/nodify-shopify
 @ ./~/nodify-shopify/index.js 6:11-24
ERROR in ./~/nodify-shopify/package.json
Module parse failed: ./node_modules/nodify-shopify/package.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
|   "name": "nodify-shopify",
|   "version": "0.2.1",
|   "description": "Shopify API client",
 @ ./~/nodify-shopify/index.js 8:12-32

ERROR in ./~/nodify-shopify/~/got/package.json
Module parse failed: ./node_modules/nodify-shopify/node_modules/got/package.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
|   "name": "got",
|   "version": "6.2.0",
|   "description": "Simplified HTTP/HTTPS requests",
 @ ./~/nodify-shopify/~/got/index.js 21:12-37

I can make the latter go away by adding to webpack.conf

loaders: [{ test: /\.json$/, loader: "json-loader" }]

but no other package requires this...

The primary I can make the parse error go away using

target: 'node'

but, then I get a failure

Uncaught ReferenceError: require is not defined

(which is understandable since I not compiling for the web)

Mocha/Nock: encodedParams Issue

Unable to mock API calls because nock can not pick up the encoded query params. I emulated your current test suite set-up, to no luck.

Output from nock.recorder.rec():

nock('https://demo-shop.myshopify.com:443', {"encodedQueryParams":true})
  .put('/admin/orders/4476182279.json', {"order":{"tags":"one,two,three"}})
  .reply(200, ["1f8b080aaa03000000ffff","ec57db8edb3610fd15417d6981f5429464cbf2533749fb96a6a893a726106892b28995488517efbac1fe7b86a46ef63a97a2796c8005a2e1903373e6cc21fd29968a32156f3ec59cc69b3c2f56689da6c5fa26662de64dbc8935a6b8d5254a7edd3bcb2d916d7c1393466a462b6ce28db04d0306c5b0e92d719aa0d502250b54bc45d9262f3679b248f24d92c04edbd1e78ee9f26d9a6c50b2c9d2d151d876e752cb0af8bf340cdc89940dac1879cf047c62c44a426b8258b1ae770949basdf38295a97aa0428776f6c4548509619dd1558bd53d335cec874802b76efb4f28c972d8af58cd9482f54a73877d38a3c1825eda08d4c29ae69c0dde560127b41c1398215b594d27d4c981917b692ff2f519006e6320ab217f47d33e1749b0e152cc4c5a5a058773ca84e13577ec395bb0aa192c9d928469fd3d8ca5ecc8fda923924a3ef85cba6bb840d5f560f7d3550d4c066881cb43332b2229838efefd21f01b12318aefac198c1d3eb55048d573b8721d1a9642f62e64cbcc41d240f011c86790f4dd4dcb7c890a4741dbd4bc69fcf90309fb2ee1474fab3e92c17bc7ba1d86835d3137d1d6ee3451bc73d89f7f45bf73a5cd7bf1c66b8a67b3c1c4545f979280514862dea189db9049d0a7f5ba480a54944bd0a723561c8b506a9614cb72992e57192c186e1a57eb4bdc69dbb0b30c75f4de2649ba8afe62aefce84f284b47d19d353202aeb187e8e7ed81773a6247a64e511abd86asdf27dff5c13aa33729d6bfe24f9df39b32ee298e2600df39315195a0139d6e93426c03941a1efd17620c844ef75afcf20545ff00cf2328aea410a36e93740addd557f85cc3385a2ace18e26c03ec3f6c088e912810bc84bfea59c3fab7707c7bb7231a5c075edde33b5d3a241f72075dff37e1d81294f96d1ca1ca2bb23bb8dee3a731b2137a77d0971069a82966899640e00df9a788b41e294bbbaa13560fec75d00719923b40e843d727f5dc1cc34bc964a70ecd1832e2a7ffb034d187553ee34dedd1a53862f24d76cca301d41906d87c569ba68a06fd6b5232b6e8b75b22a90bb09c5beb72e509adee6ab3ccf8ae538c2befa6888d0e753f55d7db79de53e185fde01e12716fd0feb8f8475360efd250b2f062b68ff41ac36b29d3dcad710142154e4df7a947ff16df7df1ee7a8f48ed92641a3e3551a5c03de8ba9ae7a2983129c723907269cf2d1f129abbb7003f46f427f56781a5cfe32093f06861b543965a0c31b23d4dbdac6f00e6bfd05ed608faced663f05c21be78e1810a2e1a2dbf93b6096c6c50399b21a4398f96cb844e17955ae57abdcbd44be1ba40b367e7b9c9ed1f9fa24fdfbd9b998bd6b537b95fd57987e7d2asdf0000ffff","0300d4ea6asdfa20e0000"]

Any thoughts?

Undefined variable

Nodify / src / resources / shop.coffee

Line 11. Variable params is throwing 'undefined'. Please, remove it as it is not used at all.

TypeError: Shopify is not a function

Hi, I get this error when I try to use this library:

const shopify = new Shopify('funkyshop.myshopify.com', 'asdf21351vfe', 'ssdafqr52fq24d1');
                ^

TypeError: Shopify is not a function

which is in reference to

const Shopify = require('nodify-shopify');
const shopify = new Shopify('funkyshop.myshopify.com', 'asdf21351vfe', 'ssdafqr52fq24d1');

PS. Thank you for the application, I can see being very useful.
PPS. apiKeys, passwords, etc changed to protect the innocent ;-)

API calls on things other than blog, product, order?

Sorry if I'm being stupid, but it looks as if you've added all the different classes for the various API sections in the /lib/resources folder, but they're not being added to the main session object when it's initialized.

Was this intentional? Am I missing something?

Thanks

Unprocessable Entity Error in Order API

Sorry this may sound basic, but for the earth of me I can't figure out why I'm getting an unprocessable entity error on this node module when trying to process an order. I'm used to Shopify returning a piece of info telling why its failing, but on the earth of me I can't figure how to get that to work with this module.

I tried a minimal example, which works fine as a direct call, but does not work with module, any idea why? (The variant and product does exist)

shopify.order.create({ "order": { "send_receipt": true, "send_fulfillment_receipt": true, "financial_status": "pending", "email": "[email protected]", "currency": "GBP", "line_items": [{ "product_id": "4384307335", "variant_id": "15017097223", "price": "255", "quantity": "3" }] } }).then(orders => console.log(orders)).catch(err => console.error(err));

customCollections not working

When I try to do

shopifyAPI.customCollection.get({ product_id : product_id })

it throws

TypeError: Request path contains unescaped characters.

I've also tried

shopifyAPI.customCollection.get({ id : collection_id}) 

as a sort of workaround, but for that it says 404 not found and shows host as undefined , even though the path looks ok.

[HTTPError: Response code 404 (Not Found)]
  message: 'Response code 404 (Not Found)',
  host: undefined,
  hostname: 'micro-clone.myshopify.com',
  method: 'GET',
  path: '/admin/custom_collections/358753670.json',
  statusCode: 404,
  statusMessage: 'Not Found' }

Exit early on missing or invalid ID

There are many places in the code where a missing id is incorrectly handled. For example:

As you can see the callback is called with an Error but the request is sent anyway because there is no return statement, and this will lead to a double callback invocation.

Also is there a particular reason to validate only the id argument? For consistency I would not validate it.

Make the `autoLimit` feature work

I used the following constructor call,

const shopify = new Shopify({
  shopName: 'dizzy-lizzie',
  apiKey: '4e8f95a3d04b272de92cdd060932e180',
  password: 'ff5ded17c15177277308c0454a9a6bc3',
  autoLimit: { calls: 2, interval: 3000 },
});

with the following call to the API

        invalids.forEach(invalid => {

            shopify.productVariant.update(invalid.id, { weight: 1 });
        });

The outgoing http request sent are going out as fast as the node loops will allow, with no respect in regards to the configured limits.

I've also try to use autoLimit: true, which similarly had no effect on the rate at which requests were sent.

Making API call using session with existing permanent token, returns 'Invalid API key or access token'

I auth, get a code, and exchange it for a permanent token that is good for the life of the app.

I then create a new session with that token (as the 4th parameter)

session = nodify.createSession( 'measureful',
'xxx',
'xxx',
'xxx');

Then make an API call with it:

session.order.all({limit: 5}, function(err, orders){
if(err) { console.log(orders); throw err;}
console.log(orders);
});

And get:

{ errors: '[API] Invalid API key or access token (unrecognized login or wrong password)' }

Is the ‘X-Shopify-Access-Token’ header not getting set? Any other ideas?

Release new version

Could a new version be created and published, please? A few changes have been made since then, and I'd like to start utilizing those features (the API call limits in specific) without having to install the package via Github repo.

scriptTag api not working.

Hello,

it seems it does not work with scriptTag specifically.
it works with product api but not with scirptTag.

	const Shopify = require('shopify-api-node');
	const spOptions = {
		shopName: Client.shopName,
		accessToken: '****',
	};
	const shopify = new Shopify(spOptions);
	shopify.scriptTag.create({
		script_tag: {
			event: 'onload',
			src: 'https:\/\/cdn.shopify.com\/s\/files\/1\/1614\/7363\/t\/1\/assets\/st-pixel.js?3770681469120072683',
		}
	})
	.then(scripts => {
		console.log('scripts added', scripts);
	})
	.catch(err => {
		console.log('err', err);
	})
	.finally(() => {
		res.send('test');
	});


this gives me an error

err { [HTTPError: Response code 422 (Unprocessable Entity)]
  message: 'Response code 422 (Unprocessable Entity)',
  host: undefined,
  hostname: 'st-pixel-test.myshopify.com',
  method: 'POST',
  path: '/admin/script_tags.json',
  statusCode: 422,
  statusMessage: 'Unprocessable Entity' }

any idea?

Thanks

complete Event resource

Event resource requires to be completed and have associated integration tests.
P.S. Event is similar to Metafield. It has endpoints that "belong" to two base classes.

Undocumented API support

For some reason, Shopify has a fair amount of undocumented APIs, most notably the search endpoints.

For example, the Variants API only has a few select endpoints documented, but there's a seemingly undocumented endpoint: GET /admin/variants/search.json.

Looking further into this, it seems that they're still working on documenting and then releasing it "soon", but I still feel it would be good to leverage this functionality now.

Will you be willing to include undocumented/beta API functions to this library?

Travis PR integration broken

It seems that there is an issue with the Travis integration in the latest PRs.
Travis still runs but the build is not visible inline in the PRs (#46, #47, #48).

I wonder if this happened when the repository has been renamed.

Request timeouts

IIRC, got doesn't have a default timeout, which seems to mean that a request can take forever if the program missed or just has not received a response. One of my programs that I wrote that utilizes this module seems to be getting bit by this problem.

I do not see a place where I can configure a timeout in this module; will support for this be added?

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.