({
transaction,
user,
}: {
transaction: UserTransaction;
user: LoggedUser;
})
| 14 | const QUEST_REWARD_REFERENCE_PREFIX = 'quest_reward:'; |
| 15 | |
| 16 | export const getTransactionType = ({ |
| 17 | transaction, |
| 18 | user, |
| 19 | }: { |
| 20 | transaction: UserTransaction; |
| 21 | user: LoggedUser; |
| 22 | }): TransactionItemType => { |
| 23 | if (!transaction.sender && !transaction.product) { |
| 24 | return 'purchase'; |
| 25 | } |
| 26 | |
| 27 | if (transaction.receiver.id === user.id) { |
| 28 | return 'receive'; |
| 29 | } |
| 30 | |
| 31 | if (transaction.sender?.id === user.id) { |
| 32 | return 'send'; |
| 33 | } |
| 34 | |
| 35 | return 'unknown'; |
| 36 | }; |
| 37 | |
| 38 | export const getTransactionLabel = ({ |
| 39 | transaction, |
no outgoing calls
no test coverage detected