Fixed billing fees unreachable error propagation. Added USDT ledger creation. Fixed ledger boundaries operation types
This commit is contained in:
@@ -76,7 +76,7 @@ func (s *Service) fxResponder(_ context.Context, req *ledgerv1.FXRequest) gsresp
|
||||
// Check for duplicate idempotency key
|
||||
existingEntry, err := s.storage.JournalEntries().GetByIdempotencyKey(ctx, orgRef, req.IdempotencyKey)
|
||||
if err == nil && existingEntry != nil {
|
||||
recordDuplicateRequest("fx")
|
||||
recordDuplicateRequest(journalEntryTypeFX)
|
||||
logger.Info("Duplicate FX request (idempotency)",
|
||||
zap.String("existingEntryID", existingEntry.GetID().Hex()))
|
||||
return &ledgerv1.PostResponse{
|
||||
@@ -244,15 +244,15 @@ func (s *Service) fxResponder(_ context.Context, req *ledgerv1.FXRequest) gsresp
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
recordJournalEntryError("fx", "transaction_failed")
|
||||
recordJournalEntryError(journalEntryTypeFX, journalEntryErrorTransactionFailed)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fromAmountFloat, _ := fromAmount.Float64()
|
||||
toAmountFloat, _ := toAmount.Float64()
|
||||
recordTransactionAmount(req.FromMoney.Currency, "fx", fromAmountFloat)
|
||||
recordTransactionAmount(req.ToMoney.Currency, "fx", toAmountFloat)
|
||||
recordJournalEntry("fx", "success", 0)
|
||||
recordTransactionAmount(req.FromMoney.Currency, journalEntryTypeFX, fromAmountFloat)
|
||||
recordTransactionAmount(req.ToMoney.Currency, journalEntryTypeFX, toAmountFloat)
|
||||
recordJournalEntry(journalEntryTypeFX, journalEntryStatusSuccess, 0)
|
||||
return result.(*ledgerv1.PostResponse), nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user