Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It takes two requests to create a customer or card #122

Closed
mcampa opened this issue Jan 16, 2015 · 3 comments
Closed

It takes two requests to create a customer or card #122

mcampa opened this issue Jan 16, 2015 · 3 comments

Comments

@mcampa
Copy link

mcampa commented Jan 16, 2015

It takes two requests to create a customer or card, with the current php library.

This is what the documents show on how to create a Customer

$marketplace = Balanced\Marketplace::mine();
$customer = $marketplace->customers->create($params);

This takes two requests, and it is extremely slow to fetch the marketplace. It's taking almost 6 seconds.

But when I switch to CURL I see that I can create a customer with one request.

So, how do I create a customer with one request?

@mjallday
Copy link
Contributor

What happens if you run

$customer = new Customer();
$customer->save();

@mcampa
Copy link
Author

mcampa commented Jan 16, 2015

Wow, so simple, but the documentation so convoluted.

Instead of having this in the docs:

$marketplace = Balanced\Marketplace::mine();
$customer = $marketplace->customers->create(array(
  'address' => array( 
     'postal_code' => '48120', 
  ), 
  'dob_month' => '7',
  'dob_year' => '1963',
  'name' => 'Henry Ford',
));

You could rewrite that to:

$customer = new Balanced\Customer(array(
  'address' => array( 
     'postal_code' => '48120', 
  ), 
  'dob_month' => '7',
  'dob_year' => '1963',
  'name' => 'Henry Ford',
));

$customer->save();

It's not obvious. Anybody reading the docs could think that it needs the $marketplace to create a Customer

@mjallday
Copy link
Contributor

Yup, you're right, it should be much simpler. I've opened another issue (#123) to resolve this. I'm going to close this one out, thanks for bringing this to our attention.

[EDIT] For the record, this is a legacy from the previous revision which required posting to a nested URL which was under the marketplace e.g. /marketplaces/MP123123/customers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants