Giter Club home page Giter Club logo

balanced-node's People

Contributors

davismwfl avatar gabekneisley avatar ianserlin avatar matthewfl avatar mjallday avatar pnegahdar avatar remear avatar rloomba avatar rserna2010 avatar stephen 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

Watchers

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

balanced-node's Issues

Delete Customer

The API allows for the deletion of Customers "so long as there has been no activity associated with it such as creating a hold, credit, or debit"

This ability needs to be added if it does not already exist.

balanced.js load time

My site loads pretty quick, but almost 50% of the load time is the 4kb balanced.js file.

I know it isn't much, but because I'm running a web app this small load time is compounded each time the file is retrieved again. I do cache .js files, but the balanced.js file has such a short lifetime that it is frequently being reloaded.

http://tools.pingdom.com/fpt/#!/cGvo2t/trashmountain.com/give

Any advice for making this connection faster?

Unable to access `owner_customer` when trying to get a marketplace's bank account.

The example provided at the following links:
https://github.com/balanced/balanced-node/blob/master/snippets/order-credit-marketplace.js
https://docs.balancedpayments.com/1.1/guides/orders/credit-marketplace/

These examples show how to retrieve a marketplace's bank account, however in my trials, balanced.marketplace.owner_customer returns as undefined from balanced.marketplace.

After further investigation, I realized the promise for balanced.marketplace had to be resolved first and came to this example:

balanced.marketplace.then(function(marketplace) {
    marketplace.owner_customer.bank_accounts.get(0).then(function(bankAccount) {
        console.log(bankAccount);
    });
});

The code above, works for me. Is this how it is actually supposed to work, which means the examples are off, or am I not using the module correctly?

birth month & year aren't stored for business representatives

When adding customers through the API without a business name or ein, the dob_month and dob_year fields are stored and my customers pass the underwriting requirements. However, when I attempt to do the same for a business, those fields don't show up in the Balanced dashboard, even though I've verified that I'm still sending them in with the exact same format. This causes my business to fail underwriting (verified by manually adding dob_month and dob_year to a business customer through the Balanced dashboard).

Any thoughts on what's going on?

Get customers response returns wrong data

If I use something like so

balanced.configure('my-api-key');

balanced.marketplace.customers.then(function(data){
     console.log(data)
     res.send(data)
})

I get this response:

{
  "_api": {
    "base_url": "https://api.balancedpayments.com/",
    "request_args": {
      "headers": {
        "Accept": "application/vnd.balancedpayments+json; version=1.1, application/vnd.api+json",
        "User-Agent": "balanced-node/1.2.0 node-jsonapi/0.0.10 node/v0.10.26"
      },
      "auth": {
        "user": "ak-test-2F6EHR.....4hfUlf54Pcn",
        "pass": ""
      }
    },
    "routes": {
      "marketplaces": {
        "debits": {
          "method": "GET",
          "href": "/debits"
        },
        "reversals": {
          "method": "GET",
          "href": "/reversals"
        },
        "disputes": {
          "method": "GET",
          "href": "/disputes"
        },
        "customers": {
          "method": "GET",
          "href": "/customers"
        },
        "credits": {
          "method": "GET",
          "href": "/credits"
        },
        "cards": {
          "method": "GET",
          "href": "/cards"
        },
        "orders": {
          "method": "GET",
          "href": "/orders"
        },
        "card_holds": {
          "method": "GET",
          "href": "/card_holds"
        },
        "refunds": {
          "method": "GET",
          "href": "/refunds"
        },
        "owner_customer": {
          "method": "GET",
          "href": "/customers/{marketplaces.owner_customer}"
        },
        "transactions": {
          "method": "GET",
          "href": "/transactions"
        },
        "bank_accounts": {
          "method": "GET",
          "href": "/bank_accounts"
        },
        "callbacks": {
          "method": "GET",
          "href": "/callbacks"
        },
        "events": {
          "method": "GET",
          "href": "/events"
        }
      }
    },
    "cache": {
      "/marketplaces/TEST-MP4o...JnIk5": {
        "in_escrow": 45,
        "domain_url": "example.com",
        "name": "Test Marketplace",
        "links": {
          "owner_customer": "CU4o63.....TIyN"
        },
        "href": "/marketplaces/TEST-MP4o.....JnIk5",
        "created_at": "2014-06-02T23:49:40.555048Z",
        "support_email_address": "[email protected]",
        "updated_at": "2014-06-02T23:49:41.024137Z",
        "support_phone_number": "+16505551234",
        "production": false,
        "meta": {},
        "unsettled_fees": 0,
        "id": "TEST-MP4.....Ik5",
        "_type": "marketplace",
        "_load_time": "2014-06-03T04:09:01.740Z"
      }
    },
    "last_cache_clean": "2014-06-03T04:08:57.245Z",
    "cache_time_limit": 120000,
    "objects": {},
    "action_names": {},
    "marketplace": {}
  },
  "_url": "/customers",
  "_objs": {},
  "_meta": null
}

