Documentation ¶
Index ¶
- Constants
- Variables
- func SendCashTransactionsExchangeMessage(ctx context.Context, data code_data.Provider, intentRecord *intent.Record) error
- func SendChatMessage(ctx context.Context, data code_data.Provider, chatTitle string, ...) (canPushMessage bool, err error)
- func SendCodeTeamMessage(ctx context.Context, data code_data.Provider, receiver *common.Account, ...) (bool, error)
- func SendKinPurchasesMessage(ctx context.Context, data code_data.Provider, receiver *common.Account, ...) (bool, error)
- func ToBlockchainMessage(signature string, sender *common.Account, ...) (*chatpb.ChatMessage, error)
- func ToKinAvailableForUseMessage(signature string, ts time.Time, ...) (*chatpb.ChatMessage, error)
- func ToReferralBonusMessage(intentRecord *intent.Record) (*chatpb.ChatMessage, error)
- func ToUsdcDepositedMessage(signature string, ts time.Time) (*chatpb.ChatMessage, error)
- func ToWelcomeBonusMessage(intentRecord *intent.Record) (*chatpb.ChatMessage, error)
- type MessageWithOwner
Constants ¶
const ( CashTransactionsName = "Cash Transactions" // Renamed to Cash Payments on client CodeTeamName = "Code Team" KinPurchasesName = "Kin Purchases" PaymentsName = "Payments" // Renamed to Web Payments on client // Test chats used for unit/integration testing only TestCantMuteName = "TestCantMute" TestCantUnsubscribeName = "TestCantUnsubscribe" )
Variables ¶
var ( InternalChatProperties = map[string]struct { TitleLocalizationKey string CanMute bool CanUnsubscribe bool }{ CashTransactionsName: { TitleLocalizationKey: localization.ChatTitleCashTransactions, CanMute: true, CanUnsubscribe: false, }, CodeTeamName: { TitleLocalizationKey: localization.ChatTitleCodeTeam, CanMute: true, CanUnsubscribe: false, }, KinPurchasesName: { TitleLocalizationKey: localization.ChatTitleKinPurchases, CanMute: true, CanUnsubscribe: false, }, PaymentsName: { TitleLocalizationKey: localization.ChatTitlePayments, CanMute: true, CanUnsubscribe: false, }, TestCantMuteName: { TitleLocalizationKey: "n/a", CanMute: false, CanUnsubscribe: true, }, TestCantUnsubscribeName: { TitleLocalizationKey: "n/a", CanMute: true, CanUnsubscribe: false, }, } )
Functions ¶
func SendCashTransactionsExchangeMessage ¶
func SendCashTransactionsExchangeMessage(ctx context.Context, data code_data.Provider, intentRecord *intent.Record) error
SendCashTransactionsExchangeMessage sends a message to the Cash Transactions chat with exchange data content related to the submitted intent. Intents that don't belong in the Cash Transactions chat will be ignored.
Note: Tests covered in SubmitIntent history tests
todo: How are we handling relationship account flows?
func SendChatMessage ¶
func SendChatMessage( ctx context.Context, data code_data.Provider, chatTitle string, chatType chat.ChatType, isVerifiedChat bool, receiver *common.Account, protoMessage *chatpb.ChatMessage, isSilentMessage bool, ) (canPushMessage bool, err error)
SendChatMessage sends a chat message to a receiving owner account.
Note: This function is not responsible for push notifications. This method might be called within the context of a DB transaction, which might have unrelated failures. A hint as to whether a push should be sent is provided.
func SendCodeTeamMessage ¶ added in v1.3.0
func SendCodeTeamMessage(ctx context.Context, data code_data.Provider, receiver *common.Account, chatMessage *chatpb.ChatMessage) (bool, error)
SendCodeTeamMessage sends a message to the Code Team chat.
func SendKinPurchasesMessage ¶ added in v1.6.0
func SendKinPurchasesMessage(ctx context.Context, data code_data.Provider, receiver *common.Account, chatMessage *chatpb.ChatMessage) (bool, error)
SendKinPurchasesMessage sends a message to the Kin Purchases chat.
func ToBlockchainMessage ¶
func ToBlockchainMessage( signature string, sender *common.Account, blockchainMessage *thirdparty.NaclBoxBlockchainMessage, ts time.Time, ) (*chatpb.ChatMessage, error)
ToBlockchainMessage takes a raw blockchain message and turns it into a protobuf chat message that can be injected into the merchant domain's chat.
func ToKinAvailableForUseMessage ¶ added in v1.3.0
func ToKinAvailableForUseMessage(signature string, ts time.Time, purchases ...*transactionpb.ExchangeDataWithoutRate) (*chatpb.ChatMessage, error)
ToKinAvailableForUseMessage turns details of a USDC swap transaction into a chat message to be inserted into the Kin Purchases chat.
func ToReferralBonusMessage ¶
func ToReferralBonusMessage(intentRecord *intent.Record) (*chatpb.ChatMessage, error)
ToReferralBonusMessage turns the intent record into a referral bonus chat message to be inserted into the Code Team chat.
func ToUsdcDepositedMessage ¶ added in v1.3.0
ToUsdcDepositedMessage turns details of a USDC deposit transaction into a chat message to be inserted into the Kin Purchases chat.
func ToWelcomeBonusMessage ¶
func ToWelcomeBonusMessage(intentRecord *intent.Record) (*chatpb.ChatMessage, error)
ToWelcomeBonusMessage turns the intent record into a welcome bonus chat message to be inserted into the Code Team chat.
Types ¶
type MessageWithOwner ¶ added in v1.1.4
type MessageWithOwner struct { Owner *common.Account Title string Message *chatpb.ChatMessage }
func SendMerchantExchangeMessage ¶
func SendMerchantExchangeMessage(ctx context.Context, data code_data.Provider, intentRecord *intent.Record, actionRecords []*action.Record) ([]*MessageWithOwner, error)
SendMerchantExchangeMessage sends a message to the merchant's chat with exchange data content related to the submitted intent. Intents that don't belong in the merchant chat will be ignored. The set of chat messages that should be pushed are returned.
Note: Tests covered in SubmitIntent history tests