-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: Implement validation for token max order amount against provision bucket size #421
base: main
Are you sure you want to change the base?
Conversation
controllers/accounts/profile_test.go
Outdated
// t.Run("GetSenderProfile", func(t *testing.T) { | ||
// testUser, err := test.CreateTestUser(map[string]interface{}{ | ||
// "email": "[email protected]", | ||
// "scope": "sender", | ||
// }) | ||
// assert.NoError(t, err) | ||
|
||
// sender, err := test.CreateTestSenderProfile(map[string]interface{}{ | ||
// "domain_whitelist": []string{"mydomain.com"}, | ||
// "user_id": testUser.ID, | ||
// }) | ||
// assert.NoError(t, err) | ||
|
||
// apiKeyService := services.NewAPIKeyService() | ||
// _, _, err = apiKeyService.GenerateAPIKey( | ||
// context.Background(), | ||
// nil, | ||
// sender, | ||
// nil, | ||
// ) | ||
// assert.NoError(t, err) | ||
|
||
// accessToken, _ := token.GenerateAccessJWT(testUser.ID.String(), "sender") | ||
// headers := map[string]string{ | ||
// "Authorization": "Bearer " + accessToken, | ||
// } | ||
// res, err := test.PerformRequest(t, "GET", "/settings/sender", nil, headers, router) | ||
// assert.NoError(t, err) | ||
|
||
// // Assert the response body | ||
// assert.Equal(t, http.StatusOK, res.Code) | ||
// var response struct { | ||
// Data types.SenderProfileResponse | ||
// Message string | ||
// } | ||
// err = json.Unmarshal(res.Body.Bytes(), &response) | ||
// assert.NoError(t, err) | ||
// assert.Equal(t, "Profile retrieved successfully", response.Message) | ||
// assert.NotNil(t, response.Data, "response.Data is nil") | ||
// assert.Greater(t, len(response.Data.Tokens), 0) | ||
// assert.Contains(t, response.Data.WebhookURL, "https://example.com") | ||
|
||
// }) | ||
|
||
} |
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.
remove comment if not needed
controllers/accounts/profile_test.go
Outdated
Network: "bitcoin", | ||
Address: "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", | ||
}, |
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.
use an evm network as example
polygon
and a 0x....
address
controllers/accounts/profile_test.go
Outdated
Network: "bitcoin", | ||
Address: "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", | ||
}, |
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.
same as below
controllers/accounts/profile_test.go
Outdated
Network: "bitcoin", | ||
Address: "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", | ||
}, |
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.
same as below
controllers/accounts/profile_test.go
Outdated
Network: "bitcoin", | ||
Address: "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", | ||
}, |
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.
same as below
Description
This PR introduces validation for the provider's token max order amount in relation to the largest provision bucket size for their local currency. When updating a token's max order amount, the system now ensures that the amount, converted to the provider's local currency, does not exceed the size of the largest provision bucket. If the amount exceeds the largest bucket, or if no provision buckets exist for the provider's currency, the request is rejected with an appropriate error message.
References
closes #399
Testing
Checklist
main