diff --git a/changelog/add-7591-missing-columns-export-csv b/changelog/add-7591-missing-columns-export-csv new file mode 100644 index 00000000000..668644d2cfc --- /dev/null +++ b/changelog/add-7591-missing-columns-export-csv @@ -0,0 +1,4 @@ +Significance: minor +Type: add + +Introduce Customer currency, Deposit currency, Amount in Customer Currency and Deposit ID columns to the Transaction list UI and CSV export diff --git a/changelog/cleanup-redundant-script-enqueueing b/changelog/cleanup-redundant-script-enqueueing new file mode 100644 index 00000000000..20c952d459e --- /dev/null +++ b/changelog/cleanup-redundant-script-enqueueing @@ -0,0 +1,4 @@ +Significance: minor +Type: dev + +Cleanup enqueueing of the scripts which were removed diff --git a/client/transactions/list/index.tsx b/client/transactions/list/index.tsx index 8b66096a60c..931712821a9 100644 --- a/client/transactions/list/index.tsx +++ b/client/transactions/list/index.tsx @@ -144,8 +144,11 @@ const getColumns = ( }, { key: 'date', - label: __( 'Date / Time', 'woocommerce-payments' ), - screenReaderLabel: __( 'Date and time', 'woocommerce-payments' ), + label: __( 'Date / Time (UTC)', 'woocommerce-payments' ), + screenReaderLabel: __( + 'Date and time in UTC', + 'woocommerce-payments' + ), required: true, isLeftAligned: true, defaultOrder: 'desc', @@ -167,10 +170,41 @@ const getColumns = ( required: true, isLeftAligned: true, }, + { + key: 'customer_currency', + label: __( 'Paid Currency', 'woocommerce-payments' ), + screenReaderLabel: __( + 'Customer Currency', + 'woocommerce-payments' + ), + isSortable: true, + visible: false, + }, + { + key: 'customer_amount', + label: __( 'Amount Paid', 'woocommerce-payments' ), + screenReaderLabel: __( + 'Amount in Customer Currency', + 'woocommerce-payments' + ), + isNumeric: true, + isSortable: true, + visible: false, + }, + { + key: 'deposit_currency', + label: __( 'Deposit Currency', 'woocommerce-payments' ), + screenReaderLabel: __( 'Deposit Currency', 'woocommerce-payments' ), + isSortable: true, + visible: false, + }, { key: 'amount', label: __( 'Amount', 'woocommerce-payments' ), - screenReaderLabel: __( 'Amount', 'woocommerce-payments' ), + screenReaderLabel: __( + 'Amount in Deposit Curency', + 'woocommerce-payments' + ), isNumeric: true, isSortable: true, }, @@ -205,8 +239,8 @@ const getColumns = ( }, { key: 'source', - label: __( 'Source', 'woocommerce-payments' ), - screenReaderLabel: __( 'Source', 'woocommerce-payments' ), + label: __( 'Payment Method', 'woocommerce-payments' ), + screenReaderLabel: __( 'Payment Method', 'woocommerce-payments' ), cellClassName: 'is-center-aligned', }, { @@ -236,6 +270,14 @@ const getColumns = ( visible: false, isLeftAligned: true, }, + includeDeposit && { + key: 'deposit_id', + label: __( 'Deposit ID', 'woocommerce-payments' ), + screenReaderLabel: __( 'Deposit ID', 'woocommerce-payments' ), + cellClassName: 'deposit', + isLeftAligned: true, + visible: false, + }, includeDeposit && { key: 'deposit', label: __( 'Deposit date', 'woocommerce-payments' ), @@ -371,6 +413,17 @@ export const TransactionsList = ( ), }; }; + const formatCustomerAmount = () => { + return { + value: formatExportAmount( + txn.customer_amount, + txn.customer_currency + ), + display: clickable( + formatCurrency( txn.customer_amount, txn.customer_currency ) + ), + }; + }; const isFinancingType = -1 !== @@ -464,6 +517,15 @@ export const TransactionsList = ( value: txn.customer_country, display: clickable( txn.customer_country ), }, + customer_currency: { + value: txn.customer_currency.toUpperCase(), + display: clickable( txn.customer_currency.toUpperCase() ), + }, + customer_amount: formatCustomerAmount(), + deposit_currency: { + value: txn.currency.toUpperCase(), + display: clickable( txn.currency.toUpperCase() ), + }, amount: formatAmount(), // fees should display as negative. The format $-9.99 is determined by WC-Admin fees: formatFees(), @@ -477,6 +539,10 @@ export const TransactionsList = ( value: calculateRiskMapping( txn.risk_level ), display: clickable( riskLevel ), }, + deposit_id: { + value: txn.deposit_id, + display: txn.deposit_id, + }, deposit: { value: txn.available_on, display: deposit }, deposit_status: { value: depositStatus, diff --git a/client/transactions/list/test/__snapshots__/index.tsx.snap b/client/transactions/list/test/__snapshots__/index.tsx.snap index 35b86a155f7..c7bfca77b45 100644 --- a/client/transactions/list/test/__snapshots__/index.tsx.snap +++ b/client/transactions/list/test/__snapshots__/index.tsx.snap @@ -248,19 +248,19 @@ exports[`Transactions list renders correctly when can filter by several currenci - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method { } ); test( 'sorts by default field date', () => { - sortBy( 'Date and time' ); + sortBy( 'Date and time in UTC' ); expectSortingToBe( 'date', 'asc' ); - sortBy( 'Date and time' ); + sortBy( 'Date and time in UTC' ); expectSortingToBe( 'date', 'desc' ); } ); test( 'sorts by amount', () => { - sortBy( 'Amount' ); + sortBy( 'Amount in Deposit Curency' ); expectSortingToBe( 'amount', 'desc' ); - sortBy( 'Amount' ); + sortBy( 'Amount in Deposit Curency' ); expectSortingToBe( 'amount', 'asc' ); } ); @@ -609,18 +609,22 @@ describe( 'Transactions list', () => { const expected = [ '"Transaction Id"', - '"Date / Time"', + '"Date / Time (UTC)"', 'Type', 'Channel', + '"Paid Currency"', + '"Amount Paid"', + '"Deposit Currency"', 'Amount', 'Fees', 'Net', '"Order #"', - 'Source', + '"Payment Method"', 'Customer', 'Email', 'Country', '"Risk level"', + '"Deposit ID"', '"Deposit date"', '"Deposit status"', ]; @@ -675,26 +679,26 @@ describe( 'Transactions list', () => { ); // channel expect( getUnformattedAmount( displayFirstTransaction[ 3 ] ).indexOf( - csvFirstTransaction[ 4 ] + csvFirstTransaction[ 7 ] ) ).not.toBe( -1 ); // amount expect( -Number( getUnformattedAmount( displayFirstTransaction[ 4 ] ) ) ).toEqual( Number( - csvFirstTransaction[ 5 ].replace( /['"]+/g, '' ) // strip extra quotes + csvFirstTransaction[ 8 ].replace( /['"]+/g, '' ) // strip extra quotes ) ); // fees expect( getUnformattedAmount( displayFirstTransaction[ 5 ] ).indexOf( - csvFirstTransaction[ 6 ] + csvFirstTransaction[ 9 ] ) ).not.toBe( -1 ); // net expect( displayFirstTransaction[ 6 ] ).toBe( - csvFirstTransaction[ 7 ] + csvFirstTransaction[ 10 ] ); // order number expect( displayFirstTransaction[ 8 ] ).toBe( - csvFirstTransaction[ 9 ].replace( /['"]+/g, '' ) // strip extra quotes + csvFirstTransaction[ 12 ].replace( /['"]+/g, '' ) // strip extra quotes ); // customer } ); } ); diff --git a/includes/class-wc-payments-upe-split-blocks-payment-method.php b/includes/class-wc-payments-upe-split-blocks-payment-method.php deleted file mode 100644 index 2f1188611ea..00000000000 --- a/includes/class-wc-payments-upe-split-blocks-payment-method.php +++ /dev/null @@ -1,26 +0,0 @@ -register( new WC_Payments_UPE_Split_Blocks_Payment_Method() ); + $payment_method_registry->register( new WC_Payments_Blocks_Payment_Method() ); } /**