Giter Site home page Giter Site logo

square-connect-node-sdk's People

Contributors

markjen avatar steckel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

square-connect-node-sdk's Issues

price_money field in variation not persisting through the endpoint

I have to preface this issue by saying that my company (mid-size, >100 employees and >5 stores) had an event involving irreversible infrastructure failure almost 24 hours ago, and I am implementing a very quick and dirty replacement POS/online store for the time being. I say this because I have been going for nearly 18 hours replacing everything I can and am not entirely sure if I could spot bugs in my own code or library code at this point.

i tried to make things a bit easy for you with a jsfiddle, but it doesn't really have a lot of similarity to my code, it just shows the structure of my object that is submitted to your wrapper. http://jsfiddle.net/efjytg6r/4/

When creating an item, I noticed that the price I set is not persisted through to my square account. Here is my form (note: it is HEAVILY modified to take out all styles etc, save the base bootstrap classes for readability and brevity)

Item Name
Item Price $
Variation
Description <textarea rows="4" class="form-control" ng-model="itemObj.description" id="description"></textarea>
Visible Online?
Available online (delivery)?
Available for pickup?
Create

here is AngularJS (modified for brevity):

controller:

var itemObj = {};
//set these to be the norm for now
itemObj.pricing_type = 'FIXED_PRICING';
itemObj.price_money = {
    currency_code: 'USD'
};

//set up the model
$scope.itemObj = {};
$scope.itemObj.variations = itemObj;
function verify_and_return(str){
 var reg = /^\d*\.{0,1}\d{0,2}$/;
 var test = reg.test(str);
 if (test == false){
    //didnt work
 } else {
    return parseFloat(str);
 }
}

$scope.create = function(item){
item.variations.price_money.amount = verify_and_return(item.variations.price_money.amount);
ItemService.create(item)
.then(handleRes, handleRes);
}

service:
this.create = function(item){
return $http.post('/square/item', {
item: item
});
}

and here is my route handler on my express server (again, heavily modified for brevity):
squareRouter.post('/item', function(req, res){
var item = req.body.item;
square.api('/me/items', 'POST', item, function(err, resp){
data_handler(err, resp, res);
});
});

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.