Fixed billing fees unreachable error propagation. Added USDT ledger creation. Fixed ledger boundaries operation types
This commit is contained in:
71
api/pkg/discovery/operations.go
Normal file
71
api/pkg/discovery/operations.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package discovery
|
||||
|
||||
import "strings"
|
||||
|
||||
const (
|
||||
OperationDiscoveryLookup = "discovery.lookup"
|
||||
|
||||
OperationDocumentsBatchResolve = "documents.batch_resolve"
|
||||
OperationDocumentsGet = "documents.get"
|
||||
OperationFeeCalc = "fee.calc"
|
||||
OperationNotifySend = "notify.send"
|
||||
OperationFXQuote = "fx.quote"
|
||||
OperationFXIngest = "fx.ingest"
|
||||
|
||||
OperationPaymentInitiate = "payment.initiate"
|
||||
OperationPaymentQuote = "payment.quote"
|
||||
OperationPaymentMultiQuote = "payment.multiquote"
|
||||
OperationPaymentMethodsManage = "payment_methods.manage"
|
||||
OperationPaymentMethodsRead = "payment_methods.read"
|
||||
|
||||
OperationBalanceRead = "balance.read"
|
||||
|
||||
OperationLedgerDebit = "ledger.debit"
|
||||
OperationLedgerCredit = "ledger.credit"
|
||||
OperationLedgerTransfer = "ledger.transfer"
|
||||
OperationLedgerFX = "ledger.fx"
|
||||
OperationExternalDebit = "external.debit"
|
||||
OperationExternalCredit = "external.credit"
|
||||
|
||||
OperationSend = "send"
|
||||
OperationFee = "fee"
|
||||
OperationObserveConfirm = "observe.confirm"
|
||||
OperationFXConvert = "fx.convert"
|
||||
)
|
||||
|
||||
// NormalizeOperation canonicalizes an operation string for comparisons.
|
||||
func NormalizeOperation(value string) string {
|
||||
return strings.ToLower(strings.TrimSpace(value))
|
||||
}
|
||||
|
||||
// HasAnyOperation reports whether ops contains any of required operations.
|
||||
func HasAnyOperation(ops []string, required []string) bool {
|
||||
if len(required) == 0 {
|
||||
return true
|
||||
}
|
||||
for _, op := range ops {
|
||||
normalized := NormalizeOperation(op)
|
||||
if normalized == "" {
|
||||
continue
|
||||
}
|
||||
for _, target := range required {
|
||||
if normalized == NormalizeOperation(target) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// LedgerServiceOperations returns canonical operations announced by ledger.
|
||||
func LedgerServiceOperations() []string {
|
||||
return []string{
|
||||
OperationBalanceRead,
|
||||
OperationLedgerDebit,
|
||||
OperationLedgerCredit,
|
||||
OperationLedgerTransfer,
|
||||
OperationLedgerFX,
|
||||
OperationExternalCredit,
|
||||
OperationExternalDebit,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user