Any idea why?

Write a test for sideloading

Given the payload

{
    "debits": [
        {
            "amount": 5000, 
            "appears_on_statement_as": "BAL*Statement text", 
            "created_at": "2014-02-27T20:03:06.176697Z", 
            "currency": "USD", 
            "description": "Some descriptive text for the debit in the dashboard", 
            "failure_reason": null, 
            "failure_reason_code": null, 
            "href": "/debits/WD1l5vYA21ZP24LMQMqHizea", 
            "id": "WD1l5vYA21ZP24LMQMqHizea", 
            "links": {
                "customer": null, 
                "dispute": null, 
                "order": null, 
                "source": "CC1diaA1Lunr4RlelwKQ8C4v"
            }, 
            "meta": {}, 
            "status": "succeeded", 
            "transaction_number": "W347-910-8642", 
            "updated_at": "2014-02-27T20:03:07.629780Z"
        }
    ], 
    "foos": [
        {
        }
    ], 
    "links": {
        "debits.customer": "/customers/{debits.customer}", 
        "debits.dispute": "/disputes/{debits.dispute}", 
        "debits.events": "/debits/{debits.id}/events", 
        "debits.order": "/orders/{debits.order}", 
        "debits.refunds": "/debits/{debits.id}/refunds", 
        "debits.source": "/resources/{debits.source}"
    }
}

Make sure that this client library does not choke and return the wrong object.

create customer response object

Hi I am trying to create a customer:

balanced.marketplace.customers.create({
    "name": req.user.displayName,
    "email": req.user.email
  }).then(function(data){
    console.log(data);
});

data comes out to be:
(i took out my testkeys from the object below)

{ _api: 
   { base_url: 'https://api.balancedpayments.com/',
     request_args: { headers: [Object], auth: [Object] },
     routes: { marketplaces: [Object], customers: [Object] },
     cache: 
      { '/marketplaces/TEST-some_key': [Object],
        '/customers/customerkey': [Object] },
     last_cache_clean: Thu Mar 20 2014 00:51:04 GMT-0400 (EDT),
     cache_time_limit: 120000,
     objects: 
      { api_key: [Object],
        marketplace: [Object],
        customer: [Object],
        card: [Object],
        bank_account: [Object],
        card_hold: [Object],
        bank_account_verification: [Object],
        callback: [Object],
        dispute: [Object],
        debit: [Object],
        credits: [Object],
        event: [Object],
        order: [Object],
        refund: [Object],
        reversal: [Object] },
     action_names: {},
     configure: [Function],
     api_key: { [Function: obj] create: [Function], find: [Function] },
     marketplace: [Getter],
     customer: { [Function: obj] create: [Function], find: [Function] },
     card: { [Function: obj] create: [Function], find: [Function] },
     bank_account: { [Function: obj] create: [Function], find: [Function] },
     card_hold: { [Function: obj] create: [Function], find: [Function] },
     bank_account_verification: { [Function: obj] create: [Function], find: [Function] },
     callback: { [Function: obj] create: [Function], find: [Function] },
     dispute: { [Function: obj] create: [Function], find: [Function] },
     debit: { [Function: obj] create: [Function], find: [Function] },
     credits: { [Function: obj] create: [Function], find: [Function] },
     event: { [Function: obj] create: [Function], find: [Function] },
     order: { [Function: obj] create: [Function], find: [Function] },
     refund: { [Function: obj] create: [Function], find: [Function] },
     reversal: { [Function: obj] create: [Function], find: [Function] } },
  _href: '/customers/some_id',
  _set_values: {},
  _deferred: false }

The object does not look like what is documented on Balanced Payments' website https://docs.balancedpayments.com/1.1/api/customers/#create-a-customer

Thanks and please respond soon!

Update Customers business name

Simply doesn't do it.

Using the method I touched on in #25 I'm setting customer.business_name to be a new value and it never updates.

Create Customer

package version: 1.0.5

The docs show this:

balanced.marketplace.customers.create({
  "uri": "/customers", 
  "payload": payload // payload object
});

however, with that approach all I get returned in my success callback is a customer with no information besides creation time.

I'm currently doing an update in the promise after running create to assign the customer information, much like in my example for #25

Balanced JS lib on Parse.com platform

Hello,
I am developing a Parse app, which requires payment integration. Unfortunately Parse.com doesn't support NPM, because of which I cannot do npm install and get work done. Is there a way to include say a "stand alone" js library which includes all dependencies. Right now its not working because jsonapi-client.js (one of Balanced.js's dependencies) is found to be missing.

