These are chat archives for synrc/n2o

27th
Dec 2016
Matti Katila
@mudyc
Dec 27 2016 13:03

this is not related to n2o but I would like to know the possible solution:

stripe_token{id = Token} = stripe:token_create("4242424242424242", 12, 2021, 123, [], [], [], [], [], []).

  • 251: record stripe_bank_account undefined

So why does erlang's dynamic type system give the error in this case? And how to fix it.

rl(stripe_token).
-record(stripe_token,{id :: token_id(),
used :: boolean(),
livemode :: boolean(),
type :: token_type(),
bank_account :: #stripe_bank_account{},
card :: #stripe_card{}}).

And why this works?

Token = stripe:token_create("4242424242424242", 12, 2021, 123, [], [], [], [], [], []).
{stripe_token,<<"tok_19VFGl2eZvKYlo2CQKAZoLXO">>,false,
false,undefined,<<"Not Returned by API">>,
{stripe_card,null,<<"4242">>,2021,12,<<"Visa">>,unchecked,
null,null,<<"US">>}}

But when I try to access this Token#stripe_token.id it gives the original error.

  • 251: record stripe_bank_account undefined
Matti Katila
@mudyc
Dec 27 2016 15:16
I think part of the issue is because of in OTP19 'undefined' is not inserted automatically to type values anymore.
Matti Katila
@mudyc
Dec 27 2016 19:14
naah, upgrade from 19.0 to 19.1 solved the issue