@@ -15,12 +15,11 @@ import (
1515
1616 "github.com/code-payments/flipcash2-server/auth"
1717 "github.com/code-payments/flipcash2-server/model"
18+ ocp_query "github.com/code-payments/ocp-server/database/query"
1819 ocp_common "github.com/code-payments/ocp-server/ocp/common"
1920 ocp_data "github.com/code-payments/ocp-server/ocp/data"
2021 ocp_intent "github.com/code-payments/ocp-server/ocp/data/intent"
2122 ocp_transaction "github.com/code-payments/ocp-server/ocp/rpc/transaction"
22- ocp_currency "github.com/code-payments/ocp-server/currency"
23- ocp_query "github.com/code-payments/ocp-server/database/query"
2423 "github.com/code-payments/ocp-server/pointer"
2524)
2625
@@ -275,6 +274,8 @@ func (s *Server) toLocalizedNotifications(ctx context.Context, log *zap.Logger,
275274 if ! isClaimed {
276275 notification .State = activitypb .NotificationState_NOTIFICATION_STATE_PENDING
277276 }
277+ } else if intentMetadata .IsSwapSell {
278+ notification .AdditionalMetadata = & activitypb.Notification_SoldCrypto {SoldCrypto : & activitypb.SoldCryptoNotificationMetadata {}}
278279 } else if intentMetadata .IsWithdrawal {
279280 notification .AdditionalMetadata = & activitypb.Notification_WithdrewCrypto {WithdrewCrypto : & activitypb.WithdrewCryptoNotificationMetadata {}}
280281 } else {
@@ -308,16 +309,21 @@ func (s *Server) toLocalizedNotifications(ctx context.Context, log *zap.Logger,
308309 intentMetadata := intentRecord .ExternalDepositMetadata
309310
310311 // Hide small, potentially spam deposits
311- if intentMetadata .UsdMarketValue < 0.01 {
312+ if ! intentMetadata . IsSwapBuy && intentMetadata .UsdMarketValue < 0.01 {
312313 continue
313314 }
314315
315316 notification .PaymentAmount = & commonpb.CryptoPaymentAmount {
316- Currency : string (ocp_currency . USD ),
317- NativeAmount : intentMetadata .UsdMarketValue ,
317+ Currency : string (intentMetadata . ExchangeCurrency ),
318+ NativeAmount : intentMetadata .NativeAmount ,
318319 Quarks : intentMetadata .Quantity ,
319320 }
320- notification .AdditionalMetadata = & activitypb.Notification_DepositedCrypto {DepositedCrypto : & activitypb.DepositedCryptoNotificationMetadata {}}
321+
322+ if intentMetadata .IsSwapBuy {
323+ notification .AdditionalMetadata = & activitypb.Notification_BoughtCrypto {BoughtCrypto : & activitypb.BoughtCryptoNotificationMetadata {}}
324+ } else {
325+ notification .AdditionalMetadata = & activitypb.Notification_DepositedCrypto {DepositedCrypto : & activitypb.DepositedCryptoNotificationMetadata {}}
326+ }
321327
322328 default :
323329 continue
0 commit comments