// @flow import React from 'react'; import Button from 'component/button'; import { Lbryio } from 'lbryinc'; import moment from 'moment'; import { STRIPE_PUBLIC_KEY } from 'config'; let stripeEnvironment = 'test'; // if the key contains pk_live it's a live key // update the environment for the calls to the backend to indicate which environment to hit if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) { stripeEnvironment = 'live'; } type Props = { accountDetails: any, transactions: any, }; const WalletBalance = (props: Props) => { // receive transactions from parent component const { transactions: accountTransactions } = props; const [lastFour, setLastFour] = React.useState(); function getCustomerStatus() { return Lbryio.call( 'customer', 'status', { environment: stripeEnvironment, }, 'post' ); } // TODO: this is actually incorrect, last4 should be populated based on the transaction not the current customer details React.useEffect(() => { (async function() { const customerStatusResponse = await getCustomerStatus(); const lastFour = customerStatusResponse.PaymentMethods && customerStatusResponse.PaymentMethods.length && customerStatusResponse.PaymentMethods[0].card.last4; setLastFour(lastFour); })(); }, []); return ( <>
{__('Date')} | {<>{__('Receiving Channel Name')}>} | {__('Tip Location')} | {__('Amount (USD)')} | {__('Card Last 4')} | {__('Anonymous')} |
---|---|---|---|---|---|
{moment(transaction.created_at).format('LLL')} | {/* receiving channel name */}{/* link to content or channel */} | {/* how much tipped */} | ${transaction.tipped_amount / 100} | {/* TODO: this is incorrect need it per transactions not per user */} {/* last four of credit card */}{lastFour} | {/* whether tip is anonymous or not */}{transaction.private_tip ? 'Yes' : 'No'} |
No Transactions
}