Sandbox Create Customer


(Kris E) #1

I created a customer in the sandbox yesterday and it was working. Today I tried it again and there is not a location in the header even though I get a 201 response…Thoughts?

Response:

Object {url: “https://api-uat.dwolla.com/customers”, method: “POST”, headers: Object, obj: null, status: 201…}
data: ""
headers: Object
cf-ray: "2774c5b79f1641c3-SJC"
content-length: "0"
content-type: null
date: "Fri, 19 Feb 2016 20:37:54 GMT"
server: "cloudflare-nginx"
x-request-id: “3f3a443d-720e-4a21-8a49-172b05613a6b”

Code:

var client = require(‘swagger-client’);

var dwolla = new client({
url: ‘https://api-uat.dwolla.com/swagger.json’,
authorizations: {
headerAuth: new client.ApiKeyAuthorization(‘Authorization’, 'Bearer ’ + ACCESS_TOKEN, ‘header’)
},
usePromise: true,
});

//Create Customer

dwolla
.then((dwolla) => {
return dwolla.customers.create({
body: {“firstName”: “Kristoasdfasdff”,
“lastName”: “Easdfasdnger”,
“email”: "asdfasssasdfsfasadfasdfasdfasd@asdfasdf.com",
“ipAddress”: “99.99.31.99”}
})
})
.then((data) => {
console.log(data);
})
.catch((error) => {
console.log(error);
})


(Spencer Hunter) #2

@Kris, Are you still running into this issue? I am curious if the Customer is showing up as being successfully created within your list of Customers.


(Kris E) #3

@spencer Thanks for responding!

Yes, when I get the list of customers it shows up as the first in the array and yes still having this issue.

I must be doing something wrong since no one else seems to be having this issue…should I be looking elsewhere in the response for the customer id?

I actually just sent this via email to you guys with a couple screen shots and code.


(Stephen Ausman) #4

Hey Kris,

I just tried this locally and got:

{ url: 'https://api-uat.dwolla.com/customers',
  method: 'POST',
  headers:
   { server: 'cloudflare-nginx',
     date: 'Thu, 25 Feb 2016 21:51:54 GMT',
     'content-length': '0',
     connection: 'close',
     'set-cookie': [ '__cfduid=d2bf2203fdc38a05da54e1f1dd8e2989e1456437114; expires=Fri, 24-Feb-17 21:51:54 GMT; path=/; domain=.dwolla.com; HttpOnly' ],
     location: 'https://api-uat.dwolla.com/customers/387170c6-25d9-4045-9034-373f78ab7bb5',
     'x-request-id': '42d24b57-694b-441e-a803-af2fe5c3744c',
     'cf-ray': '27a6a25ab6c44213-MSP' },
  obj: null,
  status: 201,
  statusText: '',
  data: '' }

I wonder if it has something to do with your JavaScript runtime? I’m running Node v5.7.0. How about you?


(Kris E) #5

Thanks for the help Stephen. What is really strange is that this was working before and I was getting the location property no problem.

I am using React Native. When I run node -v, I get v.5.7.0.

However, I think what you are asking is the following from RN’s docs:

On iOS simulators and devices, Android emulators and devices React Native uses JavaScriptCore which is the JavaScript engine that powers Safari. On iOS JSC doesn’t use JIT due to the absence of writable executable memory in iOS apps.

When using Chrome debugging, it runs all the JavaScript code within Chrome itself and communicates with native code via WebSocket. So you are using V8.

The output without the location property is from Chrome’s debugging console.


(Stephen Ausman) #6

Hmm, maybe that’s it. I am having trouble getting swagger-client to work at all in my React Native app.

By the way, you probably don’t want to access the Dwolla API directly from the client/iOS app as you will have to share your token with the client. I would only do this if you trust the client with the ability to interact with the Dwolla API on your behalf.


(Kris E) #7

Thanks for looking into it. Interesting cause the swagger-client seemingly works fine in my RN app.

Yes, I understand that I will need to extract that out to a backend before it goes into production. I was just trying to create an minimum viable product first since it is all sandboxed anyways.

Well, I guess there is no way to fix this for now? Every other call, list/transfer/getFundingSource/etc., seems to work.