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
satellite/payments: token deposit #3283
satellite/payments: token deposit #3283
Conversation
…ents_token_deposit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes to be applied right away through Github code snippet suggestions.
The rest of the comments are questions.
|
||
key := u.Query().Get("key") | ||
if key == "" { | ||
return "", errs.New("no key value found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's good to have a class or a sentinel error value for this matter.
) | ||
|
||
// GetTransacationKeyFromURL parses provided raw url string | ||
// and extracts authorization key from it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add to this documentation that an error is returned if the URL is from an invalid format or it doesn't have an authorization key.
In case that you create the commented error class or sentinel error value, mention that in case that such error is returned when there is no authorization key.
func (db *coinpaymentsTransactions) Insert(ctx context.Context, tx stripecoinpayments.Transaction) (*stripecoinpayments.Transaction, error) { | ||
amount, err := tx.Amount.GobEncode() | ||
if err != nil { | ||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we have to wrap all the errors returned by the methods of this type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have a wrapper for all dbx
errors? If that is the policy we follow that I will add another error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking dbx
autogenerated code could be because there is an option to set a wrap error function. I don't know if it's set, I suppose that it's
Anyway, this one and some others of this function aren't errors returned by DBX so they should be wrapped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, yeah you are right
|
||
// TransactionStatus defines allowed statuses | ||
// for deposit transactions. | ||
type TransactionStatus string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering, for consistency reasons, if this type shouldn't be an int
like
type Status int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coinpayments
is an implementation detail, it could possibly be different provider for token payment, with different status type. My idea is that it might be easier for caller to work with string value of statuses, but yeah it might be no difference actually.
Co-Authored-By: Ivan Fraixedes <ifcdev@gmail.com>
Co-Authored-By: Ivan Fraixedes <ifcdev@gmail.com>
Co-Authored-By: Ivan Fraixedes <ifcdev@gmail.com>
Co-Authored-By: Ivan Fraixedes <ifcdev@gmail.com>
Co-Authored-By: Ivan Fraixedes <ifcdev@gmail.com>
…ents_token_deposit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an improvement in the doc function comment but it's good to go.
Co-Authored-By: Ivan Fraixedes <ifcdev@gmail.com>
…ents_token_deposit
"storj.io/storj/satellite/payments/coinpayments" | ||
) | ||
|
||
// hack to ensure that storjTokens implements payments.StorjTokens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not really an hack, since it's so widely used :D.
|
||
transactions := db.CoinpaymentsTransactions() | ||
|
||
t.Run("test insert", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to rewrite "test"
, since it's running in a test, it's obviously a test :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense)
What: add functionality to deposit tokens
Why:
Please describe the tests:
Please describe the performance impact:
Code Review Checklist (to be filled out by reviewer)