More stripe integration2 #6734

Closed
mayeaux wants to merge 50 commits from more-stripe-integration2 into master
2 changed files with 18 additions and 28 deletions
Showing only changes of commit 35c73b00f8 - Show all commits

View file

@ -31,24 +31,12 @@ type Props = {
accountDetails: any, accountDetails: any,
}; };
export const WALLET_CONSOLIDATE_UTXOS = 400;
const LARGE_WALLET_BALANCE = 100;
const WalletBalance = (props: Props) => { const WalletBalance = (props: Props) => {
const { const {
balance,
claimsBalance, claimsBalance,
supportsBalance, supportsBalance,
tipsBalance, tipsBalance,
doOpenModal, doOpenModal,
hasSynced,
doUtxoConsolidate,
doFetchUtxoCounts,
consolidatingUtxos,
consolidateIsPending,
massClaimingTips,
massClaimIsPending,
utxoCounts,
accountDetails, accountDetails,
} = props; } = props;

View file

@ -32,31 +32,23 @@ type Props = {
utxoCounts: { [string]: number }, utxoCounts: { [string]: number },
accountDetails: any, accountDetails: any,
transactions: any, transactions: any,
totalTippedAmount: number,
}; };
export const WALLET_CONSOLIDATE_UTXOS = 400;
const LARGE_WALLET_BALANCE = 100;
const WalletBalance = (props: Props) => { const WalletBalance = (props: Props) => {
const { const {
balance,
claimsBalance,
supportsBalance,
tipsBalance,
doOpenModal,
hasSynced,
doUtxoConsolidate,
doFetchUtxoCounts,
consolidatingUtxos,
consolidateIsPending,
massClaimingTips,
massClaimIsPending,
utxoCounts,
} = props; } = props;
// receive transactions from parent component // receive transactions from parent component
let accountTransactions = props.transactions; let accountTransactions = props.transactions;
// let totalTippedAmount = props.totalTippedAmount;
// totalTippedAmount = 0;
// reverse so most recent payments come first // reverse so most recent payments come first
if(accountTransactions){ if(accountTransactions){
accountTransactions = accountTransactions.reverse(); accountTransactions = accountTransactions.reverse();
@ -66,6 +58,7 @@ const WalletBalance = (props: Props) => {
const [accountStatusResponse, setAccountStatusResponse] = React.useState(); const [accountStatusResponse, setAccountStatusResponse] = React.useState();
const [paymentHistoryTransactions, setPaymentHistoryTransactions] = React.useState(); const [paymentHistoryTransactions, setPaymentHistoryTransactions] = React.useState();
const [subscriptions, setSubscriptions] = React.useState(); const [subscriptions, setSubscriptions] = React.useState();
const [totalTippedAmount, setTotalTippedAmount] = React.useState(0);
const [lastFour, setLastFour] = React.useState(); const [lastFour, setLastFour] = React.useState();
@ -99,6 +92,14 @@ const WalletBalance = (props: Props) => {
const customerStatusResponse = await getCustomerStatus(); const customerStatusResponse = await getCustomerStatus();
let totalTippedAmount = 0;
for(const transaction of response){
totalTippedAmount = totalTippedAmount + transaction.tipped_amount
}
setTotalTippedAmount(totalTippedAmount / 100);
setLastFour(customerStatusResponse.PaymentMethods[0].card.last4); setLastFour(customerStatusResponse.PaymentMethods[0].card.last4);
if (response.length > 10) response.length = 10; if (response.length > 10) response.length = 10;
@ -124,6 +125,7 @@ const WalletBalance = (props: Props) => {
title={__('Payment History')} title={__('Payment History')}
body={ body={
<> <>
<h2>{totalTippedAmount}</h2>
<div className="table__wrapper"> <div className="table__wrapper">
<table className="table table--transactions"> <table className="table table--transactions">
<thead> <thead>