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

Add STRIPE-ACCOUNT header support #143

Merged
merged 1 commit into from Mar 16, 2015
Merged

Conversation

danwang
Copy link
Contributor

@danwang danwang commented Mar 12, 2015

r? @bkrausz @jimdanz

Add support for Stripe-Account header in RequestOptions.

This can currently only be used on methods with RequestOptions as the final parameter in their signature (none with String apiKey).

There's no tests because there's no way to test the existence of the headers without creating new accounts (if the real API is to be used, in the style of the existing tests) or ripping a lot of things apart (if mocks/captors are to be used). I tested using my own account + a test account in a super simple program:

  public static void main(String[] args) {
    Stripe.apiKey = "my test secret key";
    String connectedAccount = "the token of my connected account";
    Map<String, Object> params = new HashMap<String, Object>();

    try {
      ChargeCollection all = Charge.all(params, RequestOptions.builder().setApiKey(Stripe.apiKey).setStripeAccount(connectedAccount).build());
      System.out.println(all);
    } catch (StripeException e) {
      e.printStackTrace();
    }
  }

and verified that it returned charges from the connected account.

The issue of testing seems like too big to shave right now, and I'm pretty confident in the correctness of this.

@bkrausz
Copy link
Contributor

bkrausz commented Mar 15, 2015

Looks like a couple of NPEs in tests: https://travis-ci.org/stripe/stripe-java/jobs/54169281

@danwang danwang force-pushed the danwang/stripe-account-headers branch from ece8a0d to b654e54 Compare March 16, 2015 18:59
@danwang
Copy link
Contributor Author

danwang commented Mar 16, 2015

@bkrausz not sure what happened, but I pushed the same diff with a different hash and the tests passed.

The tests are pretty flaky running locally.

@bkrausz
Copy link
Contributor

bkrausz commented Mar 16, 2015

no prob, thanks for re-pushing. lgtm! 🐑

danwang added a commit that referenced this pull request Mar 16, 2015
@danwang danwang merged commit 72de6af into master Mar 16, 2015
@danwang danwang deleted the danwang/stripe-account-headers branch March 16, 2015 20:31
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

Successfully merging this pull request may close these issues.

None yet

3 participants