paygate
paygate copied to clipboard
spike: transfer limits per Namespace, Customer, and Account
PayGate Version: v0.8.0
Describe the problem Since PayGate supports multiple Namespaces each needs to have dynamic Transfer limits. Also, Customers and Accounts within a Namespace need their own limits.
This can be determined by underwriting, business / risk decisions, or other factors. If PayGate supports dynamic configuration (and a file based config?) to view/modify these it should support the dynamic needs of businesses.
What did you expect to see? HTTP endpoints for modifying these limits on a Namespace, Customer, and Account basis. Also required is viewing their current usage.
Initial thoughts, so feedback is appreciated.
I don't think we should support both file configured limits and HTTP configured limits. HTTP limits would be stored in the database.
File Config
If we setup a map[string]config.FixedLimits
for each namespace
then PayGate could use them as overrides from the instance-wide limits.
transfers:
limits:
// "fixed" is a key here for instance-wide limits
namespace:
"<namespace>":
softLimit: "<string>"
hardLimit: "<string>"
HTTP Endpoints
transfers:
limits:
http:
database: true # Uses the root-level database config, only enable endpoints if this is `true`.
This would setup endpoints on the admin HTTP server:
Get Namespace Limits
-
GET /namespaces/:namespace:/limits
{
"softLimit": "<string>",
"hardLimit": "<string>"
}
TODO: Should we offer the existing usage?
Update Namespace Limits
-
PUT /namespaces/:namespace:/limits
{
"softLimit": "<string>",
"hardLimit": "<string>"
}
Remove Namesapce Limit Overrides
-
DELETE /namespaces/:namespace:/limits
Removes the existing limit override for thetenantID
.