Error: https://gist.github.com/sidharthshah/8a44fce5c8b5bd2c82cb

Any other suggestion would be appreciated.

PS: This is a cross post from balanced/balanced-js#93

How to access error responses

I'd like to process the error response of a balanced debit call without resorting to string processing. The below code is referencing the sample card number on the balanced website that simulates a processor failure (last four is 4448), so it should fail.

balanced.get(myCardHref).debit({ amount: 1000})
      .then(function(obj) {
        // handle success
      })
      .catch(function(err) {
        console.log(err);
      });

The err object in the reject clause appears to be an instance of Error. How can I instead get access to the actual response object so I can access the various "errors" and "debits" clauses in the jsonapi result? I assume there must be something cleaner than JSON.parse(err["message"]).

[Error: {
  "errors": [
    {
      "status": "Payment Required",
      "category_code": "card-declined",
      "additional": "Account Frozen",
      "status_code": 402,
      "category_type": "banking",
      "extras": {},
      "request_id": "OHM431eec14e22111e3be3f02b12035401b",
      "description": "R758: Account Frozen. Your request id is OHM431eec14e22111e3be3f02b12035401b."
    }
  ],
  "links": {
    "debits.customer": "/customers/{debits.customer}",
    "debits.dispute": "/disputes/{debits.dispute}",
    "debits.source": "/resources/{debits.source}",
    "debits.order": "/orders/{debits.order}",
    "debits.refunds": "/debits/{debits.id}/refunds",
    "debits.events": "/debits/{debits.id}/events"
  },
  "debits": [
    {
      "status": "failed",
      "transaction_number": "W877-022-7997",
      "description": "SeeYourGuru.com charge",
      "links": {
        "customer": "CU3amMvcf0DcY1sEVJuscRxj",
        "source": "CC3hqWNlPglj3hYp0Uw8ktF3",
        "order": null,
        "dispute": null
      },
      "created_at": "2014-05-23T02:23:43.977581Z",
      "updated_at": "2014-05-23T02:23:44.261873Z",
      "failure_reason": "R758: Account Frozen.",
      "currency": "USD",
      "amount": 4300,
      "href": "/debits/WD22IHTvI6QDD64Z1VL9IfJj",
      "meta": {},
      "failure_reason_code": "card-declined",
      "appears_on_statement_as": "BAL*Guru charge",
      "id": "WD22IHTvI6QDD64Z1VL9IfJj"
    }
  ]
}]

Update a Customer

package version: 1.0.5

The docs show this:

balanced.get('/customers/CU4ZLxuKnxGv1XulAOL4aTXq').set('name', 'alan turing').set('email', '[email protected]').save();

However I am unable to get that to work at all.

I'm achieving my update from the promise like so:

balanced.get('/customers/CU4ZLxuKnxGv1XulAOL4aTXq').then(
  function Success(customer){
    customer.name = 'alan turing';
    customer.email = '[email protected]';
    customer.save()
  }, 
  function Error(err){}
);

So I guess my question is: Are the docs wrong, or am I missing something?

Bank account must be associated

Tests are failing on verifying a bank account.

api.BankAccounts.verify /v1/bank_accounts/BA392R2OrlXaktnWgf42kDW7/verifications  >>  {"status":"Conflict","category_code":"bank-account-no-account","additional":null,"status_code":409,"extras":{},"category_type":"logical","_uris":{},"request_id":"OHM68c5ef42fa1b11e28ffe026ba7cd33d0","description":"Bank account BA392R2OrlXaktnWgf42kDW7 must be associated with a customer before it can be verified. Your request id is OHM68c5ef42fa1b11e28ffe026ba7cd33d0."}
/home/travis/build/balanced/balanced-node/test/test.js:340
                throw err;
                      ^
[object Object]

Trying to issue a credit on a non-creditable card throws uninformative error

If you try to:

balanced.get("/cards/ABCDEFG").credit({
  amount: "1000",
  description: "Test!"
})

But the card with ID ABCDEFG has can_credit == false, I'm seeing a very vague error:

TypeError: Cannot read property 'href' of undefined
    at jsonapi._getLink (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/lib.js:179:44)
    at /vagrant/node_modules/balanced-official/node_modules/jsonapi-client/lib.js:497:34
    at _fulfilled (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:749:13)
    at /vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:810:14
    at flush (/vagrant/node_modules/balanced-official/node_modules/jsonapi-client/node_modules/q/q.js:108:17)
    at process._tickDomainCallback (node.js:372:11)

It'd be much more helpful if we instead got an error indicating that the card cannot be credited.

Explore using alpaca to create a revision 1.1 client library

Alpaca is a program for generating client libraries in various languages.

This could be a great thing for Balanced since all our client libraries are essentially mirrors of the links provided by the API.

We could test this out with the node.js implementation and if that works expand it out to other languages.

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.