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

account.GetByID: LegalEntity not set #580

Closed
nd2s opened this issue Jun 8, 2018 · 6 comments · Fixed by #582
Closed

account.GetByID: LegalEntity not set #580

nd2s opened this issue Jun 8, 2018 · 6 comments · Fixed by #582
Assignees

Comments

@nd2s
Copy link

nd2s commented Jun 8, 2018

In the latest version (32.4.0 / a90cccc) Account.LegalEntity is not set when getting an account.

acc, err := account.GetByID(accountID, nil)
if err != nil {
	panic(err)
}
fmt.Println(acc.LegalEntity)

=> (*stripe.LegalEntity)(nil)

It's there when fetching with curl.

@remi-stripe
Copy link
Contributor

@nd2s That code works for me. Do you have an example account id where it's not working?

@remi-stripe remi-stripe self-assigned this Jun 8, 2018
@nd2s
Copy link
Author

nd2s commented Jun 8, 2018

@remi-stripe Full example without key:

package main

import (
	"fmt"
	"github.com/stripe/stripe-go"
	"github.com/stripe/stripe-go/account"
)

func main() {
	stripe.Key = "sk_test_xxx"

	accountID := "acct_1CKmBeBlVKHXDelz"
	acc, err := account.GetByID(accountID, nil)
	if err != nil {
		panic(err)
	}
	fmt.Println(acc.LegalEntity)
}

Output:

$ go run test.go
2018/06/08 21:49:47 Requesting GET api.stripe.com/v1/accounts/acct_1CKmBeBlVKHXDelz
<nil>

Is that enough info?

@remi-stripe
Copy link
Contributor

@nd2s I can't seem to reproduce on my end unfortunately. Can you modify the library's stripe.go file here to add an extra line just before this that logs the raw response?

fmt.Printf("raw response body = %+v\n", string(resBody))

@nd2s
Copy link
Author

nd2s commented Jun 9, 2018

@remi-stripe

2018/06/09 10:48:35 Requesting GET api.stripe.com/v1/accounts/acct_1CKmBeBlVKHXDelz
raw response body = {
  "id": "acct_1CKmBeBlVKHXDelz",
  "object": "account",
  "business_name": "TestComp",
  "business_url": null,
  "charges_enabled": true,
  "country": "AT",
  "created": 1524657206,
  "debit_negative_balances": false,
  "decline_charge_on": {
    "avs_failure": false,
    "cvc_failure": false
  },
  "default_currency": "eur",
  "details_submitted": true,
  "display_name": null,
  "email": null,
  "external_accounts": {
    "object": "list",
    "data": [
      {
        "id": "ba_1CanQLBlVKHXDelzCEmQzP7H",
        "object": "bank_account",
        "account": "acct_1CKmBeBlVKHXDelz",
        "account_holder_name": "TestComp",
        "account_holder_type": "company",
        "bank_name": "STRIPE TEST BANK",
        "country": "AT",
        "currency": "eur",
        "default_for_currency": true,
        "fingerprint": "UJawJofMDpHzNPRV",
        "last4": "3000",
        "metadata": {},
        "routing_number": "110000000",
        "status": "new"
      }
    ],
    "has_more": false,
    "total_count": 1,
    "url": "/v1/accounts/acct_1CKmBeBlVKHXDelz/external_accounts"
  },
  "legal_entity": {
    "additional_owners": [
      {
        "address": {
          "city": "wien",
          "country": "AT",
          "line1": "huberstrasse 12",
          "line2": null,
          "postal_code": "1010",
          "state": null
        },
        "dob": {
          "day": 1,
          "month": 1,
          "year": 1980
        },
        "first_name": "hansi",
        "last_name": "huber",
        "maiden_name": null,
        "personal_id_number_provided": true,
        "verification": {
          "details": null,
          "details_code": null,
          "document": null,
          "document_back": null,
          "status": "pending"
        }
      },
      {
        "address": {
          "city": "wien",
          "country": "AT",
          "line1": "gruberweg 12",
          "line2": null,
          "postal_code": "1010",
          "state": null
        },
        "dob": {
          "day": 1,
          "month": 1,
          "year": 1970
        },
        "first_name": "hubsi",
        "last_name": "gruber",
        "maiden_name": null,
        "personal_id_number_provided": true,
        "verification": {
          "details": null,
          "details_code": null,
          "document": null,
          "document_back": null,
          "status": "pending"
        }
      }
    ],
    "address": {
      "city": "wien",
      "country": "AT",
      "line1": "hubselweg 12",
      "line2": null,
      "postal_code": "1010",
      "state": null
    },
    "business_name": "TestComp",
    "business_tax_id_provided": true,
    "business_vat_id_provided": true,
    "dob": {
      "day": 1,
      "month": 1,
      "year": 1990
    },
    "first_name": "kunibert",
    "last_name": "hotzenplotz",
    "personal_address": {
      "city": "wien",
      "country": "AT",
      "line1": "hubselweg 12",
      "line2": null,
      "postal_code": "1010",
      "state": null
    },
    "personal_id_number_provided": true,
    "phone_number": "06603101111",
    "ssn_last_4_provided": true,
    "type": "company",
    "verification": {
      "details": "Testmode: verified status from magic image upload",
      "details_code": null,
      "document": "file_1CanR5HylGtJUMUaA60ZoU8J",
      "document_back": null,
      "status": "verified"
    }
  },
  "metadata": {},
  "payout_schedule": {
    "delay_days": 7,
    "interval": "weekly",
    "weekly_anchor": "tuesday"
  },
  "payout_statement_descriptor": null,
  "payouts_enabled": true,
  "product_description": null,
  "statement_descriptor": "",
  "support_email": null,
  "support_phone": null,
  "timezone": "Etc/UTC",
  "tos_acceptance": {
    "date": 1528410309,
    "ip": "78.3.2.1",
    "user_agent": "Mozilla/5.0"
  },
  "type": "custom",
  "verification": {
    "disabled_reason": null,
    "due_by": null,
    "fields_needed": []
  }
}

<nil>

I also removed the vendor dir, cleared the glide cache and installed the dependencies again. Didn't help.

@remi-stripe
Copy link
Contributor

@nd2s Thanks a lot for the extra details, this helped reproduce the error. I was able to find the mistake I make in v32 and pushed a fix in #582

@brandur-stripe
Copy link
Contributor

Remi's fix released in 32.4.1.

nadaismail-stripe pushed a commit that referenced this issue Oct 18, 2024
* added missing fields to open spec/ updated parsing to iterate over nested sub-hashes

* updated open spec and parsing based on PR feedback

* removing garbage fields

* adding nested subhashes back

* updating lets to vars per comments
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 a pull request may close this issue.

3 participants